/******************************************************************* * Function: void checkIR(void) * Input Variables: none * Output Return: none * Overview: This function update all of the infrared range * finding sensor values sequentially ********************************************************************/ void checkIR( void ) { // Update all IR values ftIR = getFrontIR(); bkIR = getBackIR(); ltIR = getLeftIR(); rtIR = getRightIR(); }
void getIR() { ft = getFrontIR(); bk = getBackIR(); rt = getRightIR(); lt = getLeftIR(); frontRight = ATTINY_get_IR_state(ATTINY_IR_RIGHT); frontLeft = ATTINY_get_IR_state(ATTINY_IR_LEFT); }
/******************************************************************* * Function: void moveCollide(void) * Input Variables: none * Output Return: none * Overview: Use a comment block like this before functions ********************************************************************/ void moveCollide( void ) { ftIR = getFrontIR(); // Check front IR sensor if(ftIR > IR_THRESHOLD) { // Move forward. STEPPER_move_stnb( STEPPER_BOTH, STEPPER_FWD, 200, 200, 450, STEPPER_BRK_OFF, // Left STEPPER_FWD, 200, 200, 450, STEPPER_BRK_OFF ); // Right } else { //STOP. STEPPER_move_stnb( STEPPER_BOTH, STEPPER_FWD, 0, 0, 0, STEPPER_BRK_OFF, // Left STEPPER_FWD, 0, 0, 0, STEPPER_BRK_OFF ); // Right } }