i just recieved my arduino about 5 days ago and i am trying to make a code to blink an led while its scrolling on the lcd board. i can get it to blink but only at the end here is the sketch i have right now can someone please help me im trying to understand this more. thanks
for (int i = 0; i<20; i++)
{
digitalWrite(led, HIGH);
delay(500);
digitalWrite(led, LOW);
delay(500);
}
Do you want to have the led blinking and the display scrolling at the same time ?
The most important thing is to use a consistant layout of your sketch. Use indents always in the same way. That way you (and we) can spot problems a lot quicker.
Do you want to have the led blinking and the display scrolling at the same time ?
The most important thing is to use a consistant layout of your sketch. Use indents always in the same way. That way you (and we) can spot problems a lot quicker.
sorry @peter_n i am not sure where to place your code into mine. And yes I want both to blink and scroll.
You have already the four lines to turn the led on and off, and I added the for-loop around it: for (int i = 0; i<20; i++)....
Doing different things at the same time is for advanced users. You can't use any delay anymore, but have to use the Arduino timing.
Have a look at this: http://arduino.cc/en/Tutorial/BlinkWithoutDelay
That is the most famous example of the Arduino.
Is that too complicated ? then you can extend the scrolling by adding the blinking of the led. But first try to make the leds blink.
When I develop something, I start with a few test sketches. You don't have write the resulting sketch at once.
You can create another sketch to try blinking the led.
Using your sketch, you could try to blink the led after the scrolling. Just for a test.
You have this:
yes and im sorry i know its annoying that i dont understand but could you possibly just show me what the sketch should look like that way i can study it and have an idea of what to do to from now on.
When you want to blink the led independant of the scrolling, that is for advanced users as I wrote. The BlinkWithoutDelay is the first step in that direction.
There is also the possibility to use a timer to blink the led.
Then you should do what you do understand. Arduino is all about learning by doing and testing and trying new things. You will learn along the way.
Is it for school ? How important is it to have the leds blinking ?
There are a few tricks, for example a tone for loudspeaker of 1Hz. That low frequency will make the led blink.
The library toneAC can do that, but it requires specific pins to be used.