Browse Source

v1.2

master
Evangelos Oulis 5 years ago
parent
commit
efba297cbb
  1. 4
      README.md
  2. 78
      stepMotor/step_motor/step_motor.ino

4
README.md

@ -1,5 +1,5 @@
#Smart & Autonomous parking
#Authors: Oulis Evangelos, Oulis Nikolaos, Katsimpras Drosos
# Smart & Autonomous parking
# Authors: Oulis Evangelos, Oulis Nikolaos, Katsimpras Drosos
- At folder serverNode/ there is a flask-Python REST-API to provide parking status.

78
stepMotor/step_motor/step_motor.ino

@ -1,78 +0,0 @@
/*
Stepper Motor Demonstration 1
Stepper-Demo1.ino
Demonstrates 28BYJ-48 Unipolar Stepper with ULN2003 Driver
Uses Arduino Stepper Library
DroneBot Workshop 2018
https://dronebotworkshop.com
*/
//Include the Arduino Stepper Library
#include <Stepper.h>
// Define Constants
// Number of steps per internal motor revolution
const float STEPS_PER_REV = 32;
// Amount of Gear Reduction
const float GEAR_RED = 64;
// Number of steps per geared output rotation
const float STEPS_PER_OUT_REV = STEPS_PER_REV * GEAR_RED;
// Define Variables
// Number of Steps Required
const int stepper_motor_speed = 600;
int pos = 1;
const int StepsRequired = STEPS_PER_OUT_REV / 4;
// Create Instance of Stepper Class
// Specify Pins used for motor coils
// The pins used are 8,9,10,11
// Connected to ULN2003 Motor Driver In1, In2, In3, In4
// Pins entered in sequence 1-3-2-4 for proper step sequencing
Stepper steppermotor(STEPS_PER_REV, 6, 8, 12, 13);
void setup()
{
// Nothing (Stepper Library sets pins as outputs)
}
void next_step()
{
if(pos == 1)
{
steppermotor.setSpeed(stepper_motor_speed);
steppermotor.step(StepsRequired);
pos = 2;
}
else if(pos ==2)
{
steppermotor.setSpeed(stepper_motor_speed);
steppermotor.step(-1*StepsRequired);
pos = 3;
}
else if(pos == 3)
{
steppermotor.setSpeed(stepper_motor_speed);
steppermotor.step(-1*StepsRequired);
pos = 4;
}
else if(pos == 4)
{
steppermotor.setSpeed(stepper_motor_speed);
steppermotor.step(StepsRequired);
pos = 1;
}
}
void loop()
{
next_step();
delay(1000);
}
Loading…
Cancel
Save