@@ -177,8 +177,14 @@ void loop()
177
177
Serial.println (" Switching to Task 1" );
178
178
// update the neopixel strip
179
179
updatePixels (50 , 0 , 0 );
180
+
180
181
// 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
+
182
188
Serial.print (" Sending to Adafruit IO -> " );
183
189
Serial.println (taskTwo);
184
190
cubetask->save (taskTwo, minutes);
@@ -189,8 +195,14 @@ void loop()
189
195
Serial.println (" Switching to Task 2" );
190
196
// update the neopixel strip
191
197
updatePixels (0 , 50 , 0 );
198
+
192
199
// 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
+
194
206
Serial.print (" Sending to Adafruit IO -> " );
195
207
Serial.println (taskOne);
196
208
cubetask->save (taskOne, minutes);
@@ -199,7 +211,14 @@ void loop()
199
211
break ;
200
212
case 3 :
201
213
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
+
203
222
break ;
204
223
}
205
224
0 commit comments