From 3eacc71535f300150810f2e3632f861822663da7 Mon Sep 17 00:00:00 2001 From: "Crom (Thibaut CHARLES)" Date: Sun, 21 Jan 2018 19:10:24 +0100 Subject: [PATCH] Buzzer fixes --- buzzer.cpp | 5 ----- buzzer.h | 1 + config.cpp | 6 +----- config.h | 2 +- fan_controler.ino | 3 +++ 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/buzzer.cpp b/buzzer.cpp index 5e9e957..0048572 100644 --- a/buzzer.cpp +++ b/buzzer.cpp @@ -2,14 +2,9 @@ Buzzer::Buzzer(uint8_t pin): pin(pin) { - -} - -void Buzzer::setup(){ pinMode(pin, OUTPUT); } - void Buzzer::beep(const char* signal) const { char c; while(c = *(signal++)){ diff --git a/buzzer.h b/buzzer.h index 9c18933..4b87bde 100644 --- a/buzzer.h +++ b/buzzer.h @@ -6,6 +6,7 @@ class Buzzer { public: + Buzzer(){}; Buzzer(uint8_t pin); void setup(); diff --git a/config.cpp b/config.cpp index 7ca6b1d..66c5ab3 100644 --- a/config.cpp +++ b/config.cpp @@ -2,11 +2,7 @@ const uint8_t buttonPin = 0; const uint8_t ledPin = 12 ;//Blink when in low speed mode - - -const Buzzer buzzer = Buzzer{ - pin: 8 // beep beep beep. Must be analog or PWM compatible. -1 to disable beeping. -}; +const uint8_t buzzerPin = 8; // beep beep beep. Must be analog or PWM compatible. -1 to disable beeping. // List of temperature sensors Sensor sensors[] = { diff --git a/config.h b/config.h index 600d988..e23a94d 100644 --- a/config.h +++ b/config.h @@ -11,7 +11,7 @@ extern const uint8_t buttonPin; extern const uint8_t ledPin; -extern const Buzzer buzzer; +extern const uint8_t buzzerPin; extern Sensor sensors[]; extern const uint8_t sensorsLength; diff --git a/fan_controler.ino b/fan_controler.ino index e05d894..6bd65a1 100644 --- a/fan_controler.ino +++ b/fan_controler.ino @@ -6,6 +6,7 @@ Fan* fans; +Buzzer buzzer; Display display; @@ -17,6 +18,8 @@ void setup() { pinMode(buttonPin, INPUT_PULLUP); + buzzer = Buzzer(buzzerPin); + for(size_t i = 0 ; i < sensorsLength ; i++) sensors[i].setup();