From 5e433458c7e2bcc6742bf39474d4f9d217be640e Mon Sep 17 00:00:00 2001 From: hg Date: Mon, 18 May 2015 20:20:59 +0200 Subject: [PATCH] Wifi switch, but not working ;-( --- .settings/org.eclipse.cdt.core.prefs | 4 ++-- WiModbusGateway.cpp | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs index 9af1062..3f7166c 100644 --- a/.settings/org.eclipse.cdt.core.prefs +++ b/.settings/org.eclipse.cdt.core.prefs @@ -151,10 +151,10 @@ environment/project/it.baeyens.arduino.core.toolChain.release.1600398586/A.EXTRA environment/project/it.baeyens.arduino.core.toolChain.release.1600398586/A.EXTRA.TIME.DTS/value=3600 environment/project/it.baeyens.arduino.core.toolChain.release.1600398586/A.EXTRA.TIME.LOCAL/delimiter=\: environment/project/it.baeyens.arduino.core.toolChain.release.1600398586/A.EXTRA.TIME.LOCAL/operation=replace -environment/project/it.baeyens.arduino.core.toolChain.release.1600398586/A.EXTRA.TIME.LOCAL/value=1431952539 +environment/project/it.baeyens.arduino.core.toolChain.release.1600398586/A.EXTRA.TIME.LOCAL/value=1431979958 environment/project/it.baeyens.arduino.core.toolChain.release.1600398586/A.EXTRA.TIME.UTC/delimiter=\: environment/project/it.baeyens.arduino.core.toolChain.release.1600398586/A.EXTRA.TIME.UTC/operation=replace -environment/project/it.baeyens.arduino.core.toolChain.release.1600398586/A.EXTRA.TIME.UTC/value=1431945339 +environment/project/it.baeyens.arduino.core.toolChain.release.1600398586/A.EXTRA.TIME.UTC/value=1431972758 environment/project/it.baeyens.arduino.core.toolChain.release.1600398586/A.EXTRA.TIME.ZONE/delimiter=\: environment/project/it.baeyens.arduino.core.toolChain.release.1600398586/A.EXTRA.TIME.ZONE/operation=replace environment/project/it.baeyens.arduino.core.toolChain.release.1600398586/A.EXTRA.TIME.ZONE/value=3600 diff --git a/WiModbusGateway.cpp b/WiModbusGateway.cpp index 9a0a832..f0dfc65 100644 --- a/WiModbusGateway.cpp +++ b/WiModbusGateway.cpp @@ -14,7 +14,7 @@ #include - +const uint8_t WIFI_ENABLE_PIN = 4; LiquidCrystal lcd = LiquidCrystal(A0, A1, A2, A3, A4, A5); @@ -68,6 +68,11 @@ void printWifiStatus() { } void setup() { + pinMode(WIFI_ENABLE_PIN, INPUT_PULLUP); + delay(100); + wifiEnabled = true; // (digitalRead(WIFI_ENABLE_PIN) != 0); + + Serial.begin(57600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only @@ -169,6 +174,8 @@ void updateDisplay() { uint8_t wifiStatus = WiFi.status(); lcd.print(wifiStatus); lcd.print(disconnectState); + } else { + lcd.print("no wifi"); } lcd.setCursor(0, 1);