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:
- 31:7637861f4dc7
- Parent:
- 30:293ee760d357
- Child:
- 32:e5b732fb8e65
--- a/main.cpp Tue Jun 12 10:47:59 2018 +0000 +++ b/main.cpp Tue Jun 12 12:12:00 2018 +0000 @@ -98,8 +98,13 @@ const unsigned int SWBflip_3 = 0x84; //Flip SW3 const unsigned int SWBflip_4 = 0x88; //Flip SW4 -//Array that will keep track of the position of th trains. (-1 = not in track/any other number = sensor where the train is at) +//Arrays that will keep track of the position and direction of th trains. +//[pos_trains] -1 = not in track / any other number = sensor where the train is at (sensors 1-16) +//[dir_trains] -1 = left / 1 = right int pos_trains [2] = {-1,-1}; +int dir_trains [2] = {-1,-1}; + + @@ -182,7 +187,7 @@ * **/ -void printZeros(unsigned int number){ +void train_pos_update(unsigned int number){ /* bitset <sizeof(unsigned int) * 8> n (number);