mikedotalmond / arduino-tick

Pulse generator for the stepper motor typically found in (cheap) clock movements...
MIT License
1 stars 3 forks source link

Dual motor #1

Open Tannoo opened 6 years ago

Tannoo commented 6 years ago

I like your library for this. It works fine for one motor.

I have interfaced with a $20 atomic clock from Wal-Mart to give me control of the minute hand also. So, there are two of these motors in there.

I have them working with my own timings, but I am trying to use your library, as it would make my code cleaner.

I hope that the library doesn't have to get re-written, because it is nice as it is.

Tannoo commented 6 years ago

I tried swapping the clock pins with setClockPins, but it did nothing. I'm likely doing something wrong.

mikedotalmond commented 6 years ago

Hi - I've not used this code in a while, but I think it should work if you have two Tick instances set to use separate pairs of pins.

Are you getting errors from the code or is it just not driving the second motor? You could try hooking up a couple of LEDs to the outputs to see if it's sending any pulses out. If it is sending pulses then I suppose its possible that the motor for the minute hand needs different pulse timings or more current.

Tannoo commented 6 years ago

How would I setup two instances?

Tick ticksec
Tick tickmin

?

mikedotalmond commented 6 years ago

Yeah, exactly - then in setup you'll need to configure each one with the pins you're using, and the delay between ticks (1000 for one tick per second, and 60000 for one a minute)

  ticksec.setup(tickSecPinA, tickSecPinB, 1000);
  tickmin.setup(tickMinPinA, tickMinPinB, 60000);

and update each one in the main loop

    ticksec.stepMillisecondDelta(dt);
    tickmin.stepMillisecondDelta(dt);