cansat

Dependencies:   BMP085 JPEGCamera SDFileSystem mbed

Fork of SaibiCansat2014 by Takashi SASAKI

Revision:
8:3230ddd3a3d1
Parent:
7:cc8080b31ac5
Child:
9:3a2d25f4700b
--- a/FastJpegCamera.h	Thu Jul 17 23:17:45 2014 +0000
+++ b/FastJpegCamera.h	Thu Jul 17 23:30:16 2014 +0000
@@ -12,7 +12,7 @@
         Serial pc;
 
         FastJpegCamera(PinName tx, PinName rx) : JPEGCamera(tx,rx), baudrate(38400), pc(USBTX, USBRX), myled1(LED1){
-            this->baud38400();
+            this->baud115200();
         };
         
         void baud115200(){
@@ -20,6 +20,7 @@
             //char buf[5] = {0x56, 0x00, 0x34, 0x0d, 0xa6};
             //int ret = sendReceive(buf, sizeof buf, 5);
             for (int i = 0; i < sizeof buf; i++) putc(buf[i]);
+            wait(0.5);
             this->baudrate = 115200;
             this->baud(this->baudrate);
             wait(4);
@@ -40,11 +41,15 @@
 
         void baud38400(){
             char buf[7] = {0x56, 0x00, 0x24, 0x03, 0x01, 0x2a, 0xf2};
-            int ret = sendReceive(buf, sizeof buf, 5);
+            //int ret = sendReceive(buf, sizeof buf, 5);
+            for (int i = 0; i < sizeof buf; i++) putc(buf[i]);
             wait(0.5);
             //this->reset();
             this->baudrate = 38400;
             this->baud(this->baudrate);
+            wait(4);
+            //this->reset();
+            receive(buf, 5, 500);
             pc.printf("%02x %02x %02x %02x %02x", buf[0], buf[1], buf[2], buf[3], buf[4]);
         };