-
-
Save sousci/5afafab30526b965ed011222e7775b20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
IRremote: IRsendRawDemo - demonstrates sending IR codes with sendRaw | |
An IR LED must be connected to Arduino PWM pin 3. | |
Version 0.1 July, 2009 | |
Copyright 2009 Ken Shirriff | |
http://arcfn.com | |
IRsendRawDemo - added by AnalysIR (via www.AnalysIR.com), 24 August 2015 | |
This example shows how to send a RAW signal using the IRremote library. | |
The example signal is actually a 32 bit NEC signal. | |
Remote Control button: LGTV Power On/Off. | |
Hex Value: 0x20DF10EF, 32 bits | |
It is more efficient to use the sendNEC function to send NEC signals. | |
Use of sendRaw here, serves only as an example of using the function. | |
*/ | |
#include <IRremote.h> | |
IRsend irsend; | |
bool CH[8] = {0}; | |
int khz = 38; // 38kHz carrier frequency for the NEC protocol | |
int STATUS = 13; | |
unsigned int irSignal1[] = {3300, 1850, 400, 500, 350, 500, 350, 1350, 400, 1350, 350, 500, 400, 1350, 350, 500, 350, 500, 400, 500, 350, 1350, 400, 500, 350, 500, 350, 1400, 350, 500, 350, 1350, 400, 500, 350, 1350, 400, 500, 350, 500, 350, 1350, 400, 500, 350, 500, 350, 500, 400, 500, 350, 1350, 400, 500, 300, 1400, 350, 1400, 300, 550, 300, 1450, 300, 550, 300, 550, 350, 500, 350, 550, 300, 1400, 350, 550, 300, 550, 300, 1450, 300, 550, 350, 500, 350}; //AnalysIR Batch Export (IRremote) - RAW | |
unsigned int irSignal2[] = {3300, 1850, 350, 500, 350, 500, 400, 1350, 300, 1450, 300, 550, 300, 1450, 300, 550, 300, 550, 350, 500, 350, 1400, 300, 550, 350, 550, 300, 1400, 350, 500, 350, 1400, 300, 550, 350, 1400, 300, 550, 350, 550, 300, 1400, 350, 500, 350, 550, 300, 550, 300, 550, 350, 1400, 300, 1400, 350, 1400, 300, 1450, 300, 550, 300, 1450, 300, 550, 300, 550, 350, 500, 350, 1400, 300, 1450, 300, 550, 300, 550, 350, 1400, 300, 550, 300, 550, 350}; //AnalysIR Batch Export (IRremote) - RAW | |
unsigned int irSignal3[] = {}; //AnalysIR Batch Export (IRremote) - RAW | |
unsigned int irSignal4[] = {}; //AnalysIR Batch Export (IRremote) - RAW | |
unsigned int irSignal5[] = {3450, 1600, 350, 500, 300, 1350, 350, 500, 300, 1350, 400, 450, 350, 1300, 400, 450, 350, 1300, 350, 500, 350, 1300, 400, 450, 350, 1300, 400, 1300, 350, 500, 300, 1350, 350, 500, 300, 1350, 350, 1300, 350, 1350, 350, 1300, 350, 500, 350, 500, 300, 500, 350, 1350, 350, 450, 350, 1350, 300, 500, 350, 500, 350, 1300, 400, 450, 350, 500, 350, 500, 300, 500, 350, 1350, 350, 1300, 350, 500, 300, 1350, 400, 450, 300, 500, 350, 500, 350, 1350, 400, 400, 350, 500, 350, 500, 300, 1350, 400, 450, 300, 1350, 350, 1300, 400}; //AnalysIR Batch Export (IRremote) - RAW | |
unsigned int irSignal6[] = {3450, 1600, 350, 500, 300, 1350, 350, 500, 300, 1350, 400, 450, 350, 1300, 400, 450, 350, 1300, 350, 500, 350, 1300, 400, 450, 350, 1300, 400, 1300, 350, 500, 300, 1350, 350, 500, 300, 1350, 350, 1300, 350, 1350, 350, 1300, 350, 500, 350, 500, 300, 500, 350, 1350, 350, 450, 350, 1350, 300, 500, 350, 500, 350, 1300, 400, 450, 350, 500, 350, 500, 300, 500, 350, 1350, 350, 1300, 350, 500, 300, 1350, 400, 450, 300, 500, 350, 500, 350, 1350, 400, 400, 350, 500, 350, 500, 300, 1350, 400, 450, 300, 1350, 350, 1300, 400}; //AnalysIR Batch Export (IRremote) - RAW | |
unsigned int irSignal7[] = {}; //AnalysIR Batch Export (IRremote) - RAW | |
unsigned int irSignal8[] = {}; //AnalysIR Batch Export (IRremote) - RAW | |
void setup() | |
{ | |
//Serial.begin(9600); | |
for (int i = 4; i <= 11; i++) { | |
pinMode(i, INPUT_PULLUP); | |
} | |
pinMode(STATUS, OUTPUT); | |
digitalWrite(STATUS, LOW); | |
} | |
void loop() { | |
for (int i = 4; i <= 11; i++) { | |
CH[i - 4] = digitalRead(i); | |
if (CH[i - 4] != true) { | |
digitalWrite(STATUS, HIGH); | |
switch (i) { | |
case 4: | |
irsend.sendRaw(irSignal1, sizeof(irSignal1) / sizeof(irSignal1[0]), khz); | |
Serial.println("CH1 Send."); | |
break; | |
case 5: | |
irsend.sendRaw(irSignal2, sizeof(irSignal2) / sizeof(irSignal2[0]), khz); | |
Serial.println("CH2 Send."); | |
break; | |
case 6: | |
irsend.sendRaw(irSignal3, sizeof(irSignal3) / sizeof(irSignal3[0]), khz); | |
Serial.println("CH3 Send."); | |
break; | |
case 7: | |
irsend.sendRaw(irSignal4, sizeof(irSignal4) / sizeof(irSignal4[0]), khz); | |
Serial.println("CH4 Send."); | |
break; | |
case 8: | |
irsend.sendRaw(irSignal5, sizeof(irSignal5) / sizeof(irSignal5[0]), khz); | |
Serial.println("CH5 Send."); | |
break; | |
case 9: | |
irsend.sendRaw(irSignal6, sizeof(irSignal6) / sizeof(irSignal6[0]), khz); | |
Serial.println("CH6 Send."); | |
break; | |
case 10: | |
irsend.sendRaw(irSignal7, sizeof(irSignal7) / sizeof(irSignal7[0]), khz); | |
Serial.println("CH7 Send."); | |
break; | |
case 11: | |
irsend.sendRaw(irSignal8, sizeof(irSignal8) / sizeof(irSignal8[0]), khz); | |
Serial.println("CH8 Send."); | |
break; | |
} | |
Serial.print(CH[i - 4]); | |
Serial.print(" "); | |
delay(500); | |
digitalWrite(STATUS, LOW); | |
} | |
else { | |
Serial.print(CH[i - 4]); | |
Serial.print(" "); | |
} | |
} | |
Serial.println(); | |
delay(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment