/* Simple stub code for IRA Lab 1. This program moves the robot forward slowly until the front IR sensor reports a range of 1/4 meter. */ #include #include int main(int argc, char **argv) { char *host = "localhost"; if(argc > 1) host = argv[1]; if(mpro_connect(host) < 0) { printf("Can't connect to %s!\n", host); return 1; } mpro_set_velocity(0.25, 0); // start moving forward at 0.25 m/sec float range; do { mpro_get_ir(0, &range); // get the range from IR 0 } while(range > 0.25); mpro_stop(); return 0; }