Created
April 19, 2015 22:49
-
-
Save yminsky/f98996143e4631eb739b to your computer and use it in GitHub Desktop.
This one sounds worse, but is non-blocking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void play_note(long tone, long start, long now) { | |
long gap = now - start; | |
long step = gap / tone; | |
boolean high = (step % 2 == 0); | |
if (high) { digitalWrite(speaker_pin, HIGH); } | |
else { digitalWrite(speaker_pin,LOW); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment