Car 2: Electric Boogaloo
Fork of Car2 by
Code for an NXP Cup car using a linescan Camera
main.cpp
- Committer:
- zamatthews
- Date:
- 2017-02-20
- Revision:
- 2:0db7cc5ad6db
- Parent:
- 1:63c28aae78c9
- Child:
- 3:dadfc15fc2d1
File content as of revision 2:0db7cc5ad6db:
#include "mbed.h" #include "Servo.h" //Servo myServo(PTD4); // //int main(){ // while(1){ // for(float p=0; p<1.0; p += 0.1) { // myServo = p; // wait(0.2); // } // } //} PwmOut servo(PTD4); PwmOut leftMotor(PTA12); PwmOut rightMotor(PTA4); DigitalOut DIR_L(PTC4); DigitalOut DIR_R(PTC5); int main() { leftMotor.period_us(50); rightMotor.period_us(50); leftMotor.write(0.25); rightMotor.write(0.25); DIR_L = 0; DIR_R = 1; while(1){ //for(float p=0.0001f; p<=0.0015f; p += 0.00005f) { // //servo.period(0.020f); // servo.pulsewidth(p); // wait(0.05); // } // for(float p=0.0015f; p>=0.0001f; p -= 0.00005f) { // //servo.period(0.020f); // servo.pulsewidth(p); // wait(0.05); // } } }