Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. //Libraries and tones definitions
  2.  
  3. const int ButtonPin = 2;
  4. const int SpeakerPin = 8;
  5. void setup()
  6. {
  7.   pinMode(2,INPUT);
  8.   pinMode(8,OUTPUT);
  9.   Serial.begin(9600);
  10. }
  11.  
  12. void loop()
  13. {
  14.   int ButtonValue = digitalRead(2);
  15.   println(ButtonValue);
  16.   if(ButtonValue)
  17.   {
  18.     tone(SpeakerPin,440,1000);
  19.   }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement