11.07.2015 Views

Builders guide robot pacman.pdf

Builders guide robot pacman.pdf

Builders guide robot pacman.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

MIN_RIGHT += read_adc();}output_bit(SENSOR_LED, 0);calibration_stage++;}else if ( calibration_stage == 5){initial_start = 1 ; //facing north initiallyrf1 = input(RF_1);rf0 = input(RF_0);}else{}rf_enable = 1;if ( !rf1 && !rf0 ) // north{next_turn = NONE;}else if ( rf1 && !rf0 ){next_turn = RIGHT;}else if ( !rf1 && rf0 ){next_turn = LEFT;}else // south{next_turn = BACK;}rf1 = input(RF_1);rf0 = input(RF_0);if ( !rf1 && !rf0 ) // north{switch (current_orient){case N:// move forwardnext_turn = NONE;break;case E:// turn leftnext_turn = LEFT;break;case S:// turn_backwardsnext_turn = BACK;break;case W:// turn rightnext_turn = RIGHT;break;}current_orient = N;}else if ( rf1 && !rf0 ) // west{switch (current_orient){case N:// turn leftnext_turn = LEFT;break;case E:// turn backwardsnext_turn = BACK;break;case S:// turn rightnext_turn = RIGHT;break;case W:// move forwardnext_turn = NONE;break;}current_orient = W;}else if ( !rf1 && rf0 ) // east{// stop = 1;switch (current_orient){case N:// turn rightnext_turn = RIGHT;break;case E:// east// west

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!