Friday, August 29, 2008

Burning Man 2009 desktop count-down

Burning Man 2008 week is wrapping up, and I know quite a few folks that consider burning man to be the beginning and end to their year (just about replacing New Years)! So to commemorate the coming Burning Man 2009 year, I wrote a little program on the TouchSheild to count down the days until next time. I hope you enjoy it!

Arduino TouchShield 4 Burning man by you.





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.


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.


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(&#38;p)){};
days = 365;
};
if (!demo) {
while(!touch_get_cursor(&#38;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 &#38;&#38; out[1]==32) {
len=1;
} else if (out[0]==32 &#38;&#38; 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: