blob: 02c8fdf234b8ac0c6c112ac56e1dc9dbb3050252 (
plain)
1
2
3
4
5
6
7
|
ok = open_serial(1, 2, 115200) // At port 2 with baud rate of 115200
if ok ~= 0 error('Check the serial port and try again'); end
cmd_servo_attach(1, 1) // To attach the motor to pin 5
cmd_servo_move(1, 1, 30) // tell servo to rotate by 30 degrees
sleep(1000)
cmd_servo_detach(1, 1) // Detach the motor
close_serial(1)
|