Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: Sources/main.cpp
- Revision:
- 2:01e9de508316
- Parent:
- 1:388c915756f5
--- a/Sources/main.cpp Sun Mar 19 12:20:26 2017 +0000 +++ b/Sources/main.cpp Tue Mar 21 13:12:54 2017 +0000 @@ -38,12 +38,18 @@ /* */ int main(){ + Timer t; + t.start(); initializeDistanceSensors(); - int counter = 0; //counts how many times the robot has turned, before driving + int counter = 0; //counts how many times the robot has turned, before driving while( 1 ){ - sam.search(&counter); + if ( t.read() > TIMEOUT ){ + NVIC_SystemReset(); //Resets Sam. + } + + sam.search(&counter, &t); wait( 0.1f ); } return 0;