// Define pin connections & motor's steps per revolution const int potPin = 12; // select the input pin for the potentiometer int potValue; const int buttonPin = 33; int buttonState; int counter = 0; void setup() { Serial.begin(115200); pinMode(buttonPin, INPUT_PULLUP); pinMode(potPin, INPUT); } void loop() { if (digitalRead(buttonPin)==0){ Serial.println("Button pressed"); potValue = analogRead(potPin); Serial.print("pot value is: "); Serial.println(potValue); delay(1000); } else { Serial.println("Button not pressed"); potValue = analogRead(potPin); Serial.print("pot value is: "); Serial.println(potValue); delay(1000); } }