Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int bot = 4;
- int led = 2;
- int x = 0;
- void setup()
- {
- pinMode(led, OUTPUT);
- pinMode(bot, INPUT);
- }
- void loop()
- {
- int stato = digitalRead(bot);
- if (stato == HIGH and x == 0)
- {
- digitalWrite(led, HIGH);
- x = 1;
- }
- else if (stato == HIGH and x == 1)
- {
- digitalWrite(led, LOW);
- x = 0;
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement