Advertisement
chtulhu

Untitled

Jan 26th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1.  
  2. //tabella delle freuenze e delle note
  3. unsigned int pitch[] = {
  4. 0, 33,35,37,39,41,44,46,49,52,55,58,
  5. 62,65,69,73,78,82,87,93,98,104,110,117,
  6. 123,131,139,147,156,165,175,185,196,208,220,233,
  7. 247,262,277,294,311,330,349,370,392,415,440,466,
  8. 494,523,554,587,622,659,698,740,784,831,880,932,
  9. 988,1047,1109,1175,1245,1319,1397,1480,1568,1661,1760,1865,
  10. 1976,2093,2217,2349,2489,2637,2794,2960,3136,3322,3520,3729};
  11. int f=440;
  12. int prec=f;
  13. int k;
  14.  
  15. void setup() {
  16. pinMode(8, OUTPUT);
  17.  
  18. }
  19.  
  20. void loop() {
  21. k=map(analogRead(A0),0,1023,0,83);
  22. f=pitch[k];
  23. if (f!= prec) {
  24. tone(8,f);
  25. prec=f;
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement