// Control the movements of a robot by numeric keys // Use this program to set the correct spinning // directions for the left and right motors #include "motor.h" main() { writes("key", 500); loop switch(getkey()) { case '0': stop_all(); break; case '1': drive( 1, 1, 0); break; // forward case '2': drive(-1, -1, 0); break; // backward case '3': drive(-1, 1, 0); break; // spin left case '4': drive( 1, -1, 0); break; // spin right case '5': stop_all(); writes("end", 2000); exit(); break; // stop and exit } }