Details of myservo command??

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.

Ken (a Arduino newbee)

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.

Some libraries are documented here:

I should have asked the REAL question.

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?


PWM and servo PPM have different timing schedules. Are you going to be using servos?

How do I.........

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.


Assuming the Arduino Nano has no built in PWM hardware

Why would I assume that?

Digital I/O Pins 14 (of which 6 provide PWM output)

Of course, the presence or absence of PWM pins to drive servos, that use PPM, is completely irrelevant.

I found it!

Until a few moments ago I had not found and read servo.h

At first glance it looks like it will answer my questions.

We newbes are soooo new...


The chip on my Nano is an ATmega328.

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. ?????


Thanks everyone.

Time of bed here on the East Coast.

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.