Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Lilnija_29012017 NucleoF042K6_IRReceiver
examples/IRsendRawDemo/IRsendRawDemo.ino@0:70c8e56bac45, 2016-01-23 (annotated)
- Committer:
- yuhki50
- Date:
- Sat Jan 23 06:16:48 2016 +0000
- Revision:
- 0:70c8e56bac45
import https://github.com/z3t0/Arduino-IRremote e3ec11d
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| yuhki50 | 0:70c8e56bac45 | 1 | /* |
| yuhki50 | 0:70c8e56bac45 | 2 | * IRremote: IRsendRawDemo - demonstrates sending IR codes with sendRaw |
| yuhki50 | 0:70c8e56bac45 | 3 | * An IR LED must be connected to Arduino PWM pin 3. |
| yuhki50 | 0:70c8e56bac45 | 4 | * Version 0.1 July, 2009 |
| yuhki50 | 0:70c8e56bac45 | 5 | * Copyright 2009 Ken Shirriff |
| yuhki50 | 0:70c8e56bac45 | 6 | * http://arcfn.com |
| yuhki50 | 0:70c8e56bac45 | 7 | * |
| yuhki50 | 0:70c8e56bac45 | 8 | * IRsendRawDemo - added by AnalysIR (via www.AnalysIR.com), 24 August 2015 |
| yuhki50 | 0:70c8e56bac45 | 9 | * |
| yuhki50 | 0:70c8e56bac45 | 10 | * This example shows how to send a RAW signal using the IRremote library. |
| yuhki50 | 0:70c8e56bac45 | 11 | * The example signal is actually a 32 bit NEC signal. |
| yuhki50 | 0:70c8e56bac45 | 12 | * Remote Control button: LGTV Power On/Off. |
| yuhki50 | 0:70c8e56bac45 | 13 | * Hex Value: 0x20DF10EF, 32 bits |
| yuhki50 | 0:70c8e56bac45 | 14 | * |
| yuhki50 | 0:70c8e56bac45 | 15 | * It is more efficient to use the sendNEC function to send NEC signals. |
| yuhki50 | 0:70c8e56bac45 | 16 | * Use of sendRaw here, serves only as an example of using the function. |
| yuhki50 | 0:70c8e56bac45 | 17 | * |
| yuhki50 | 0:70c8e56bac45 | 18 | */ |
| yuhki50 | 0:70c8e56bac45 | 19 | |
| yuhki50 | 0:70c8e56bac45 | 20 | |
| yuhki50 | 0:70c8e56bac45 | 21 | #include <IRremote.h> |
| yuhki50 | 0:70c8e56bac45 | 22 | |
| yuhki50 | 0:70c8e56bac45 | 23 | IRsend irsend; |
| yuhki50 | 0:70c8e56bac45 | 24 | |
| yuhki50 | 0:70c8e56bac45 | 25 | void setup() |
| yuhki50 | 0:70c8e56bac45 | 26 | { |
| yuhki50 | 0:70c8e56bac45 | 27 | |
| yuhki50 | 0:70c8e56bac45 | 28 | } |
| yuhki50 | 0:70c8e56bac45 | 29 | |
| yuhki50 | 0:70c8e56bac45 | 30 | void loop() { |
| yuhki50 | 0:70c8e56bac45 | 31 | int khz = 38; // 38kHz carrier frequency for the NEC protocol |
| yuhki50 | 0:70c8e56bac45 | 32 | 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 |
| yuhki50 | 0:70c8e56bac45 | 33 | |
| yuhki50 | 0:70c8e56bac45 | 34 | irsend.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), khz); //Note the approach used to automatically calculate the size of the array. |
| yuhki50 | 0:70c8e56bac45 | 35 | |
| yuhki50 | 0:70c8e56bac45 | 36 | delay(5000); //In this example, the signal will be repeated every 5 seconds, approximately. |
| yuhki50 | 0:70c8e56bac45 | 37 | } |