Freedom Seeedstudio Grove Flame Sensor Example
Dependencies: mbed
Fork of frdm_Grove_Flame_Example by
Simply Import this Program
into your mbed compiler
Select Compile
to generate the binary file
Plug the Grove Shield v2 on the top of your FRDM-K64F
Connect on end of the 4-pin Grove cable to the Buzzer module and the other end to the port D2 of the Grove Adapter
.
Drag n drop the frdm_Grove_Buzzer_Example_K64F.bin
into the mbed drive from your file explorer
Wait for download to complete
Press the Reset/SW1 button of your FRDM-K64F board
to launch the program
The RGB LED should now power on Green
Press the SW2 user push-button of the FRDM-K64F
and you should hear the buzzer ringing while RGB LED will power off.
To stop the buzzer, just release the SW2 button and press it again
Happy Buzzer'ing :D
main.cpp@0:e72d14a5d0bc, 2016-01-03 (annotated)
- Committer:
- GregC
- Date:
- Sun Jan 03 05:17:49 2016 +0000
- Revision:
- 0:e72d14a5d0bc
Freedom Seeedstudio Grove Flame Sensor Example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GregC | 0:e72d14a5d0bc | 1 | #include "mbed.h" |
GregC | 0:e72d14a5d0bc | 2 | |
GregC | 0:e72d14a5d0bc | 3 | DigitalIn FLAME_SENSOR(D2); |
GregC | 0:e72d14a5d0bc | 4 | DigitalOut led_red(LED_RED); |
GregC | 0:e72d14a5d0bc | 5 | |
GregC | 0:e72d14a5d0bc | 6 | int main(void) |
GregC | 0:e72d14a5d0bc | 7 | { |
GregC | 0:e72d14a5d0bc | 8 | led_red = 1; |
GregC | 0:e72d14a5d0bc | 9 | while(1) |
GregC | 0:e72d14a5d0bc | 10 | { |
GregC | 0:e72d14a5d0bc | 11 | if (!FLAME_SENSOR) |
GregC | 0:e72d14a5d0bc | 12 | led_red = 0; |
GregC | 0:e72d14a5d0bc | 13 | else led_red = 1; |
GregC | 0:e72d14a5d0bc | 14 | } |
GregC | 0:e72d14a5d0bc | 15 | } |