Tony YI
/
ESDC2014
123123123123123123123123123
Diff: communication.cpp
- Revision:
- 1:cbec1283a16a
- Parent:
- 0:3417ca0a36c0
- Child:
- 2:442902ec3aa1
--- a/communication.cpp Tue Jul 01 10:59:33 2014 +0000 +++ b/communication.cpp Thu Jul 03 03:56:29 2014 +0000 @@ -28,12 +28,11 @@ #include <communication.h> Communication::Communication(MySerial* _DEBUG, MySerial *_IntelToMbed, MySerial *_MbedToArduino) -:compass(SDA, SCL) { this->_DEBUG = _DEBUG; this->_IntelToMbed = _IntelToMbed; this->_MbedToArduino = _MbedToArduino; - + this->compass=new COMPASS(COMPASS_TX,COMPASS_RX); init(); } @@ -439,13 +438,8 @@ } else if(action_type == 3) { - HMC5883L compasss(SDA, SCL); - campass_degree = 0; - unsigned short data1 = compasss.get_degree(); - wait(0.5); - unsigned short data2 = compasss.get_degree(); - - campass_degree = (data1 + data2) / 2; + + campass_degree = compass->Read(); uint8_t temp1,temp2; temp1 = campass_degree;