No description
Language:
C++
Created:
13.04.2023
Updated:
01.06.2023
Stars:
2
Visit on GitHub
Library for controlling lx16a and similar servos that actually works on ESP32.
Add current version to your platformio.ini:
...
lib_deps = https://github.com/RoboticsBrno/Esp32-lx16a/archive/refs/tags/v1.2.1.zip # or newer version...
...
#include <Arduino.h>
#include "SmartServoBus.hpp"
using namespace lx16a;
static SmartServoBus servoBus;
void setup() {
// Servos on the bus must have sequential IDs, starting from 0 (not 1)!
// The '1' below is count of servos on the bus, not servo ID.
servoBus.begin(1, UART_NUM_2, GPIO_NUM_14);
/*
// Set servo Id (must be only one servo connected to the bus)
servoBus.setId(0);
while (true) {
printf("GetId: %d\n", servoBus.getId());
delay(1000);
}
*/
printf("Current pos: %f\n", servoBus.pos(0).deg());
servoBus.set(0, 180_deg);
}
void loop() {
}