I need a pwm that is at a different frequency than the standard analogWrite(), I need 125Hz. so I have coded a loop that works to give me that. I am using mosfets to switch the power on my application. I would like for simplification purpose have one pin give a PWM signal at 125hz and supply all the other channels so I can just have them turn the mosfets on and off while the signal pin is giving the PWM to the mosfets.
How do I have the signal continue throughout my code without having to code it in for every channel I am using?
Similar to using a analogWrite and initializing it to run say at 165 in the setup loop so it keeps running during the main loop.
Here is the function I am using to give me a 65% duty cycle at 125Hz:
#define WIRE1 2
#define on_time 5240
#define off_time 2760
#define PWM 375 //this runs the duty cycle for 3 seconds
for(int cycle = 0; cycle < PWM; cycle++)