Advertisement
RuiViana

Funcao_LigaLed

Mar 12th, 2016
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. #define led1 4 // Port para o led1
  2. #define led2 5 // Port para o led2
  3. #define led3 6 // Port para o led3
  4. //-------------------------------------------------------------------------
  5. void setup()
  6. {
  7. Serial.begin(9600); // Inicialisa o Monitor serial
  8. }
  9. //-------------------------------------------------------------------------
  10. void LigaLed(byte Qled, unsigned int Tempo1,unsigned int Tempo2)
  11. {
  12. Serial.println("liga");
  13. digitalWrite(Qled, HIGH);
  14. delay(Tempo1);
  15. Serial.println("deslig");
  16. digitalWrite(Qled, LOW);
  17. delay(Tempo2);
  18. }
  19. //-------------------------------------------------------------------------
  20. void loop()
  21. {
  22. if ((((now.hour() == horaliga1) || (now.hour() == horaliga2)) && (now.minute() == minlig) && (now.second() <= 2))) // hora da ação
  23. { // 1
  24. LigaLed(led1,500,1000); // Chama a função LigaLed informando led, temp de ligado e tempo de desliogado
  25. LigaLed(led2,500,1000);
  26. LigaLed(led3,500,1000);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement