//writing the code to have button input and potentiometer input
// name and assign the pin
int led = D2;
int buttonPin = D3;
int buttonState; //Store the reading from Button
void setup() {
pinMode( led, OUTPUT );
pinMode (buttonPin, INPUT_PULLUP);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == LOW) {
digitalWrite (led,HIGH);
}else{
digitalWrite (led,LOW);
}
delay(500);
}
Click to Expand
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .