This program reads the distance from an ultrasonic sensor, and interpolates the distance to red and green values. The red and green values are then output to an externally connected RGB LED on the FRDM-K64F board.
The pinout for the FRDM-K64F board can be found here.
- Connect the VCC pin to the 5V pin on the FRDM-K64F board.
- Connect the GND pin to a GND pin on the FRDM-K64F board.
- Connect the TRIG pin to the D8/PTC12 pin on the FRDM-K64F board.
- Connect the ECHO pin to the D9/PTC4 pin on the FRDM-K64F board.
- Connect the R pin to the D5/PTA2 (PWM) pin on the FRDM-K64F board.
- Connect the G pin to the D6/PTC2 (PWM) pin on the FRDM-K64F board.
- B pin is not used.
- Connect the GND pin to a GND pin on the FRDM-K64F board.