Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
You are viewing an older revision! See the latest version
Homepage
Overview¶
This program is an example program that uses the FRDM-TFC library to actually permit a car using the FDRM-TFC shield + FRDM-KL25Z to race around a center line track.
Car Hookup¶
Motors
- Code written assuming left motor hooked to B1(red)/B2(black) and right motor hooked to A1(red)/A2(black).
Battery
- Be sure to hook positive (red) to 'Vbat' and negative (black) to 'Gnd'
Steering Servo
- Servo must be hooked up with black wire innermost (away from LEDs).
- Also be sure to mount servo on chassis with wire coming out the right side of the car.
Camera
- Camera must be hooked up with black wire towards LEDs on the shield board.
- Be sure to mount camera on tower with connector down towards the bottom.
Potentiometers (Pots)
- Pots by default should have arrows pointing toward battery/motor hookup (for demo mods default).
Car Hardware Controls¶
DIP SWITCH CONTROLS:
- Switch 1: Controls whether running main racing program (ON) or Demo program (OFF). Function of other 3 switches depend on this first switch.
RACING MODE (Switch 1 = ON)
- Switch 2: Logging frame camera data to RAM while racing. Enable (ON) or Disable (OFF).
- Switch 3: Risky / faster racing (ON); Conservative / slower race option (OFF). NOTE: Faster mode may cause car to fall off track. Needs tweaking...
- Switch 4: Enable Start Gate Stop (ON) or Disable (OFF). NOTE: May not actually stop at start gate. Needs tweaking...
- POTs 1,2 - controls nothing at the moment
- PUSHBUTTON A - START car race!
- PUSHBUTTON B - END CAR RACE / (while holding down when 'log frame data' active will also output terminal data gathered during race)
- LEDs 1,2 light when Track is found
- LEDs 0,3 light when Start Gate is Found
DEMO MODE 0 (Switch 1 = OFF; Switch 2 = OFF, Switch 3 = OFF)
- PUSHBUTTON A - Light LED 0
- PUSHBUTTON B - Light LED 3
DEMO MODE 1 (Switch 1 = OFF; Switch 2 = ON, Switch 3 = OFF)
- POT 1 - Controls Servo: CCW = left; CW = right
DEMO MODE 2 (Switch 1 = OFF; Switch 2 = OFF, Switch 3 = ON)
- POT 1 - Controls speed of right wheel: CCW = reverse; CW = forward
- POT 2 - Controls speed of left wheel: CCW = reverse; CW = forward
- NOTE In this mode the high pitched whine heard is of the H-bridge being active. To disable whine, briefly put into demo mode 1 above.
DEMO MODE 3 (Switch 1 = OFF; Switch 2 = ON, Switch 3 = ON)
- Outputs camera data captured to terminal in CSV format, once every second.
Car Calibration¶
Camera
- Be sure to focus the camera properly. See demo video.
- Be sure to prevent light noise on camera: Avoid Light Noise
- More camera info
Servo/Steering
More Info¶
- The Freescale Cup main info page
- redxeth youtube channel with useful related videos