[{"element_type":"text","content":"\n  \n        \u003cp\u003eThis is a library for servomotors: model names \u003cstrong\u003eLX-16A\u003c/strong\u003e and \u003cstrong\u003eLX-224\u003c/strong\u003e. I developed it with \u003cstrong\u003eAdafruit Metro\u003c/strong\u003e board and tested on \u003cstrong\u003eESP32\u003c/strong\u003e boards. The library is fully open-source and published here:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://docs.arduino.cc/libraries/lx16a-bus/\"\u003eArduino Library Manager\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/alecxcode/LX16A-bus\"\u003eGutHub repo with examples\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eHow does it work? It needs a bus linker (USB debug board) for these motors, and utilizes UART (RX and TX pins). Can it be used without the bus linker? Yes, but only to send commands, not to receive them.\u003c/p\u003e\n      \n","metadata":{}},{"element_type":"embed","content":"https://www.youtube.com/watch?v=hftOepSBWFY"},{"element_type":"text","content":"\n        \u003cp\u003eThe library provides a convenient class to control these servos.\u003c/p\u003e\n\u003cp\u003eFor instance, to rotate to the given position/angle (for LX-16A from 0 to 240), call:\u003cbr\u003e\u003ccode\u003evoid move(float angle, uint16_t time = 0, bool wait = false);\u003c/code\u003e\u003c/p\u003e\n\u003cp\u003eTo read a physical angle at which the servo is currently positioned:\u003cbr\u003e\u003ccode\u003efloat getPhysicalAngle();\u003c/code\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eThe comprehensive set of methods allow to read temperature and voltage, set and get the mode of operation (motor or servo), set or get if torque is enabled, if an LED is enabled, change servo id, prepare a movement and execute it later.\u003c/p\u003e\n\u003cp\u003eBelow is an example of the code to control the servo in a simple manner.\u003c/p\u003e\n      ","metadata":{}},{"element_type":"code","content":"#include \u003cArduino.h\u003e\n#include \"LX16A-bus.h\"\n\nLX16A motor1(1, Serial);\nLX16A motor2(2, Serial);\n\nvoid setup() {\n  Serial.begin(115200);\n  motor1.initialize();\n  motor1.enableTorque();\n  motor2.initialize();\n  motor2.enableTorque();\n  motor1.setServoMode();\n  motor2.setServoMode();\n}\n\nvoid loop() {\n  float angle = motor1.getPhysicalAngle();\n  delay(50);\n  Serial.print(\"angle: \");\n  Serial.println(angle);\n  motor1.move(240);\n  delay(1000);\n  motor2.move(240);\n  delay(2000);\n  angle = motor1.getPhysicalAngle();\n  delay(50);\n  Serial.print(\"angle: \");\n  Serial.println(angle);\n  motor1.move(0);\n  delay(1000);\n  motor2.move(0);\n  delay(2000);\n}","metadata":{"language":"cpp","filename":"simpleservo.ino","linenums":false}},{"element_type":"product","content":"https://www.adafruit.com/product/2488","metadata":{"quantity":"1","description":"","name":"","url":"","featured":"false"}},{"element_type":"parts","content":"\n  \n    \u003cinput value=\"parts\" class=\"element_type\" id=\"user_page_elements_attributes_6_element_type\"\u003e\n    \u003cinput value=\"3223425\" class=\"id\" id=\"user_page_elements_attributes_6_id\"\u003e\n    \u003cinput value=\"6\" class=\"position\" id=\"user_page_elements_attributes_6_position\"\u003e\n    \u003cinput value=\"LX-16A\" class=\"part-name\" id=\"user_page_elements_attributes_6_part_name\"\u003e\n    \u003cinput value=\"\" class=\"part-url\" id=\"user_page_elements_attributes_6_part_url\"\u003e\n    \u003cinput value=\"Serial Bus Servo\" class=\"part-description\" id=\"user_page_elements_attributes_6_description\"\u003e\n    \u003cinput value=\"2\" class=\"quantity\" id=\"user_page_elements_attributes_6_quantity\"\u003e\n    \u003cinput value=\"false\" class=\"featured\" id=\"user_page_elements_attributes_6_featured\"\u003e\n\n  \n    \u003ci class=\"fa fa-edit\"\u003e\u003c/i\u003e\n  \n\n  \u003cdiv class=\"product-column product-details-wrapper\"\u003e\n    \u003cdiv class=\"parts-header\"\u003e\n      \u003cdiv class=\"product-title\"\u003e\n          \u003cspan class=\"parts-name\"\u003eLX-16A\u003c/span\u003e\n        \u003cspan class=\"product-quantity-badge\"\u003e(×2)\u003c/span\u003e\n      \u003c/div\u003e\n\n        \u003cdiv class=\"product-custom-description parts-description\"\u003eSerial Bus Servo\u003c/div\u003e\n    \u003c/div\u003e\n  \u003c/div\u003e\n\n  \u003cdiv class=\"parts-purchase\"\u003e\n    \u003cdiv class=\"product-buy-wrapper\"\u003e\n      \u003cspan class=\"btn-primary preview-btn\"\u003eBuy Now\u003c/span\u003e\n    \u003c/div\u003e\n  \u003c/div\u003e\n","metadata":{"quantity":"2","description":"Serial Bus Servo","name":"LX-16A","url":""}},{"element_type":"product","content":"https://www.adafruit.com/product/5400","metadata":{"quantity":"1","description":"","name":"","url":"","featured":"false"}}]