Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Stepper.h>
- const float STEPS_PER_REV = 64;
- Stepper steppermotor(STEPS_PER_REV, 8, 10, 9, 11);
- const int PotPin = A0;
- int PotVal = 0;
- int angle = 0;
- void setup()
- {
- pinMode(PotPin, INPUT);
- Serial.begin(9600);
- }
- void loop()
- {
- PotVal = analogRead(PotPin);
- Serial.println(PotVal);
- angle = map(PotVal, 0,1023,0,359);
- steppermotor.step(angle*5);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement