HeptaSat
Dependencies: HEPTA_SENSOR mbed HEPTA_EPS HEPTA_COM
main.cpp
00001 #include "mbed.h" 00002 #include"HEPTA_EPS.h" 00003 #include"HEPTA_SENSOR.h" 00004 #include"HEPTA_COM.h" 00005 00006 Serial pc(USBTX,USBRX); 00007 HEPTA_EPS eps(p16,p26); 00008 HEPTA_SENSOR sensor(p17, 00009 p28,p27,0xD0,0x18, 00010 p13, p14,p25,p24); 00011 HEPTA_COM com(p9,p10); 00012 00013 int main() 00014 { 00015 int i = 0,rcmd=0,cmdflag=0; 00016 float bt,ax,ay,az; 00017 com.printf("Count Up!\r\n"); 00018 while(1) { 00019 com.printf("num = %d\r\n",i); 00020 i++; 00021 wait(1.0); 00022 com.xbee_receive(&rcmd,&cmdflag); 00023 pc.printf("rcmd=%d, cmdflag=%d\r\n",rcmd, cmdflag); 00024 if (cmdflag == 1) { 00025 if (rcmd == 'a') { 00026 pc.printf("Command Get %d\r\n",rcmd); 00027 com.printf("HEPTA Uplink OK\r\n"); 00028 pc.printf("===================\r\n"); 00029 pc.printf("Accel sensing Mode\r\n"); 00030 pc.printf("===================\r\n"); 00031 for(int ii = 0; ii < 10; ii++) { 00032 sensor.sen_acc(&ax,&ay,&az); 00033 eps.vol(&bt); 00034 com.printf("AX = %f\r\n",ax); 00035 com.printf("AY = %f\r\n",ay); 00036 com.printf("AZ = %f\r\n",az); 00037 com.printf("V = %f\r\n",bt); 00038 wait(0.5); 00039 } 00040 } 00041 com.initialize(); 00042 } 00043 } 00044 }
Generated on Thu Aug 18 2022 13:26:28 by 1.7.2