int buttonPin = 2;
void setup() {
pinMode(buttonPin, INPUT_PULLUP);
}
void loop() {
int buttonValue = digitalRead(buttonPin);
if(buttonValue == 0){
//insert action to be taken
//examples could be to blink and LED or sound a buzzer
}
else{
//insert action to be taken
//example could be to turn LED or buzzer off
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.