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

main.cpp

Committer:
Bobymicjohn
Date:
2017-02-02
Revision:
4:25e028102625
Parent:
3:c8867972ffc7
Child:
6:0682e1c90119

File content as of revision 4:25e028102625:

#include "mbed.h"

//#include "Motor.h"
 
 
PwmOut servo(PTE20);

//DigitalOut DIR_L(PTA13, 1);
//DigitalOut DIR_R(PTC9, 1);

//PwmOut PWM_L(PTD0);
//PwmOut PWM_R(PTD5);

int main(void) {
    servo.period(0.020);
    //Motor motor;
 
    //PWM_L.period_us(60);
    //PWM_R.period_us(60);
    
    while (1) {
        //motor.setLeftSpeed(20);
        //motor.setRightSpeed(20);
        //PWM_L.pulsewidth_us(60);
        //PWM_R.pulsewidth_us(60);
        //servo.pulsewidth(0.0015);
        
        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);
        }
        
        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);
        }
    }
    
}
*/