SerialServo.zip
This library MUST be put into the Arduino sketch folder "arduino\libraries\" To import this library, simply go to Sketch -> Import library. If you do not see the library there, it is possible you put the library in the wrong spot or you did not extract the library. ** Double foldering will result in errors
This simple library is designed to work with all JP Serial Servo Controllers, (4, 10, 23 and 34 channels).
There are two baud rates the controller can communicate at 4800 and 19200.
This can either be set to Serial to use pin 1 (Tx) to communicate with the controller or it can be used with the SoftwareSerial library, which will allow you to use any digital or analog pin you like.
This identifies what controller is used and provides the correct settings for that controller. Default is set to 4.
This is a simple function that takes two things to work, a channel number (starting from 1) and an angle (0 - 179)
If when calibrating the servo and it locks up, you can change the left and right limits. (lowest left can go is 7, highest right can go is 247)
This function is optional, it checks at 0 degrees, 90 and 180.
#include "SerialServo.h" SerialServo servo (Serial); void setup () { Serial.begin (19200); servo.Number_of_Channels(4); } // end of setup void loop() { for(int i = 0; i < 180; i += 10) { servo.Move(1, i); // channel 1, move servo based on for loop delay(200); } } // end of loop
#include "SerialServo.h" #include <SoftwareSerial.h> const byte TX = 5; SoftwareSerial mySerial (-1, TX, false); // set Rx pin to -1 for not used SerialServo servo (mySerial); void setup () { mySerial.begin (19200); servo.Number_of_Channels(4); } // end of setup void loop () { for(int i = 0; i < 180; i += 10) { servo.Move(1, i); delay(200); } }