I am running a model level radio control car autonomously using an Arduino Nano. The goal is to have the car run quickly around a gym floor counter clockwise looking down. It uses front and right side sonar sensors. The Electronic Speed Control circuit that controls the rear wheel drive motor requires a Pulse Width Modulated (proportional) signal.
I have found mention of the Arduino0022 'myservo' command but no details. Where are the details of its actions? I need to control the length of the pulse (proportionally between 1 and 2 millisec) and the frequency (50Hz is ideal) without Arduino 'delay' between pulses. There is plenty of work for the chip to do listening to its sensors and making decisions.
myservo is in a library. This leads to the bigger question. Where are the details of the various libraries.
The variable myservo is an instance of the Servo class. The details for the library are in the header file in the Servo directory in the arduino-intallation-path\libraries folder.
How do I create 50Hz Pulse Width Modulated signals (I need two. One for the drive wheels and one for the steering servo.) without using any 'delay' states.
Assuming the Arduino Nano has no built in PWM hardware the answer must be setting interrupts for every 20msec. Any code strings around that I can copy?
You simply utilize the servo library, it handles all the gory details. Read the source code of the servo library if you want to learn how it does it, otherwise just utilize it's commands. Your speed control mimics a servo (50msec refresh, 1-2msec pulse) that the servo library can directly control.
Where is the multi-hundred page pdf Data Sheet? My previous PIC, Microchip 16F887, had all kinds of documentation. I have searched as best I know how on the WEB but not found much. ?????
Tomorrow I translate from PIC BASIC PRO to Arduino0022. It appears that all I need to do on the solderless proto board is replace the 15F887 with the Nano board.
If you are interested here's a video on my progress as of a couple months ago.