Bram documentation buzzers pt 2

This commit is contained in:
Bram Barbieri
2024-03-04 15:28:05 +01:00
parent ce24a782ed
commit 5b26d6b844

View File

@@ -133,3 +133,35 @@ And The fysical board looks like this:
And here it looks in action: And here it looks in action:
Later on i could expand this code and the fysical product to include the rest of the sensors. Later on i could expand this code and the fysical product to include the rest of the sensors.
### Buzzers .pt 2
I found out how to make multiple buzzers go off with the press of one button and increase as mutch as there are pins.
I tried to not look up anything for this one, but did ask questions form time to time.
I designed it to work with scaning if there is and input and then output this signal to activate the buzzers.
This output signal can activate over multiple pins so this one button can set off all sorts of stuff.
The code is short and simple:
```
int button = 20;
int buzzerone = 12;
int buzzertwo = 11;
void setup() {
// put your setup code here, to run once:
pinMode(button, INPUT);
pinMode(buzzerone, OUTPUT);
pinMode(buzzertwo, OUTPUT);
}
void loop() {
if(digitalRead(button) == HIGH){
digitalWrite(buzzerone, HIGH);
digitalWrite(buzzertwo, HIGH);
}else{
digitalWrite(buzzerone, LOW);
digitalWrite(buzzertwo, LOW);
}
}
```
and the fysical design looks like this: ...