/BiaxialServo

Arduino library for biaxial servo bracket

Primary LanguageC++

BiaxialServo

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.

Instruction

Files

  • 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

Functions

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.

How to

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.

Prepare

Connection

Connect servo with arduino. In the sample Pin7(XY servo) and Pin8(YZ servo) are used.

Upload

  1. Download BiaxialServo.

     #get through GIT tools :
     git clone https://github.com/elechouse/BiaxialServo.git
    

    or

     #download zip file
    
  2. 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

  3. Reopen your Arduino IDE.

  4. Open biaxial_servo_sample0. (ArduinoIDE->File->Examples->BiaxialServo->biaxial_servo_sample0)

  5. Connect your Arduino board to PC, select exact Serial Port, select exact arduino Board.

  6. Hit upload button, wait to be uploaded.

  7. Now you can control your Servos through serial port(Default : 115200,8,N,1),

Control

Control your Servos by sending these characters:

  • i --> up;
  • k --> down;
  • j --> left;
  • l --> right;
  • o --> center;

Buy

Elechouse online shop .