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:
- 33:d39c30e9264b
- Parent:
- 32:c957a1948ac1
- Child:
- 40:b2e9bc654ca1
--- a/sensor_ctl.cpp Thu Dec 11 17:15:04 2014 +0000 +++ b/sensor_ctl.cpp Fri Dec 12 16:46:43 2014 +0000 @@ -29,7 +29,7 @@ Presence kiosk(PTB10, true, KIOSK_SENSOR_DEBOUNCE_MS); //(Interrupt pinrequired, no timeout) #endif //NODE KIOSK STATION #if NODE_DOOR_TRIP_STATION -SHARPIR sharpir(PTC11); //(AnalogIn required), for IR door trip +SHARPIR sharpir(PTB10); //(AnalogIn required), for IR door trip #endif //NODE TRIP STATION #if NODE_HEIGHT_STATION Timer sonarTimer; @@ -59,7 +59,7 @@ //Door Height... float door_height_max_value = 0; bool door_height_measuring = 0; -bool door_height_sample_count = 0; +int door_height_sample_count = 0; //Initialisation @@ -129,10 +129,11 @@ #if NODE_DOOR_TRIP_STATION void handle_door_trip_report_timer(){ float value= sharpir.volt(); + printf ("\n\r door:%f", value); bool new_door_trip = 0; - if (value>door_trip_starting_volts+0.15) { + if (value>door_trip_starting_volts+0.2) { new_door_trip=true; - } else if (value<door_trip_starting_volts+0.15) { + } else if (value<door_trip_starting_volts+0.2) { new_door_trip=false; } @@ -146,6 +147,7 @@ #if NODE_HEIGHT_STATION void handle_door_height_sample_timer(){ int height_sample = DOOR_HEIGHT_SENSOR_MOUNT_HEIGHT_CM-sonar.read(); + printf("\n\r %d", height_sample); if(height_sample > DOOR_HEIGHT_START_MEASURING_THRESHOLD_CM) { door_height_sample_count=0; if (height_sample > door_height_max_value) {