Vincent Hervieux / Mbed OS Nucleo_radar

Dependencies:   HC_SR04_Ultrasonic_Library PinDetect

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers button.cpp Source File

button.cpp

00001 #include "radar.h"
00002 // Callback routine is interrupt activated by a debounced pb hit
00003 // must import Cookbook PinDetct library into project
00004 // URL: http://mbed.org/users/AjK/libraries/PinDetect/lkyxpw
00005 #include "PinDetect.h"
00006 
00007 void pb_hit_callback (void) {
00008     position++;
00009     position = position % RANGE_MAX;
00010     led3 = (position >= RANGE_CLOSE);
00011     led2 = (position >= RANGE_MID);
00012     led1 = (position >= RANGE_FAR);
00013 }