Skip to content

Commit

Permalink
fix beeps on ESP32
Browse files Browse the repository at this point in the history
  • Loading branch information
kmetz committed Sep 10, 2020
1 parent 112fe87 commit f24d6ab
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions coro2sens/coro2sens.ino
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ void alarmOnce() {
* Triggered continuously when the CO2 level is critical.
*/
void alarmContinuous() {
#if defined(ESP32)
// Use Tone32.
tone(BUZZER_PIN, BEEP_TONE, BEEP_DURATION_MS, 0);
#else
// Use Arduino tone().
tone(BUZZER_PIN, BEEP_TONE, BEEP_DURATION_MS);
#endif
}


Expand All @@ -147,6 +153,9 @@ void setup() {
led.setPixelColor(0, 0, 0, 0);
led.show();

// Initialize buzzer.
pinMode(BUZZER_PIN, OUTPUT);

// Initialize SCD30 sensor.
Wire.begin();
if (scd30.begin(Wire)) {
Expand Down

0 comments on commit f24d6ab

Please sign in to comment.