From b052f2aafc7c685b4ad8ccce9edf49c25729a0fb Mon Sep 17 00:00:00 2001 From: Robert K Date: Wed, 8 Mar 2023 22:34:58 +0100 Subject: [PATCH] =?UTF-8?q?L=C3=A4uft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1D_pongESP32/1D_pongESP32.ino | 22 +++++++++++----------- README.md | 12 ++++++++++++ 2 files changed, 23 insertions(+), 11 deletions(-) mode change 100644 => 100755 README.md diff --git a/1D_pongESP32/1D_pongESP32.ino b/1D_pongESP32/1D_pongESP32.ino index d38d6e4..f892fe8 100755 --- a/1D_pongESP32/1D_pongESP32.ino +++ b/1D_pongESP32/1D_pongESP32.ino @@ -28,15 +28,15 @@ #define NELEM(x) (sizeof(x) / sizeof((x)[0])) #define PIN_WSDATA GPIO21 // LED data -#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_BUT_RS GPIO19 // Right start/hit button (Y) +#define PIN_BUT_RP GPIO18 // Right power-up button (Y) +#define PIN_BUT_LS GPIO33 // Left start/hit button (X) +#define PIN_BUT_LP GPIO23 // Left power-up button (X) #define PIN_SOUND GPIO32 // Buzzer output (PB1/OC1A) #define NPIXELS 60 // Number of pixels to handle -#define ZONE_SIZE 7 // Bounce-back zone size +#define ZONE_SIZE 10 // Bounce-back zone size #define SHOW_LO 12 // Score dots intensity background #define SHOW_HI 48 // Score dots intensity foreground #define WIN_POINTS 10 // Points needed to win @@ -299,11 +299,11 @@ static inline void set_tone(uint16_t note, uint16_t duration) // to calculate the note duration, take one second divided by the note type. //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]); - const int sndChannel = 0; - ledcSetup(sndChannel, pitch, 8); - ledcAttachPin(PIN_SOUND, sndChannel); - ledcWrite(sndChannel, 255); +// uint16_t pitch = pgm_read_word(&tone_pitch[note-1]); +// 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; @@ -354,7 +354,7 @@ static void draw_ball(int8_t dir, uint8_t pos) for (uint8_t i = 0; i < 5 && pos >= 0 && pos < NPIXELS; i++) { one_d.setPixelColor(pos, c, c, 0); - c >>= 1; + c /= 3; pos -= dir; } } diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 49bd394..82e1484 --- a/README.md +++ b/README.md @@ -9,3 +9,15 @@ fail to press the button in time you loose a point since the ball enters your ho This version supports a boost button which sacrefies one pixel of your home area in favor of boosting your ball faster. +We discovered that using these Pins for I/O had quite some success + +* GPIO19 = Right start/hit button (Y) +* GPIO18 = Right power-up button (Y) +* GPIO33 = Left start/hit button (X) +* GPIO23 = Left power-up button (X) +* SOUND GPIO32 = Buzzer output (PB1/OC1A) + +Some pins do not allow to configure Pull up resistors or work only as output. Don't use them. + +We used Mouse devices which where re-soldered to use the 4 USB wires as 'short to GND' to work as controllers. +