Skip to content

Instantly share code, notes, and snippets.

@hollyhockberry
Created October 24, 2021 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hollyhockberry/19659b9070f3fc20350d6cbe663db0e7 to your computer and use it in GitHub Desktop.
Save hollyhockberry/19659b9070f3fc20350d6cbe663db0e7 to your computer and use it in GitHub Desktop.
M5StickCPlus: IR Unit sample
#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