-
Notifications
You must be signed in to change notification settings - Fork 0
/
Multiplication_Game.ino
70 lines (51 loc) · 1.37 KB
/
Multiplication_Game.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "handle_pins.h"
#include "game_logic.h"
#include "handle_screen.h"
#include "handle_neopix.h"
#include <ESP8266WiFi.h>
#include "handle_spiffs.h"
void setup() {
// put your setup code here, to run once:
WiFi.mode(WIFI_OFF);
wifi_fpm_set_sleep_type (LIGHT_SLEEP_T);
WiFi.forceSleepBegin(); // if you dont need wifi, ~22ma instead of ~75ma
Serial.begin(115200);
init_neo();
init_spiffs();
reset_routine();
printout_routine();
normalize_data();
printout_spiffs();
init_pins();
init_screen();
init_game();
next_move();
}
void loop() {
// put your main code here, to run repeatedly:
//show_eqq(5, 7, 32, 14, 35, 22);
calculate_res();
updat_pix();
delay(16);
}
void printout_routine(){
pinMode(GUMB_DESNO_ZGORAJ, INPUT_PULLUP);
if(digitalRead(GUMB_DESNO_ZGORAJ) == LOW){
printout_stat_new();
}
}
void reset_routine(){
pinMode(GUMB_LEVO_SPODAJ, INPUT_PULLUP);
pinMode(GUMB_DESNO_SPODAJ, INPUT_PULLUP);
if(digitalRead(GUMB_LEVO_SPODAJ) == LOW && digitalRead(GUMB_DESNO_SPODAJ) == LOW){
long start = millis();
resetting_pix();
while(digitalRead(GUMB_LEVO_SPODAJ) == LOW && digitalRead(GUMB_DESNO_SPODAJ) == LOW && millis() - start < 4000){
delay(100);
}
if(digitalRead(GUMB_LEVO_SPODAJ) == LOW && digitalRead(GUMB_DESNO_SPODAJ) == LOW){
reset_spiffs();
correct_neo();
}
}
}