Project 02 - A DTMF Dialer

<< Click to Display Table of Contents >>

Navigation:  Projects >

Project 02 - A DTMF Dialer

This project shows how to create the DTMF dialer using the CleO primitives and touch subsystem.





This project uses the following component(s) -


56mm, 80hm 0.5W(RMS) / 1W(Peak) Internal CleO speaker





The Setup() routine initializes CleO and sets the background gradient using the SetBackgroundGradient() command.


void setup() {

/* Initialize CleO */


 CleO.SetBackgroundGradient(0, 0, 0, 480, DARK_GRAY, BLACK);



Inside the loop routine(), it draws all the button between CleO.Start() and CleO.Show() calls, to construct a frame to be drawn on the screen.


The (x,y) coordinates are controlled by the for loop() and the color of the button (circle) is controlled by the touch (based on tag value).


/* Start drawing screen frame */



/* Draw circle and assign tag for each tone */

for (int i = 0; i < 12; i++) {

int x = (i % 3) * 100 + (800/2) - 100;

int y = 90 + (i / 3) * 100;

int key = tones[i];

int touching = (tag == key);


 k[0] = key;


 CleO.CircleExt(x, y, 0, 40, touching ? WHITE : DARK_ORANGE, MM, 0, 0);

 CleO.StringExt(FONT_SANS_6, x, y, BLACK, MM, 0, 0, k);



/* Display screen frame */



In the above sample code snippet, each button (Circle) is assigned with a tag using tones character string which holds the value of "123456789*0#".


Initially the loop() routine checks whether the screen is touched and if so, it plays the sound using the tag value. It also keeps track of the previous touch by storing the dur value in prevdur.