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:
- Bobymicjohn
- Date:
- 2017-02-03
- Revision:
- 8:92f6baeea027
- Parent:
- 6:0682e1c90119
- Child:
- 10:fedb5786a109
File content as of revision 8:92f6baeea027:
#include "mbed.h" #include "Motor.h" #include "USBHIDServer.h" PwmOut servo(PTE20); DigitalOut led(LED1, 1); int main(void) { servo.period(0.020); //Camera cam; Motor motor; motor.setLeftSpeed(0.9f); motor.setRightSpeed(0.9f); wait(2); motor.setLeftSpeed(-0.9f); motor.setRightSpeed(-0.9f); wait(3); motor.setLeftSpeed(-0.0f); motor.setRightSpeed(-0.0f); USBHIDServer server; unsigned int testCount = 0; unsigned int testCount2 = 0; char buf[5]; while (1) { led = 0; server.Update(0.0f); motor.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.01); } } /* 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); } } } */