From e9d43f77514a548a969c932edfaeab6ab36674d8 Mon Sep 17 00:00:00 2001 From: AnalysIR Date: Mon, 24 Aug 2015 21:17:23 +0100 Subject: [PATCH 1/4] Create IRsendRawDemo As sendRaw is a very popular methos of sending unknown or AC signals, I though it would be very useful to include and example of same with the library. The code in this new example is tested and verified as working with the latest Master. --- examples/IRsendRawDemo | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 examples/IRsendRawDemo diff --git a/examples/IRsendRawDemo b/examples/IRsendRawDemo new file mode 100644 index 0000000..e83d6e6 --- /dev/null +++ b/examples/IRsendRawDemo @@ -0,0 +1,37 @@ +/* + * 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 + +IRsend irsend; + +void setup() +{ + +} + +void loop() { + int khz = 38; // 38kHz carrier frequency for the NEC protocol + unsigned int irSignal[] = {9000, 4500, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 39416, 9000, 2210, 560}; //AnalysIR Batch Export (IRremote) - RAW + + irsend.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), khz); //Note the approach used to automatically calculate the size of the array. + + delay(5000); //In this example, the signal will be repeated every 5 seconds, approximately. +} From 61d0263c5b3bc176f59fbc29a9c2db437872a6f1 Mon Sep 17 00:00:00 2001 From: AnalysIR Date: Mon, 24 Aug 2015 21:21:46 +0100 Subject: [PATCH 2/4] Rename IRsendRawDemo to IRsendRawDemo.ino forgot to put .ino extension on file. now corrected --- examples/{IRsendRawDemo => IRsendRawDemo.ino} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/{IRsendRawDemo => IRsendRawDemo.ino} (100%) diff --git a/examples/IRsendRawDemo b/examples/IRsendRawDemo.ino similarity index 100% rename from examples/IRsendRawDemo rename to examples/IRsendRawDemo.ino From 0abc9f090879595c43cba27e454b4859894d3cf1 Mon Sep 17 00:00:00 2001 From: AnalysIR Date: Mon, 24 Aug 2015 21:25:22 +0100 Subject: [PATCH 3/4] Create IRsendRawDemo.ino New example should go into new fordel of same name...sorry --- examples/IRsendRawDemo/IRsendRawDemo.ino | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 examples/IRsendRawDemo/IRsendRawDemo.ino diff --git a/examples/IRsendRawDemo/IRsendRawDemo.ino b/examples/IRsendRawDemo/IRsendRawDemo.ino new file mode 100644 index 0000000..e83d6e6 --- /dev/null +++ b/examples/IRsendRawDemo/IRsendRawDemo.ino @@ -0,0 +1,37 @@ +/* + * 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 + +IRsend irsend; + +void setup() +{ + +} + +void loop() { + int khz = 38; // 38kHz carrier frequency for the NEC protocol + unsigned int irSignal[] = {9000, 4500, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 39416, 9000, 2210, 560}; //AnalysIR Batch Export (IRremote) - RAW + + irsend.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), khz); //Note the approach used to automatically calculate the size of the array. + + delay(5000); //In this example, the signal will be repeated every 5 seconds, approximately. +} From 339a7969c9a900262b40812cf8a8ebb4d131de46 Mon Sep 17 00:00:00 2001 From: AnalysIR Date: Mon, 24 Aug 2015 21:26:08 +0100 Subject: [PATCH 4/4] Delete IRsendRawDemo.ino moved to own folder to maintain consistency with other examples --- examples/IRsendRawDemo.ino | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 examples/IRsendRawDemo.ino diff --git a/examples/IRsendRawDemo.ino b/examples/IRsendRawDemo.ino deleted file mode 100644 index e83d6e6..0000000 --- a/examples/IRsendRawDemo.ino +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 - -IRsend irsend; - -void setup() -{ - -} - -void loop() { - int khz = 38; // 38kHz carrier frequency for the NEC protocol - unsigned int irSignal[] = {9000, 4500, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 39416, 9000, 2210, 560}; //AnalysIR Batch Export (IRremote) - RAW - - irsend.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), khz); //Note the approach used to automatically calculate the size of the array. - - delay(5000); //In this example, the signal will be repeated every 5 seconds, approximately. -}