Go Down

Topic: Counting questions.. (Read 146 times) previous topic - next topic

Hackdub

Feb 03, 2013, 06:05 pm Last Edit: Feb 03, 2013, 06:23 pm by mrfunk Reason: 1
Well two questions...

I want to count how many times something happings in a loop..

so.. approx:-

Code: [Select]
int countTEST=0;

Void  loop:-
{If(blah,blah )

++countTEST;// this increments the count by 1}




---------------------------------


so I've got that..

If I wanted my display to display the count..
would this work?
Code: [Select]
lcd.setCursor(0,1);//
 lcd.print(countTEST);



my second question is i would want an led to blink a number of times, to indicate waht the count number is,-- (this is really where I'm stuck.

cheers

David

UKHeliBob

You have a variable that holds the number of times to blink the LED, which is a good start.  Have a look at the 'blink without delay' sketch to see how not to tie up the processor whilst blinking an LED.

Please post the whole of your existing program to get more help but read the 'sticky' thread at the beginning of this section of the forum before you do.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up