3/22-23の実験用 Send_Status(): 加速度・ジャイロをパケットで相手に送信 Get_Status():受信したパケットを表示
Dependencies: ADXL345 AigamozuControlPackets_展示会 Aigamozu_Robot_展示会 HMC5843 ITG3200 MBed_Adafruit-GPS-Library XBee agzIDLIST mbed setting
Fork of Aigamozu_Robot_展示会 by
Diff: main.cpp
- Revision:
- 41:55539183dbb0
- Parent:
- 40:656858844814
- Child:
- 42:69b4cb31aafc
diff -r 656858844814 -r 55539183dbb0 main.cpp --- a/main.cpp Sat Mar 11 15:01:48 2017 +0000 +++ b/main.cpp Mon Mar 13 17:55:45 2017 +0000 @@ -127,7 +127,7 @@ } //send normal data //Create GPS Infomation Packet - agz.SendDataCommand(MyID,SenderIDc,(uint8_t)set.agzGyr.x,(uint8_t)set.agzGyr.y, (uint8_t)set.agzGyr.z, (uint8_t)set.agzAcc.x, (uint8_t)set.agzAcc.y, (uint8_t)set.agzAcc.z, (uint8_t)flag); + agz.SendDataCommand(MyID,SenderIDc,(int16_t)set.agzGyr.x,(int16_t)set.agzGyr.y, (int16_t)set.agzGyr.z, (int16_t)set.agzAcc.x,(int16_t)set.agzAcc.y,(int16_t)set.agzAcc.z, (uint8_t)flag); /* //debug*************************************************** printf("latitude:%f,longitude:%f\nlatitudeK:%f,longitudeK:%f\nCovlat:%f,Covlongi:%f\n", @@ -140,12 +140,11 @@ //debug end*************************************************** */ //debug - //printf("%d %d %d %d %d %d\n",(int16_t)set.agzGyr.x,(int16_t)set.agzGyr.y, (int16_t)set.agzGyr.z, (int16_t)set.agzAcc.x, (int16_t)set.agzAcc.y, (int16_t)set.agzAcc.z); - for(int i = 0; i < 18; i++){ + printf("%d %d %d %d %d %d\n\r",(int16_t)set.agzGyr.x,(int16_t)set.agzGyr.y, (int16_t)set.agzGyr.z, (int16_t)set.agzAcc.x, (int16_t)set.agzAcc.y, (int16_t)set.agzAcc.z); +for(int i = 0; i < 24; i++){ printf("%d ", agz.packetData[i]); } printf("\n\r"); - //Select Destination ZBTxRequest tx64request(send_Address,agz.packetData,agz.getPacketLength()); @@ -247,7 +246,7 @@ setup_gyr(); Timer auto_Timer; - const int auto_Time = 1000; //refresh time in ms + const int auto_Time = 500; //refresh time in ms wait_ms(2000); @@ -264,9 +263,6 @@ update_accel(); update_gyro(); - Send_Status(); - //printf("gx:%d,gy:%d,gz:%d,ax:%d,ay:%d,az:%d\n\r",(int16_t)set.agzGyr.x,(int16_t)set.agzGyr.y, (int16_t)set.agzGyr.z, (int16_t)set.agzAcc.x, (int16_t)set.agzAcc.y, (int16_t)set.agzAcc.z); - wait_ms(1000); if (xbee.getResponse().isAvailable()) { xbee.getResponse().getZBRxResponse(zbRx); @@ -302,9 +298,9 @@ }//endifZB_RX_RESPONSE }//endifisAvailable - if(agz.nowMode == AUTO_GPS_MODE && auto_Timer.read_ms() >= auto_Time){ + if(auto_Timer.read_ms() >= auto_Time){ auto_Timer.reset(); - agz.gpsAuto(); + Send_Status(); } }