This is a library for controlling two servos(like Tower Pro SG90), this library depends on Arduino Servo library.
See the comprehensive usage on WifiCar project.
- BiaxialServo.h - library header file
- BiaxialServo.cpp - library source file
- exmples - samples folder.
- biaxial_servo_sample0.ino - sample
- image - some related images
- keywords.txt - ArduinoIDE brights the keywords in this file
BiaxialServo - library class name, use to declare a user class for using library.
begin(int xy_pin_num, int yz_pin_num) - BiaxialServo initial function. Must be called in setup() function of arduino. xy_pin_num is the pin which is used to control xy direction servo, yz_pin_num is the pin which is used to control yz direction servo.
up() - YZ servo up
down() - YZ servo down
left() - XY servo left
right() - XY servo right
center() - center two servos.
This is a quick start guide, which aims to teach you how to use this BiaxialServo library and tell you what you need prepare for using.
-
A biaxial servo bracket
-
two servos
Connect servo with arduino. In the sample Pin7(XY servo) and Pin8(YZ servo) are used.
-
Download BiaxialServo.
#get through GIT tools : git clone https://github.com/elechouse/BiaxialServo.git
or
#download zip file
-
Extract the zip file if you download the zip format file. Copy BiaxialServo to $ArduinoSketch/libraries .
Note: $ArduinoSketch means your Arduino sketchbook location, you can find it by opening ArduinoIDE->File->Preferences manually or using shortcut Ctrl+comma
-
Reopen your Arduino IDE.
-
Open biaxial_servo_sample0. (ArduinoIDE->File->Examples->BiaxialServo->biaxial_servo_sample0)
-
Connect your Arduino board to PC, select exact Serial Port, select exact arduino Board.
-
Hit upload button, wait to be uploaded.
-
Now you can control your Servos through serial port(Default : 115200,8,N,1),
Control your Servos by sending these characters:
- i --> up;
- k --> down;
- j --> left;
- l --> right;
- o --> center;