2021/11/26
Dependencies: mbed TextLCD TinyGPS TinyGPSplus
Revision 0:bfbab849e286, committed 2021-11-26
- Comitter:
- mi7110imam
- Date:
- Fri Nov 26 07:49:44 2021 +0000
- Commit message:
- 2021/11/26
Changed in this revision
diff -r 000000000000 -r bfbab849e286 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Fri Nov 26 07:49:44 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
diff -r 000000000000 -r bfbab849e286 TinyGPS.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TinyGPS.lib Fri Nov 26 07:49:44 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/dROb/code/TinyGPS/#44bee9056857
diff -r 000000000000 -r bfbab849e286 TinyGPSplus.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TinyGPSplus.lib Fri Nov 26 07:49:44 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/Sir_Binky/code/TinyGPSplus/#9163a9f5fc36
diff -r 000000000000 -r bfbab849e286 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Nov 26 07:49:44 2021 +0000 @@ -0,0 +1,50 @@ +#include "mbed.h" +#include "Serial.h" +#include "TinyGPSplus.h" +#include "TextLCD.h" + + +Serial gps(p9, p10); // tx, rx +Serial pc(USBTX, USBRX); // tx, rx +DigitalOut myled(LED1); +Serial xbee(p13,p14); +TinyGPSPlus tgps; +AnalogIn vo(p20); +AnalogIn vi(p16); +TextLCD lcd(p24,p26,p27,p28,p29,p30); + +bool read_gps(bool debug=false) { + char ch; + bool stat; + if(gps.readable()) { + ch = gps.getc(); + if(debug)pc.putc(ch); + stat = tgps.encode(ch); + } + return stat; +} + +int main() +{ + int hour, time; + xbee.baud(9600); + lcd.cls(); + while(1){ + if(read_gps() && tgps.time.second()%5 == 0){ + if(tgps.time.hour()>15){ + hour=tgps.time.hour()%15; + }else{ + hour=tgps.time.hour()+9; + } + if(time != tgps.time.second()){ + xbee.printf("%d/%d/%d, %d:%d:%d ,",tgps.date.year(),tgps.date.month(),tgps.date.day(),hour,tgps.time.minute(),tgps.time.second()); + xbee.printf("%f, %f ,",tgps.location.lat(),tgps.location.lng()); + xbee.printf("%f\r\n",vo.read()*3.3*0.3); + lcd.locate(0,0); + lcd.printf("%f",vo.read()*3.3*0.3); + time=tgps.time.second(); + } + } + } + } + \ No newline at end of file
diff -r 000000000000 -r bfbab849e286 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Nov 26 07:49:44 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file