Advertisement
WielkaSpluwa

Apteczka Delayed Start

Jun 16th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.85 KB | None | 0 0
  1. #include <IRremote.h>
  2. const int BUTTON = 5;
  3. const int POWER_DIODE = 6;
  4. //IR PIN - 4 RESERVED
  5. IRsend irsend;
  6. const int EMPTY=600;
  7. const int ZER=600;
  8. const int ONE=1200;
  9. const int HEADER=2400;
  10. void setup()
  11. {
  12.  digitalWrite(POWER_DIODE, HIGH);
  13. }
  14. //0x83   –   0х0C
  15. void loop() {
  16.  
  17. if(digitalRead(BUTTON) == HIGH)
  18. {
  19.     int khz = 56; // 38kHz carrier frequency for the NEC protocol
  20.     unsigned int irSignal[] = {HEADER, EMPTY,
  21.   ONE,EMPTY,ZER,EMPTY,ZER,EMPTY,ZER,EMPTY,ZER,EMPTY,ZER,EMPTY,ONE,EMPTY,ONE,EMPTY,
  22.   ZER,EMPTY,ZER,EMPTY,ZER,EMPTY,ZER,EMPTY,ONE,EMPTY,ONE,EMPTY,ZER,EMPTY,ZER,EMPTY,
  23.   ONE,EMPTY,ONE,EMPTY,ONE,EMPTY,ZER,EMPTY,ONE,EMPTY,ZER,EMPTY,ZER,EMPTY,ZER,EMPTY};
  24.    
  25.     irsend.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), khz); //Note the approach used to automatically calculate the size of the array.
  26. }
  27.   delay(50);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement