
Hello! Found and laundered a Soviet watch. For their operation, it is necessary to apply pulses of different polarity 24V alternately once a minute. There is arduino uno, module l298d, real time clock ds1307.
Help with the program.
/ SECONDARY CLOCK ARROW
int IN1 = 8; // output for L293d
int IN2 = 9; // output for L293d
int button = 10; // output for the button
void setup()
{
pinMode (button, INPUT); // configure the port as an input
pinMode (IN1, OUTPUT); // configure the port as an output to l293d
pinMode (IN2, OUTPUT); // configure the port as an output to l293d
}
void loop ()
{
if (digitalRead (button) == HIGH) // if the button is pressed
{
// MINUTE HAND AS SECOND
digitalWrite (IN1, HIGH);
digitalWrite (IN2, LOW);
delay (150);
digitalWrite (IN1, LOW);
digitalWrite (IN2, LOW);
delay (850);
digitalWrite (IN1, LOW);
digitalWrite (IN2, HIGH);
delay (150);
digitalWrite (IN1, LOW);
digitalWrite (IN2, LOW);
delay (850);
}
// MINUTE HAND STROKE
// If the button is not pressed
else {
// Give a pulse for 1 millisecond
digitalWrite (IN1, HIGH);
digitalWrite (IN2, LOW);
delay (150);
// turn off for 59850 milliseconds
digitalWrite (IN1, LOW); //
digitalWrite (IN2, LOW);
delay (59850);
// CHANGE POLARITY
// Give a pulse for 1 millisecond
digitalWrite (IN1, LOW); //
digitalWrite (IN2, HIGH);
delay (150);
digitalWrite (IN1, LOW); //
digitalWrite (IN2, LOW);
delay (59850);
}
}
How to make ds1307 count down the minutes?