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.
Diff: main.cpp
- Revision:
- 48:553716e13d45
- Parent:
- 47:e992a129ef44
- Child:
- 49:880c0b9c9c64
--- a/main.cpp Mon Jun 18 22:46:49 2018 +0000 +++ b/main.cpp Tue Jun 19 10:22:37 2018 +0000 @@ -630,14 +630,13 @@ DR_train.set_position(sensor); if(DR_train.goes_cw()){ - - if(sensor == D9 || sensor == D3){ - + if(DR_train.get_position_number() == D5 || DR_train.get_position_number() == D11){ + DR_train.set_goes_cw(false); //If train goes cw and passes D5 or D11 we change orientation } }else{ - if(sensor == D5 || sensor == D11){ + if(DR_train.get_position_number() == D9 || DR_train.get_position_number() == D3){ DR_train.set_goes_cw(true); //If train goes ccw and passes D9 or D3 we change orientation } @@ -656,14 +655,14 @@ LR_train.set_position(sensor); if(LR_train.goes_cw()){ - - if(sensor == D9 || sensor == D3){ + if(LR_train.get_position_number() == D5 || LR_train.get_position_number() == D11){ + LR_train.set_goes_cw(false); //If train goes cw and passes D5 or D11 we change orientation } }else{ - if(sensor == D5 || sensor == D11){ + if(LR_train.get_position_number() == D9 || LR_train.get_position_number() == D3){ LR_train.set_goes_cw(true); //If train goes ccw and passes D9 or D3 we change orientation }