Go Down

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


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



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: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Go Up