int main() // Main - execution begins! { xbee = fdserial_open(11, 10, 0, 9600); //dprint(xbee, "hello"); //dprint(xbee, "hello"); drive_speed(0,0); // Start servos/encoders cog drive_setRampStep(10); // Set ramping at 10 ticks/sec per 20 ms sirc_setTimeout(50); // Remote timeout = 50 ms //drive_feedback(0); dt = CLKFREQ/10; t = CNT; while(1) // Outer loop { int button = sirc_button(4); // check for remote key press // Motion responses - if key pressed, set wheel speeds if(button == 2) { if(!running) cogstart(&gofwd, NULL, fstack, sizeof fstack); } if(button == 8) { if(!running) cogstart(&gobkwd, NULL, bstack, sizeof bstack); } if(button == CH_UP)drive_rampStep(100, 100); // Left turn if(button == CH_DN)drive_rampStep(-100, -100); // Right turn if(button == VOL_DN)drive_rampStep(-100, 100); // Left turn if(button == VOL_UP)drive_rampStep(100, -100); // Right turn if(button == MUTE)drive_rampStep(0, 0); // Stop if(button == ENTER) { getTicks(); displayTicks(); } if(CNT - t > dt) { t+=dt; i++; getTicks(); if ( ticksLeftCalc != ticksLeftCalcOld || ticksRightCalc != ticksRightCalcOld || ticksLeft != ticksLeftOld || ticksRight != ticksRightOld ) { displayTicks(); } } } }
void derecha(){ for(int n = 1; n <= 65; n++){ // Count to hundred drive_rampStep(35,35); // move not too fast pause(10); // 50 ms between reps } drive_speed(0,0); pause(500); drive_goto(25,-25); //giro a la derecha pause(500); for(int n = 1; n <= 65; n++){ // Count to hundred drive_rampStep(35,35); // move not too fast pause(10); // 50 ms between reps } }
//static int step = 6; void drive_ramp(int left, int right) { if(!abd_intTabSetup) { interpolation_table_setup(); set_drive_speed(0, 0); pause(40); } while((left != abd_speedL) || (right != abd_speedR)) { drive_rampStep(left, right); } }
int forward(){ drive_rampStep(55,55); return 2; }
void recto(){ drive_rampStep(50,50); }