Skip to content

Instantly share code, notes, and snippets.

@Robotonics
Created November 6, 2013 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Robotonics/7333743 to your computer and use it in GitHub Desktop.
Save Robotonics/7333743 to your computer and use it in GitHub Desktop.
Arduino DTMF
#include <Tone.h>
Tone freq1;
Tone freq2;
const int DTMF_freq1[] = { 1336, 1209, 1336, 1477, 1209, 1336, 1477, 1209, 1336, 1477 };
const int DTMF_freq2[] = { 941, 697, 697, 697, 770, 770, 770, 852, 852, 852 };
void setup()
{
Serial.begin(9600);
freq1.begin(5);
freq2.begin(4);
}
void playDTMF(uint8_t number, long duration)
{
freq1.play(DTMF_freq1[number], duration);
freq2.play(DTMF_freq2[number], duration);
}
void loop()
{
int i;
uint8_t phone_number[] = { 0, 7, 4, 5, 3, 6 ,0, 6, 8, 5, 9 };
for(i = 0; i < sizeof(phone_number); i ++)
{
playDTMF(phone_number[i], 100);
delay(200);
}
delay(4000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment