Skip to content

Instantly share code, notes, and snippets.

@boxalljohn
Created July 15, 2013 04:19
Show Gist options
  • Save boxalljohn/5997472 to your computer and use it in GitHub Desktop.
Save boxalljohn/5997472 to your computer and use it in GitHub Desktop.
// Example 4.2
void setup()
{
pinMode(8, OUTPUT); // speker on pin 8
}
int del = 250; // for tone length
int lowrange = 2000; // the lowest frequency value to use
int highrange = 4000; // the highest...
void loop()
{
// increasing tone
for (int a = lowrange; a<=highrange; a++)
{
tone (8, a, del);
}
// decreasing tone
for (int a = highrange; a>=lowrange; a--)
{
tone (8, a, del);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment