Created
October 24, 2021 11:49
-
-
Save hollyhockberry/19659b9070f3fc20350d6cbe663db0e7 to your computer and use it in GitHub Desktop.
M5StickCPlus: IR Unit sample
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 <M5StickCPlus.h> | |
#include <IRsend.h> | |
static IRsend irsend(32); | |
void send(bool up) { | |
const uint64_t code = up ? 0x41B65DA2 : 0x41B6DD22; | |
for (auto i = 0; i < 4; ++i) { | |
irsend.sendNEC(code, 32); | |
::delay(70); | |
} | |
} | |
void setup() { | |
M5.begin(); | |
irsend.begin(); | |
} | |
void loop() { | |
M5.update(); | |
if (M5.BtnA.wasPressed()) { | |
for (auto i = 0; i < 5; ++i) { | |
send(false); | |
send(true); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment