Hello everyone !!!
I have a problem with my code in my project...
I use a LED and a lcd screen and i want to turn on and off the LED every 100 microseconds AND AT THE SAME TIME to count numbers in lcd screen until 10 every 1000 microseconds
Example:
void _clock()
{
for (int i = 0; i <= 10; i++)
{
lcd.setCursor(0, 1);
lcd.print(i);
delay(1000);
lcd.clear();
}
}
But in loop method first the led goes from on to off and after that ,execute the _clock method in lcd .
But i want to do that 2 things (led and lcd screen message) at THE SAME TIME...
Please i want your help...
Thanks a lot !!!
arduiNICK:
I use a LED and a lcd screen and i want to turn on and off the LED every 100 microseconds AND AT THE SAME TIME to count numbers in lcd screen until 10 every 1000 microseconds
Do you mean microseconds or milliseconds? The delay statement in your code, delay(1000), is for 1000 milliseconds, or 1,000,000 microseconds.
I use a LED and a lcd screen and i want to turn on and off the LED every 100 milliseconds AND AT THE SAME TIME to count numbers in lcd screen until 10 every 1000 milliseconds.
My code:
#include <LiquidCrystal.h>
int led = 13;
LiquidCrystal lcd (12, 11, 5, 4, 3, 2);
Change the function to something like this. It is called by loop() every time, but only shows an update every 10th pass thru, so the delays in loop() determine how often it updates.
void _clock()
{
i = i +1;
if (i == 10)
{
lcd.print(j);
j = j +1;
if ( j == 10){
j = 0;
}
i == 0;