Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <toneAC.h>
- const int buzzerPin = 8;
- const int button1Pin = 9;
- const int button2Pin = 10;
- const int button3Pin = 11;
- void setup() {
- pinMode (buzzerPin, OUTPUT);
- pinMode (button1Pin, INPUT);
- pinMode (button2Pin, INPUT);
- pinMode (button3Pin, INPUT);
- // put your setup code here, to run once:
- }
- void loop(){
- // put your main code here, to run repeatedly:
- int button1State = digitalRead (button1Pin);
- if (button1State == 1) {
- // button 1 pressed
- toneAC (60);
- delay (10000);
- }
- int button2State = digitalRead (button2Pin);
- if (button2State == 2) {
- //button 2 pressed
- toneAC (100);
- delay (10000);
- }
- int button3State = digitalRead (button3Pin);
- if (button2State == 3);{
- //button 3 pressed
- toneAC (150);
- delay (10000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement