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
main.cpp
- Committer:
- hazheng
- Date:
- 2017-02-03
- Revision:
- 6:0682e1c90119
- Parent:
- 4:25e028102625
- Parent:
- 5:577b582e4fe9
- Child:
- 8:92f6baeea027
File content as of revision 6:0682e1c90119:
#include "mbed.h" //#include "Motor.h" //#include "Camera.h" #include "USBHIDServer.h" PwmOut servo(PTE20); //DigitalOut DIR_L(PTA13, 1); //DigitalOut DIR_R(PTC9, 1); //PwmOut PWM_L(PTD0); //PwmOut PWM_R(PTD5); DigitalOut led(LED1, 1); int main(void) { servo.period(0.020); //Camera cam; //Motor motor; //PWM_L.period_us(60); //PWM_R.period_us(60); USBHIDServer server; unsigned int testCount = 0; unsigned int testCount2 = 0; char buf[5]; //motor.setLeftSpeed(20); //motor.setRightSpeed(20); //PWM_L.pulsewidth_us(60); //PWM_R.pulsewidth_us(60); //servo.pulsewidth(0.0015); while (1) { led = 0; server.Update(0.0f); testCount++; if(testCount >= 10000) { testCount2++; sprintf(buf, "%d", testCount2); //server.PushUnreliableMsg('D', "Test Message!"); server.PushUnreliableMsg('D', buf); testCount = 0; } wait(0.1); } } /* PwmOut servo(PTE20); int main() { servo.period(0.020); // servo requires a 20ms period while (1) { for(float offset=0.0; offset<0.001; offset+=0.0001) { servo.pulsewidth(0.001 + offset); // servo position determined by a pulsewidth between 1-2ms wait(0.25); } } } */