-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
kaizoku-oh
committed
Aug 20, 2023
1 parent
889dea4
commit 35e0a28
Showing
6 changed files
with
47 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef Buzzer_h | ||
#define Buzzer_h | ||
|
||
#include "Arduino.h" | ||
|
||
class Buzzer { | ||
|
||
public: | ||
Buzzer(int pin); | ||
void beep(); | ||
void beep(int duration); | ||
void stop(); | ||
|
||
private: | ||
int _pin; | ||
|
||
}; | ||
|
||
#endif // Buzzer_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ class Led { | |
|
||
public: | ||
Led(int pin); | ||
void blink(int blinkRate); | ||
void on(); | ||
void off(); | ||
void toggle(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "Arduino.h" | ||
#include "Buzzer.h" | ||
|
||
Buzzer::Buzzer(int pin) { | ||
pinMode(pin, OUTPUT); | ||
_pin = pin; | ||
} | ||
|
||
void Buzzer::beep() { | ||
tone(_pin, 1000, 0xFFFFFFFF); | ||
} | ||
|
||
void Buzzer::beep(int duration) { | ||
tone(_pin, 1000, duration); | ||
} | ||
|
||
void Buzzer::stop() { | ||
noTone(_pin); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters