This Instructable was made in the interest of arduino users:
Many of the prototypers had compiling issues while using Servo.h with VirtualWire.h (most of them were not able to solve the error even after using ServoTimer2.h ) We searched the Arduino forums and found that the ServoTimer2 library can be modified to make the code compile. It feels a kind of awesome to modify an Arduino library. We have modified the library and tested it a 100 times. It works just like ServoTimer2.h flawlessly. If you have been using Servo.h before, please go through all the steps
The real credit goes to Nick Bontrager
We just tweaked his library to create ServoV2.h
ServoV2.h is a modified version of ServoTimer2.h library
If you have already used ServoTimer2 then you can directly Downloadthe library
Step 1: How Do We Use ServoV2.h Library?
ServoV2.h library uses Timer2 to drive up to 8 servos using interrupts
The usage and naming method is similar to the Arduino Servo.h library
Naming the Servos:
- attach(pin) - Attaches a servo motor to an i/o pin.
- attach(pin, min, max ) - Attaches to a pin setting min and max values in microseconds.Default min is 544, max is 2400.write() - Sets the servo pulse width in microseconds.
- read() - Gets the last written servo pulse width in microseconds.
- attached() - Returns true if there is a servo attached.detach() - Stops an attached servos from pulsing its I/O pin.
Note: analogWrite of PWM on pins 3 and 11 are disabled when the first servo is attached
Step 2: IT's Better to Use PulseWidth:
PulseWidth for some popular servos (in MicroSeconds)
- TowerPro: 500 - 2400
- Futaba: 500 - 3000
- Feetech: 500 - 2500
Mostly these values range from 700 to 2400
Now you have the freedom to use VirtualWire.h with Servos.
You will not be confronting Compiling errors once again.
Information for ArduinoDroid(Android app) Users:
The attached file is a zip file; you will need an unzipping tool to use this.
Step 3: Help Us Improve
If you feel that this project was worth viewing or If it will help you;
Please vote for us in the contest if you like to support us
If you think that this project is not worth voting;
This is our Second Instructable,So please bear with us and
Please consider commenting so that we will be able to rectify our mistakes and create Better Instructables in the future
Your suggestions will help us evolve a lot.
You can have a look at our other Instructablesif you wish