mbed Sensor node for Instrumented Booth over ETH.
Dependencies: EthernetInterface-1 MaxbotixDriver Presence HTU21D_TEMP_HUMID_SENSOR_SAMPLE Resources SHARPIR mbed-rtos mbed-src WDT_K64F nsdl_lib
Fork of Trenton_Switch_LPC1768_ETH by
Diff: sensor_ctl.cpp
- Revision:
- 31:389416beb4c3
- Parent:
- 30:b74aa0729b07
- Child:
- 32:c957a1948ac1
--- a/sensor_ctl.cpp Fri Dec 05 16:45:56 2014 +0000 +++ b/sensor_ctl.cpp Tue Dec 09 11:41:28 2014 +0000 @@ -46,17 +46,14 @@ //And it might have a door trip.. bool current_door_trip_value = false; +//Door trip... float door_trip_starting_volts = 0; - float maxValue=0; - bool set=0; +float maxValue=0; +bool set=0; + + //Initialisation void init_sensors() { - - //Start the sonar pulse width timer... - #if NODE_HEIGHT_STATION - - #endif - #if NODE_DOOR_TRIP_STATION door_trip_starting_volts = sharpir.volt(); #endif @@ -136,19 +133,19 @@ #if NODE_HEIGHT_STATION void handle_door_height_sample_timer(){ - - current_height_value=Sonar.data_conversion_m(); - - if(current_height_value>1) { - if (current_height_value>maxValue) { - maxValue = current_height_value; + float height_sample = Sonar.data_conversion_m(); + printf("Height Sample: %2.2f \r\n", height_sample); + if(height_sample>1) { + if (height_sample>maxValue) { + maxValue = height_sample; } set=true; } - if(current_height_value<1 && set) { + if(height_sample<1 && set) { current_height_value=maxValue; maxValue=0,set=false; + printf("Height Update: %2.2f \r\n", current_height_value); height_report(); }