Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Script:
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
pinMode(ledPin, OUTPUT); // initialize the LED pin as an output
pinMode(buttonPin, INPUT); // initialize the pushbutton pin as an input
}
void loop() {
buttonState = digitalRead(buttonPin); // read the state of the pushbutton value
if (buttonState == HIGH) { // check if the pushbutton is pressed
digitalWrite(ledPin, HIGH); // turn LED on
delay(500); // wait for half a second
digitalWrite(ledPin, LOW); // turn LED off
delay(500); // wait for half a second
} else {
digitalWrite(ledPin, LOW); // turn LED off
}
}
Como Executar o Script:
1. Components Required:
2. Circuit Setup:
3. Upload the Script:
4. Test the Setup: