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
Diff: main.cpp
- Revision:
- 29:f87d8790f57d
- Parent:
- 28:271fc8445e89
- Child:
- 32:5badeff825dc
diff -r 271fc8445e89 -r f87d8790f57d main.cpp --- a/main.cpp Mon Feb 27 21:43:59 2017 +0000 +++ b/main.cpp Wed Mar 01 16:31:36 2017 +0000 @@ -5,30 +5,38 @@ #include "WheelEncoder.h" #include "Core.h" #include "SWUSBServer.h" -#include "Camera.h" +//#include "Camera.h" +#include "OV7725RegBuf.h" + +#include "ArduCAM.h" #include "PinAssignment.h" +#include "GlobalVariable.h" -//DigitalOut led(LED1, 1); SPI g_spi_port(PIN_SPI_MOSI, PIN_SPI_MISO, PIN_SPI_SCK); +SW::Core g_core; int main(void) { Timer timer; - SW::Core core; + g_spi_port.frequency(1000000); + //g_spi_port.format(8, 0); + + //SW::Core core; //Motor motor(core); //Servo servo(core); //WheelEncoder wheelEncoder(core); - Camera cam(core); + //Camera cam(core); - DigitalOut led(LED3, 1); - //bool isRegRead = false; + bool isRegRead = false; //motor.setLeftSpeed(0.2); + ardu_cam_init(); + float tempCount = 0; //timer.reset(); timer.start(); @@ -41,26 +49,28 @@ deltaTime = timeWas - deltaTime; //led = 0; - core.Update(deltaTime); + g_core.Update(deltaTime); //motor.Update(deltaTime); //servo.Update(deltaTime); //wheelEncoder.Update(deltaTime); - cam.Update(deltaTime); + //cam.Update(deltaTime); tempCount += deltaTime; if(tempCount > 1.0f) { - led = !led; + //led = !led; tempCount = 0.0f; } - /* - if(!isRegRead && core.GetUSBServer().GetStatus() == SER_STAT_RUNNING) + + if(!isRegRead && g_core.GetUSBServer().GetStatus() == SER_STAT_RUNNING) { - cam.ReadRegisters(); + OV7725RegBuf * regBuf = new OV7725RegBuf(g_core); + regBuf->ReadRegisters(); + delete regBuf; isRegRead = true; } - */ + wait(0.01); } }