![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Lab9
Dependencies: mbed HeptaBattery SDFileSystem HeptaCamera_GPS Hepta9axis HeptaTemp HeptaXbee
Diff: main.cpp
- Revision:
- 17:f12839296eb5
- Parent:
- 13:a1fa75a002f6
- Child:
- 18:0f270fef8476
--- a/main.cpp Fri Nov 17 02:10:06 2017 +0000 +++ b/main.cpp Fri Nov 17 03:34:52 2017 +0000 @@ -1,25 +1,30 @@ #include "mbed.h" #include "SDFileSystem.h" -#include "HeptaXbee.h" #include "HeptaCamera_GPS.h" -#include "Hepta9axis.h" -#include "HeptaTemp.h" -#include "HeptaBattery.h" Serial pc(USBTX,USBRX); SDFileSystem sd(p5, p6, p7, p8, "sd"); -HeptaXbee xbee(p9,p10); -HeptaCamera_GPS cam_gps(p13, p14,p25,p24); -Hepta9axis n_axis(p28,p27,0xD0,0x18); -HeptaTemp temp(p17); -HeptaBattery battery(p16,p26); - -DigitalOut myled(LED1); +HeptaCamera_GPS cam_gps(p13, p14,p25,p24);//(tx,rx,camera switch,gps switch) int main() { - myled = 1; - wait(0.5); - myled = 0; - wait(0.5); + pc.printf("Camera Snapshot Mode\r\n"); + pc.printf("Hit Any Key To Take Picture\r\n"); + while(!pc.readable()) {} + cam_gps.Sync(); + cam_gps.initialize(HeptaCamera_GPS::Baud115200, HeptaCamera_GPS::JpegResolution320x240); + cam_gps.test_jpeg_snapshot_data(1); + FILE *fp = fopen("/sd/test0.txt", "r"); + if(fp == NULL) { + pc.printf("Could not open file for write\r\n"); + } else { + char str[1024]; + while((fgets(str,256,fp))!=NULL) { + pc.printf("%s",str); + //xbee.printf("%s",str); + wait(0.001); + } + pc.printf("Data transmitting finished\r\n"); + fclose(fp); + } } \ No newline at end of file