|
| 1 | +/* |
| 2 | + * SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: MIT |
| 5 | + */ |
| 6 | +// More examples on: https://github.com/crankyoldgit/IRremoteESP8266/tree/master/examples |
| 7 | +#include <Arduino.h> |
| 8 | +#include <M5StackChan.h> |
| 9 | +#include <IRremoteESP8266.h> |
| 10 | +#include <IRsend.h> |
| 11 | + |
| 12 | +const uint16_t kIrLed = 5; // IR tx pin |
| 13 | + |
| 14 | +IRsend irsend(kIrLed); // Set the GPIO to be used to sending the message. |
| 15 | + |
| 16 | +// Example of data captured by IRrecvDumpV2.ino |
| 17 | +uint16_t rawData[67] = {9000, 4500, 650, 550, 650, 1650, 600, 550, 650, 550, 600, 1650, 650, 550, |
| 18 | + 600, 1650, 650, 1650, 650, 1650, 600, 550, 650, 1650, 650, 1650, 650, 550, |
| 19 | + 600, 1650, 650, 1650, 650, 550, 650, 550, 650, 1650, 650, 550, 650, 550, |
| 20 | + 650, 550, 600, 550, 650, 550, 650, 550, 650, 1650, 600, 550, 650, 1650, |
| 21 | + 650, 1650, 650, 1650, 650, 1650, 650, 1650, 650, 1650, 600}; |
| 22 | +// Example Samsung A/C state captured from IRrecvDumpV2.ino |
| 23 | +uint8_t samsungState[kSamsungAcStateLength] = {0x02, 0x92, 0x0F, 0x00, 0x00, 0x00, 0xF0, |
| 24 | + 0x01, 0xE2, 0xFE, 0x71, 0x40, 0x11, 0xF0}; |
| 25 | + |
| 26 | +void setup() |
| 27 | +{ |
| 28 | + M5StackChan.begin(); |
| 29 | + USBSerial.begin(115200); |
| 30 | + irsend.begin(); |
| 31 | +} |
| 32 | + |
| 33 | +void loop() |
| 34 | +{ |
| 35 | + USBSerial.println("NEC"); |
| 36 | + irsend.sendNEC(0x00FFE01FUL); |
| 37 | + delay(2000); |
| 38 | + USBSerial.println("Sony"); |
| 39 | + irsend.sendSony(0xa90, 12, 2); // 12 bits & 2 repeats |
| 40 | + delay(2000); |
| 41 | + USBSerial.println("a rawData capture from IRrecvDumpV2"); |
| 42 | + irsend.sendRaw(rawData, 67, 38); // Send a raw data capture at 38kHz. |
| 43 | + delay(2000); |
| 44 | + USBSerial.println("a Samsung A/C state from IRrecvDumpV2"); |
| 45 | + irsend.sendSamsungAC(samsungState); |
| 46 | + delay(2000); |
| 47 | +} |
0 commit comments