Skip to content

Commit 8e95122

Browse files
authored
Add how to send a state/air-con to IRsendDemo.ino (#594)
- Add example of how to send a typical `state[]`-type protocol. - Remove precompiler options to make it simpler to read.
1 parent ea9ff78 commit 8e95122

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

examples/IRsendDemo/IRsendDemo.ino

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* IRremoteESP8266: IRsendDemo - demonstrates sending IR codes with IRsend.
22
*
3-
* Version 1.0 April, 2017
3+
* Version 1.1 January, 2019
44
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009,
55
* Copyright 2009 Ken Shirriff, http://arcfn.com
66
*
@@ -46,26 +46,27 @@ uint16_t rawData[67] = {9000, 4500, 650, 550, 650, 1650, 600, 550, 650, 550,
4646
650, 550, 650, 550, 600, 550, 650, 550, 650, 550,
4747
650, 1650, 600, 550, 650, 1650, 650, 1650, 650, 1650,
4848
650, 1650, 650, 1650, 650, 1650, 600};
49+
// Example Samsung A/C state captured from IRrecvDumpV2.ino
50+
uint8_t samsungState[kSamsungAcStateLength] = {
51+
0x02, 0x92, 0x0F, 0x00, 0x00, 0x00, 0xF0,
52+
0x01, 0xE2, 0xFE, 0x71, 0x40, 0x11, 0xF0};
4953

5054
void setup() {
5155
irsend.begin();
5256
Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
5357
}
5458

5559
void loop() {
56-
#if SEND_NEC
5760
Serial.println("NEC");
58-
irsend.sendNEC(0x00FFE01FUL, 32);
59-
#endif // SEND_NEC
61+
irsend.sendNEC(0x00FFE01FUL);
6062
delay(2000);
61-
#if SEND_SONY
6263
Serial.println("Sony");
63-
irsend.sendSony(0xa90, 12, 2);
64-
#endif // SEND_SONY
64+
irsend.sendSony(0xa90, 12, 2); // 12 bits & 2 repeats
6565
delay(2000);
66-
#if SEND_RAW
6766
Serial.println("a rawData capture from IRrecvDumpV2");
6867
irsend.sendRaw(rawData, 67, 38); // Send a raw data capture at 38kHz.
69-
#endif // SEND_RAW
68+
delay(2000);
69+
Serial.println("a Samsung A/C state from IRrecvDumpV2");
70+
irsend.sendSamsungAC(samsungState);
7071
delay(2000);
7172
}

0 commit comments

Comments
 (0)