Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define botao 2
- #define LED 13
- byte cnt = 0;
- byte cnt2 = 0;
- char LED_status;
- //-------------------------
- void setup()
- {
- pinMode(botao, INPUT);
- pinMode(LED, OUTPUT);
- attachInterrupt(0, PressDn, FALLING);
- }
- //--------------------------
- void PressDn()
- {
- detachInterrupt(0);
- // noInterrupts();
- cnt2++;
- cnt = 0;
- LED_status = !LED_status;
- digitalWrite(LED, LED_status);
- }
- //-------------------------
- void loop()
- {
- while(cnt == 0)
- {
- // interrupts(); // 2a opção
- attachInterrupt(0, PressDn, FALLING);
- cnt = 1;
- while(cnt2 >= 3)
- {
- ;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement