Devices & Components
Arduino Uno Rev3
Jumper wires (generic)
stepper motor 28BYJ-48
Software & Tools
Arduino IDE
Project description
Code
copy the code and paste
java
just copy.
1// Arduino stepper motor control code 2 3#include <Stepper.h> // Include the header file 4 5// change this to the number of steps on your motor 6#define STEPS 32 7 8// create an instance of the stepper class using the steps and pins 9Stepper stepper(STEPS, 8, 10, 9, 11); 10 11int val = 0; 12 13void setup() { 14 Serial.begin(9600); 15 stepper.setSpeed(200); 16} 17 18void loop() { 19 20 if (Serial.available()>0) 21 { 22 val = Serial.parseInt(); 23 stepper.step(val); 24 Serial.println(val); //for debugging 25 } 26 27 28}
copy the code and paste
java
just copy.
1// Arduino stepper motor control code 2 3#include <Stepper.h> // Include 4 the header file 5 6// change this to the number of steps on your motor 7#define 8 STEPS 32 9 10// create an instance of the stepper class using the steps and pins 11Stepper 12 stepper(STEPS, 8, 10, 9, 11); 13 14int val = 0; 15 16void setup() { 17 Serial.begin(9600); 18 19 stepper.setSpeed(200); 20} 21 22void loop() { 23 24 if (Serial.available()>0) 25 26 { 27 val = Serial.parseInt(); 28 stepper.step(val); 29 Serial.println(val); 30 //for debugging 31 } 32 33 34}
Downloadable files
This is the stepper motor tutorial.
just do the same ok.:D
This is the stepper motor tutorial.

Comments
Only logged in users can leave comments