Satellite_Code
Dependencies: HEPTA_SENSOR mbed HEPTA_EPS HEPTA_COM
Satellite_f_main.cpp@0:eef572dc288c, 2022-08-27 (annotated)
- Committer:
- anfegusa
- Date:
- Sat Aug 27 01:09:25 2022 +0000
- Revision:
- 0:eef572dc288c
Satellite_Code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
anfegusa | 0:eef572dc288c | 1 | #include "mbed.h" |
anfegusa | 0:eef572dc288c | 2 | #include "HEPTA_COM.h" |
anfegusa | 0:eef572dc288c | 3 | #include "HEPTA_EPS.h" |
anfegusa | 0:eef572dc288c | 4 | #include "HEPTA_SENSOR.h" |
anfegusa | 0:eef572dc288c | 5 | |
anfegusa | 0:eef572dc288c | 6 | Serial pc(USBTX,USBRX); |
anfegusa | 0:eef572dc288c | 7 | HEPTA_COM com(p9,p10); |
anfegusa | 0:eef572dc288c | 8 | HEPTA_EPS eps(p16,p26); |
anfegusa | 0:eef572dc288c | 9 | HEPTA_SENSOR sensor(p17, |
anfegusa | 0:eef572dc288c | 10 | p28,p27,0x19,0x69,0x13, |
anfegusa | 0:eef572dc288c | 11 | p13, p14,p25,p24); |
anfegusa | 0:eef572dc288c | 12 | Serial device(p9,p10); |
anfegusa | 0:eef572dc288c | 13 | Serial gpsa(p28,p27); |
anfegusa | 0:eef572dc288c | 14 | |
anfegusa | 0:eef572dc288c | 15 | char dato; |
anfegusa | 0:eef572dc288c | 16 | int main() { |
anfegusa | 0:eef572dc288c | 17 | pc.baud(9600); |
anfegusa | 0:eef572dc288c | 18 | com.baud(9600); |
anfegusa | 0:eef572dc288c | 19 | sensor.gps_setting(); |
anfegusa | 0:eef572dc288c | 20 | char buffer[200]={0}; |
anfegusa | 0:eef572dc288c | 21 | while(1) { |
anfegusa | 0:eef572dc288c | 22 | //if(pc.readable()) { |
anfegusa | 0:eef572dc288c | 23 | |
anfegusa | 0:eef572dc288c | 24 | //device.putc(pc.getc()); |
anfegusa | 0:eef572dc288c | 25 | |
anfegusa | 0:eef572dc288c | 26 | //} |
anfegusa | 0:eef572dc288c | 27 | |
anfegusa | 0:eef572dc288c | 28 | if(device.readable()) { |
anfegusa | 0:eef572dc288c | 29 | device.gets(buffer,200); |
anfegusa | 0:eef572dc288c | 30 | //pc.putc(device.getc(buffer,30)); |
anfegusa | 0:eef572dc288c | 31 | //pc.printf("I got '%s'\n", buffer); |
anfegusa | 0:eef572dc288c | 32 | |
anfegusa | 0:eef572dc288c | 33 | int quality=0,stnum=0,gps_check=0; |
anfegusa | 0:eef572dc288c | 34 | char ns='A',ew='B',aunit='m'; |
anfegusa | 0:eef572dc288c | 35 | float time=0.0,latitude=0.0,longitude=0.0,hacu=0.0,altitude=0.0; |
anfegusa | 0:eef572dc288c | 36 | wait(0.1); |
anfegusa | 0:eef572dc288c | 37 | sensor.gga_sensing(&time, &latitude, &ns, &longitude, &ew, &quality, &stnum, &hacu, &altitude, &aunit, &gps_check); |
anfegusa | 0:eef572dc288c | 38 | wait(0.1); |
anfegusa | 0:eef572dc288c | 39 | pc.printf("This is Satellite,%f,%f,%f,%f,%s %\r\n",time,latitude,longitude,altitude,buffer); |
anfegusa | 0:eef572dc288c | 40 | gpsa.printf("This is Satellite,%f,%f,%f,%f,%s %\r\n",time,latitude,longitude,altitude,buffer); |
anfegusa | 0:eef572dc288c | 41 | //com.printf("GPGGA,%f,%f,%c,%f,%c,%d,%d,%f,%f,%c %\r\n",time,latitude,ns,longitude,ew,quality,stnum,hacu,altitude,aunit); |
anfegusa | 0:eef572dc288c | 42 | } |
anfegusa | 0:eef572dc288c | 43 | |
anfegusa | 0:eef572dc288c | 44 | |
anfegusa | 0:eef572dc288c | 45 | } |
anfegusa | 0:eef572dc288c | 46 | } |