Skip to content

Commit c76348b

Browse files
authored
Merge pull request #10 from thexmanxyz/feature/auto_rotate
Added auto rotate functionality
2 parents f3ff86d + e4a97e9 commit c76348b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

CUBE/CUBE.ino

+7-2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ uint16_t timer;
5454

5555
uint64_t randomTimer;
5656

57+
bool autoRotate = true;
58+
uint64_t lastEffectChange = 0;
59+
uint32_t effectDuration = 5000;
60+
5761
bool loading;
5862

5963
void setup() {
@@ -75,10 +79,11 @@ void setup() {
7579
}
7680

7781
void loop() {
78-
82+
uint64_t currentTime = millis();
7983
randomTimer++;
8084

81-
if (digitalRead(BUTTON_PIN) == LOW) {
85+
if (digitalRead(BUTTON_PIN) == LOW || (currentTime - lastEffectChange >= effectDuration && autoRotate)) {
86+
lastEffectChange = millis();
8287
clearCube();
8388
loading = true;
8489
timer = 0;

0 commit comments

Comments
 (0)