//-------------------------------------------------- // Endtool Trial : BMX //-------------------------------------------------- const int analogOutPin = 9; const int buttonPin = 2; int buttonState = 0; int maxVal=150; void setup() { Serial.begin(9600); pinMode(buttonPin, INPUT_PULLUP); } void loop() { // put your main code here, to run repeatedly: buttonState = digitalRead(buttonPin); if(buttonState == LOW){ analogWrite(analogOutPin, maxVal); Serial.println("pushed"); delay(100); }else{ analogWrite(analogOutPin, 0); Serial.println("High"); delay(100); } }