Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- Servo my_servo;
- int max, min, tick;
- void setup()
- {
- my_servo.attach(6);//Assign pin to component
- max=1000;
- min=50;
- }
- void loop()
- {
- tick = analogRead(A0);
- my_servo.write(map(tick,min,max,180,0));
- if(tick<min)min=tick; //Lower knob bound recalibration
- if(tick>max)max=tick; //Upper knob bound recalibration
- }
Add Comment
Please, Sign In to add comment