Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int led = 13;
- int x = 10;
- byte jacare;
- //----------------------------------
- void emergencia()
- {
- jacare = 1;
- Serial.println("Emergencia");
- }
- //----------------------------------
- void setup()
- {
- pinMode(led, OUTPUT);
- pinMode(2, INPUT_PULLUP);
- digitalWrite(2, 1);
- Serial.begin(9600);
- attachInterrupt(0, emergencia, FALLING);
- }
- //-----------------------------------
- void loop() {
- for (int i = 0; i < x; i++)
- {
- Serial.println(i);
- delay(500);
- if (jacare == 1)
- {
- digitalWrite(led, LOW);
- delay(500);
- digitalWrite(led, HIGH);
- delay(500);
- digitalWrite(led, LOW);
- delay(500);
- digitalWrite(led, HIGH);
- delay(500);
- jacare = 0;
- }
- }
- }
Add Comment
Please, Sign In to add comment