@@ -177,8 +177,14 @@ void loop()
177177 Serial.println (" Switching to Task 1" );
178178 // update the neopixel strip
179179 updatePixels (50 , 0 , 0 );
180+
180181 // play a sound
181- tone (PIEZO_PIN, 650 , 300 );
182+ #if defined(ARDUINO_ARCH_ESP32)
183+ ledcWriteTone (PIEZO_PIN, 650 );
184+ #else
185+ tone (PIEZO_PIN, 650 , 300 );
186+ #endif
187+
182188 Serial.print (" Sending to Adafruit IO -> " );
183189 Serial.println (taskTwo);
184190 cubetask->save (taskTwo, minutes);
@@ -189,8 +195,14 @@ void loop()
189195 Serial.println (" Switching to Task 2" );
190196 // update the neopixel strip
191197 updatePixels (0 , 50 , 0 );
198+
192199 // play a sound
193- tone (PIEZO_PIN, 850 , 300 );
200+ #if defined(ARDUINO_ARCH_ESP32)
201+ ledcWriteTone (PIEZO_PIN, 850 );
202+ #else
203+ tone (PIEZO_PIN, 850 , 300 );
204+ #endif
205+
194206 Serial.print (" Sending to Adafruit IO -> " );
195207 Serial.println (taskOne);
196208 cubetask->save (taskOne, minutes);
@@ -199,7 +211,14 @@ void loop()
199211 break ;
200212 case 3 :
201213 updatePixels (0 , 0 , 50 );
202- tone (PIEZO_PIN, 950 , 300 );
214+
215+ // play a sound
216+ #if defined(ARDUINO_ARCH_ESP32)
217+ ledcWriteTone (PIEZO_PIN, 950 );
218+ #else
219+ tone (PIEZO_PIN, 950 , 300 );
220+ #endif
221+
203222 break ;
204223 }
205224
0 commit comments