updated locations and started documenting classes.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
class BuzzerPin{
|
||||
private:
|
||||
int buzzerPin;
|
||||
int button;
|
||||
public:
|
||||
BuzzerPin(int bp, int but){
|
||||
buzzerPin = bp;
|
||||
button = but;
|
||||
pinMode(button, INPUT);
|
||||
pinMode(buzzerPin, OUTPUT);
|
||||
}
|
||||
|
||||
void activate(){
|
||||
if(digitalRead(button) == HIGH){
|
||||
digitalWrite(buzzerPin, HIGH);
|
||||
}else{
|
||||
digitalWrite(buzzerPin, LOW);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
BuzzerPin buzzerOne(12, 20);
|
||||
|
||||
void setup(){
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
buzzerOne.activate();
|
||||
}
|
Reference in New Issue
Block a user