Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Libraries and tones definitions
- const int ButtonPin = 2;
- const int SpeakerPin = 8;
- void setup()
- {
- pinMode(2,INPUT);
- pinMode(8,OUTPUT);
- Serial.begin(9600);
- }
- void loop()
- {
- int ButtonValue = digitalRead(2);
- println(ButtonValue);
- if(ButtonValue)
- {
- tone(SpeakerPin,440,1000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement