1010
1111#define NUM_DOTSTAR 5
1212#define BG_COLOR ST77XX_BLACK
13+ #define ST77XX_GREY 0x8410 // define mid-grey in RGB565
1314
1415// display!
1516Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RESET);
@@ -124,23 +125,23 @@ void loop() {
124125 tft.setTextColor (ST77XX_YELLOW);
125126 tft.print (" Buttons: " );
126127 if (! digitalRead (BUTTON_DOWN)) {
127- tft.setTextColor (0x808080 );
128+ tft.setTextColor (ST77XX_GREY );
128129 } else {
129130 Serial.println (" DOWN pressed" );
130131 tft.setTextColor (ST77XX_WHITE);
131132 }
132133 tft.print (" DOWN " );
133134
134135 if (! digitalRead (BUTTON_SELECT)) {
135- tft.setTextColor (0x808080 );
136+ tft.setTextColor (ST77XX_GREY );
136137 } else {
137138 Serial.println (" SELECT pressed" );
138139 tft.setTextColor (ST77XX_WHITE);
139140 }
140141 tft.print (" SEL " );
141142
142143 if (! digitalRead (BUTTON_UP)) {
143- tft.setTextColor (0x808080 );
144+ tft.setTextColor (ST77XX_GREY );
144145 } else {
145146 Serial.println (" UP pressed" );
146147 tft.setTextColor (ST77XX_WHITE);
@@ -155,7 +156,7 @@ void loop() {
155156 tft.print (" Captouch 6: " );
156157 touchread = touchRead (6 );
157158 if (touchread < 10000 ) {
158- tft.setTextColor (0x808080 , BG_COLOR);
159+ tft.setTextColor (ST77XX_GREY , BG_COLOR);
159160 } else {
160161 tft.setTextColor (ST77XX_WHITE, BG_COLOR);
161162 }
@@ -168,7 +169,7 @@ void loop() {
168169 tft.print (" Captouch 7: " );
169170 touchread = touchRead (7 );
170171 if (touchread < 20000 ) {
171- tft.setTextColor (0x808080 , BG_COLOR);
172+ tft.setTextColor (ST77XX_GREY , BG_COLOR);
172173 } else {
173174 tft.setTextColor (ST77XX_WHITE, BG_COLOR);
174175 }
@@ -182,7 +183,7 @@ void loop() {
182183 tft.print (" Captouch 8: " );
183184 touchread = touchRead (8 );
184185 if (touchread < 20000 ) {
185- tft.setTextColor (0x808080 , BG_COLOR);
186+ tft.setTextColor (ST77XX_GREY , BG_COLOR);
186187 } else {
187188 tft.setTextColor (ST77XX_WHITE, BG_COLOR);
188189 }
@@ -247,10 +248,10 @@ void loop() {
247248 /* ************************* Beep! */
248249 if (digitalRead (BUTTON_SELECT)) {
249250 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
252253 delay (100 );
253- // tone (SPEAKER, 2000, 100);
254+ // fhtone (SPEAKER, 2000.0 , 100.0 );
254255 }
255256
256257 /* ************************* LEDs */
@@ -268,7 +269,7 @@ void loop() {
268269}
269270
270271
271- void tone (uint8_t pin, float frequecy, float duration) {
272+ void fhtone (uint8_t pin, float frequecy, float duration) {
272273 ledcSetup (1 , frequecy * 80 , 8 );
273274 ledcAttachPin (pin, 1 );
274275 ledcWrite (1 , 128 );
0 commit comments