![Arduino TouchShield 4 Burning man by you.](http://farm4.static.flickr.com/3233/2808126079_7c020d6fa6.jpg?v=0)
Arduino and TouchShield Burning Man 2009 countdown from Matt Bitz on Vimeo.
Arduino and TouchShield Burning Man 2009 from Matt Bitz on Vimeo.
![Touching to advance 2 by you.](http://farm4.static.flickr.com/3193/2808126711_fd4053f26d.jpg?v=0)
I've just uploaded all the source code, pictures, and image uploader utility over at the projects page.
![Arduino TouchShield burning man counter by you.](http://farm4.static.flickr.com/3278/2808976748_96856dbc5d.jpg?v=0)
For a shortcut, here's the source code for the TouchShield:
#include "touchLargeNums.h"
largeNum myFont = largeNum();
POINT p;
unsigned long days;
char out[5];
COLOR c = {236,191,51};
int demo = 0;
int demodelay = 100;
int numpix = 4;
void setup()
{
//uncomment this to stall the touchshield into picture uploading mode
//image_interface_begin();
days = 365;//365;
myFont.setForeColor(c);
numpix = 4;
}
void loop()
{
for(int i=0;i<numpix;i++){
if (i==0) bmp_draw("burn001",0,0);
if (i==1) bmp_draw("burn002",0,0);
if (i==2) bmp_draw("burn003",0,0);
if (i==3) bmp_draw("burn004",0,0);
printbignum(days--);
if (days == -1) {
while(!touch_get_cursor(&p)){};
days = 365;
};
if (!demo) {
while(!touch_get_cursor(&p)){};
} else {
delay(demodelay);
};
}
} //end loop
void printbignum(unsigned int num) {
int len = 3;
//itoa(num,out,10);
dtostrf(num,3,0,out);
//dtostrf((unsigned int)out[1],3,0,out);
if (out[0]==32 && out[1]==32) {
len=1;
} else if (out[0]==32 && out[1]!=32) {
len=2;
}
if(len==2) {
dtostrf(num,2,0,out);
myFont.putst(out,10,15);
} else if (len==1) {
dtostrf(num,1,0,out);
myFont.putst(out,18,15);
} else if (len==3) {
dtostrf(num,3,0,out);
myFont.putsb(out,30,45);
}
}
No comments:
Post a Comment