Go Down

Topic: Very confused about timing. (Read 3 times) previous topic - next topic

Roddiy

Okay guys, say i want Arduino to run a function for about 8 hours, ( from 8am to about 3pm, every day.

how would i do that?

Ive been reading about the millis() function, but i cant seem to get a grasp of it, not a single bit. i dont even have any sample code to show :/

any help is much appreciated!

AWOL

Eight hours in milliseconds:
8L * 60L * 60L * 1000L
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Roddiy


AWOL

Quote
I'm... Lost

Post your code, and we'll draw you a map.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Roddiy

As i have it right now theres only the function code:
Code: [Select]

int readPin = A0;
int Value;
int Strobe = 6;

void setup() {
 pinMode(readPin, INPUT);
 pinMode(8, OUTPUT);
 pinMode(Strobe, OUTPUT);
 
 attachInterrupt(0, light, LOW);
 
}

void loop() {
 Value = analogRead(readPin);

    if ( Value >= 1) {
      digitalWrite(8, HIGH);
      delay(3000);
    }
    else {
      digitalWrite(8, LOW);
    }
 }
 
 void light() {
   digitalWrite(Strobe, HIGH);
 }

Go Up