I started a similar post in the hardware forum but thought it should be here instead. I asked a moderator to remove the post from the hardware forum.
In any case, I made an LED script that pulses an LED like a heartbeat. The script is as follows:
/*
Heart Beat for Start Button
Jaguar Start Button blinks like a heartbeat with KOEO( Key on Engine off )
until pressed to start car
*/
int heartLED = 10;
int time = 2;
int pulsewidth;
void setup() {
// Nothing needed for analoge pwm
}
void loop() {
for (pulsewidth=0; pulsewidth <= 255; pulsewidth++){
analogWrite(heartLED, pulsewidth);
delay(time/3);
}
// slowly dim the LEDs
for (pulsewidth=255; pulsewidth >= 0; pulsewidth--){
analogWrite(heartLED, pulsewidth);
delay(time/2);
}
for (pulsewidth=0; pulsewidth <= 255; pulsewidth++){
analogWrite(heartLED, pulsewidth);
delay(time/2);
}
// slowly dim the LEDs
for (pulsewidth=255; pulsewidth >= 0; pulsewidth--){
analogWrite(heartLED, pulsewidth);
delay(time*2);
}
delay(200);
}
I asked if the delays in the script would inhibit any other things I want to add to the script later and I was advised that it would, and was directed to a millis() and blink without delay example on the arduino site.
My problem is, Even after reading those examples and trying to change my code, I am NOT understanding millis() or how to use them properly. When I tried to implement them in my code and commented out my delays, the LED just stayed on solid.
So if someone here could break this down for me ( spoon feed me) so that I can substitute delay(), for... count(millis and wait than continue)
I would appreciate the help.