Pages: [1]   Go Down
Author Topic: Motor Timer  (Read 679 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
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

Massachusetts, USA
Offline Offline
Tesla Member
Karma: 212
Posts: 8975
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: