![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
GPS and IMU reading works
Dependencies: mbed Servo SDFileSystem
Diff: main.cpp
- Revision:
- 15:dbf20c1209ae
- Parent:
- 14:92bacb5af01b
- Child:
- 16:0ea992d9a390
diff -r 92bacb5af01b -r dbf20c1209ae main.cpp --- a/main.cpp Wed Aug 26 16:33:26 2015 +0000 +++ b/main.cpp Wed Aug 26 22:41:36 2015 +0000 @@ -46,6 +46,9 @@ string item; vector<string> tokens; while (getline(ss, item, delim)) { + if (item.empty()) { + item == "N/A"; + } tokens.push_back(item); } return tokens; @@ -58,7 +61,7 @@ vector<string> result = split(IMU_data_string, ','); IMU_Y = result.at(0); IMU_P = result.at(1); - IMU_R = result.at(2).substr(0, result.at(2).size()-1);; + IMU_R = result.at(2).substr(0, result.at(2).size()-1); } } @@ -96,6 +99,17 @@ } +//@GET=GPS_Quality +void decodePC(string PC_data) { + string PC_data_string(PC_data); + if (PC_data_string.substr(0,4) == "@GET") { + pc.printf("%s", PC_data_string.c_str()); + PC_data_string = PC_data_string.substr(5, PC_data_string.size()-6); + pc.printf("%s\n", decodeCommand(PC_data_string).c_str()); + } +} + + void printStateIMU() { pc.printf("IMU_Y: %s, IMU_P: %s, IMU_R: %s\n",IMU_Y.c_str(), IMU_P.c_str(), IMU_R.c_str()); } @@ -186,8 +200,8 @@ while (1) { led1 = !led1; - wait(0.2); - printStateIMU(); - printStateGPS(); + wait(0.4); + //printStateIMU(); + //printStateGPS(); } } \ No newline at end of file