Cutdown Timer?

Hey all, so i just got my 16x1 LCD to work now I need to do the cut down timer. My current device uses 4 7-segments to output time now i'm upgrading to LCD primarly because I need to show more minutes.

Ex: 199:23 which mean 199 minutes and 23 seconds Every second we subcontract 1 second. Is there any way to so this and output data in nice formatted way that i need?

TNX!

What type of LCD is it?

Char buffer[17];
Sprintf(buffer,"%03d:%02d",minutes,seconds);
LCD.srtcursor(0,0);
LCD.print(buffer);

You will have to correct my caps since iPad is crazy and forces changes on my typing.

What type of LCD is it?

Why would this matter?

Don

floresta:

What type of LCD is it?

Why would this matter?

Because I was curious as to what the communications interface was... if it was the standard parallel interface, then we could point alexus to a tutorial on it.

This code did not compile :(

Char buffer[17];
Sprintf(buffer,"%03d:%02d",minutes,seconds);
LCD.srtcursor(0,0);
LCD.print(buffer);

Also I was trying to have to separate variables for minutes and seconds and then join them like:

minutes + ":" + seconds

but for some reason strings didn't join correctly. well when I do 0 + A, i'm getting something like 48, seams like this is a ASCII character codes :(

and yes this is standard parallel LCD using LiquidCrystal Lib

This code did not compile

Did you read the bit about having to change leading capital letters to lower case?

im terrible at spelling and following instructions :) But yes after changing case and replacing 1 character it did work :)

TNX!!!

sprintf(buffer,"%02d:%02d",time_min,time_sec);
lcd.setCursor(0,1);
lcd.print(buffer);

kinda follow up question :) is there easy way to show hours base on Minutes+ Sec? Of curse I can do the division and reminder and derive it that way but maybe there is easy way out? tnx!

alexus: im terrible at spelling and following instructions :) But yes after changing case and replacing 1 character it did work :)

TNX!!!

sprintf(buffer,"%02d:%02d",time_min,time_sec);
lcd.setCursor(0,1);
lcd.print(buffer);

Sorry about the typing. I promise not to use ipad for any serious forum post replies in the future. The syntax you used minutes + ":" + seconds will work in java as the string ":" tells java to convert everything in the expression to string, possibly with toString() method, by means of overloading the operator "+". It's a kind of convenient but sloppy way to format things, which I admit I've been infected with it in Processing. I don't believe the Arduino does that much of work for you. You're better off with sprintf since it can give you exactly what you need, down to number of digits and zero padding. With long_msg_lcd() in my phi_prompt, you can simply dump everything in one string and expect the library function to do line breaks so everything fits on the screen.

alexus: kinda follow up question :) is there easy way to show hours base on Minutes+ Sec? Of curse I can do the division and reminder and derive it that way but maybe there is easy way out? tnx!

Assume your "minutes" contains minutes like 72, your "seconds" contains seconds between 0 and 59, such as 30, then 72 minutes and 30 seconds is displayed as 01:12:30 from the following code:

sprintf(msg,"%02d:%02d:%02d", minutes/60, minutes%60,seconds);

The % is a blessing. You should read about it if you have not come to know it yet.

tnx :) this almost worked. im getting like 04:00:15 (where 04 is hours, and 15 is minutes, and 00 are seconds) I dont know why seconds got in the middle :( Aslo by looking at inline division, maybe i can use seconds as based variable and them based on seconds I derive minutes and hours value?

So % is like reminder of division?

By the way you can disable auto correction on iPad :)

alexus: tnx :) this almost worked. im getting like 04:00:15 (where 04 is hours, and 15 is minutes, and 00 are seconds) I dont know why seconds got in the middle :( Aslo by looking at inline division, maybe i can use seconds as based variable and them based on seconds I derive minutes and hours value?

So % is like reminder of division?

By the way you can disable auto correction on iPad :)

You must have used long integers for minutes and/or seconds, right?

then do this:

sprintf(msg,"%02d:%02d:%02d", (int)(minutes/60), (int)(minutes%60),(int)seconds);

It's a sure fix :)

How do you disable auto-correct? Seriously.

yep i used "long" variables :) Now all works well :) Thanks a lot!

Oh by the way maybe you would know where i can find Eagle footprint for my LCD? (http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=320537704468&ssPageName=ADME:X:RTQ:US:1123) I want to align holes for standoffs. Right now i just added 16pin headers :(

TNX!

Not sure about the eagle, but that looks like a 16x2… are you sure that it only has 1 row?

yep 100% positive :) I have it on my desk. 1 row 16 chr

alrighty.

Check its dimension with this one:

http://www.sparkfun.com/products/255

It's footprint is included in sparkfun's eagle library.

http://www.opencircuits.com/SFE_Footprint_Library_Eagle

are 1 and 2 line modules have same dimensions? I alredy have spark fun lib I will print the footprint and see if it mutches the board :)