Pages: [1]   Go Down
Author Topic: Motor Timer  (Read 633 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8855
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
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
}
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: