Created
November 6, 2013 10:11
-
-
Save Robotonics/7333743 to your computer and use it in GitHub Desktop.
Arduino DTMF
This file contains hidden or 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
#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