Skip to content

Instantly share code, notes, and snippets.

@nezuppo
Created June 27, 2021 04:19
Show Gist options
  • Save nezuppo/a3c22548dfea025a4ac88f8303376201 to your computer and use it in GitHub Desktop.
Save nezuppo/a3c22548dfea025a4ac88f8303376201 to your computer and use it in GitHub Desktop.
#include <M5Atom.h>
#include <BleMouse.h>
BleMouse bleMouse;
void setup() {
M5.begin(true, false, true);
delay(50);
// M5.dis.drawpix(2, 2, 0xf00000); // Green
// M5.dis.drawpix(2, 2, 0x00f000); // Red
// M5.dis.drawpix(2, 2, 0x0000f0); // Blue
M5.dis.drawpix(2, 2, 0x000040);
delay(50);
bleMouse.begin();
while(bleMouse.isConnected() == false) {
delay(100);
}
}
void loop() {
if (bleMouse.isConnected() == true) {
bleMouse.move(1, 0);
bleMouse.move(-1, 0);
delay(50);
M5.dis.drawpix(2, 2, 0x400000);
}
else {
M5.dis.drawpix(2, 2, 0x004000);
}
delay(50);
M5.update();
// delay(300000UL); // 300000UL は unsigned long で 300000 ミリ秒 = 5分
delay(60000UL);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment