Were you you told to look at the blink with out delay tutorial?
did you understand what was going on with it?
Well I sure don't and I'm not sure how helpful it would be to my projects. So I'm going to post the code line by line, and I want comments on all the things I explain wrong.
your help is greatly appreciated
const int ledPin = 13;
const = constant : cannot be changed
int = integer : a number up to 255? (medium sized)
int ledState = LOW;
long previousMillis = 0;
long= longer number; a number up to XXXXXX (large sized)
a "long" variable called "previousMillis" set to "0"
long interval = 1000
A "Long" variable called "interval" set to "1000"
void setup() {
// set the digital pin as output:
pinMode(ledPin, OUTPUT);
}
void loop()
{
ok
if (millis() - previousMillis > interval) {
if the differance between the variables "millis" (number of milliseconds the arduino has been running) and previousMillis (initally set to 0) is greater than "interval" (1000) DO:
previousMillis = millis();
set the number of seconds the arduino has been running to the variable "Previousmilis"
and:
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;
if the led is off, turn it on, otherwise turn it off.
digitalWrite(ledPin, ledState);
}
}
Write the state to the pin
so this is the part I don't understand.
the "clock" counts to 1001mS, since the initial value of previousmilis is 0, 1001-0=1001
1001>1000
if (millis() - previousMillis > interval) {
previousMillis = millis();
so the clock is reset to 0 ? because previousmilis = 0, so why doesn't it just say
millis = 0 ?
is this explanation correct?