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.
Fork of ESDC2014 by
Diff: communication.cpp
- Revision:
- 2:442902ec3aa1
- Parent:
- 1:cbec1283a16a
- Child:
- 3:4306d042af6f
diff -r cbec1283a16a -r 442902ec3aa1 communication.cpp --- a/communication.cpp Thu Jul 03 03:56:29 2014 +0000 +++ b/communication.cpp Thu Jul 03 10:59:37 2014 +0000 @@ -171,7 +171,7 @@ } check_sum += _x; action_type = _x; - if(action_type == 0 || action_type == 1 || action_type == 2 || action_type == 3) + if(action_type == 0 || action_type == 1 || action_type == 2 || action_type == 3 || action_type == 4) { state_IntelToMbed++; } @@ -218,7 +218,7 @@ } check_sum += _x; move_dir = _x; - if((action_type == 0 && (move_dir == 0 || move_dir == 1 || move_dir == 2 || move_dir == 3)) || (action_type == 1 && (move_dir == 0 || move_dir == 2)) || action_type == 2 || action_type == 3) + if((action_type == 0 && (move_dir == 0 || move_dir == 1 || move_dir == 2 || move_dir == 3)) || (action_type == 1 && (move_dir == 0 || move_dir == 2)) || action_type == 2 || action_type == 3 || action_type == 4) { state_IntelToMbed++; } @@ -265,7 +265,7 @@ } check_sum += _x; rotate_dir = _x; - if(action_type == 3 || (action_type == 1 && ((rotate_dir >> 6) == 0)) || ((action_type == 0 || action_type == 2) && ((rotate_dir >> 6) == 3))) + if(action_type == 3 || action_type == 4 || (action_type == 1 && ((rotate_dir >> 6) == 0)) || ((action_type == 0 || action_type == 2) && ((rotate_dir >> 6) == 3))) { state_IntelToMbed++; } @@ -305,6 +305,10 @@ case 3: //compass info_ok_IntelToMbed = 4; break; + + case 4: //buzzer + info_ok_IntelToMbed = 5; + break; default: info_ok_IntelToMbed = 0; //not ok @@ -439,7 +443,7 @@ else if(action_type == 3) { - campass_degree = compass->Read(); + campass_degree = compass->read(); uint8_t temp1,temp2; temp1 = campass_degree; @@ -451,6 +455,16 @@ return; } + else if(action_type == 4) + { + + putByte(BUZZER_STARTER ,1); //1 means IntelToMbed + putByte(0,1); //O + putByte(0,1); //K + putByte(0,1); //check_sum = 0xaf + 0x4b = 0x9a + + return; + } putByte(STARTER ,1); //1 means IntelToMbed putByte(0x4f ,1); //O