From f8c6156057ac82ad30ea3ae4677fca245bcbd6a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=B8rch?= Date: Mon, 19 Sep 2016 21:14:15 +0200 Subject: [PATCH] Updated sketch with analog check (#580) --- .../SensebenderGatewaySerial.ino | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/examples/SensebenderGatewaySerial/SensebenderGatewaySerial.ino b/examples/SensebenderGatewaySerial/SensebenderGatewaySerial.ino index e0d6510..5e9c89c 100644 --- a/examples/SensebenderGatewaySerial/SensebenderGatewaySerial.ino +++ b/examples/SensebenderGatewaySerial/SensebenderGatewaySerial.ino @@ -22,6 +22,8 @@ * The ArduinoGateway prints data received from sensors on the serial link. * The gateway accepts input on seral which will be sent out on radio network. * +the last one is meant for the end user to break up into the various connectors used on the board. + * This GW code is designed for Sensebender GateWay / Arduino Zero * * Wire connections (OPTIONAL): @@ -36,7 +38,7 @@ * */ -#define SKETCH_VERSION "0.1" +#define SKETCH_VERSION "0.2" // Enable debug prints to serial monitor #define MY_DEBUG @@ -124,6 +126,7 @@ void preHwInit() { delay(500); } // Wait for USB to be connected, before spewing out data. } + digitalWrite(LED_BLUE, LOW); if (Serial) { Serial.println("Sensebender GateWay test routine"); Serial.print("Mysensors core version : "); @@ -146,7 +149,11 @@ void preHwInit() { digitalWrite(LED_ORANGE, HIGH); tests++; } - if (tests == 3) { + if (testAnalog()) { + digitalWrite(LED_BLUE, HIGH); + tests++; + } + if (tests == 4) { while(1) { for (int i=0; i analog : "); + Serial.print(bat_detect); + if (bat_detect < 400 || bat_detect > 650) { + Serial.println(" Failed"); + return false; + } + Serial.println(" Passed"); + return true; +} + +