Go Down

Topic: Motor Timer (Read 714 times) previous topic - next topic

LeandroTo

Hello, I am a rookie, still do not quite understand everything that is programming.
I want to light a 9v motor, to ignite every 6 hours and must last for one minute . Can you help me?
I'm not very good at speaking English

johnwasser

http://itp.nyu.edu/physcomp/Tutorials/HighCurrentLoads

Code: [Select]

const int MotorPin = 8;  // Arduino pin going to transistor

void setup() {
    pinMode(MotorPin, OUTPUT};
}

void loop() {
    digitalWrite(MotorPin, HIGH);  // Turn the motor on
    delay(60000);  //  Wait 60 seconds
    digitalWrite(MotorPin, LOW);  // Turn motor off
    delay(21600000UL - 60000UL);  // Wait 5 hours and 59 minutes
}
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Go Up