Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int buttonPin = A7;
- int buttonValue = 1;
- int currentState = 0;
- void setup() {
- pinMode(buttonPin, INPUT_PULLUP);
- }
- void loop() {
- buttonValue = digitalRead(buttonPin);
- if (buttonValue == LOW) {
- if (currentState == 0) {
- currentState = 1;
- // WRITE YOUR MOTOR CODE FOR POSITION 1
- }
- else {
- currentState = 0;
- //WRITE YOUR MOTOR CODE FOR POSITION 2
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement