SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.

Dependencies:   TSI USBDevice mbed-dev

Fork of SmartWheels by haofan Zheng

Revision:
37:7074a6118d03
Parent:
36:7e747e19f660
Child:
40:be98219930e4
--- a/Hardwares/ArduCAM.cpp	Tue Mar 14 22:23:15 2017 +0000
+++ b/Hardwares/ArduCAM.cpp	Tue Mar 14 23:36:13 2017 +0000
@@ -69,7 +69,7 @@
 
     camReg->WriteRegSet(ResetProg);
     wait_ms(5);
-    camReg->WriteRegSet(OV2640Prog::QVGA);
+    camReg->WriteRegSet(QVGA);
     wait_ms(100);
     
 #if defined(ARDUCAM_OV2640)
@@ -192,13 +192,44 @@
     
     //Begin output the picture
     std::string lineBuf;
+#if defined(MANUAL_REDUCE_RESULOTION_BY2)
+    lineBuf.resize((RESOLUTION_WIDTH / 2) + 1);
+#else
     lineBuf.resize(RESOLUTION_WIDTH + 1);
+#endif
     
     //ardu_cam_spi_set_burst();
     ardu_cam_get_pixel(); //Get the first dummy pixel
     
     for (uint8_t i = 0; i < RESOLUTION_HEIGHT; ++i)
     {
+#if defined(MANUAL_REDUCE_RESULOTION_BY2)
+        lineBuf[0] = i / 2;
+        
+        for (int j = 0; j < RESOLUTION_WIDTH; ++j)
+        {
+            if(i % 2 == 0 || j % 2 == 0)
+            {
+                ardu_cam_get_pixel();
+            }
+            else
+            {
+                lineBuf[(j / 2) + 1] = ardu_cam_get_pixel();
+            }
+        }
+        
+        if(i % 2 == 0)
+        {
+            
+        }
+        else
+        {
+            g_core.GetUSBServer().PushReliableMsg('P', lineBuf);
+            wait(0.35);
+        }
+        
+#else
+
         lineBuf[0] = i;
         
         for (int j = 0; j < RESOLUTION_WIDTH; ++j)
@@ -209,6 +240,9 @@
         
         g_core.GetUSBServer().PushReliableMsg('P', lineBuf);
         wait(0.35);
+        
+#endif
+        
     }
     
 }
\ No newline at end of file