Skip to content

Commit

Permalink
Buzzer fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CromFr committed Jan 21, 2018
1 parent bfb14cd commit 3eacc71
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
5 changes: 0 additions & 5 deletions buzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)){
Expand Down
1 change: 1 addition & 0 deletions buzzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

class Buzzer {
public:
Buzzer(){};
Buzzer(uint8_t pin);

void setup();
Expand Down
6 changes: 1 addition & 5 deletions config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down
2 changes: 1 addition & 1 deletion config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions fan_controler.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@


Fan* fans;
Buzzer buzzer;
Display display;


Expand All @@ -17,6 +18,8 @@ void setup() {

pinMode(buttonPin, INPUT_PULLUP);

buzzer = Buzzer(buzzerPin);

for(size_t i = 0 ; i < sensorsLength ; i++)
sensors[i].setup();

Expand Down

0 comments on commit 3eacc71

Please sign in to comment.