From fd52693593c50d030ac9cdb32856304cb8fb49d3 Mon Sep 17 00:00:00 2001 From: JbLb Date: Sun, 19 Feb 2023 16:48:12 +0100 Subject: [PATCH] add a #define for buzer pin --- src/my_buttons.cpp | 2 +- src/my_buttons.h | 2 +- src/oorobot.ino | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/my_buttons.cpp b/src/my_buttons.cpp index bd0785e..aecb180 100644 --- a/src/my_buttons.cpp +++ b/src/my_buttons.cpp @@ -52,7 +52,7 @@ int b = -1; if (currentClick > lastClick + DEBOUNCING_DELAY) { Serial.println(" Sort"); lastClick = currentClick; - tone(12, 1000, 50); + tone(BUZZ, 1000, 50); lastButtonId = b; } else { b = -1; diff --git a/src/my_buttons.h b/src/my_buttons.h index b5ec765..f8c4dbf 100644 --- a/src/my_buttons.h +++ b/src/my_buttons.h @@ -1,6 +1,6 @@ -#define KEYS_PIN A0 +#define BUZZ 12 // Buzzer int getPressedButton(); void setupButtons(); diff --git a/src/oorobot.ino b/src/oorobot.ino index 58cdc52..841a4a7 100644 --- a/src/oorobot.ino +++ b/src/oorobot.ino @@ -12,7 +12,6 @@ #include #include #include "charset.h" -//#include "buttons.h" #include "my_buttons.h" @@ -47,6 +46,8 @@ SoftwareSerial BTSerie(RxD, TxD); #define motorPin7 10 // IN3 on the ULN2003 driver 2 #define motorPin8 11 // IN4 on the ULN2003 driver 2 + + // Menu index #define START_MENU 0 #define SETTINGS_MENU 1 @@ -127,13 +128,13 @@ void setup() { setupButtons(); Serial.println(F("Setup")); - tone(12, 1047, 100); + tone(BUZZ, 1047, 100); delay(150); - tone(12, 1319, 100); + tone(BUZZ, 1319, 100); delay(150); - tone(12, 1560, 100); + tone(BUZZ, 1560, 100); delay(150); - noTone(12); + noTone(BUZZ); lcd.init(); lcd.backlight();