summaryrefslogtreecommitdiff
path: root/Origin/user-code/servo/scilab/servo-reverse.sce
blob: 7fe1008e8a1328de3b8d4271e274af4d69c33b78 (plain)
1
2
3
4
5
6
7
8
9
ok = open_serial(1, 2, 115200)  // Connect to Arduino at port 2 
if ok ~= 0 error('Check the serial port and try again'); end
cmd_servo_attach(1, 1)         // Attach the motor to pin 5. 1 means 9
cmd_servo_move(1, 1, 90)        // Move the servo to 90 degree
sleep(1000) // be there for one second
cmd_servo_move(1, 1, 45)        // Move the servo to 45 degree
sleep(1000)      // be there for one second
cmd_servo_detach(1, 1)          // Detach the motor
close_serial(1)               // To close the connection safely