Week 16: Oct 3rd - Oct 9th
- Neil Bishop
- Oct 9, 2022
- 2 min read
This week's goals were to resolve a conflict with the servo motors, test the code with the hobby servos, and also update the GUI to be more aesthetically pleasing.
GUI Update:
The color scheme was chosen for the GUI to be pleasing to the eye while also increasing it’s usability. The font size was increased, and the font Arial was chosen. After this, the sizes of the buttons were adjusted to be more consistent in size. Here is the result.

Library Conflicts:
The logic controlling the Arduino relies on two main libraries, one to control the servos and the other to control the serial communication. While programming the servos, we came across a big issue that arises when using these two libraries together while a servo is activated. Every time data is sent to the Arduino the servo would twitch. After much research it was found that the servo library uses the same interrupts that the serial library uses which causes the servo to be sent a signal even without the servo being addressed causing it to twitch.
After trying many different servo and serial libraries with no real solution, I found a servo library that is not interrupt based and would not be affected by the use of serial communication functions. This library is called, Servo_Hardware_PWM. It was made by Daniel Duller and makes use of the PWM timer/counter on the Arduino Mega to control up to 9 servos. This library uses the same function names as the previously used Servo library, so nothing was changed code wise in the Arduino program.
Testing The Hobby Servo With New Library:
After updating the Arduino code, the GUI software was started and can now be tested using a hobby servo.
References:
Comments