From 630b88349586747a76eca5a20269e9f902a67062 Mon Sep 17 00:00:00 2001 From: Robert K Date: Sun, 26 Feb 2023 19:14:01 +0100 Subject: [PATCH] dings --- 1D_pongESP32/1D_pongESP32.ino | 13 +++++++++---- 1D_pongESP32/notes.h | 0 1D_pongESP32/pin-names.h | 0 3 files changed, 9 insertions(+), 4 deletions(-) mode change 100644 => 100755 1D_pongESP32/1D_pongESP32.ino mode change 100644 => 100755 1D_pongESP32/notes.h mode change 100644 => 100755 1D_pongESP32/pin-names.h diff --git a/1D_pongESP32/1D_pongESP32.ino b/1D_pongESP32/1D_pongESP32.ino old mode 100644 new mode 100755 index 01726d6..d38d6e4 --- a/1D_pongESP32/1D_pongESP32.ino +++ b/1D_pongESP32/1D_pongESP32.ino @@ -28,8 +28,8 @@ #define NELEM(x) (sizeof(x) / sizeof((x)[0])) #define PIN_WSDATA GPIO21 // LED data -#define PIN_BUT_RS GPIO35 // Right start/hit button -#define PIN_BUT_RP GPIO33 // Right power-up button +#define PIN_BUT_RS GPIO33 // Right start/hit button +#define PIN_BUT_RP GPIO35 // Right power-up button #define PIN_BUT_LS GPIO19 // Left start/hit button #define PIN_BUT_LP GPIO18 // Left power-up button #define PIN_SOUND GPIO32 // Buzzer output (PB1/OC1A) @@ -215,7 +215,8 @@ static const tnote tune_win[] PROGMEM = { void sound_off() { // stop play - noTone(PIN_SOUND); + //noTone(PIN_SOUND); + ledcDetachPin(PIN_SOUND); } /* @@ -299,7 +300,11 @@ static inline void set_tone(uint16_t note, uint16_t duration) //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc. //int noteDuration = 1000 / noteDurations[thisNote]; uint16_t pitch = pgm_read_word(&tone_pitch[note-1]); - tone(PIN_SOUND, pitch, duration) + const int sndChannel = 0; + ledcSetup(sndChannel, pitch, 8); + ledcAttachPin(PIN_SOUND, sndChannel); + ledcWrite(sndChannel, 255); + //tone(PIN_SOUND, pitch, duration) // TCCR1A = _BV(COM1A0); /* Set toggle output */ // TCNT1 = 0; } diff --git a/1D_pongESP32/notes.h b/1D_pongESP32/notes.h old mode 100644 new mode 100755 diff --git a/1D_pongESP32/pin-names.h b/1D_pongESP32/pin-names.h old mode 100644 new mode 100755