Last active
March 7, 2023 15:12
-
-
Save katsuyoshi/4bc97c14b89f97c42e8521642c4e8016 to your computer and use it in GitHub Desktop.
M5AtomS3でソニーテレビの赤外線リモコン信号を送信
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
#include <Arduino.h> | |
#include <IRremoteESP8266.h> | |
#include <IRsend.h> | |
#include <M5Unified.h> | |
#ifndef USE_USEBSERIAL | |
#define USBSerial Serial | |
#endif | |
static uint16_t kIrLed = 4; | |
IRsend *irsend; | |
void setup() { | |
M5.begin(); | |
switch(M5.getBoard()) { | |
case m5gfx::board_t::board_M5StickC: | |
kIrLed = 9; | |
break; | |
case m5gfx::board_t::board_M5AtomS3: | |
kIrLed = 4; | |
break; | |
} | |
irsend = new IRsend(kIrLed); | |
USBSerial.begin(115200); | |
irsend->begin(); | |
} | |
void loop() { | |
M5.update(); | |
if (M5.BtnA.wasClicked()) { | |
USBSerial.println("Power off"); | |
irsend->sendSony(0xa90, 12, 3); // 12 bits & 3 repeats | |
//irsend.sendNEC(0x00FFE01FUL); | |
delay(2000); | |
} | |
} |
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
[platformio] | |
default_envs = ATOMS3 | |
;default_envs = M5STICK-C | |
[env:ATOMS3] | |
platform = espressif32@5.2.0 | |
framework = arduino | |
platform_packages = platformio/framework-arduinoespressif32@^3.20005.220925 | |
board = esp32-s3-devkitc-1 | |
lib_ldf_mode = deep | |
monitor_speed = 115200 | |
upload_speed = 1500000 | |
board_build.f_cpu = 240000000L | |
board_build.f_flash = 80000000L | |
board_build.flash_mode = dio | |
build_flags = | |
-DCORE_DEBUG_LEVEL=3 | |
-DUSE_USEBSERIAL | |
-Iinclude | |
lib_deps = | |
crankyoldgit/IRremoteESP8266@^2.8.4 | |
m5stack/M5Unified@^0.1.4 | |
[env:M5STICK-C] | |
platform = espressif32 | |
board = m5stick-c | |
framework = arduino | |
monitor_speed = 115200 | |
lib_deps = | |
crankyoldgit/IRremoteESP8266@^2.8.4 | |
m5stack/M5Unified@^0.1.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment