Devices & Components
Arduino Uno Rev3
Analog joystick (Generic)
Jumper wires (generic)
LEGO
28BYJ-48 Stepper Motor and ULN2003 Driver Board
9V 1A Switching Wall Power Supply
Project description
Code
Code
arduino
Really basic, but suitable for my purposes
1#include <Stepper.h> 2int stepsPerRevolution=1024; 3Stepper myStepper(stepsPerRevolution, 8,10,9,11); 4 5int joystickPin=A0; 6int joystickVal; 7 8void setup() { 9 // put your setup code here, to run once: 10myStepper.setSpeed(15); 11} 12 13void loop() { 14 // put your main code here, to run repeatedly: 15joystickVal = analogRead(joystickPin); 16 17if(joystickVal>900){ 18 19 myStepper.step(1); 20} 21 22if(joystickVal<100){ 23 myStepper.step(-1); 24} 25 26} 27
Downloadable files
Schematic
Schematic

Comments
Only logged in users can leave comments