0

I am currently working with a project for school in which I am building a small cart that will scan an area for the most intense source of light and drive towards it. I have programmed an SG90 180 degree servo to scan a 180 degree area, use the info I scanned to create a decision and then turn the cart and drive towards the light. The issue I have run into is that I am using the TIMER/COUNTER1 to create a PWM wave to drive the motors. My issue extends from the fact that I am using FS90R servos to drive the cart which also run on a PWM wave. My timer counter is already running the 180 degree servo and when I go to drive the continuous servos the SG90 turns and while I am scanning one of my wheels turns. This obviously is not how the cart should run. Does anyone have a way to possibly create an interrupt driven PWM wave that does not directly employ the use of the PWM capabilities of the TIMER/COUNTER1 so that I can control all 3 of the servos separately?

too honest for this site
  • 12,050
  • 4
  • 30
  • 52

1 Answers1

-1

There are 6 PWM outputs on the Arduino, two from each timer. If you are using existing libraries to drive the outputs to the servos the libraries might assume the use of timer 1. You would have to dive into the library code to modify the libraries.

Arduino PWM Information

Ensure that you have each servo on a separate PWM output.

Derek
  • 58
  • 3
  • While yes there are 6 possible pins for a PWM wave you can only create the required 20ms period with the correct duty cycle on the 16bit timer/counter pins. I figured out what I needed to do and that was manually create a PWM wave using interrupts. I will post my solution soon. – Sheridan Mason Aug 10 '17 at 19:08