Freedom Example for the Seeed Grove Collision Sensor
Dependencies: mbed
Fork of frdm_Grove_Collision_Example by
Simply Import this Program
into your mbed compiler
Select Compile
to generate the binary file
Open an Hyperterminal window and connect to the mbed Serial Port (COMxx)
peripheral using speed 9600bps
Plug the Grove Shield v2 on the top of your FRDM-K64F
Connect on end of the 4-pin Grove cable to the Collision module and the other end to the port D2 of the Grove Adapter
.
Drag n drop the frdm_Grove_Collision_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
Your hyperterminal window should now display Collision detected when you choc the module (see picture below)!!
Revision 0:b1fc8bedca76, committed 2015-12-31
- Comitter:
- GregC
- Date:
- Thu Dec 31 23:04:59 2015 +0000
- Commit message:
- Freedom Seeed Grove Collision Example
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r b1fc8bedca76 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Dec 31 23:04:59 2015 +0000 @@ -0,0 +1,14 @@ + +#include "mbed.h" + +DigitalIn sig1(D2); + +int main() +{ + while(1) { + if(sig1 == 0) { + printf("Collision detected!\n\r"); + wait(1); // 1 second delay + } + } +}
diff -r 000000000000 -r b1fc8bedca76 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Dec 31 23:04:59 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013 \ No newline at end of file