JJRobots COMMUNITY

Full Version: Changing pin of servo
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I want to modify the servo code of the B-Robot EVO2 to work from the 32u4's Analog Pin 2 instead of Digital Pin 10: https://github.com/jjrobots/B-ROBOT_EVO2...os.ino#L72

There seems to be a lot of complicated bit register logic, which I don't understand well.

According to https://www.arduino.cc/en/Hacking/PinMapping32u4, analog pin 2 is (ADC5/TMS) PF5, and digital pin 10 is (PCINT6/OC1B/OC4B/ADC13) PB6.

I tried changing OC4B (pin 10) to ADC5, TMS, and PF5, but the sketch wouldn't compile.

Does anyone know how to switch the pins?
Alternatively, I can just use the Servo arduino library, but the brobot uses timer 1 and that conflicts with the Servo library. Is there any way to get the BROBOT to use another time for steppers instead of timer 1?
The thing is: The B-robot uses almost the 99% of the 32u4 processor. And both TIMERs to precisely control the Wheels in order to keep the balance. Changing the PIN is not straightforward as it will conflict with... timers.
Reference URL's