diff --git a/.cproject b/.cproject
index e279948..6948854 100644
--- a/.cproject
+++ b/.cproject
@@ -25,6 +25,11 @@
+
+
+
+
+
@@ -36,6 +41,11 @@
+
+
+
+
+
@@ -47,6 +57,11 @@
+
+
+
+
+
@@ -72,4 +87,5 @@
+
diff --git a/.project b/.project
index ce4ae9c..8b21cc7 100644
--- a/.project
+++ b/.project
@@ -31,6 +31,16 @@
io.sloeber.arduinonature
+
+ I2Cdev
+ 2
+ C:/Users/agr/Nextcloud3/Fileserver/inet4all/Projekte/SmartFarm/Libraries/I2Cdev
+
+
+ IAQ2000
+ 2
+ C:/Users/agr/Nextcloud3/Fileserver/inet4all/Projekte/SmartFarm/Libraries/IAQ2000
+
core/core2
@@ -39,7 +49,17 @@
core/variant2
- ECLIPSE_HOME/arduinoPlugin/packages/arduino/hardware/avr/1.8.2/variants/mega
+ ECLIPSE_HOME/arduinoPlugin/packages/arduino/hardware/avr/1.8.2/variants/eightanaloginputs
+
+
+ libraries/Adafruit_Unified_Sensor
+ 2
+ ECLIPSE_HOME/arduinoPlugin/libraries/Adafruit_Unified_Sensor/1.1.2
+
+
+ libraries/DHT_sensor_library
+ 2
+ ECLIPSE_HOME/arduinoPlugin/libraries/DHT_sensor_library/1.3.8libraries/EEPROM
@@ -61,5 +81,10 @@
2ECLIPSE_HOME/arduinoPlugin/packages/arduino/hardware/avr/1.8.2/libraries/SPI
+
+ libraries/Wire
+ 2
+ ECLIPSE_HOME/arduinoPlugin/packages/arduino/hardware/avr/1.8.2/libraries/Wire
+
diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
index 9969d91..9f6c658 100644
--- a/.settings/language.settings.xml
+++ b/.settings/language.settings.xml
@@ -4,7 +4,7 @@
-
+
diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs
index 5269f99..6ab7273 100644
--- a/.settings/org.eclipse.cdt.core.prefs
+++ b/.settings/org.eclipse.cdt.core.prefs
@@ -13,10 +13,10 @@ environment/project/io.sloeber.core.toolChain.release.613547860/A.BOOTLOADER.EXT
environment/project/io.sloeber.core.toolChain.release.613547860/A.BOOTLOADER.EXTENDED_FUSES/value=0xFD
environment/project/io.sloeber.core.toolChain.release.613547860/A.BOOTLOADER.FILE/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.BOOTLOADER.FILE/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.BOOTLOADER.FILE/value=stk500v2/stk500boot_v2_mega2560.hex
+environment/project/io.sloeber.core.toolChain.release.613547860/A.BOOTLOADER.FILE/value=atmega/ATmegaBOOT_168_atmega328.hex
environment/project/io.sloeber.core.toolChain.release.613547860/A.BOOTLOADER.HIGH_FUSES/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.BOOTLOADER.HIGH_FUSES/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.BOOTLOADER.HIGH_FUSES/value=0xD8
+environment/project/io.sloeber.core.toolChain.release.613547860/A.BOOTLOADER.HIGH_FUSES/value=0xDA
environment/project/io.sloeber.core.toolChain.release.613547860/A.BOOTLOADER.LOCK_BITS/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.BOOTLOADER.LOCK_BITS/operation=replace
environment/project/io.sloeber.core.toolChain.release.613547860/A.BOOTLOADER.LOCK_BITS/value=0x0F
@@ -34,7 +34,7 @@ environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.ARCH/ope
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.ARCH/value=AVR
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.BOARD/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.BOARD/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.BOARD/value=AVR_MEGA2560
+environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.BOARD/value=AVR_NANO
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.CORE.PATH/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.CORE.PATH/operation=replace
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.CORE.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\hardware\\avr\\1.8.2\\cores\\arduino
@@ -49,7 +49,7 @@ environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.F_CPU/op
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.F_CPU/value=16000000L
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.MCU/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.MCU/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.MCU/value=atmega2560
+environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.MCU/value=atmega328p
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.PATH/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.PATH/operation=replace
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.PATH/value=${ProjDirPath}/${ConfigName}
@@ -67,10 +67,10 @@ environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.USB_MANU
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.USB_MANUFACTURER/value=\\"Unknown\\"
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.VARIANT.PATH/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.VARIANT.PATH/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.VARIANT.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\hardware\\avr\\1.8.2\\variants\\mega
+environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.VARIANT.PATH/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\hardware\\avr\\1.8.2\\variants\\eightanaloginputs
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.VARIANT/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.VARIANT/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.VARIANT/value=mega
+environment/project/io.sloeber.core.toolChain.release.613547860/A.BUILD.VARIANT/value=eightanaloginputs
environment/project/io.sloeber.core.toolChain.release.613547860/A.COMPILER.AR.CMD/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.COMPILER.AR.CMD/operation=replace
environment/project/io.sloeber.core.toolChain.release.613547860/A.COMPILER.AR.CMD/value=avr-gcc-ar
@@ -91,7 +91,7 @@ environment/project/io.sloeber.core.toolChain.release.613547860/A.COMPILER.C.ELF
environment/project/io.sloeber.core.toolChain.release.613547860/A.COMPILER.C.ELF.EXTRA_FLAGS/value=
environment/project/io.sloeber.core.toolChain.release.613547860/A.COMPILER.C.ELF.FLAGS/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.COMPILER.C.ELF.FLAGS/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.COMPILER.C.ELF.FLAGS/value=${A.COMPILER.WARNING_FLAGS} -Os -Wl,--gc-sections,--relax
+environment/project/io.sloeber.core.toolChain.release.613547860/A.COMPILER.C.ELF.FLAGS/value=${A.COMPILER.WARNING_FLAGS} -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections
environment/project/io.sloeber.core.toolChain.release.613547860/A.COMPILER.C.EXTRA_FLAGS/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.COMPILER.C.EXTRA_FLAGS/operation=replace
environment/project/io.sloeber.core.toolChain.release.613547860/A.COMPILER.C.EXTRA_FLAGS/value=
@@ -160,28 +160,10 @@ environment/project/io.sloeber.core.toolChain.release.613547860/A.ESP8266.NETWOR
environment/project/io.sloeber.core.toolChain.release.613547860/A.ESP8266.NETWORK.UPLOAD.TOOL/value=esp8266OTA
environment/project/io.sloeber.core.toolChain.release.613547860/A.NAME/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.NAME/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.NAME/value=Arduino Mega or Mega 2560
+environment/project/io.sloeber.core.toolChain.release.613547860/A.NAME/value=Arduino Nano
environment/project/io.sloeber.core.toolChain.release.613547860/A.PACKAGES/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.PACKAGES/operation=replace
environment/project/io.sloeber.core.toolChain.release.613547860/A.PACKAGES/value=${eclipse_home}/arduinoPlugin/packages
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.0/delimiter=;
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.0/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.0/value=0x0010
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.1/delimiter=;
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.1/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.1/value=0x0042
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.2/delimiter=;
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.2/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.2/value=0x0010
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.3/delimiter=;
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.3/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.3/value=0x0042
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.4/delimiter=;
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.4/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.4/value=0x0210
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.5/delimiter=;
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.5/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.PID.5/value=0x0242
environment/project/io.sloeber.core.toolChain.release.613547860/A.PREPROC.INCLUDES.FLAGS/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.PREPROC.INCLUDES.FLAGS/operation=replace
environment/project/io.sloeber.core.toolChain.release.613547860/A.PREPROC.INCLUDES.FLAGS/value=-w -x c++ -M -MG -MP
@@ -424,16 +406,16 @@ environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.ALTID/o
environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.ALTID/value=no_altID
environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.MAXIMUM_DATA_SIZE/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.MAXIMUM_DATA_SIZE/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.MAXIMUM_DATA_SIZE/value=8192
+environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.MAXIMUM_DATA_SIZE/value=2048
environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.MAXIMUM_SIZE/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.MAXIMUM_SIZE/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.MAXIMUM_SIZE/value=253952
+environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.MAXIMUM_SIZE/value=30720
environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.PROTOCOL/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.PROTOCOL/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.PROTOCOL/value=wiring
+environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.PROTOCOL/value=arduino
environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.SPEED/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.SPEED/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.SPEED/value=115200
+environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.SPEED/value=57600
environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.TOOL/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.TOOL/operation=replace
environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.TOOL/value=avrdude
@@ -443,24 +425,6 @@ environment/project/io.sloeber.core.toolChain.release.613547860/A.UPLOAD.USBID/v
environment/project/io.sloeber.core.toolChain.release.613547860/A.VERSION/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/A.VERSION/operation=replace
environment/project/io.sloeber.core.toolChain.release.613547860/A.VERSION/value=1.8.2
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.0/delimiter=;
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.0/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.0/value=0x2341
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.1/delimiter=;
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.1/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.1/value=0x2341
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.2/delimiter=;
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.2/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.2/value=0x2A03
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.3/delimiter=;
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.3/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.3/value=0x2A03
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.4/delimiter=;
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.4/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.4/value=0x2341
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.5/delimiter=;
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.5/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/A.VID.5/value=0x2341
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.ARCHITECTURE_ID/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.ARCHITECTURE_ID/operation=replace
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.ARCHITECTURE_ID/value=avr
@@ -469,13 +433,13 @@ environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.BOARDS_FI
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.BOARDS_FILE/value=C\:\\Sloeber\\arduinoPlugin\\packages\\arduino\\hardware\\avr\\1.8.2\\boards.txt
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.BOARD_ID/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.BOARD_ID/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.BOARD_ID/value=mega
+environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.BOARD_ID/value=nano
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.BOARD_NAME/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.BOARD_NAME/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.BOARD_NAME/value=Arduino Mega or Mega 2560
+environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.BOARD_NAME/value=Arduino Nano
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.COM_PORT/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.COM_PORT/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.COM_PORT/value=COM4
+environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.COM_PORT/value=COM7
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.ECLIPSE_LOCATION/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.ECLIPSE_LOCATION/operation=replace
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.ECLIPSE_LOCATION/value=C\:\\Sloeber\\
@@ -505,7 +469,7 @@ environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.MAKE_LOCA
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.MAKE_LOCATION/value=C\:\\Sloeber\\arduinoPlugin\\tools\\make\\
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.MENU/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.MENU/operation=replace
-environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.MENU/value=cpu\=atmega2560
+environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.MENU/value=cpu\=atmega328old
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.OBJCOPY/delimiter=;
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.OBJCOPY/operation=replace
environment/project/io.sloeber.core.toolChain.release.613547860/JANTJE.OBJCOPY/value=${A.RECIPE.OBJCOPY.EEP.PATTERN}\n\t${A.RECIPE.OBJCOPY.HEX.PATTERN}
diff --git a/Web_Net_Setup.ino b/Web_Net_Setup.ino
index 83c3210..f4da9d2 100644
--- a/Web_Net_Setup.ino
+++ b/Web_Net_Setup.ino
@@ -1,337 +1,346 @@
/* Web_Net_Setup.pde - example for a webinterface to set the network configuration
-Author: Matthias Maderer
-Date: 07.03.2013
-Version: 1.0.1
-web: www.edvler-blog.de/arduino_networksetup_webinterface_with_eeprom
+ Author: Matthias Maderer
+ Date: 07.03.2013
+ Version: 1.0.1
+ web: www.edvler-blog.de/arduino_networksetup_webinterface_with_eeprom
-This is a sample Sketch for Webduino!
-More informations about Webduino can be found at https://github.com/sirleech/Webduino
+ This is a sample Sketch for Webduino!
+ More informations about Webduino can be found at https://github.com/sirleech/Webduino
-For more informations about EEPROMAnything.h look at http://playground.arduino.cc/Code/EEPROMWriteAnything
-*/
+ For more informations about EEPROMAnything.h look at http://playground.arduino.cc/Code/EEPROMWriteAnything
+ */
/*
-* With this example its possible to configure the network configuration of the
-* Arduino Ethernet Shield with a webinterface. Imagine like your router setup.
-*
-* It's possible to configure the following network settings:
-* - MAC address
-* - IP address
-* - Subnet
-* - Gateway
-* - DNS Server
-* - Webserver port
-* - USE DHCP YES/NO (if you use DHCP connect per serial port - 9600 baud - on powerup to see which ip address is assigned)
-* - DHCP renew interval
-*
-* Other functions:
-* - Display DHCP renew status
-* - Display DHCP renew timestamp
-* - Display Arduino uptime
-* - Display used RAM
-*
-* You can configure default settings. This settings are used wenn no configuration is present.
-* Look at the function set_EEPROM_Default().
-*
-* It is possible to connect a RESET button. If the button is pressed and the Arduino is turned on
-* the default values would be restored too.
-* See #define RESET_PIN.
-*
-*
-* All settings are stored in EEPROM. This means they are permanent.
-* Please look at http://arduino.cc/en/Reference/EEPROM for a short description.
-*
-*
-* To setup your arduino upload this sketch.
-*
-* If you don't change the sourcecode the default IP address is http://192.168.0.111/
-* Don't forget to change the IP of your network adapter to a suitable address (e.g. to IP 192.168.0.1, NETMASK 255.255.255.0)!
-*
-* Enter the following URL for the setup page:
-* http://192.168.0.111/setupNet.html
-*
-* Please note that no input checks are done!!
-* This means that no error would be thrown if you type a wrong IP address or other failures.
-* Keep this in mind.
-*
-* Resources:
-* There are many Strings for the HTML site. The compiled size is about 27.000 Bytes. Aprox. 2000 byte of SRAM is used.
-* On smaller Arduinos this may cause problems. I've tested it on a MEGA 2560.
-*
-* BUGS:
-* - After uploading your sketch the arduino is not reachable. --> Reset your Arduino!!
-*/
-
+ * With this example its possible to configure the network configuration of the
+ * Arduino Ethernet Shield with a webinterface. Imagine like your router setup.
+ *
+ * It's possible to configure the following network settings:
+ * - MAC address
+ * - IP address
+ * - Subnet
+ * - Gateway
+ * - DNS Server
+ * - Webserver port
+ * - USE DHCP YES/NO (if you use DHCP connect per serial port - 9600 baud - on powerup to see which ip address is assigned)
+ * - DHCP renew interval
+ *
+ * Other functions:
+ * - Display DHCP renew status
+ * - Display DHCP renew timestamp
+ * - Display Arduino uptime
+ * - Display used RAM
+ *
+ * You can configure default settings. This settings are used wenn no configuration is present.
+ * Look at the function set_EEPROM_Default().
+ *
+ * It is possible to connect a RESET button. If the button is pressed and the Arduino is turned on
+ * the default values would be restored too.
+ * See #define RESET_PIN.
+ *
+ *
+ * All settings are stored in EEPROM. This means they are permanent.
+ * Please look at http://arduino.cc/en/Reference/EEPROM for a short description.
+ *
+ *
+ * To setup your arduino upload this sketch.
+ *
+ * If you don't change the sourcecode the default IP address is http://192.168.0.111/
+ * Don't forget to change the IP of your network adapter to a suitable address (e.g. to IP 192.168.0.1, NETMASK 255.255.255.0)!
+ *
+ * Enter the following URL for the setup page:
+ * http://192.168.0.111/setupNet.html
+ *
+ * Please note that no input checks are done!!
+ * This means that no error would be thrown if you type a wrong IP address or other failures.
+ * Keep this in mind.
+ *
+ * Resources:
+ * There are many Strings for the HTML site. The compiled size is about 27.000 Bytes. Aprox. 2000 byte of SRAM is used.
+ * On smaller Arduinos this may cause problems. I've tested it on a MEGA 2560.
+ *
+ * BUGS:
+ * - After uploading your sketch the arduino is not reachable. --> Reset your Arduino!!
+ */
//#define WEBDUINO_FAVICON_DATA "" // no favicon
-#define DEBUG //uncomment for serial debug output
-#define USE_SYSTEM_LIBRARY //comment out if you want to save some space (about 1 Byte). You wouldn't see uptime and free RAM if it's commented out.
+//#define DEBUG //uncomment for serial debug output
+//#define USE_SYSTEM_LIBRARY //comment out if you want to save some space (about 1 Byte). You wouldn't see uptime and free RAM if it's commented out.
#define SERIAL_BAUD 9600
-
#include "SPI.h" // new include
#include "avr/pgmspace.h" // new include
#include "Ethernet.h"
#include "WebServer.h"
#include
-
+#include "IAQ2000.h"
+#include "I2Cdev.h"
+#include
/* #############################################################################################################################################################
-* Code for the EEPROM related things
-*
-*/
+ * Code for the EEPROM related things
+ *
+ */
//#include
//#include "EEPROMAnything.h"
-
-#define RESET_PIN 40 //Connect a button to this PIN. If the button is hold, an the device is turned on the default ethernet settings are restored.
+#define RESET_PIN 8 //Connect a button to this PIN. If the button is hold, an the device is turned on the default ethernet settings are restored.
/* structure which is stored in the eeprom.
-* Look at "EEPROMAnything.h" for the functions storing and reading the struct
-*/
+ * Look at "EEPROMAnything.h" for the functions storing and reading the struct
+ */
#include "struct.h"
-//MQTT intern include
-//#include "mqttintern.h"
+#define dht_apin 5
+
+IAQ2000 iaq;
+
+DHT dht(dht_apin, DHT11);
+
+uint16_t airQuality;
+int val = 0;
+float Temperatur;
+float Humidity;
+unsigned long loopcnt = 0;
/**
-* set_EEPROM_Default() function
-*
-* The default settings.
-* This settings are used when no config is present or the reset button is pressed.
-*/
+ * set_EEPROM_Default() function
+ *
+ * The default settings.
+ * This settings are used when no config is present or the reset button is pressed.
+ */
void set_EEPROM_Default() {
- eeprom_config.config_set=1; // dont change! It's used to check if the config is already set
-
- eeprom_config.use_dhcp=0; // use DHCP per default
- eeprom_config.dhcp_refresh_minutes=60; // refresh the DHCP every 60 minutes
-
- // set the default MAC address. In this case its DE:AD:BE:EF:FE:ED
- eeprom_config.mac[0]=0xDE;
- eeprom_config.mac[1]=0xAD;
- eeprom_config.mac[2]=0xBE;
- eeprom_config.mac[3]=0xEF;
- eeprom_config.mac[4]=0xFE;
- eeprom_config.mac[5]=0xED;
-
- // set the default IP address for the arduino. In this case its 192.168.1.97
- eeprom_config.ip[0]=192;
- eeprom_config.ip[1]=168;
- eeprom_config.ip[2]=1;
- eeprom_config.ip[3]=97;
-
- // set the default GATEWAY. In this case its 192.168.1.1
- eeprom_config.gateway[0]=192;
- eeprom_config.gateway[1]=168;
- eeprom_config.gateway[2]=1;
- eeprom_config.gateway[3]=1;
-
- // set the default SUBNET. In this case its 255.255.255.0
- eeprom_config.subnet[0]=255;
- eeprom_config.subnet[1]=255;
- eeprom_config.subnet[2]=255;
- eeprom_config.subnet[3]=0;
-
- // set the default DNS SERVER. In this case its 192.168.1.1
- eeprom_config.dns_server[0]=192;
- eeprom_config.dns_server[1]=168;
- eeprom_config.dns_server[2]=1;
- eeprom_config.dns_server[3]=1;
-
- // set the default Webserver Port. In this case its Port 80
- eeprom_config.webserverPort=80;
-
- // set the default MQTT SERVER. In this case its 192.168.1.35
- eeprom_config.mqtt_server[0]=192;
- eeprom_config.mqtt_server[1]=168;
- eeprom_config.mqtt_server[2]=1;
- eeprom_config.mqtt_server[3]=35;
-
- // set the default Webserver Port. In this case its Port 80
- eeprom_config.mqttserverPort=1883;
- #ifdef DEBUG
- Serial.println("Config reset");
- #endif
+ eeprom_config.config_set = 1; // dont change! It's used to check if the config is already set
+
+ eeprom_config.use_dhcp = 0; // use DHCP per default
+ eeprom_config.dhcp_refresh_minutes = 60; // refresh the DHCP every 60 minutes
+
+ // set the default MAC address. In this case its DE:AD:BE:EF:FE:ED
+ eeprom_config.mac[0] = 0xDE;
+ eeprom_config.mac[1] = 0xAD;
+ eeprom_config.mac[2] = 0xBE;
+ eeprom_config.mac[3] = 0xEF;
+ eeprom_config.mac[4] = 0xFE;
+ eeprom_config.mac[5] = 0xED;
+
+ // set the default IP address for the arduino. In this case its 192.168.1.97
+ eeprom_config.ip[0] = 192;
+ eeprom_config.ip[1] = 168;
+ eeprom_config.ip[2] = 1;
+ eeprom_config.ip[3] = 97;
+
+ // set the default GATEWAY. In this case its 192.168.1.1
+ eeprom_config.gateway[0] = 192;
+ eeprom_config.gateway[1] = 168;
+ eeprom_config.gateway[2] = 1;
+ eeprom_config.gateway[3] = 1;
+
+ // set the default SUBNET. In this case its 255.255.255.0
+ eeprom_config.subnet[0] = 255;
+ eeprom_config.subnet[1] = 255;
+ eeprom_config.subnet[2] = 255;
+ eeprom_config.subnet[3] = 0;
+
+ // set the default DNS SERVER. In this case its 192.168.1.1
+ eeprom_config.dns_server[0] = 192;
+ eeprom_config.dns_server[1] = 168;
+ eeprom_config.dns_server[2] = 1;
+ eeprom_config.dns_server[3] = 1;
+
+ // set the default Webserver Port. In this case its Port 80
+ eeprom_config.webserverPort = 80;
+
+ // set the default MQTT SERVER. In this case its 192.168.1.35
+ eeprom_config.mqtt_server[0] = 192;
+ eeprom_config.mqtt_server[1] = 168;
+ eeprom_config.mqtt_server[2] = 1;
+ eeprom_config.mqtt_server[3] = 35;
+
+ // set the default Webserver Port. In this case its Port 80
+ eeprom_config.mqttserverPort = 1883;
+#ifdef DEBUG
+ Serial.println("Config reset");
+#endif
}
-
/**
-* read_EEPROM_Settings function
-* This function is used to read the EEPROM settings at startup
-*
-* Overview:
-* - Set the PIN for the RESET-button to input and activate pullups
-* - Load the stored data from EEPROM into the eeprom_config struct
-* - Check if a config is stored or the reset button is pressed. If one of the conditions is ture, set the defaults
-*/
+ * read_EEPROM_Settings function
+ * This function is used to read the EEPROM settings at startup
+ *
+ * Overview:
+ * - Set the PIN for the RESET-button to input and activate pullups
+ * - Load the stored data from EEPROM into the eeprom_config struct
+ * - Check if a config is stored or the reset button is pressed. If one of the conditions is ture, set the defaults
+ */
void read_EEPROM_Settings() {
- pinMode(RESET_PIN, INPUT);
- digitalWrite(RESET_PIN, HIGH);
-
- // read the current config
- EEPROM_readAnything(0, eeprom_config);
-
- // check if config is present or if reset button is pressed
- if (eeprom_config.config_set != 1 || digitalRead(RESET_PIN) == LOW) {
- // set default values
- set_EEPROM_Default();
-
- // write the config to eeprom
- EEPROM_writeAnything(0, eeprom_config);
- }
+ pinMode(RESET_PIN, INPUT);
+ digitalWrite(RESET_PIN, HIGH);
+
+ // read the current config
+ EEPROM_readAnything(0, eeprom_config);
+
+ // check if config is present or if reset button is pressed
+ if (eeprom_config.config_set != 1 || digitalRead(RESET_PIN) == LOW) {
+ // set default values
+ set_EEPROM_Default();
+
+ // write the config to eeprom
+ EEPROM_writeAnything(0, eeprom_config);
+ }
}
/**
-* print_EEPROM_Settings() function
-*
-* This function is used for debugging the configuration.
-* It prints the actual configuration to the serial port.
-*/
+ * print_EEPROM_Settings() function
+ *
+ * This function is used for debugging the configuration.
+ * It prints the actual configuration to the serial port.
+ */
#ifdef DEBUG
void print_EEPROM_Settings() {
- Serial.print("IP: ");
- for(int i = 0; i<4; i++) {
- Serial.print(eeprom_config.ip[i]);
- if (i<3) {
- Serial.print('.');
- }
- }
- Serial.println();
-
- Serial.print("Subnet: ");
- for(int i = 0; i<4; i++) {
- Serial.print(eeprom_config.subnet[i]);
- if (i<3) {
- Serial.print('.');
- }
- }
- Serial.println();
-
- Serial.print("Gateway: ");
- for(int i = 0; i<4; i++) {
- Serial.print(eeprom_config.gateway[i]);
- if (i<3) {
- Serial.print('.');
- }
- }
- Serial.println();
-
- Serial.print("DNS Server: ");
- for(int i = 0; i<4; i++) {
- Serial.print(eeprom_config.dns_server[i]);
- if (i<3) {
- Serial.print('.');
- }
- }
- Serial.println();
-
- Serial.print("MQTT Server: ");
- for(int i = 0; i<4; i++) {
- Serial.print(eeprom_config.mqtt_server[i]);
- if (i<3) {
- Serial.print('.');
- }
- }
- Serial.println();
-
- Serial.print("MAC: ");
- for (int a=0;a<6;a++) {
- Serial.print(eeprom_config.mac[a],HEX);
- if(a<5) {
- Serial.print(":");
- }
- }
- Serial.println();
- Serial.print("MQTTserver Port: ");
- Serial.println(eeprom_config.mqttserverPort);
-
- Serial.print("Webserver Port: ");
- Serial.println(eeprom_config.webserverPort);
-
- Serial.print("USE DHCP: ");
- Serial.println(eeprom_config.use_dhcp);
-
- Serial.print(" DHCP renew every ");
- Serial.print(eeprom_config.dhcp_refresh_minutes);
- Serial.println(" minutes");
-
- Serial.print("Config Set: ");
- Serial.println(eeprom_config.config_set);
+ Serial.print("IP: ");
+ for (int i = 0; i < 4; i++) {
+ Serial.print(eeprom_config.ip[i]);
+ if (i < 3) {
+ Serial.print('.');
+ }
+ }
+ Serial.println();
+
+ Serial.print("Subnet: ");
+ for (int i = 0; i < 4; i++) {
+ Serial.print(eeprom_config.subnet[i]);
+ if (i < 3) {
+ Serial.print('.');
+ }
+ }
+ Serial.println();
+
+ Serial.print("Gateway: ");
+ for (int i = 0; i < 4; i++) {
+ Serial.print(eeprom_config.gateway[i]);
+ if (i < 3) {
+ Serial.print('.');
+ }
+ }
+ Serial.println();
+
+ Serial.print("DNS Server: ");
+ for (int i = 0; i < 4; i++) {
+ Serial.print(eeprom_config.dns_server[i]);
+ if (i < 3) {
+ Serial.print('.');
+ }
+ }
+ Serial.println();
+
+ Serial.print("MQTT Server: ");
+ for (int i = 0; i < 4; i++) {
+ Serial.print(eeprom_config.mqtt_server[i]);
+ if (i < 3) {
+ Serial.print('.');
+ }
+ }
+ Serial.println();
+
+ Serial.print("MAC: ");
+ for (int a = 0; a < 6; a++) {
+ Serial.print(eeprom_config.mac[a], HEX);
+ if (a < 5) {
+ Serial.print(":");
+ }
+ }
+ Serial.println();
+ Serial.print("MQTTserver Port: ");
+ Serial.println(eeprom_config.mqttserverPort);
+
+ Serial.print("Webserver Port: ");
+ Serial.println(eeprom_config.webserverPort);
+
+ Serial.print("USE DHCP: ");
+ Serial.println(eeprom_config.use_dhcp);
+
+ Serial.print(" DHCP renew every ");
+ Serial.print(eeprom_config.dhcp_refresh_minutes);
+ Serial.println(" minutes");
+
+ Serial.print("Config Set: ");
+ Serial.println(eeprom_config.config_set);
}
#endif
// #############################################################################################################################################################
-
/* START Network section #######################################################################################################################################
-* Code for setting up network connection
-*/
+ * Code for setting up network connection
+ */
unsigned long last_dhcp_renew;
byte dhcp_state;
/**
-* renewDHCP() function
-* Renew the DHCP relase in a given interval.
-*
-* Overview:
-* - Check if interval = 0 and set it to 1
-* - Check if renew interval is reached and renew the lease
-*/
+ * renewDHCP() function
+ * Renew the DHCP relase in a given interval.
+ *
+ * Overview:
+ * - Check if interval = 0 and set it to 1
+ * - Check if renew interval is reached and renew the lease
+ */
void renewDHCP(int interval) {
- unsigned long interval_millis = interval * 60000;
-
- if (interval == 0 ) {
- interval = 1;
- }
- if (eeprom_config.use_dhcp==1) {
- if((millis() - last_dhcp_renew) > interval_millis) {
- last_dhcp_renew=millis();
- dhcp_state = Ethernet.maintain();
- }
- }
+ unsigned long interval_millis = interval * 60000;
+
+ if (interval == 0) {
+ interval = 1;
+ }
+ if (eeprom_config.use_dhcp == 1) {
+ if ((millis() - last_dhcp_renew) > interval_millis) {
+ last_dhcp_renew = millis();
+ dhcp_state = Ethernet.maintain();
+ }
+ }
}
-
/**
-* setupNetwork() function
-* This function is used to setupup the network according to the values stored in the eeprom
-*
-* Overview:
-* - First of all read the EEPROM settings
-* - Display a link to the ethernet setup
-* - Check if DHCP should be used, if not create instaces of IPAddress for ip, gateway, subnet and dns_server
-* - Invoke Ethernet.begin with all parameters if no dhcp is active (Ethernet.begin(mac, ip, dns_server, gateway, subnet);).
-* - If DHCP is used invoke only with mac (Ethernet.begin(mac);) and display the ip on the serial console.
-*/
+ * setupNetwork() function
+ * This function is used to setupup the network according to the values stored in the eeprom
+ *
+ * Overview:
+ * - First of all read the EEPROM settings
+ * - Display a link to the ethernet setup
+ * - Check if DHCP should be used, if not create instaces of IPAddress for ip, gateway, subnet and dns_server
+ * - Invoke Ethernet.begin with all parameters if no dhcp is active (Ethernet.begin(mac, ip, dns_server, gateway, subnet);).
+ * - If DHCP is used invoke only with mac (Ethernet.begin(mac);) and display the ip on the serial console.
+ */
void setupNetwork() {
- read_EEPROM_Settings();
-
- #ifdef DEBUG
- print_EEPROM_Settings();
- #endif
-
- // byte mac[] = { eeprom_config.mac[0], eeprom_config.mac[1], eeprom_config.mac[2], eeprom_config.mac[3], eeprom_config.mac[4], eeprom_config.mac[5] };
-
- if (eeprom_config.use_dhcp != 1) {
- IPAddress ip(eeprom_config.ip[0], eeprom_config.ip[1], eeprom_config.ip[2], eeprom_config.ip[3]);
- IPAddress gateway (eeprom_config.gateway[0],eeprom_config.gateway[1],eeprom_config.gateway[2],eeprom_config.gateway[3]);
- IPAddress subnet (eeprom_config.subnet[0], eeprom_config.subnet[1], eeprom_config.subnet[2], eeprom_config.subnet[3]);
- IPAddress dns_server (eeprom_config.dns_server[0], eeprom_config.dns_server[1], eeprom_config.dns_server[2], eeprom_config.dns_server[3]);
- Ethernet.begin(eeprom_config.mac, ip, dns_server, gateway, subnet);
- } else {
- if (Ethernet.begin(eeprom_config.mac) == 0) {
- Serial.print("Failed to configure Ethernet using DHCP");
- }
- Serial.println(Ethernet.localIP());
- }
+ read_EEPROM_Settings();
+
+#ifdef DEBUG
+ print_EEPROM_Settings();
+#endif
+
+ // byte mac[] = { eeprom_config.mac[0], eeprom_config.mac[1], eeprom_config.mac[2], eeprom_config.mac[3], eeprom_config.mac[4], eeprom_config.mac[5] };
+
+ if (eeprom_config.use_dhcp != 1) {
+ IPAddress ip(eeprom_config.ip[0], eeprom_config.ip[1],
+ eeprom_config.ip[2], eeprom_config.ip[3]);
+ IPAddress gateway(eeprom_config.gateway[0], eeprom_config.gateway[1],
+ eeprom_config.gateway[2], eeprom_config.gateway[3]);
+ IPAddress subnet(eeprom_config.subnet[0], eeprom_config.subnet[1],
+ eeprom_config.subnet[2], eeprom_config.subnet[3]);
+ IPAddress dns_server(eeprom_config.dns_server[0],
+ eeprom_config.dns_server[1], eeprom_config.dns_server[2],
+ eeprom_config.dns_server[3]);
+ Ethernet.begin(eeprom_config.mac, ip, dns_server, gateway, subnet);
+ } else {
+ if (Ethernet.begin(eeprom_config.mac) == 0) {
+ Serial.print("Failed to configure Ethernet using DHCP");
+ }
+ Serial.println(Ethernet.localIP());
+ }
}
// END Network section #########################################################################################################################################
-
/* WEB-Server section #######################################################################################################################################
-* Webserver Code
-*/
+ * Webserver Code
+ */
#ifdef USE_SYSTEM_LIBRARY
#include "system.h"
@@ -339,29 +348,29 @@ System sys;
#endif
/* Store all string in the FLASH storage to free SRAM.
-The P() is a function from Webduino.
-*/
-P(Page_start) = "Web_EEPROM_Setup\n";
+ The P() is a function from Webduino.
+ */
+P(Page_start) = "Web_i4a_Arduino_Page\n";
P(Page_end) = "";
P(Http400) = "HTTP 400 - BAD REQUEST";
-P(Index) = "
index.html
This is your main site! The code is found in the indexHTML() function. You can add more sites if you need. Please see the well documented source code.
Use the following link to setup the network. NETWORK SETUP";
+P(Index) = "