int main(int argc, char ** argv) { unsigned short servo_cmds[6] = {0, 340, 682, 1023, 682, 340}; // enable servos int i; for (i = 0; i < NUM_SERVOS; ++i) set_servo_enabled(i, 1); for (i = 0; i < 30; ++i) { int chan; for (chan = 0; chan < 4; ++chan) { unsigned short cmd_ind = (i + chan) % 6; set_servo_position(chan, servo_cmds[cmd_ind]); } // TODO: demo allstop // TODO: demo individual enable/disable msleep(2000); } // disable servos for (i = 0; i < NUM_SERVOS; ++i) set_servo_enabled(i, 0); return 0; }
VH #include "kovan/servo.h" #include "servo_p.hpp" VI void enable_servo(int servo) { set_servo_enabled(servo, 1); }
VI void disable_servo(int servo) { set_servo_enabled(servo, 0); }