![]() ![]() PinMode(echoPin, INPUT) // Sets the echoPin as an Input PinMode(trigPin, OUTPUT) // Sets the trigPin as an Output defines variables for ultrasonic sensor defines pins numbers for ultrasonic sensor Stepper steppermotor(STEPS_PER_REV, 8, 10, 9, 11) Pins entered in sequence 1-3-2-4 for proper step sequencing ![]() ![]() Connected to ULN2003 Motor Driver In1, In2, In3, In4 Number of steps per geared output rotationĬonst float STEPS_PER_OUT_REV = STEPS_PER_REV * GEAR_RED Number of steps per internal motor revolution I can run the Stepper and when the distance is I have only connected one Stepper motor at the moment (Providing external power supply). After combining two different codes for HC-SR04 & Stepper, I could get a partial result of my requirement. Stepper motor: 28BYJ-48 with ULN2003 controllerĪs i mentioned earlier i'm new to this platform. Its basically a obstacle avoiding robot which runs in a straight line and when the distance from the wall is 10cm, it turns around by 180 degree and moves in the opposite direction. After that a delay of 5sec and both motors should resume rotation again. For the next obstruction, both motors should stop and Stepper Motor-2 should rotate for certain number of steps. After a delay of.say 5 secs, both stepper motors should resume rotation until the next obstruction of 10cm distance is observed. Then one stepper motor-1 should rotate for a certain number of steps (lets say 100). Two stepper motors should run continuously and when the ultrasonic sensor gives a reading of 10Cm from the obstruction, both stepper motors should stop for the moment. I need to control 2 Unipolar Stepper motors(28BYJ-48) using ultrasonic sensor HC-SR04. I need a help is Programming Arduino for my project. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |