Bram documentation buzzers pt 2
This commit is contained in:
@@ -133,3 +133,35 @@ And The fysical board looks like this:
|
||||
And here it looks in action:
|
||||
|
||||
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: ...
|
Reference in New Issue
Block a user