-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmp.cpp
More file actions
65 lines (57 loc) · 1.19 KB
/
Copy pathtmp.cpp
File metadata and controls
65 lines (57 loc) · 1.19 KB
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
/****************************************************************
*
* This Example is used to test leds
*
* Arduino tools Setting
* -board : M5StickC
* -Upload Speed: 115200 / 750000 / 1500000
*
****************************************************************/
#include "M5Atom.h"
#include "Adafruit_SGP30.h"
//co2センサ関連
#define GPIO_PIN 25
uint32_t beep_last_time = 0;
uint8_t beep_volume = 50; //min 1, max 255
uint32_t beep_total_time = 0;
uint16_t eco2_threshhold = 1000;
Adafruit_SGP30 sgp;
int i = 15;
long last_millis = 0;
void setup()
{
M5.begin(true, false, true);
delay(50);
M5.dis.drawpix(0, 0xf00000);
}
uint8_t FSM = 0;
void loop()
{
if (M5.Btn.wasPressed())
{
switch (FSM)
{
case 0:
M5.dis.drawpix(0, 0xf00000);
break;
case 1:
M5.dis.drawpix(0, 0x00f000);
break;
case 2:
M5.dis.drawpix(0, 0x0000f0);
break;
case 3:
M5.dis.drawpix(0, 0x707070);
break;
default:
break;
}
FSM++;
if (FSM >= 4)
{
FSM = 0;
}
}
delay(50);
M5.update();
}