10
10
11
11
#define NUM_DOTSTAR 5
12
12
#define BG_COLOR ST77XX_BLACK
13
+ #define ST77XX_GREY 0x8410 // define mid-grey in RGB565
13
14
14
15
// display!
15
16
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RESET);
@@ -124,23 +125,23 @@ void loop() {
124
125
tft.setTextColor (ST77XX_YELLOW);
125
126
tft.print (" Buttons: " );
126
127
if (! digitalRead (BUTTON_DOWN)) {
127
- tft.setTextColor (0x808080 );
128
+ tft.setTextColor (ST77XX_GREY );
128
129
} else {
129
130
Serial.println (" DOWN pressed" );
130
131
tft.setTextColor (ST77XX_WHITE);
131
132
}
132
133
tft.print (" DOWN " );
133
134
134
135
if (! digitalRead (BUTTON_SELECT)) {
135
- tft.setTextColor (0x808080 );
136
+ tft.setTextColor (ST77XX_GREY );
136
137
} else {
137
138
Serial.println (" SELECT pressed" );
138
139
tft.setTextColor (ST77XX_WHITE);
139
140
}
140
141
tft.print (" SEL " );
141
142
142
143
if (! digitalRead (BUTTON_UP)) {
143
- tft.setTextColor (0x808080 );
144
+ tft.setTextColor (ST77XX_GREY );
144
145
} else {
145
146
Serial.println (" UP pressed" );
146
147
tft.setTextColor (ST77XX_WHITE);
@@ -155,7 +156,7 @@ void loop() {
155
156
tft.print (" Captouch 6: " );
156
157
touchread = touchRead (6 );
157
158
if (touchread < 10000 ) {
158
- tft.setTextColor (0x808080 , BG_COLOR);
159
+ tft.setTextColor (ST77XX_GREY , BG_COLOR);
159
160
} else {
160
161
tft.setTextColor (ST77XX_WHITE, BG_COLOR);
161
162
}
@@ -168,7 +169,7 @@ void loop() {
168
169
tft.print (" Captouch 7: " );
169
170
touchread = touchRead (7 );
170
171
if (touchread < 20000 ) {
171
- tft.setTextColor (0x808080 , BG_COLOR);
172
+ tft.setTextColor (ST77XX_GREY , BG_COLOR);
172
173
} else {
173
174
tft.setTextColor (ST77XX_WHITE, BG_COLOR);
174
175
}
@@ -182,7 +183,7 @@ void loop() {
182
183
tft.print (" Captouch 8: " );
183
184
touchread = touchRead (8 );
184
185
if (touchread < 20000 ) {
185
- tft.setTextColor (0x808080 , BG_COLOR);
186
+ tft.setTextColor (ST77XX_GREY , BG_COLOR);
186
187
} else {
187
188
tft.setTextColor (ST77XX_WHITE, BG_COLOR);
188
189
}
@@ -247,10 +248,10 @@ void loop() {
247
248
/* ************************* Beep! */
248
249
if (digitalRead (BUTTON_SELECT)) {
249
250
Serial.println (" ** Beep! ***" );
250
- tone (SPEAKER, 988 , 100 ); // tone1 - B5
251
- tone (SPEAKER, 1319 , 200 ); // tone2 - E6
251
+ fhtone (SPEAKER, 988.0 , 100.0 ); // tone1 - B5
252
+ fhtone (SPEAKER, 1319.0 , 200.0 ); // tone2 - E6
252
253
delay (100 );
253
- // tone (SPEAKER, 2000, 100);
254
+ // fhtone (SPEAKER, 2000.0 , 100.0 );
254
255
}
255
256
256
257
/* ************************* LEDs */
@@ -268,7 +269,7 @@ void loop() {
268
269
}
269
270
270
271
271
- void tone (uint8_t pin, float frequecy, float duration) {
272
+ void fhtone (uint8_t pin, float frequecy, float duration) {
272
273
ledcSetup (1 , frequecy * 80 , 8 );
273
274
ledcAttachPin (pin, 1 );
274
275
ledcWrite (1 , 128 );
0 commit comments