tayafaith.blogg.se

Billings pro run concurrent timers
Billings pro run concurrent timers








  1. BILLINGS PRO RUN CONCURRENT TIMERS HOW TO
  2. BILLINGS PRO RUN CONCURRENT TIMERS CODE

analogWrite(motorPWM, PWMMax) // !!! CHECK BASED ON THE POWER SOURCE AND THE MOTOR RATING PinMode(pumpDIR, OUTPUT) // set pin DIR B to send signal out PinMode(pumpBrake, OUTPUT) // set pin BRAKE B to send signal out PinMode(pumpPWM, OUTPUT) // set pin PWM B to send signal out PinMode(motorDIR, OUTPUT) // set pin DIR A to send signal out PinMode(motorBrake, OUTPUT) // set pin BRAKE A to send signal out PinMode(motorPWM, OUTPUT) // set pin PWM A to send signal out Int PWMValue = 50 // if other PWM value is needed Pump spins CCW for 10s -> Pump spins CW for 3s -> Pump spins CCW for 10s -> Pump spins CW for 3s -> ETC.Ĭonst long motorStage1 = 60000 // Stage 1 duration in ms, motorĬonst long motorStage2 = 15000 // Stage 2 duration in ms, motorĬonst long pumpStage1 = 25000 // Stage 1 duration in ms, pumpĬonst long pumpStage2 = 3575000 // Stage 2 duration in ms, pump Motor runs for 5s -> Motor stops for 2.5s -> Motor runs for 5s -> Motor stops for 2.5s -> ETC.Į.g. STAGE 1 ACTION (timer 1) -> STAGE 2 ACTION (timer 2) -> STAGE 1 ACTION (timer 1) -> STAGE 2 ACTION (timer 2) -> ETC.Į.g. Unsigned long pumpMillisMark = 0 // stores the most recent timestamp when the pump was set initiated as 0 unsigned long motorMillisMark = 0 // stores the most recent timestamp when the motor was set initiated as 0 I’d appreciate any thoughts on where I’m making the mistake.

BILLINGS PRO RUN CONCURRENT TIMERS HOW TO

The only thing I know that is less than optimal is running two loops one after another but I don’t know how to merge them together and still retain flexibility in setting how long on and off stages should be for each of them separately.

BILLINGS PRO RUN CONCURRENT TIMERS CODE

I’m not sure if I’m doing anything wrong with my code though. Both motors are 12V so 8.5V I get at PWM=255 is quite enough to run them (I confirmed this using the benchtop DC power supply).

billings pro run concurrent timers

I have Arduino powered by a 9V DC power supply. I cannot see anything wrong when I try to debug it via Serial.println(), it’s directly on pins A and B where I see the issue (I’m using a multimeter), i.e. However, when I try to make them asynchronous, the equipment will run once and then either one of them will stop, or both, or one or both cycles will go awry so they will run at their own pace. I tested this extensively and I found out that all works very well when the cycles are synchronized or when the shorter cycle fits N times into the longer cycle (N is a whole number). The way I’m doing it is shown in the code below. I’m using millis() instead of delay() because of this reason.

billings pro run concurrent timers

I’m trying to run a motor and a pump concurrently but also to cycle them on and off separately.










Billings pro run concurrent timers