Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of dgps by
Diff: main.cpp
- Revision:
- 7:c75d5e5e6bfc
- Parent:
- 6:434d20e99e49
- Child:
- 8:28b866df62cf
--- a/main.cpp Fri Feb 21 15:15:25 2014 +0000 +++ b/main.cpp Tue Apr 01 15:52:08 2014 +0000 @@ -1,8 +1,8 @@ #include "mbed.h" #include <string> #include <sstream> -#include "usb.h" -#include "camera.h" +#include "adapt/usb.h" +#include "adapt/camera.h" /* Serial pc(USBTX,USBRX); Serial xbee(p9,p10);//tx, rx @@ -150,34 +150,30 @@ reading = true; } } + + */ +Serial gps(p28,p27); + int main(){ - //USB::getSerial().printf("------Starting Program------\n"); - Camera cam; - char* version = cam.getVersion(); - //USB::getSerial().printf("Camera Version:\n%s\n",version); - uint8_t targetSize=VC0706_640x480;//VC0706_160x120; - cam.setImageSize(targetSize); - uint8_t realSize=cam.getImageSize(); - //USB::getSerial().printf("Image Size | Target: %d, Real %d",targetSize,realSize); - if (! cam.takePicture()) { - USB::getSerial().printf("Failed to snap!\n"); - while(1){} - } else { - //USB::getSerial().printf("Picture taken!\n"); + ImageHandle imageHand; + GPSHand gpsHand; + + /// Main Loop + while(1){ + // Run image handler + imageHand.run(); + // Run GPS handler + gpsHand.run(); } - int size=cam.frameLength(); - //USB::getSerial().printf("Image Size %d\n",size); - int i; - for(i=0;i<size;){ - // read 32 bytes at a time; - uint8_t bytesToRead = min(64, size-i); // change 32 to 64 for a speedup but may not work with all setups! - uint8_t bytesRead=0; - uint8_t* buffer = cam.readPicture(bytesToRead,&bytesRead); - for(int a=0;a<bytesRead;a++){USB::getSerial().putc(buffer[a]);} - //USB::getSerial().write(buffer,bytesToRead); - //USB::getSerial().printf("Read: %d/%d - %d/%d\n",i,size,bytesRead,bytesToRead); - i+=bytesRead; + + USB::getSerial().printf("Start!\n"); + gps.baud(57600); + while(true){ + if(gps.readable()>0){ + char c = gps.getc(); + USB::getSerial().printf("%c",c); + } } //USB::getSerial().printf("Done(%d)\n",i); while(1){