Freedom Example for the Seeed Grove Collision Sensor

Dependencies:   mbed

Fork of frdm_Grove_Collision_Example by Freescale

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 
00002 #include "mbed.h"
00003 
00004 DigitalIn sig1(D2);
00005 
00006 int main()
00007 {
00008     while(1) {
00009         if(sig1 == 0) {
00010             printf("Collision detected!\n\r");
00011             wait(1);    // 1 second delay
00012         }
00013     }
00014 }