Advertisement
CaptainSpaceCat

Music Player

Apr 3rd, 2017
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include "Song.h"
  2. #define BUZZ 1
  3.  
  4. int dick = 0;
  5. Song s = Song();
  6.  
  7. void setup() {
  8.   pinMode(BUZZ, OUTPUT);
  9. }
  10.  
  11. void loop() {
  12.   int note = s.nextNote();
  13.   int len = s.nextLength();
  14.   if (note == -1) {
  15.     noTone(BUZZ);
  16.   } else {
  17.     tone(BUZZ, note);
  18.   }
  19.   delay(len);
  20.   if (s.completed()) {
  21.     noTone(BUZZ);
  22.     s.reset();
  23.     delay(3000);
  24.   }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement