Created
April 4, 2020 05:21
-
-
Save TakuroFukamizu/43e016191d597100f6e060c0ba542549 to your computer and use it in GitHub Desktop.
M5Atom Circle Indicator 16*9
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 "M5Atom.h" | |
uint8_t counter = 0; | |
uint8_t line1[] = {2,3,4,9,14,19,24,23,22,21,20,15,10,5,0,1}; // 16 | |
uint8_t line2[] = {7,8,13,18,17,16,11,6}; //8 | |
// ---------------- | |
void display_progress_circle() { | |
M5.dis.clear(); | |
uint8_t limit1 = counter & 0xF; | |
uint8_t limit2 = (counter & 0xF0) >> 4; | |
if (limit2 == 9) { | |
for(int i=0; i<3; i++) { | |
M5.dis.clear(); | |
delay(100); | |
M5.dis.drawpix(12, 0x0000ff); | |
delay(100); | |
} | |
M5.dis.clear(); | |
counter = 0; | |
return; | |
} | |
Serial.print(limit1); | |
Serial.print(","); | |
Serial.println(limit2); | |
for (int i=0; i<limit1+1; i++) { | |
M5.dis.drawpix(line1[i], 0x00ff00); | |
} | |
if ( 0 < limit2) { | |
for (int i=0; i<limit2; i++) { | |
M5.dis.drawpix(line2[i], 0xff0000); | |
} | |
} | |
counter++; | |
} | |
// ---------------- | |
void setup() { | |
M5.begin(true, false, true); | |
delay(50); | |
M5.dis.clear(); | |
} | |
void loop() { | |
M5.update(); | |
display_progress_circle(); | |
delay(500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment