Code for the car to drive in a figure eight motion
Dependencies: mbed-rtos mbed MODSERIAL mbed-dsp telemetry
main.cpp@10:85f486ad4e5f, 2015-03-20 (annotated)
- Committer:
- cheryl_he
- Date:
- Fri Mar 20 01:35:44 2015 +0000
- Revision:
- 10:85f486ad4e5f
- Parent:
- 5:764c2ffb523a
- Child:
- 11:f8aa39c19477
revised pins figure eight
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ericoneill | 0:2002d645d2a6 | 1 | #include "mbed.h" |
ericoneill | 2:3eb545c3e6a1 | 2 | #include "telemetry.h" |
ericoneill | 2:3eb545c3e6a1 | 3 | #include "rtos.h" |
ericoneill | 0:2002d645d2a6 | 4 | |
ericoneill | 2:3eb545c3e6a1 | 5 | // Camera Pins |
ericoneill | 2:3eb545c3e6a1 | 6 | DigitalOut clk(PTA13); |
ericoneill | 2:3eb545c3e6a1 | 7 | DigitalOut si(PTD4); |
ericoneill | 2:3eb545c3e6a1 | 8 | AnalogIn camData(PTC2); |
ericoneill | 2:3eb545c3e6a1 | 9 | //Servo, Motor, Serial Pins |
ericoneill | 2:3eb545c3e6a1 | 10 | PwmOut servo(PTA5); |
cheryl_he | 10:85f486ad4e5f | 11 | PwmOut motor1(PTA4); |
cheryl_he | 10:85f486ad4e5f | 12 | PwmOut motor2(PTA12); |
cheryl_he | 10:85f486ad4e5f | 13 | DigitalOut break1(PTC12); |
cheryl_he | 10:85f486ad4e5f | 14 | DigitalOut break2(PTC13); |
ericoneill | 2:3eb545c3e6a1 | 15 | Serial pc(USBTX, USBRX); |
ericoneill | 2:3eb545c3e6a1 | 16 | // Interrupt for encoder |
ericoneill | 2:3eb545c3e6a1 | 17 | InterruptIn interrupt(PTA13); |
ericoneill | 0:2002d645d2a6 | 18 | |
ericoneill | 4:03594bf9a0de | 19 | void read_sensors(){ |
ericoneill | 4:03594bf9a0de | 20 | |
ericoneill | 4:03594bf9a0de | 21 | } |
ericoneill | 4:03594bf9a0de | 22 | |
ericoneill | 4:03594bf9a0de | 23 | void actuate(){ |
ericoneill | 4:03594bf9a0de | 24 | |
ericoneill | 4:03594bf9a0de | 25 | } |
ericoneill | 4:03594bf9a0de | 26 | void linecam_thread(void const *args){ |
ericoneill | 5:764c2ffb523a | 27 | |
ericoneill | 4:03594bf9a0de | 28 | } |
ericoneill | 4:03594bf9a0de | 29 | |
ericoneill | 4:03594bf9a0de | 30 | |
ericoneill | 0:2002d645d2a6 | 31 | int main() { |
ericoneill | 4:03594bf9a0de | 32 | Thread thread(linecam_thread); |
ericoneill | 0:2002d645d2a6 | 33 | while(1) { |
ericoneill | 4:03594bf9a0de | 34 | read_sensors(); |
ericoneill | 4:03594bf9a0de | 35 | actuate(); |
ericoneill | 0:2002d645d2a6 | 36 | } |
ericoneill | 0:2002d645d2a6 | 37 | } |