Skip to content

Abstraction layer on top of 32 chineese servo controller (Manual and Software Attached)

License

Notifications You must be signed in to change notification settings

shakram02/HexdServos

Repository files navigation

HexdServos

C++ driver for 16/32 servo controller. The communication with the MCU on the controller is done using a software serial

** References are in the attachements folder **

Usage

For easy usage, add the library using Arduino text editor (a.k.a IDE) from Sketch->Include Library->Add .ZIP Library...

  • Create a HexdServos object
  • Write the data to servoNumber giving it an angle and optionally a speed
  • Angles range from 0~180
  • Speeds range from 0~100
#include "HexdServos.hpp"
#include <Arduino.h>

const int rxPin = 10;
const int txPin = 11;
const int servoChannel = 1;
const int servoDelay = 200;
const int driverBaudRate = 9600;

HexdServos servos(rxPin, txPin, driverBaudRate);

void setup() { servos.begin(); }

void loop() {

  // Sweep counter-clockwise
  for (int i = 180; i >= 0; i -= 45) {
    servos.servoWrite(servoChannel, i);
    delay(servoDelay);
  }

  // Sweep clockwise
  for (int i = 0; i < 180; i += 45) {
    servos.servoWrite(servoChannel, i);
    delay(servoDelay);
  }
}

About

Abstraction layer on top of 32 chineese servo controller (Manual and Software Attached)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages