Servostellung angepasst

Servostellung angepasst

--- Arduino_Humidor_Monitoring/Arduino_Humidor_Monitoring.ino
+++ Arduino_Humidor_Monitoring/Arduino_Humidor_Monitoring.ino
@@ -1,42 +1,46 @@
 /*
- * Humidor Überwachung mit einem Arduino Nano v3 und einem ESP8266 WIFI Modul.
- *
- * Der Arduino Nano wertet die Sensorendaten von Luftfeuchtigkeit und Temperatur aus, und falls es einen Grenzwert
+ * Humidor Überwachung mit einem Arduino Mega 2560 R3 und einem ESP8266 WIFI Modul.
+ *
+ * Der Arduino wertet die Sensorendaten von Luftfeuchtigkeit und Temperatur aus, und falls es einen Grenzwert
  * unterschreitet, öffnet es die Befeuchtungskammer und schaltet einen Lüfter ein.
  *
  * Somit erzeugt es die richtige Luftfeuchtigkeit im Humidor.
  *
- * Als zusatz wird noch ein OLED Display am Humidor eingebaut um den derzeitigen Status anzuzeigen.
+ * Als zusatz wird noch ein OLED Display am Humidor eingebaut um den derzeitigen Status anzuzeigen (leider durch die Größe
+ * der Bibliothek musste ich auf einen Arduino Mega umsteigen).
  * Genauso verwenden wir die Bibliothek ArduinoJson und bauen für die Übertragung ein Json String.
  *
  * Arduino Mega 2560 R3 Pinbelegung:
- * ----------------------------
+ * =================================
  * VCC = 5V
  * GND = GND
- * D22  = TX Pin ESP8266 WIFI
- * D23  = RX Pin ESP8266 WIFI
+ * D22 = TX Pin ESP8266 WIFI
+ * D23 = RX Pin ESP8266 WIFI
  * 3.3V= VCC ESP8266 WIFI
  * ---
- * D24  = DHT11 Sensor
+ * D24 = DHT11 Sensor
  * ---
- * A4  = I2C OLED Display (SDA)
- * A5  = I2C OLED Display (SCL)
+ * 19  = RST
+ * 20  = I2C OLED Display (SDA)
+ * 21  = I2C OLED Display (SCL)
  * ---
  * D5  = (PWM) Servo Motor
+ * D6  = Luefter (Optional)
  * ---
- * D26  = LED (Power)
- * D27  = LED (Activity)
+ * D26 = LED (Power)
+ * D27 = LED (Activity)
  * ---
  *
  * OLED Display SSD1306:
- * ---------------------
+ * =====================
  * VCC = 3.3V
  * GND = Ground
  * SCL = SCL (I2C)
  * SDA = SDA (I2C)
+ * RST = D19
  *
  * Servo Motor:
- * ------------
+ * ============
  * VCC (Red) = 5V
  * GND (Black = Ground
  * Control (Yellow) = D5 (PWM)
@@ -59,6 +63,8 @@
    ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    MIT Lizenz in Deutsch:
+   ======================
+   MIT Lizenz:
    Copyright (c) 2017 Günter Bailey

    Hiermit wird unentgeltlich jeder Person, die eine Kopie der Software und der zugehörigen Dokumentationen (die "Software") erhält,
@@ -86,8 +92,6 @@
 int led_act=27;

 // ESP8266 WIFI
-//#include<SoftwareSerial.h>
-//SoftwareSerial wifi(14,15); //RX, TX
 boolean NO_IP=false;
 boolean WIFI_CONN=false;
 String IP="";
@@ -102,8 +106,8 @@
 #include <Servo.h>
 int servo_pin = 2; // Declare the Servo pin
 Servo servo1; // Create a servo object
-int pos_open = 130; // open position in degrees
-int pos_close = 15; // close position in degrees
+int pos_open = 100; // open position in degrees
+int pos_close = 50; // close position in degrees

 //DHT11 Lib
 int dhtPin = 24;
@@ -113,9 +117,6 @@
 // delay between the measurements in Milliseconds
 unsigned long stime = 1800000; // delay time between the transmitting
 unsigned long mtime = 900000; // delay time between the measurements
-// only for tests
-//unsigned long stime = 20000;
-//unsigned long mtime = 10000;

 boolean isopen; // Field to check if open or closed

@@ -123,14 +124,15 @@
 StaticJsonBuffer<110> jsonBuffer;
 JsonObject& root = jsonBuffer.createObject();

-/*
+
 // OLED Display
+int RSTpin = 19;
 #include <SPI.h>
 #include <Wire.h>
 #include <Adafruit_GFX.h>
 #include <Adafruit_SSD1306.h>

-#define OLED_RESET 4
+#define OLED_RESET RSTpin
 Adafruit_SSD1306 display(OLED_RESET);

 #define NUMFLAKES 10
@@ -140,7 +142,82 @@

 #define LOGO16_GLCD_HEIGHT 16
 #define LOGO16_GLCD_WIDTH  16
+
+/*
+#if (SSD1306_LCDHEIGHT != 64)
+#error("Height incorrect, please fix Adafruit_SSD1306.h!");
+#endif
 */
+
+// my company Sign
+//created with LCDAssistant http://en.radzio.dxp.pl/bitmap_converter/
+const unsigned char logo [] = {
+0x80, 0x00, 0x40, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC,
+0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xF8, 0xF8,
+0xF8, 0xF8, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+0xC0, 0xE0, 0xF0, 0xF0, 0xF8, 0xF8, 0xF8, 0xF8, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xF8, 0xF8, 0xF8,
+0xF8, 0xF0, 0xE0, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x1F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0x0F, 0x0F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x3F,
+0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0xFC, 0xF9, 0xF1, 0xE1, 0xC1,
+0xC1, 0x81, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xCF, 0x87, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x3F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xF0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x07, 0x07, 0x07, 0x07, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x07, 0x3F,
+0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x1F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xFC, 0xFC, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x01, 0x01, 0x03, 0x03, 0x03, 0x03, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x03, 0x03,
+0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x1F, 0x1F,
+0x1F, 0x1F, 0x0F, 0x0F, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};

 void act(int state){
   if(state==1){
@@ -278,6 +355,7 @@
   digitalWrite(led_pwr, LOW);
   digitalWrite(led_act, LOW);

+  // build Json string
   root["ID"] = ID;
   root["sendtime"] = stime;
   root["measuretime"] = mtime;


Revert "fixing yellow led blinking"

Revert "fixing yellow led blinking"

This reverts commit ca59349c6af22f69dd169a124e8c096ee9a54cbf.

--- Arduino/Arduino.ino
+++ Arduino/Arduino.ino
@@ -114,8 +114,8 @@
 char inStringBuffer[BUFFSIZE];
 char outStringBuffer[BUFFSIZE];
 uint32_t bytesRead = 0;
-int blinkGreenTimer, blinkYellowTimer;
-bool stateYellow,stateGreen;
+int blinkGreenTimer, blinkRedTimer;
+bool stateRed,stateGreen;
 bool emergency_mode,warning;
 int emergency_sensor_threshold =900;

@@ -142,8 +142,8 @@
   delay(1000);
   Serial.println("All power to the engines!");
   stop(SOFT);
-  blinkGreenTimer=blinkYellowTimer= millis();
-  stateGreen=stateYellow=true;
+  blinkGreenTimer=blinkRedTimer= millis();
+  stateGreen=stateRed=true;
   emergency_mode=warning=false;
   digitalWrite(LED_GREEN, LOW);
   digitalWrite(LED_YELLOW, LOW);
@@ -217,16 +217,13 @@
         stateGreen=!stateGreen;
         blinkGreenTimer=millis();
         digitalWrite(LED_GREEN, stateGreen);
-        digitalWrite(LED_YELLOW, LOW);
       }
     }
     else {
-      //if we didn't receive nothing from adk and last receiver (blink) was more than 600ms ago
-      if (millis()-blinkYellowTimer>300&& millis()-blinkGreenTimer>600){
-        digitalWrite(LED_GREEN, LOW);
-        stateYellow=!stateYellow;
-        blinkYellowTimer=millis();
-        digitalWrite(LED_YELLOW, stateYellow);
+      if (millis()-blinkRedTimer>300){
+        stateRed=!stateRed;
+        blinkRedTimer=millis();
+        digitalWrite(LED_YELLOW, stateRed);
       }
       Serial.print("*");
     }


Added more code to send SSID, change, and get SSID from the local file.

--- BackEnd/BackEnd.ino
+++ BackEnd/BackEnd.ino
@@ -16,7 +16,7 @@
 */

 // If debbuging declare
-#define DEBUG_CAT
+//#define DEBUG_CAT

 #include <Dhcp.h>
 #include <Dns.h>
@@ -162,9 +162,9 @@
 // Configuration file
 #define CONFIG_FILE_MAX_SIZE WEB_SOCKET_BUFFER_SIZE
 #define CONFIG_FILE_FULL_PATH "/home/root/hardware.conf"
-#define HOSTAPD_CONFIG_FILE_FULL_PATH "/etc/hostapd/hostapd_test.conf"
+#define HOSTAPD_CONFIG_FILE_FULL_PATH "/etc/hostapd/hostapd.conf"
 //#define TEMP_CONFIG_FILE_FULL_PATH "/etc/hostapd/hostapd_tmp.conf"
-#define TEMP_CONFIG_FILE_FULL_PATH "/etc/hostapd/hostapdTest.conf"
+#define TEMP_CONFIG_FILE_FULL_PATH "/etc/hostapd/hostapdTemp.conf"

 // Scripts
 #define START_ACCESS_POINT_SCRIPT_FULL_PATH "/home/root/startAP"
@@ -207,16 +207,13 @@

 static const struct serveable whitelist[] = {
   {
-    "/favicon.ico", "image/x-icon"                                           }
+    "/favicon.png", "image/png"                                           }
   ,
   {
     "/static/css/app.css", "text/css"                                           }
   ,
   {
     "/static/css/bootstrap.min.css", "text/css"                                           }
-  ,
-  {
-    "/static/css/play_mode.css", "text/css"                                           }
   ,
   {
     "/static/fonts/droid-sans/DroidSans.ttf", "application/x-font-ttf"                                           }
@@ -276,6 +273,12 @@
     "/templates/connect.html", "text/html"                                           }
   ,
   {
+    "/templates/add_remove_pins.html", "text/html"                                           }
+  ,
+  {
+    "/templates/app_settings.html", "text/html"                                           }
+  ,
+  {
     "/templates/pin.html", "text/html"                                           }
   ,
   {
@@ -285,11 +288,29 @@
     "/templates/pin_settings.html", "text/html"                                           }
   ,
   {
+    "/templates/pin_slider.html", "text/html"                                           }
+  ,
+  {
+    "/templates/pin_settings_directive.html", "text/html"                                           }
+  ,
+  {
     "/templates/pin_stub.html", "text/html"                                           }
   ,
   {
     "/templates/play.html", "text/html"                                           }
   ,
+  {
+    "/templates/remove_pin_dialog.html", "text/html"                                           }
+  ,
+  {
+    "/templates/reset_dialog.html", "text/html"                                           }
+  ,
+  {
+    "/templates/ssid_changed.html", "text/html"                                           }
+  ,
+  {
+    "/templates/ssid_dialog.html", "text/html"                                           }
+  ,
   // last one is the default served if no match
   {
     "/index.html", "text/html"                                           }
@@ -688,6 +709,9 @@

   // Clear SSID string
   memset(g_sSsid, '\0', SSID_MAX_LENGTH);
+  //sprintf(g_sSsid,"%s","CAT2");
+  getSsidName(g_sSsid);
+

   // Initialize all pins with no lable and 0.0 value
   for(int i=0; i<TOTAL_NUM_OF_PINS; i++)
@@ -902,6 +926,9 @@
   // Creating status JSON object
   aJsonObject* poStatus = aJson.createObject();

+  // Create SSID object
+  aJsonObject* poSsid = aJson.createObject();
+
   // Creating pin JSON objects
   aJsonObject* poPins = aJson.createObject();
   aJsonObject* apoPin[TOTAL_NUM_OF_PINS];
@@ -918,6 +945,9 @@

   // Create STATUS
   poStatus = aJson.createItem("OK");
+
+  // Create SSID
+  poSsid = aJson.createItem(g_sSsid);

   // Create PINS
   int iaPinConnects[TOTAL_NUM_OF_PINS];
@@ -1030,12 +1060,12 @@

   // Push to JSON object
   aJson.addItemToObject(poJsonBoardState,"status",poStatus);
+  aJson.addItemToObject(poJsonBoardState,"ssid",poSsid);
   aJson.addItemToObject(poJsonBoardState,"pins",poPins);
 //  aJson.addItemToObject(poJsonBoardState,"connections",poConnections);
   aJson.addItemToObject(poJsonBoardState,"connections",paConnections);
   aJson.addItemToObject(poJsonBoardState,"message_ids_processed",paMsgIds);

-
   return poJsonBoardState;

 }
@@ -1119,9 +1149,14 @@
 void procSsidMsg( aJsonObject *_pJsonSsid )
 {
   aJsonObject *poSsid = aJson.getObjectItem(_pJsonSsid, "ssid");
-  if (poSsid && String(poSsid->valuestring).length() <= SSID_MAX_LENGTH)
-    sprintf(g_sSsid, "%s", poSsid->valuestring);
-
+  if ( poSsid && String(poSsid->valuestring).length() <= SSID_MAX_LENGTH )
+  {
+    if( strcmp(g_sSsid, poSsid->valuestring) )
+    {
+      sprintf(g_sSsid, "%s", poSsid->valuestring);
+      setSsidName(poSsid->valuestring);
+    }
+  }
  }

 ///////////////////////////////
@@ -1331,8 +1366,47 @@

 }

-
-int changeSsidName(char *_sSsidName)
+int getSsidName(char *_sSsidName)
+{
+  // We need a buffer to read in data
+  char      Buffer[LOCAL_BUFFER_SIZE];
+
+  // Open the file for reading/write.
+  FILE     *Input = fopen(HOSTAPD_CONFIG_FILE_FULL_PATH, "r"); // Read/write
+
+  // Our find and replace arguments
+  char     *Find = "ssid=";
+
+  if(NULL == Input)
+  {
+      trace_info("%s(): %s file not found", __func__,HOSTAPD_CONFIG_FILE_FULL_PATH);
+      return 1;
+  }
+
+  // For each line...
+  while(NULL != fgets(Buffer, LOCAL_BUFFER_SIZE, Input))
+  {
+    char *SubStr = NULL;    // Where 'ssid=' was found in the line
+    char *Line = Buffer; // Start at the beginning of the line, and after each match
+
+    // Find match
+    SubStr = strstr(Line, Find);
+    if( SubStr )
+    {
+      int iSsidLen = strlen(Line)-strlen(Find);
+      // Truncate Ssid if it too long
+      int n = iSsidLen < SSID_MAX_LENGTH ? iSsidLen : SSID_MAX_LENGTH;
+      strncpy(_sSsidName, SubStr+strlen(Find), n);
+    }
+  }
+
+  // Close our files
+  fclose(Input);
+
+  return 0;
+}
+
+int setSsidName(char *_sSsidName)
 {
   // Truncate Ssid if it too long
   char sSsidName[LOCAL_BUFFER_SIZE];
@@ -1341,7 +1415,7 @@

 // We need a buffer to read in data
   char      Buffer[LOCAL_BUFFER_SIZE];
-  char      TempBuffer[LOCAL_BUFFER_SIZE];
+//  char      TempBuffer[LOCAL_BUFFER_SIZE];

   // Open the file for reading/write.
   FILE     *Input = fopen(HOSTAPD_CONFIG_FILE_FULL_PATH, "r"); // Read/write
@@ -1363,7 +1437,7 @@
   // For each line...
   while(NULL != fgets(Buffer, LOCAL_BUFFER_SIZE, Input))
   {
-    char *Start = NULL;    // Where 'ssid=' was found in the line
+ //   char *Start = NULL;    // Where 'ssid=' was found in the line
     char *Line = Buffer; // Start at the beginning of the line, and after each match

     // Find match
@@ -1431,7 +1505,7 @@
     case DOWN:

         Serial.println("Changing SSID");
-        changeSsidName("CAT1");
+        setSsidName("CAT1");

 //        system("shutdown -r now");


delay for alignment

delay for alignment

--- arduino_motor/mains/Calibrator.ino
+++ arduino_motor/mains/Calibrator.ino
@@ -168,7 +168,7 @@
     }

     if(delta>0) {
-      moveForward(abs(delta));
+        moveForward(abs(delta)); delay(100);
     }
     else {
         moveBackward(abs(delta)); delay(100);


Bugfix only setPwmDuty, no digitalWrite to LEDOUT pin.

--- kast.ino
+++ kast.ino
@@ -90,7 +90,7 @@
     }
   }
   else {
-    digitalWrite(LEDOUT, 0);
+    Timer1.setPwmDuty(LEDOUT, 0);
   }
 }


defect: debugger flag not saved

defect: debugger flag not saved

--- src/sonoff-webserver.ino
+++ src/sonoff-webserver.ino
@@ -373,11 +373,11 @@
     Eeprom.saveSwitchGPIO(server.arg("switch_gpio").toInt());
   }

-  if (server.arg("switch_sensitiveness").length() > 0 ) {
+  if (server.arg("switch_sensitiveness").length() > 0 ) {
+    Eeprom.saveSwitchSensitiveness(server.arg("switch_sensitiveness").toInt());
+  }
+
   if (server.arg("debugger").length() > 0 ) {
-    Eeprom.saveSwitchSensitiveness(server.arg("switch_sensitiveness").toInt());
-  }
-
     Eeprom.saveDebuggable(1);
   } else {
     if (Eeprom.debuggable()) {


removes base_count for scores

removes base_count for scores

--- ir_targets/ir_targets.ino
+++ ir_targets/ir_targets.ino
@@ -21,7 +21,7 @@
 int activeReceiver;

 // Store scores
-int scores[BASE_COUNT] = {0,0};
+int scores[] = {0,0};
 decode_results results;

 // methods


Add files via upload

Add files via upload

Fixed some bugs.

--- simu_buttonreader_teensy_wheel/simu_buttonreader_teensy_wheel.ino
+++ simu_buttonreader_teensy_wheel/simu_buttonreader_teensy_wheel.ino
@@ -33,9 +33,9 @@
    (1)
    As the system is intended to be battery powered, the recommendation
    is to program Teensy as USB TYPE = NO USB and use for example 24MHz
-   clock. These are set from Tools menu in Arduino/Teensyduino IDE:
-   Setting NO USB will require you to press the manual program button on
-   Teensy to upload the code, but it will save a lot of power.
+   or 16 MHz clock. These are set from Tools menu in Arduino/Teensyduino
+   IDE. Setting NO USB will require you to press the manual program button
+   on Teensy to upload the code, but it will save a lot of power.

    (2)
    Additionally you can set all unused inputs as outputs, which
@@ -46,6 +46,33 @@
    LISTED IN InitialiseIO() FUNCTION. THE AUTHOR(S) TAKE NOT RESPONSIBILITY
    IF YOU MANAGE TO FRY/SHORT OUT A PIN OR YOUR TEENSY MICROCONTROLLER.
    -------------------------------------------------------------------------
+
+   NOTE ABOUT BATTERY VOLTAGE ADC MEASUREMENT
+   -------------------------------------------------------------------------
+   As typical resistors have 5% or even 10% tolerance, you should
+   use a multimeter to measure when the battery voltage starts to indicate
+   low voltage by blinkin the led, and then adjust
+   BATTERY_LOW_VOLTAGE_THRESHOLD accordingly.
+
+   If you are running on 1-cell LiPO battery, you shouldn't discharge
+   it more than 80% of its capacity, leaving 20% capacity in the battery.
+   This equals to about 3.75 volts. This is recommended, because deeper
+   discharges will start to reduce overall battery life.
+
+   One way to do your ADC/voltage divider calibration is to set
+   the variable to quite high value, for example 3800. Start with a known
+   full battery, and see when the low battery voltage measurement triggers.
+   Then measure the battery voltage using a multimeter.
+   Then you can use maths like this:
+   3600     =   YOUR_MEASURED_VOLTAGE
+   X        =   3.75
+
+   X = 3600 * 3.75 / YOUR_MEASURED_VOLTAGE
+
+   This will result in a value for BATTERY_LOW_VOLTAGE_THRESHOLD that should
+   work, as ADC is linear. Round up to the next even hundred to be
+   extra safe.
+   -------------------------------------------------------------------------
 */

 // used pin definitions, other than buttons
@@ -55,11 +82,24 @@
 #define connectionLed 22
 #define batteryADC 23

-#define LED_BRIGHTNESS 5 // define led brighness here in percentage
+
+// define led brighness here in percentage
+#define LED_BRIGHTNESS 5
 // for 82 ohm series resistor and small 3mm red/green through-hole
 // led, 5 % seems fine.
-
 #define ledOutputValue 255*LED_BRIGHTNESS/100
+
+
+// Define if you want to blink Teensy's own led or not.
+// Defined value = yes, commented out = no
+#define BLINK_TEENSY_LED
+
+
+// Adjust to fit your voltage divider and battery.
+// This value is good starting point for 33k / 11.85k
+// resistors when using internal 1.2V voltage reference on Teensy 3.2.
+#define BATTERY_LOW_VOLTAGE_THRESHOLD 3600
+

 // Uncomment this to save a bit of battery power.
 // DANGER: Please make double sure that all your unconnected pins
@@ -67,7 +107,6 @@
 // Errors here will permanently damage your Teensy microcontroller.

 // #define POWERSAVING_WITH_PINS_AS_OUTPUTS
-

 // Included the Bounce2 library found here :
@@ -109,10 +148,6 @@
 unsigned long int lastBatteryUpdate = 0;
 unsigned long int lastWaitIndicationUpdate = 0;

-// Adjust to fit your voltage divider and battery.
-// This value is good for 33k / 11.85k resistors when using
-// internal 1.2V voltage reference on Teensy 3.2.
-const int batterylowVoltageThreshold = 3730;

 boolean batteryLow = false;
 byte batteryLedStatus = 0;
@@ -156,6 +191,9 @@
   // Connect to Bt module
   Serial1.begin(57600); // use same baud rate as you have set your BT modules
   Serial1.flush();
+
+  // turn off teensy led
+  digitalWriteFast(teensyLed, LOW);
 }

 void loop() {
@@ -182,7 +220,7 @@
     if(connectionLedStatus) {
       analogWrite(connectionLed, ledOutputValue);
     } else{
-      digitalWriteFast(connectionLed, 0);
+      analogWrite(connectionLed, 0);
     }
     connectionLedStatus = !connectionLedStatus;
   }
@@ -194,7 +232,7 @@
     lastBatteryUpdate = millis();

     // check if battery low:
-    if (analogRead(batteryADC) < batterylowVoltageThreshold) {
+    if (analogRead(batteryADC) < BATTERY_LOW_VOLTAGE_THRESHOLD) {
       batteryLow = true;
       buttons_7_13 |= 0b01000000; // this bit tells battery status to base unit

@@ -207,7 +245,7 @@
       if(batteryLedStatus) {
         analogWrite(batteryLed, ledOutputValue);
       } else {
-        digitalWriteFast(batteryLed, LOW);
+        analogWrite(batteryLed, 0);
       }
       batteryLedStatus = !batteryLedStatus;
     }
@@ -222,6 +260,7 @@
       Serial1.write(buttons_0_6);
       Serial1.write(buttons_7_13);

+    #ifdef BLINK_TEENSY_LED
     // 13 = red led on teensy 3.2. Might as well flash it.
     // as aliveness status.
     // Pin 13 is not PWM capable, so just regular digitalWriteFasts here.
@@ -232,6 +271,7 @@
       ledStatus = 1;
       digitalWriteFast(teensyLed, HIGH);
     }
+    #endif
   }
 }


Uncomment watchdog timer lines

Uncomment watchdog timer lines

--- dmf_control_board/src/dmf_control_board/dmf_control_board.ino
+++ dmf_control_board/src/dmf_control_board/dmf_control_board.ino
@@ -22,7 +22,7 @@
 #if defined(AVR)
   #include "Memory.h"
   #include <EEPROM.h>
-//  #include <TimerOne.h>
+  #include <TimerOne.h>
 #elif defined(__SAM3X8E__)
   #include <DueFlashStorage.h>
   DueFlashStorage EEPROM;
@@ -38,8 +38,8 @@

 void setup() {
   /* Trigger timer to callback every 5 seconds _(5000000 microseconds)_. */
-  //Timer1.initialize(5000000L);
-  //Timer1.attachInterrupt(callback);
+  Timer1.initialize(5000000L);
+  Timer1.attachInterrupt(callback);
   dmf_control_board.begin();
 #ifdef AVR
   Serial.print("ram="); Serial.println(ram_size(), DEC);


vision pipeline updated

vision pipeline updated

--- armTools/ReactorMove_ino/ReactorMove_ino.ino
+++ armTools/ReactorMove_ino/ReactorMove_ino.ino
@@ -243,25 +243,38 @@
   /*unsigned long starttime, stoptime;
   starttime = millis();*/
   int i = 0;
+  message = "";
   while(Serial.available()) {
       //Start reading the stream
       //Serial.println("before read");
       incomingChar=Serial.read();
       message.concat(incomingChar); //Concatanate the received characters to the string message
-      /*if(message.endsWith(Startseq)) {
+      if(message.endsWith(Startseq)) {
+        message = "";
         incomingChar=Serial.read();
-        message.concat(incomingChar);
         Serial.println(message);
-        //Check for the SOP Header and strip it off once the received string is larger than the SOP header
+        while(!message.endsWith(Endseq)) {
+          incomingChar=Serial.read();
+          message.concat(incomingChar);
+        }
+      message = message.substring(0,message.length()-Endseq.length());
+        int s = message.toInt();
+        while(!message.endsWith(SOPHeader)) {
+          incomingChar=Serial.read();
+          message.concat(incomingChar);
+        }
+              //Check for the SOP Header and strip it off once the received string is larger than the SOP header
         if(message.endsWith(SOPHeader)) {
           message = "";
           while(Serial.available()) { //Start receiving once data is available on the serial link
             incomingChar=Serial.read();
             message.concat(incomingChar);
             if(message.endsWith(EOPTail)) {
-              message = message.substring(0,message.length()-Endseq.length());
-              parseMove(message, i);
-              i++;
+              while(i < s) {
+                message = message.substring(0,message.length()-EOPTail.length());
+                parseMove(i);
+                i++;
+              }
               break;
             }
           }
@@ -269,7 +282,7 @@
             break;
           }
         }
-      }*/
+      }
       if (message.endsWith(getangles)) {
         message = "";
         int id = 1;
@@ -314,10 +327,9 @@
 }

-void parseMove(String m, int counter) {
+void parseMove(int counter) {
+
   int Base, Shoulder, Shoulder1, Elbow, Elbow1, Wrist, Wrot, grip;
-  char message[256];
-  m.toCharArray(message, 256);
   char *str;
   char* delim = ",";
   Base = atoi(strtok_r(message, delim, &str));


AC_CONF_

--- _66-slack-bot/_66-slack-bot.ino
+++ _66-slack-bot/_66-slack-bot.ino
@@ -54,10 +54,10 @@
 // AC
 #define IR_RX_PIN 14
 #define IR_TX_PIN 2
-#define AC_TYPE 1
-#define AC_HEATING 0
-#define AC_ON_MIN 5
-#define AC_OFF_MIN 3
+#define AC_CONF_TYPE 1
+#define AC_CONF_HEATING 0
+#define AC_CONF_ON_MIN 5
+#define AC_CONF_OFF_MIN 3

 volatile struct
 {
@@ -73,7 +73,7 @@
 } ir_data;

 IRrecv irrecv(IR_RX_PIN);
-lgWhisen lgWhisen(AC_TYPE, AC_HEATING);
+lgWhisen lgWhisen(AC_CONF_TYPE, AC_CONF_HEATING);

 void chane_ac_temp_flow()
 {
@@ -175,7 +175,7 @@
   msg += "off -> ac off\n";
   msg += "ton -> timer start with ac on\n";
   msg += "[18 ~ 30] -> temperature set\n";
-  if (AC_TYPE == 0)
+  if (AC_CONF_TYPE == 0)
   {
     msg += "[0 ~ 2] -> flow set(low/mid/high)\n";
   }
@@ -257,7 +257,7 @@
       }
       else if (num >= 1 && num <= 3)
       {
-        if (AC_TYPE == 0 && num == 3)
+        if (AC_CONF_TYPE == 0 && num == 3)
         {
           return;
         }
@@ -364,8 +364,8 @@
   ir_data.haveData    = false;
   ir_data.timermode   = false;
   ir_data.timerfirst  = false;
-  ir_data.intervalon  = (AC_ON_MIN * 60 * 1000); // ms
-  ir_data.intervaloff = (AC_OFF_MIN * 60 * 1000); // min
+  ir_data.intervalon  = (AC_CONF_ON_MIN * 60 * 1000); // ms
+  ir_data.intervaloff = (AC_CONF_OFF_MIN * 60 * 1000); // min
   ir_data.timerMillis = millis();;
   nextTimercheck = ir_data.intervalon;


Updated readme...

Updated readme...

--- GS3_Transformer.ino
+++ GS3_Transformer.ino
@@ -4,11 +4,11 @@
 	GS/3 "Chimera"
 	Electronic "Paddle" and profile replay control application for La Marzocco GS/3 AV

-	https://github.com/alitai/GS3-Transformer
-
 	This software and associated Arduino based hardware converts a GS/3 into a powerful pressure
 	profiling machine. Furthermore it can mimic (hence "Chimera") all sorts of machines, such as
 	Slayer like slow preinfusion and abrupt pressure change, etc.
+
+    New versions can be downloaded from https://github.com/alitai/GS3-Transformer

 	Modes supported:
     	Manual (virtual) Paddle - based on potentiometer


watchdog approx 5s

watchdog approx 5s

--- master/master.ino
+++ master/master.ino
@@ -1296,4 +1296,17 @@
 		loopCount++;  // update loop count
 		linelocation_prev = linelocation;
 	}
-}+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+  void startup_early_hook() {
+    WDOG_TOVALL = (1000); // The next 2 lines sets the time-out value. This is the value that the watchdog timer compare itself to.
+    WDOG_TOVALH = 0;
+    WDOG_STCTRLH = (WDOG_STCTRLH_ALLOWUPDATE | WDOG_STCTRLH_WDOGEN | WDOG_STCTRLH_WAITEN | WDOG_STCTRLH_STOPEN); // Enable WDG
+    //WDOG_PRESC = 0; // prescaler
+  }
+#ifdef __cplusplus
+}
+#endif


changed tunings

changed tunings


Fix new flag code

Fix new flag code

Fixed some bugs, such as one-off bugs and logic errors

--- Guzheng/Guzheng.ino
+++ Guzheng/Guzheng.ino
@@ -13,6 +13,7 @@
 // Port I/O defines
 #define THRESHOLD 500
 #define LASTPORT 4
+#define BUTTONPORT 2

 // MIDI property defines
 #define VOLUME 0x7F
@@ -35,6 +36,11 @@
 int note2 = 0x3E;
 int note1 = 0x3C;

+/* Flag values for each laser. This may need some explanation. These
+ * values will operate on the bit levels, directly with binary. They
+ * work together with the lastNote variable to keep track of blocked
+ * lasers. Here, I use an AND operator to read if the value has been
+ * set, and OR to set the value. */
 uint8_t laser1 = 0x01;
 uint8_t laser2 = 0x02;
 uint8_t laser3 = 0x04;
@@ -168,26 +174,26 @@
   for (int i = 0; i <= LASTPORT; i++) {
     if(analogRead(i) > THRESHOLD) {
 #ifndef WIND
-      if (!(lastNote & (inttomask(i)))) {
+      if (!(lastNote & (inttomask(i+1)))) {
 #endif
         // Beam has been cut
         // i+1 is because i is 0 indexed, but the ID starts with 1
         musicOn(i + 1);
 #ifndef WIND
-        lastNote |= (inttomask(i));
+        lastNote |= (inttomask(i+1));
       }
 #endif
     } else {
 #ifndef WIND
-      if (lastNote == i) {
-        lastNote &= ~(inttomask(i));
+      if ((lastNote & (inttomask(i+1)))) {
+        lastNote &= ~(inttomask(i+1));
       }
 #endif
       // Hand is gone. Stop the sound
       musicOff(i + 1);
     }
     // Delay 10 to prevent weird analog readings
-    delay(DELAY);
+    // delay(DELAY);
   }
 }


Remove toggle mode in estop

Remove toggle mode in estop

--- estop/code/SPI_rf24L01_TX/SPI_rf24L01_TX.ino
+++ estop/code/SPI_rf24L01_TX/SPI_rf24L01_TX.ino
@@ -44,7 +44,6 @@
 //***************************************************

 int estopStatus = 0;
-bool isToggling = false;

 //***************************************************

@@ -67,14 +66,10 @@
 void loop()
 {
   int k = !digitalRead(IN_PIN);
-  if (k == 1) {
+  if (k != estopStatus) {
     digitalWrite(WIRELESS_LED, HIGH);
-    if (!isToggling) {
-      isToggling = true;
-      estopStatus = !estopStatus;
-    }
-  } else if (k == 0 && isToggling) {
-    isToggling = false;
+    estopStatus = k;
+  } else {
     digitalWrite(WIRELESS_LED, LOW);
   }


Initial release

Initial release

Bug fixes;
Added stable frequency control;

--- sanro/sanro.ino
+++ sanro/sanro.ino
@@ -9,16 +9,15 @@
  ***************************************************************/

 #define MODE_JIRO 1
-#define MODE_DEBUG 1
-#define MODE_DEBUG_SHOW_TIME 0
+#define MODE_DEBUG 0

 #define CHANNELS 4

-#define SAMPLE_CACHE_LENGTH 15
+#define SAMPLE_CACHE_LENGTH 12
 #define POWER_CACHE_LENGTH 3

-#define LIGHT_THRES 500
-#define HEAVY_THRES 1000
+#define LIGHT_THRES 5000
+#define HEAVY_THRES 20000

 #include <limits.h>
 #include <Keyboard.h>
@@ -27,6 +26,8 @@
 #if MODE_JIRO
 #define HEAVY_THRES LONG_MAX
 #endif
+
+unsigned long int lastTime;

 int channelSample [CHANNELS];
 int lastChannelSample [CHANNELS];
@@ -50,28 +51,14 @@
     lastChannelSample [i] = 0;
     triggered [i] = false;
   }
+  lastTime = 0;
 }

 void loop() {
-
-#if MODE_DEBUG
-  long int sampleLastTime = 0;
-  long int calcLastTime = 0;
-#endif

   for (short int i = 0; i < CHANNELS; i++) {
-
-#if MODE_DEBUG
-    long int lastTime = micros();
-#endif

-    channelSample[i] = analogRead (pins[i]);
-
-#if MODE_DEBUG
-    sampleLastTime += micros () - lastTime;
-    lastTime = micros();
-#endif
-
+    channelSample[i] = analogRead (pins [i]);
     sampleCache [i].put (channelSample [i] - lastChannelSample [i]);

     long int tempInt;
@@ -79,44 +66,31 @@
     power [i] -= tempInt * tempInt;
     tempInt = sampleCache [i].get ();
     power [i] += tempInt * tempInt;
-
     if (power [i] < LIGHT_THRES) {
       power [i] = 0;
     }

     powerCache [i].put (power [i]);
     lastChannelSample [i] = channelSample [i];
-
     if (powerCache [i].get (1) == 0) {
       triggered [i] = false;
     }

-    bool isDescending = true;
-    for (short int j = 0; j < POWER_CACHE_LENGTH - 1; j++){
-      if (!triggered [i] && (powerCache [i].get (j - 1) > powerCache [i].get (j))) {
-        isDescending = false;
-        break;
+    if (!triggered [i]) {
+      for (short int j = 0; j < POWER_CACHE_LENGTH - 1; j++) {
+        if (powerCache [i].get (j - 1) >= powerCache [i].get (j)) {
+          break;
+        } else if (powerCache [i].get (1) >= HEAVY_THRES) {
+          triggered [i] = true;
+          Keyboard.print (heavyKeys [i]);
+        } else if (powerCache [i].get (1) >= LIGHT_THRES) {
+          triggered [i] = true;
+          Keyboard.print (lightKeys [i]);
+        }
       }
     }
-    if (isDescending) {
-      if (power [i] >= HEAVY_THRES) {
-        triggered [i] = true;
-#if !MODE_DEBUG
-        Keyboard.print (heavyKeys [i]);
-#endif
-      } else if (power [i] >= LIGHT_THRES) {
-        triggered [i] = true;
-#if !MODE_DEBUG
-        Keyboard.print (lightKeys [i]);
-#endif
-      }
-
-#if MODE_DEBUG
-    calcLastTime += micros () - lastTime;
-#endif
-    }

-#if MODE_DEBUG
+#if MODE_DEBUGjj
     Serial.print (power [i]);
     Serial.print ("\t");
 #endif
@@ -125,19 +99,19 @@
   }

 #if MODE_DEBUG
-// Damn Arduino plotter, the Y axis scale changes much
-// too frequently! Use these 5000 and 0 values to "lock"
-// the plotter.
-  Serial.print (5000);
+// Damn Arduino plotter, the Y axis scale changes too frequently! Use these values to "lock" the plotter's scale.
+  Serial.print (50000);
   Serial.print ("\t");
   Serial.print (0);
   Serial.print ("\t");
-#if MODE_DEBUG_SHOW_TIME
-  Serial.print (sampleLastTime);
-  Serial.print ('\t');
-  Serial.print (calcLastTime);
-#endif
+
   Serial.println ("");
 #endif

+// Force the sample frequency to be less than 1000Hz
+  unsigned int frameTime = micros () - lastTime;
+  lastTime = micros ();
+  if (frameTime < 1000) {
+    delayMicroseconds (1000 - frameTime);
+  }
 }


AudioPassThru_Quad: remove unneeded pin declarations

--- examples/AIC_Shield/AudioPassThru_Quad/AudioPassThru_Quad.ino
+++ examples/AIC_Shield/AudioPassThru_Quad/AudioPassThru_Quad.ino
@@ -18,9 +18,6 @@
 const float sample_rate_Hz = 44117.0f ;  //24000 to 44117 to 96000 (or other frequencies in the table in AudioOutputI2S_F32)
 const int audio_block_samples = 128;     //do not make bigger than audio_block_SAMPLES from AudioStream.h (which is 128)  Must be 128 for SD recording.
 AudioSettings_F32 audio_settings(sample_rate_Hz, audio_block_samples);
-
-#define AIC_RESET_PIN 20   //for I2C connection to AIC shield (eventually move into Tympan library)
-#define AIC_I2C_BUS 2     //for I2C connection to AIC shield (eventually move into Tympan library)

 // define classes to control the Tympan and the AIC_Shield
 Tympan                        myTympan;    //note: Rev C is not compatible with the AIC shield


Including all TORTIS commands, a Logo subset

Some research revealed that there was a subset of Logo commands used in a pushblock format that enabled young children (unable to read and type yet) to use the robotic turlte (Primo.io's cubetto seems to have taken this idea and run with it).   Though "pen up" and "pen down" will require the addition of a servo motor and pen, they are included, though there implementation will be delayed until servos and engineering a pen-holder are accomplished.

--- LogoBot/LogoBot.ino
+++ LogoBot/LogoBot.ino
@@ -79,6 +79,12 @@

 }

+
+/***************************************************************/
+/**      Commands from Logo's TORTIS project,                 **/
+/** a pushbutton system for children to young to read and type**/
+/***************************************************************/
+
 // forward, aka FD
 void FD(int amt){{

@@ -99,6 +105,25 @@

 }

+void toot(){
+
+}
+
+void pen_up(){
+
+}
+
+void pen_down(){
+
+}
+
+void light_on(){
+
+}
+
+void light_off(){
+
+}

 // play a Note, not an authentic Logo command, just fun to use.
 void NT(int note, int duration) {


Update GPRS_OutgoingCall_Software.ino

Update GPRS_OutgoingCall_Software.ino

--- examples/GPRS_OutgoingCall_Software/GPRS_OutgoingCall_Software.ino
+++ examples/GPRS_OutgoingCall_Software/GPRS_OutgoingCall_Software.ino
@@ -9,9 +9,9 @@
 #define PHONE_NUMBER  "+79263995140"

 // создаём объект класса GPRS
-// и передаём ему номера пинов TX, RX, и скорость 9600 бод
+// и передаём ему номера пинов ST, PK, RX и TX.
 // с помощью него будем давать команды GPRS шилду
-GPRS gprs(10, 11, 9600);
+GPRS gprs(2, 3, 11, 10);

 void setup()
 {


Added temperature sensor

Added temperature sensor

--- puzzle-box/puzzle-box.ino
+++ puzzle-box/puzzle-box.ino
@@ -44,6 +44,10 @@

 // Temperature Sensor
 const int pinTemp = A3;
+int tempThreshold = 25;
+float temperature;
+int B = 3975;                         //  B Value of the Thermistor
+float resistance;

 void setup()
 {
@@ -81,6 +85,16 @@
     struct Color gcolor = game.getColor();
     lcd.setRGB(gcolor.r, gcolor.g, gcolor.b);
     delay(500);
+
+    //Temperature Sensor
+    int tempSensor = analogRead(pinTemp);
+    resistance=(float)(1023-tempSensor)*10000/tempSensor;                      // get resistance
+    temperature=1/(log(resistance/10000)/B+1/298.15)-273.15;     // calc temperature
+    if(temperature>tempThreshold)
+    {
+
+    }
+
 }

 /*********************************************************************************************************


Updated Limit functions

Updated Limit functions

--- FumeHoodMonitor/RTD.ino
+++ FumeHoodMonitor/RTD.ino
@@ -1,6 +1,8 @@
 #include <Adafruit_MAX31865.h> // Adafruit library for using the MAX31865 (RTD Amp)
 const int numRTDReadings = 10;
-const float maxRTDTemperature = 350.0; //Deg F
+static const float oilTempLow = 75.0; //Deg F
+static const float oilTempHigh = 80.0; //Deg F
+static const float oilTempOnFire = 85.0; //Deg F
 float RTDreadings[numRTDReadings];
 int RTDreadIndex = 0;
 float RTDtotal = 0;
@@ -36,10 +38,14 @@
   return tempF;
 }

-bool isFluidTempHigh() {
-  return readRTDTemp() > maxRTDTemperature;
+bool isOilTempLow(float tempF) {
+  return tempF <= oilTempLow;
 }

-bool isFluidTempHigh(float tempF){
-  return tempF > maxRTDTemperature;
+bool isOilTempHigh(float tempF){
+  return tempF >= oilTempHigh;
 }
+
+bool isOilTempOnFire(float tempF){
+  return tempF >= oilTempOnFire;
+}


Added delay

Added delay


Led-Schalt-Funktion entfernt

Led-Schalt-Funktion entfernt

--- source/SensorUnit/WebserverSensorUnit/WebserverSensorUnit.ino
+++ source/SensorUnit/WebserverSensorUnit/WebserverSensorUnit.ino
@@ -7,7 +7,7 @@
 #define Addr 0x40
 #define ALTITUDE 1260.0 //Höhe in Leysin
 #define AMPLITUDEPIN A0
-unsigned long previousMillis = 0;        // will store last time LED was updated
+unsigned long previousMillis = 0;
 const long interval = 1000;           // interval at which to Update the Sensor Variables (milliseconds)

 const char* ssid = "ssid";
@@ -108,7 +108,6 @@
   unsigned long currentMillis = millis();

   if (currentMillis - previousMillis >= interval) {
-    // save the last time you blinked the LED
     previousMillis = currentMillis;

 unsigned int data[2];
@@ -337,9 +336,6 @@
   ///////////////////////////
   String sResponse,sHeader;

-  ////////////////////////////
-  // 404 for non-matching path
-  ////////////////////////////

   ///////////////////////
   // format the html page
@@ -398,8 +394,6 @@
     sResponse += "m): ";
     sResponse += p0;
     sResponse += "hPa
";
-    sResponse += "Funktion 1 schaltet GPIO2 und erzeugt eine serielle Ausgabe.
";
-    sResponse += "
Funktion 1 <button>einschalten</button> <button>ausschalten</button>
";

     //////////////////////
@@ -408,14 +402,6 @@
     if (sCmd.length()>0) {
       // write received command to html page
       sResponse += "Kommando:" + sCmd + "
";
-
-      // switch GPIO
-      if(sCmd.indexOf("LEDOFF")>=0)      {
-        digitalWrite(2, 0);
-      }
-      else if(sCmd.indexOf("LEDON")>=0)      {
-        digitalWrite(2, 1);
-      }
     }

     sResponse += "";


LED blinks via our serial protocol.

LED blinks via our serial protocol.

--- Arduino/blink_on_serial/blink_on_serial.ino
+++ Arduino/blink_on_serial/blink_on_serial.ino
@@ -1,7 +1,13 @@
-int inByte = 0;         // incoming serial byte
+int led = 13;          // Internal LED / pin 13
+int inByte = 0;        // incoming serial byte
+int onMessage = 49;    // expected "on" message
+int offMessage = 48;   // expected "off" message

 void setup()
 {
+  // initialize the digital pin as an output.
+  pinMode(led, OUTPUT);
+
   // start serial port at 9600 bps:
   Serial.begin(9600);
   while (!Serial) {
@@ -18,6 +24,12 @@
   if (Serial.available() > 0) {
     // get incoming byte:
     inByte = Serial.read();
+    if(inByte == onMessage){
+      turnOn();
+    }
+    if(inByte == offMessage){
+      turnOff();
+    }
   }
 }

@@ -27,3 +39,11 @@
     delay(300);
   }
 }
+
+void turnOn() {
+  digitalWrite(led, HIGH);
+}
+
+void turnOff() {
+  digitalWrite(led, LOW);
+}


Added timer and ligth effects to make ganme entirely usable

--- Stecchino/Stecchino.ino
+++ Stecchino/Stecchino.ino
@@ -20,6 +20,7 @@
 #define FRAMES_PER_SECOND  120
 #define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
 #define SET_IDLE_MILLISECONDS 20000 // how many seconds at idle before moving to sleep?
+#define NUM_LEDS_PER_SECONDS 2 // how many LEDs are turned on every second when playing?

 // Variables used in CheckAccel() routine
 MPU6050 accelgyro;
@@ -33,7 +34,7 @@
 int a_forward_offset=0,a_sideway_offset=0,a_vertical_offset=0;

-unsigned long start_time=0, current_time=0, elapsed_milliseconds=0;
+unsigned long start_time=0, current_time=0, elapsed_time=0, record_time=0, previous_record_time=0;
 int i=0;

 CRGB leds[NUM_LEDS];  // Define the array of leds
@@ -88,6 +89,22 @@
 #define GAME_OVER_TRANSITION 1000 //duration of game over animation (ms)
 #define SLEEP_TRANSITION 2000 //duration of animation to sleep (ms)

+void LEDS_ON(int count, int record){
+    for (int i = NUM_LEDS; i >=0; i--) {
+      if (i<=NUM_LEDS-count){leds[i]=CRGB::Black;}
+      //else {leds[i]=CRGB::Green;}
+      else {leds[i]=CHSV(gHue, 255, 255);}
+      if (i==NUM_LEDS-record){leds[i]=CRGB::Red;}
+    }
+
+  // send the 'leds' array out to the actual LED strip
+  FastLED.show();
+  // insert a delay to keep the framerate modest
+  FastLED.delay(1000/FRAMES_PER_SECOND);
+  // do some periodic updates
+  EVERY_N_MILLISECONDS( 20 ) { gHue++; } // slowly cycle the "base color" through the rainbow
+}
+
 void LED(String pattern){
   if (pattern=="going_to_sleep"){
     digitalWrite(MOSFET_GATE,HIGH);
@@ -111,7 +128,7 @@
     }
   }

-   if (pattern=="play"){
+   if (pattern=="wahoo"){
     digitalWrite(MOSFET_GATE,HIGH);
     FastLED.setBrightness(HIGH_BRIGHTNESS);
     // Call the pattern function once, updating the 'leds' array
@@ -207,6 +224,15 @@
   }
 }

+void alloff() {
+  for (int i = NUM_LEDS; i >=0; i--) {
+    leds[i]=CRGB::Black;
+    delay(10);
+    FastLED.show();
+  }
+  //FastLED.show();
+}
+
 enum {Check_Battery,Wake_Up_Transition,Idle,Start_Play_Transition,Play,Wahoo,Game_Over_Transition, Sleep_Transition} condition=Idle;

 void loop() {
@@ -230,12 +256,19 @@
     break;

   case Start_Play_Transition:
-    if (millis()-start_time>START_PLAY_TRANSITION){condition=Play;start_time=millis();}
-    else {LED("start_play");}
+    //if (millis()-start_time>START_PLAY_TRANSITION){condition=Play;start_time=millis();previous_record_time=record_time;}
+    //else {LED("start_play");}
+    alloff();
+    condition=Play;
+    start_time=millis();
+    previous_record_time=record_time;
     break;

   case Play:
-    LED("play");
+    elapsed_time=(millis()-start_time)/1000;
+    if (elapsed_time>record_time){record_time=elapsed_time;}
+    if (elapsed_time>previous_record_time && elapsed_time<=previous_record_time+1 && previous_record_time !=0){LED("wahoo");}
+    else {LEDS_ON(NUM_LEDS_PER_SECONDS*int(elapsed_time),NUM_LEDS_PER_SECONDS*int(record_time));}
     if (accel_status=="fallen"){condition=Game_Over_Transition;start_time=millis();}
     break;


Resetting to previous version

Resetting to previous version

--- XV_Lidar_Controller.ino
+++ XV_Lidar_Controller.ino
@@ -1,38 +1,21 @@
 /*
   XV Lidar Controller v1.2.2
-<<<<<<< HEAD
-
-=======

->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
  Copyright 2014 James LeRoy getSurreal
  https://github.com/getSurreal/XV_Lidar_Controller
  http://www.getsurreal.com/products/xv-lidar-controller
-<<<<<<< HEAD
-
- Modified to add CRC checking - Doug Hilton, WD0UG November, 2015 mailto: six.speed (at) yahoo (dot) com
-
- See README for additional information
-
-=======

  See README for additional information

->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
  The F() macro in the Serial statements tells the compiler to keep your strings in PROGMEM
  */

-#include <TimerThree.h>              // used for ultrasonic PWM motor control
+#include <TimerThree.h> // used for ultrasonic PWM motor control
 #include <PID.h>
 #include <EEPROM.h>
 #include "EEPROMAnything.h"
 #include <SerialCommand.h>

-<<<<<<< HEAD
-const int SHOW_ALL_ANGLES = 360;     // value means 'display all angle data, 0..359'
-
-=======
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
 struct EEPROM_Config {
   byte id;
   char version[6];
@@ -49,36 +32,22 @@
   double Ki;
   double Kd;

-  boolean motor_enable;     // to spin the laser or not.  No data when not spinning
-  boolean raw_data;         // to retransmit the seiral data to the USB port
-  boolean show_dist;        // controlled by ShowDist and HideDist commands
-  boolean show_rpm;         // controlled by ShowRPM and HideRPM commands
+  boolean motor_enable;  // to spin the laser or not.  No data when not spinning
+  boolean raw_data;  // to retransmit the seiral data to the USB port
+  boolean show_dist;  //  controlled by ShowDist and HideDist commands
+  boolean show_rpm;  // controlled by ShowRPM and HideRPM commands
   unsigned int show_angle;  // controlled by ShowAngle (0 - 359, 360 shows all)
-}
+}
 xv_config;

-<<<<<<< HEAD
-/*
- * EEPROM_ID
- * Used to validate that the EEPROM is initialized
- * Important to increment the number anytime variables are added or removed
- *   or when the default values are changed
- */
-const byte EEPROM_ID = 0x05;
-=======
 const byte EEPROM_ID = 0x05;  // used to validate EEPROM initialized
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174

 double pwm_val = 500;  // start with ~50% power
 double pwm_last;
 double motor_rpm;
 unsigned long now;
 unsigned long motor_check_timer = millis();
-<<<<<<< HEAD
-unsigned long motor_check_interval = 200;
-=======
 unsigned long motor_check_interval = 200;
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
 unsigned int rpm_err_thresh = 10;  // 2 seconds (10 * 200ms) to shutdown motor with improper RPM and high voltage
 unsigned int rpm_err = 0;
 unsigned long curMillis;
@@ -87,12 +56,6 @@
 PID rpmPID(&motor_rpm, &pwm_val, &xv_config.rpm_setpoint, xv_config.Kp, xv_config.Ki, xv_config.Kd, DIRECT);

 uint8_t inByte = 0;  // incoming serial byte
-<<<<<<< HEAD
-uint8_t motor_rph_high_byte = 0;
-uint8_t motor_rph_low_byte = 0;
-uint16_t dist[N_DATA_QUADS] = {0, 0, 0, 0};   // thre are (4) distances, one for each data quad
-uint16_t quality[N_DATA_QUADS] = {0, 0, 0, 0}; // same with 'quality'
-=======
 uint16_t data_status = 0;
 uint16_t data_4deg_index = 0;
 uint16_t data_loop_index = 0;
@@ -100,7 +63,6 @@
 uint8_t motor_rph_low_byte = 0;
 uint8_t data0, data2;
 uint16_t dist, quality;
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
 uint16_t motor_rph = 0;
 uint16_t angle;

@@ -118,21 +80,9 @@

 void setup() {
   EEPROM_readAnything(0, xv_config);
-  if ( xv_config.id != EEPROM_ID) { // verify EEPROM values have been initialized
+  if( xv_config.id != EEPROM_ID) { // verify EEPROM values have been initialized
     initEEPROM();
   }
-<<<<<<< HEAD
-  pinMode(xv_config.motor_pwm_pin, OUTPUT);
-  Serial.begin(115200);                      // USB serial
-  Serial1.begin(115200);                     // XV LDS data
-
-  /*
-   *   Timer3.initialize(30)
-   *   sets PWM frequency to 32.768kHz for quite ultrasonic motor control
-   *   PWM duty cycle is 0-1023
-   */
-  Timer3.initialize(30);
-=======
   pinMode(xv_config.motor_pwm_pin, OUTPUT);
   Serial.begin(115200);  // USB serial
   #if defined(__AVR_ATmega32U4__) && defined(CORE_TEENSY) // if Teensy 2.0
@@ -144,85 +94,17 @@
   #endif

   Timer3.initialize(30); // set PWM frequency to 32.768kHz
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
-
-  rpmPID.SetOutputLimits(xv_config.pwm_min, xv_config.pwm_max);
+
+  rpmPID.SetOutputLimits(xv_config.pwm_min,xv_config.pwm_max);
   rpmPID.SetSampleTime(xv_config.sample_time);
   rpmPID.SetTunings(xv_config.Kp, xv_config.Ki, xv_config.Kd);
   rpmPID.SetMode(AUTOMATIC);

   initSerialCommands();
   pinMode(ledPin, OUTPUT);
-<<<<<<< HEAD
-
-  eState = eState_Find_COMMAND;
-  for (ixPacket = 0; ixPacket < PACKET_LENGTH; ixPacket++)  // Initialize
-    Packet[ixPacket] = 0;
-  ixPacket = 0;
-=======
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
 }

 void loop() {
-<<<<<<< HEAD
-  boolean bPacketOkay;                            // true = packet is okay (CRC valid)
-  sCmd.readSerial();  // check for incoming serial commands
-  if (Serial1.available() > 0) {                  // read byte from LIDAR and relay to USB
-    inByte = Serial1.read();                      // get incoming byte:
-    if (xv_config.raw_data)
-      Serial.print(inByte, BYTE);                 // relay
-    // Switch, based on 'eState':
-    // State 1: We're scanning for 0xFA (COMMAND) in the input stream
-    // State 2: Build a complete data packet
-    if (eState == eState_Find_COMMAND) {          // flush input until we get COMMAND byte
-      if (inByte == COMMAND) {
-        eState++;                                 // switch to 'build a packet' state
-        Packet[ixPacket++] = inByte;              // store 1st byte of data into 'Packet'
-      }
-    }
-    else {                                        // eState == eState_Build_Packet
-      Packet[ixPacket++] = inByte;                // keep storing input into 'Packet'
-      if (ixPacket == PACKET_LENGTH) {            // we've got all the input bytes, so we're done building this packet
-        bPacketOkay = (eValidatePacket() == 0);   // Check packet CRC
-        startingAngle = processIndex(bPacketOkay);   // get the starting angle of this group (of 4)
-        processSpeed(bPacketOkay);                // process the speed
-        // process each of the (4) sets of data in the packet
-        for (int ix = 0; ix < N_DATA_QUADS; ix++) // process the distance
-          processDistance(bPacketOkay, ix);
-        for (int ix = 0; ix < N_DATA_QUADS; ix++) // process the signal strength (quality)
-          processSignalStrength(bPacketOkay, ix);
-        if (bPacketOkay) {
-          if (xv_config.show_dist) {              // show distance command is active
-            if (xv_config.show_angle == SHOW_ALL_ANGLES
-                || (xv_config.show_angle >= startingAngle && xv_config.show_angle < startingAngle + N_DATA_QUADS)) {
-              for (int ix = 0; ix < N_DATA_QUADS; ix++) {
-                if ((xv_config.show_angle == SHOW_ALL_ANGLES)
-                    || (xv_config.show_angle == startingAngle + ix)) {
-                  Serial.print(startingAngle + ix);
-                  Serial.print(F(": "));
-                  Serial.print(int(dist[ix]));
-                  Serial.print(F(" ("));
-                  Serial.print(quality[ix]);
-                  Serial.println(F(")"));
-                }
-              }  // or (int ix = 0; ix < N_DATA_QUADS; ix++)
-            }  // if (xv_config.show_angle == SHOW_ALL_ANGLES ...
-          }  // if (xv_config.show_dist)
-        }  // if (bPacketOkay)
-        // initialize a bunch of stuff before we switch back to State 1
-        for (int ix = 0; ix < N_DATA_QUADS; ix++) {
-          dist[ix] = 0;
-          quality[ix] = 0;
-        }
-        for (ixPacket = 0; ixPacket < PACKET_LENGTH; ixPacket++)  // clear out this packet
-          Packet[ixPacket] = 0;
-        ixPacket = 0;
-        eState = eState_Find_COMMAND;                // This packet is done -- look for next COMMAND byte
-      }  // if (ixPacket == PACKET_LENGTH)
-    }  // if (eState == eState_Find_COMMAND)
-  }  // if (Serial1.available() > 0)
-  if (xv_config.motor_enable) {
-=======

   sCmd.readSerial();  // check for incoming serial commands

@@ -236,41 +118,12 @@
   }

   if (xv_config.motor_enable) {
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
     rpmPID.Compute();
     if (pwm_val != pwm_last) {
       Timer3.pwm(xv_config.motor_pwm_pin, pwm_val);  // replacement for analogWrite()
       pwm_last = pwm_val;
     }
     motorCheck();
-<<<<<<< HEAD
-<<<<<<< HEAD
-  }  // if (xv_config.motor_enable)
-}  // loop
-/*
- * processIndex - Process the packet element 'index'
- * index is the index byte in the 90 packets, going from A0 (packet 0, readings 0 to 3) to F9
- *    (packet 89, readings 356 to 359).
- * Enter with: bValidData = true if packet is okay (good CRC)
- * Uses:       Packet
- *             ledState gets toggled if angle = 0
- *             ledPin = which pin the LED is connected to
- *             ledState = LED on or off
- *             xv_config.show_dist = true if we're supposed to show distance
- *             curMillis = milliseconds, now
- *             lastMillis = milliseconds, last time through this subroutine
- * Calls:      digitalWrite() - used to toggle LED pin
- *             Serial.print
- * Returns:    The first angle (of 4) in the current 'index' group
- */
-uint16_t processIndex(boolean bValidData) {
-  uint16_t angle = 0;
-  if (bValidData) {
-    uint16_t data_4deg_index = Packet[OFFSET_TO_INDEX] - INDEX_LO;
-    angle = data_4deg_index * N_DATA_QUADS;     // 1st angle in the set of 4
-=======
-=======
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
   }
 }

@@ -320,48 +173,16 @@
   case 1: // 4 degree index
     data_4deg_index = inByte - 0xA0;
     angle = data_4deg_index * 4;  // 1st angle in the set of 4
-<<<<<<< HEAD
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
-=======
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
     if (angle == 0) {
       if (ledState) {
         ledState = LOW;
-      }
+      }
       else {
         ledState = HIGH;
       }
       digitalWrite(ledPin, ledState);
       if (xv_config.show_dist) {
         curMillis = millis();
-<<<<<<< HEAD
-        if (xv_config.show_angle == SHOW_ALL_ANGLES) {
-          /*
-          Serial.print(F("Time Interval: "));
-          Serial.println(curMillis - lastMillis);
-          */
-        }
-        lastMillis = curMillis;
-      }
-    } // if (angle == 0)
-  }  // if (bValidData)
-  return angle;
-}
-/*
- * processSpeed- Process the packet element 'speed'
- * speed is two-bytes of information, little-endian. It represents the speed, in 64th of RPM (aka value
- *    in RPM represented in fixed point, with 6 bits used for the decimal part).
- * Enter with: bValidData = true if packet is okay (good CRC)
- * Uses:       Packet
- *             angle = if 0 then enable display of RPM and PWM
- *             xv_config.show_rpm = true if we're supposed to display RPM and PWM
- * Calls:      Serial.print
- */
-void processSpeed(boolean bValidData) {
-  if (bValidData) {
-    motor_rph_low_byte = Packet[OFFSET_TO_SPEED_LSB];
-    motor_rph_high_byte = Packet[OFFSET_TO_SPEED_MSB];
-=======
         Serial.print(F("Time Interval: "));
         Serial.println(curMillis - lastMillis);
         lastMillis = curMillis;
@@ -377,104 +198,14 @@

   case 3: // speed in RPH high byte
     motor_rph_high_byte = inByte;
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
     motor_rph = (motor_rph_high_byte << 8) | motor_rph_low_byte;
     motor_rpm = float( (motor_rph_high_byte << 8) | motor_rph_low_byte ) / 64.0;
     if (xv_config.show_rpm and angle == 0) {
       Serial.print(F("RPM: "));
       Serial.print(motor_rpm);
-      Serial.print(F("  PWM: "));
+      Serial.print(F("  PWM: "));
       Serial.println(pwm_val);
     }
-<<<<<<< HEAD
-  }  // if (bValidData)
-}
-/*
- * Data 0 to Data 3 are the 4 readings. Each one is 4 bytes long, and organized as follows :
- *   byte 0 : <distance 7:0>
- *   byte 1 : <"invalid data" flag> <"strength warning" flag> <distance 13:8>
- *   byte 2 : <signal strength 7:0>
- *   byte 3 : <signal strength 15:8>
- */
-/*
- * processDistance- Process the packet element 'distance'
- * Enter with: bValidData = true if packet is okay (good CRC)
- *             iQuad = which one of the (4) readings to process, value = 0..3
- * Uses:       Packet
- *             dist[] = distance to object
- * Calls:      N/A
- */
-void processDistance(boolean bValidData, int iQuad) {
-  uint8_t dataL, dataM;
-  dist[iQuad] = 0;                       // initialize
-  if (bValidData) {
-    int iOffset = (iQuad * N_DATA_QUADS) + OFFSET_TO_4_DATA_READINGS + OFFSET_DATA_DISTANCE_LSB;
-    // byte 0 : <distance 7:0>
-    // byte 1 : <"invalid data" flag> <"strength warning" flag> <distance 13:8>
-    dataL = Packet[iOffset];             // first half of distance data
-    dataM = Packet[iOffset + 1];         // get MSB of distance data + flags
-    if ((dataM & 0x80) == 0)             // check for Invalid Flag
-      dist[iQuad] = dataL | ((dataM & 0x3F) << 8);
-  }  // if (bValidData)
-}
-/*
- * processSignalStrength- Process the packet element 'signal strength'
- * Enter with: bValidData = true if packet is okay (good CRC)
- *             iQuad = which one of the (4) readings to process, value = 0..3
- * Uses:       Packet
- *             quality[] = signal quality
- * Calls:      N/A
- */
-void processSignalStrength(boolean bValidData, int iQuad) {
-  uint8_t dataL, dataM;
-  quality[iQuad] = 0;                        // initialize
-  if (bValidData) {
-    int iOffset = (iQuad * N_DATA_QUADS) + OFFSET_TO_4_DATA_READINGS + OFFSET_DATA_SIGNAL_LSB;
-    dataL = Packet[iOffset];                  // signal strength LSB
-    dataM = Packet[iOffset + 1];
-    quality[iQuad] = dataL | (dataM << 8);
-  }  // if (bValidData)
-}
-
-/*
- * eValidatePacket - Validate 'Packet'
- * Enter with: 'Packet' is ready to check
- * Uses:       CalcCRC
- * Exits with: 0 = Packet is okay
- * Error:      non-zero = Packet is no good
- */
-byte eValidatePacket() {
-  unsigned long chk32;
-  unsigned long checksum;
-  const int bytesToCheck = PACKET_LENGTH - 2;
-  const int CalcCRC_Len = bytesToCheck / 2;
-  unsigned int CalcCRC[CalcCRC_Len];
-
-  byte b1a, b1b, b2a, b2b;
-  int ix;
-
-  for (int ix = 0; ix < CalcCRC_Len; ix++)       // initialize 'CalcCRC' array
-    CalcCRC[ix] = 0;
-
-  // Perform checksum validity test
-  for (ix = 0; ix < bytesToCheck; ix += 2)      // build 'CalcCRC' array
-    CalcCRC[ix / 2] = Packet[ix] + ((Packet[ix + 1]) << 8);
-
-  chk32 = 0;
-  for (ix = 0; ix < CalcCRC_Len; ix++)
-    chk32 = (chk32 << 1) + CalcCRC[ix];
-  checksum = (chk32 & 0x7FFF) + (chk32 >> 15);
-  checksum &= 0x7FFF;
-
-  b1a = checksum & 0xFF;
-  b1b = Packet[OFFSET_TO_CRC_L];
-  b2a = checksum >> 8;
-  b2b = Packet[OFFSET_TO_CRC_M];
-  if ((b1a == b1b) && (b2a == b2b))
-    return 0;                                  // okay
-  else
-    return 1;                                  // non-zero = bad CRC
-=======
     break;

   case 4:
@@ -607,17 +338,12 @@
   default: // others do checksum
     break;
   }
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
 }

 void initEEPROM() {
   xv_config.id = 0x05;
   strcpy(xv_config.version, "1.2.2");
-<<<<<<< HEAD
-  xv_config.motor_pwm_pin = 9;   // pin connected N-Channel Mosfet  (only pin controlled with Timer3)
-=======
   xv_config.motor_pwm_pin = 9;  // pin connected N-Channel Mosfet
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174

   xv_config.rpm_setpoint = 300;  // desired RPM
   xv_config.rpm_min = 200;
@@ -639,12 +365,11 @@
 }

 void initSerialCommands() {
-  sCmd.addCommand("Help",        help);
-  sCmd.addCommand("help",        help);
+  sCmd.addCommand("help",       help);
+  sCmd.addCommand("Help",       help);
   sCmd.addCommand("ShowConfig",  showConfig);
-  sCmd.addCommand("show",  show);
-  sCmd.addCommand("SaveConfig",  saveConfig);
-  sCmd.addCommand("ResetConfig", initEEPROM);
+  sCmd.addCommand("SaveConfig", saveConfig);
+  sCmd.addCommand("ResetConfig",initEEPROM);

   sCmd.addCommand("SetRPM",        setRPM);
   sCmd.addCommand("SetKp",         setKp);
@@ -652,24 +377,15 @@
   sCmd.addCommand("SetKd",         setKd);
   sCmd.addCommand("SetSampleTime", setSampleTime);

-  sCmd.addCommand("ShowRPM",   showRPM);
-  sCmd.addCommand("HideRPM",   hideRPM);
+  sCmd.addCommand("ShowRPM",  showRPM);
+  sCmd.addCommand("HideRPM",  hideRPM);
   sCmd.addCommand("ShowDist",  showDist);
   sCmd.addCommand("HideDist",  hideDist);
-<<<<<<< HEAD
-  sCmd.addCommand("ShowAngle", showAngle);
-  sCmd.addCommand("HideAngle", hideDist);
-  sCmd.addCommand("MotorOff",  motorOff);
-  sCmd.addCommand("MotorOn",   motorOn);
-  sCmd.addCommand("HideRaw",   hideRaw);
-  sCmd.addCommand("ShowRaw",   showRaw);
-=======
   sCmd.addCommand("ShowAngle",  showAngle);
   sCmd.addCommand("MotorOff", motorOff);
   sCmd.addCommand("MotorOn",  motorOn);
   sCmd.addCommand("HideRaw", hideRaw);
   sCmd.addCommand("ShowRaw",  showRaw);
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
 }

 void showRPM() {
@@ -706,48 +422,8 @@
   Serial.println(F(" "));
 }

-void show() {
-  boolean syntax_error = false;
-
-  String arg1 = sCmd.next();  // 1st argument
-  if (arg1 != "") {
-    /*
-     * show rpm
-     */
-    if (arg1 == "rpm") {
-      String arg2 = sCmd.next();
-      if (arg2 != "") {
-        syntax_error = true;  // should not be any more arguements for rpm
-      }
-      else {
-        xv_config.show_rpm = true;
-        if (xv_config.raw_data == true) {
-          hideRaw();
-        }
-        Serial.println(F(" "));
-        Serial.print(F("Showing RPM data"));
-        Serial.println(F(" "));
-      }
-    }
-    /*
-     * no matching commands
-     */
-    else {
-      syntax_error = true;
-    }
-  } // if (arg != NULL)
-  else {
-    syntax_error = true;  // no arguments passed
-  }
-  if (syntax_error) {
-    Serial.println(F(" "));
-    Serial.print(F("Invalid Command"));
-    Serial.println(F(" "));
-  }
-}
-
 void showAngle() {
-  showDist();
+  showDist();
   double sVal = 0.0;
   char *arg;
   boolean syntax_error = false;
@@ -770,7 +446,7 @@

   if (syntax_error) {
     Serial.println(F(" "));
-    Serial.print(F("Incorrect syntax.  Example: ShowAngle 0 (0 - 359 or 360 for all)"));
+    Serial.print(F("Incorrect syntax.  Example: ShowAngle 0 (0 - 359 or 360 for all)"));
     Serial.println(F(" "));
   }
   else {
@@ -801,11 +477,7 @@

 void motorCheck() {  // Make sure the motor RPMs are good else shut it down
   now = millis();
-<<<<<<< HEAD
-  if (now - motor_check_timer > motor_check_interval) {
-=======
   if (now - motor_check_timer > motor_check_interval){
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
     if ((motor_rpm < xv_config.rpm_min or motor_rpm > xv_config.rpm_max) and pwm_val > 1000) {
       rpm_err++;
     }
@@ -813,11 +485,7 @@
       rpm_err = 0;
     }
     if (rpm_err > rpm_err_thresh) {
-<<<<<<< HEAD
-      motorOff();
-=======
       motorOff();
->>>>>>> 9423c3c07ba8665de06a1a0f3cdad7d726b30174
       ledState = LOW;
       digitalWrite(ledPin, ledState);
     }
@@ -875,7 +543,7 @@

   if (syntax_error) {
     Serial.println(F(" "));
-    Serial.print(F("Incorrect syntax.  Example: SetRPM 300"));
+    Serial.print(F("Incorrect syntax.  Example: SetRPM 300"));
     Serial.println(F(" "));
   }
   else {
@@ -909,7 +577,7 @@

   if (syntax_error) {
     Serial.println(F(" "));
-    Serial.print(F("Incorrect syntax.  Example: SetKp 1.0"));
+    Serial.print(F("Incorrect syntax.  Example: SetKp 1.0"));
     Serial.println(F(" "));
   }
   else {
@@ -942,13 +610,13 @@

   if (syntax_error) {
     Serial.println(F(" "));
-    Serial.print(F("Incorrect syntax.  Example: SetKi 0.5"));
+    Serial.print(F("Incorrect syntax.  Example: SetKi 0.5"));
     Serial.println(F(" "));
   }
   else {
     Serial.println(F(" "));
     Serial.print(F("Setting Ki to: "));
-    Serial.println(sVal);
+    Serial.println(sVal);
     Serial.println(F(" "));
     xv_config.Ki = sVal;
     rpmPID.SetTunings(xv_config.Kp, xv_config.Ki, xv_config.Kd);
@@ -975,13 +643,13 @@

   if (syntax_error) {
     Serial.println(F(" "));
-    Serial.print(F("Incorrect syntax.  Example: SetKd 0.001"));
+    Serial.print(F("Incorrect syntax.  Example: SetKd 0.001"));
     Serial.println(F(" "));
   }
   else {
     Serial.println(F(" "));
     Serial.print(F("Setting Kd to: "));
-    Serial.println(sVal);
+    Serial.println(sVal);
     Serial.println(F(" "));
     xv_config.Kd = sVal;
     rpmPID.SetTunings(xv_config.Kp, xv_config.Ki, xv_config.Kd);
@@ -1008,13 +676,13 @@

   if (syntax_error) {
     Serial.println(F(" "));
-    Serial.print(F("Incorrect syntax.  Example: SetSampleTime 20"));
+    Serial.print(F("Incorrect syntax.  Example: SetSampleTime 20"));
     Serial.println(F(" "));
   }
   else {
     Serial.println(F(" "));
     Serial.print(F("Setting Sample time to: "));
-    Serial.println(sVal);
+    Serial.println(sVal);
     Serial.println(F(" "));
     xv_config.sample_time = sVal;
     rpmPID.SetSampleTime(xv_config.sample_time);


Basic scanning

Basic scanning

Note that when approaching the frequency that a receiver is listening on
you need to get very close to be received, 1597 is received by a
listener on 1600. However when sweeping through the frequencies the
listener hangs onto the signal up to 1622.

--- examples/RF12/RF12tune/RF12tune.ino
+++ examples/RF12/RF12tune/RF12tune.ino
@@ -8,7 +8,18 @@
 #include <JeeLib.h>
 #include <util/crc16.h>
 #include <avr/eeprom.h>
-//#include <avr/pgmspace.h>
+#define ACK_TIME   20  // number of milliseconds to wait for an ack
+#define RETRY_LIMIT 9  // maximum number of times to retry
+#define RADIO_SYNC_MODE 2
+
+char importedConfig[] =
+///
+/// Highlight the string below and paste in the value obtained from the RF12Demo "0j" command.
+   "B4D4C66D54206932302A206732313220403836382E32323530204D487A00690C";  // C T i20* g212 @868.2250 MHz
+//   "B4D4C64054206932302A206732313220403836382E30303030204D487A00A4F4";  // C T i20* g212 @868.0000 MHz
+//   "94D4C6405420693230206732313220403836382E30303030204D487A0000FCE4";  // C T i20 g212 @868.0000 MHz
+////0....5....10...5....20...5....30...5....40...5....50...5....60..
+///

 /// @details
 /// eeprom layout details
@@ -57,12 +68,6 @@
 #else
 #define SERIAL_BAUD 57600
 #endif
-char importedConfig[] =
-///
-/// Highlight the string below and paste in the value obtained from the RF12Demo "0j" command.
-   "B4D4C66D54206932302A206732313220403836382E32323530204D487A00690C";
-////0....5....10...5....20...5....30...5....40...5....50...5....60..
-///
 byte h, w;

 void setup() {
@@ -72,6 +77,7 @@
 }

 void loop() {
+  unsigned int scan;
   for (byte i = 0; i < (RF12_EEPROM_SIZE * 2); i+=2 ) {
     w = ChkHex(importedConfig[i]);
     if (w) h = (w << 4);         // Move into high nibble
@@ -84,7 +90,7 @@
 //    Serial.print(h, HEX);
   }
  Serial.println();
- Serial.println(config.crc, HEX);
+// Serial.println(config.crc, HEX);

 ///   for (byte i = 0; i < sizeof RF12_EEPROM_SIZE - 2; ++i)
 ///    config.crc = _crc16_update(config.crc, ((byte*) &config)[i]);
@@ -98,15 +104,59 @@

     Serial.println(config.msg);
-    Serial.println(config.crc, HEX);
+    showNibble(config.crc >> 12);
+    showNibble(config.crc >> 8);
+    showNibble(config.crc >> 4);
+    showNibble(config.crc);

     if (rf12_config()) Serial.println("Config Initialized");

     frequency = (config.ee_frequency_hi << 8) + config.ee_frequency_lo;              // Loose flag nibble to get frequency high order
-    Serial.println(frequency);
-
+  for (scan = (frequency - 50); scan < (frequency + 50); ++scan)
+  {
+   rf12_control(0xA000 + scan);
+   Serial.print("Sending ");
+   Serial.println(scan);
+   delay(50);
+   byte acked = probe();
+   if (acked){
+     Serial.print("Received ");
+     Serial.println(scan);
+   }
+      else {
+        Serial.print("No Ack ");
+        Serial.println(scan);
+      }
+  }
  delay(32767);
+}
+
+static byte probe()
+  {
+      for (byte i = 0; i < RETRY_LIMIT; ++i)
+      {
+        while (!rf12_canSend())
+        rf12_recvDone();
+        rf12_sendStart(RF12_HDR_ACK, &config, sizeof config, RADIO_SYNC_MODE);
+        byte acked = waitForAck();
+        if (acked) {
+          return 1;
+        }
+      }
+    return 0;
+  }
+
+// wait a few milliseconds for proper ACK to me, return true if indeed received
+static byte waitForAck() {
+    MilliTimer ackTimer;
+    while (!ackTimer.poll(ACK_TIME)) {
+        if (rf12_recvDone() && rf12_crc == 0 &&
+                // see http://talk.jeelabs.net/topic/811#post-4712
+                rf12_hdr == (RF12_HDR_DST | RF12_HDR_CTL | (config.nodeId & 0x1F)))
+            return 1;
+    }
+    return 0;
 }
 static char ChkHex(char c) {
   if ((c > 64) && (c < 71)) return (c + 9);    // "A" to "F"


Erase and GO

Erase and GO

--- _4DSystemDispalyBare/_4DSystemDispalyBare.ino
+++ _4DSystemDispalyBare/_4DSystemDispalyBare.ino
@@ -6,6 +6,8 @@
  //Display.gfx_MoveTo(30, 30);

 #include <stdio.h>
+
+//#define DEBUG

 #define DisplaySerial Serial1
 #define HWLOGGING Serial // Serial port for debugging
@@ -31,8 +33,8 @@
 int coladd = 0;
 unsigned int num = 0;

-int commands[100];
-int duration[100];
+unsigned int commands[100];
+unsigned int duration[100];

 int index;
 void setup()
@@ -58,9 +60,14 @@
 #define ROTATE_STATE 2
 #define GO_STATE 3
 #define ERASE_STATE 4
+#define KEYBOARD_STATE 5

 #define MOVE 1
-
+#define ROTATE_LEFT 2
+#define ROTATE_RIGHT 3
+#define SHOOT 4
+
+int current_command = 0;
 int state = INIT_STATE;
 void loop()
 {
@@ -77,7 +84,9 @@
     do {} while (Display.touch_Get(TOUCH_STATUS) != TOUCH_PRESSED);
     x = Display.touch_Get(TOUCH_GETX);                          // so we can get the first point
     y = Display.touch_Get(TOUCH_GETY);
-    debugCoordinates();
+#if defined DEBUG
+   debugCoordinates();
+#endif
     HWLOGGING.print("X=");
     HWLOGGING.print(x);
     HWLOGGING.print("; Y=");
@@ -90,35 +99,35 @@
         {
           HWLOGGING.print("MOVE");
           drawButton("MOVE", 0, 1,BUTTON_DOWN);
-          state = MOVE_STATE;
-          drawMoveScreen();
+          current_command = MOVE;
+          state = KEYBOARD_STATE;
+          drawKeyboardScreen();
         }else if (insideRegion(0, 2, x, y, BUTTON_W)) // ROTATE
         {
            HWLOGGING.print("ROTATE");
            state = ROTATE_STATE;
-           //drawButton("ROTATE", 0, 2, BUTTON_DOWN);
            drawRotateScreen();
         }else if (insideRegion(0, 3, x, y, BUTTON_W)) // SHOOT
         {
           HWLOGGING.print("SHOOT");
           drawButton("SHOOT", 0, 3, BUTTON_DOWN);
+          current_command = SHOOT;
+          state = KEYBOARD_STATE;
+          drawKeyboardScreen();
         }else if (insideRegion(0, 5, x, y, BUTTON_W)) // GO
         {
           state = GO_STATE;
           HWLOGGING.print("GO");
           go();
-          drawButton("GO", 0, 5, BUTTON_DOWN);
         }else if (insideRegion(0, 6, x, y, BUTTON_W)) // ERASE
         {
-          //state = ERASE_STATE;
-          state = INIT_STATE;
+          state = ERASE_STATE;
           HWLOGGING.print("ERASE");
-          drawButton("ERASE", 0, 6, BUTTON_DOWN);
-          index = 0;
+          drawEraseScreen();
         }
         break;

-      case MOVE_STATE:
+      case KEYBOARD_STATE:
         if(insideRegion(0+coladd, 1+rowadd, x, y, BUTTON_SMALL_W)) // 1
         {
           add(1);
@@ -153,7 +162,8 @@
         }
         else if(insideRegion(0, OK_BUTTON_ROW, x, y, BUTTON_W)) // OK
         {
-          addCommand(MOVE);
+          //addCommand(MOVE);
+          addCommand(current_command);
           state = INIT_STATE;
           drawInitialScreen();
         }
@@ -164,26 +174,51 @@
 //          drawInitialScreen();
 //        }
       break;
+
       case ROTATE_STATE:
-      if(insideRegion(0, 1, x, y, BUTTON_W)) // LEFT
-        {
-           HWLOGGING.print("Left");
-        }else if (insideRegion(0, 2, x, y, BUTTON_W)) // RIGHT
-        {
-           HWLOGGING.print("Right");
-
-        }else if(insideRegion(0, OK_BUTTON_ROW, x, y, BUTTON_W)) // OK
+        if(insideRegion(0, 1, x, y, BUTTON_W)) // LEFT
+          {
+             current_command = ROTATE_LEFT;
+             HWLOGGING.print("Left");
+             state = KEYBOARD_STATE;
+             drawKeyboardScreen();
+          }else if (insideRegion(0, 2, x, y, BUTTON_W)) // RIGHT
+          {
+            current_command = ROTATE_RIGHT;
+            HWLOGGING.print("Right");
+            state = KEYBOARD_STATE;
+            drawKeyboardScreen();
+          }else if(insideRegion(0, OK_BUTTON_ROW, x, y, BUTTON_W)) // OK
+          {
+            state = INIT_STATE;
+            drawInitialScreen();
+          }
+  //        } else if(insideRegion(1, 10, x, y, BUTTON_W)) // OK
+  //        {
+  //          //TODO: Save
+  //          state = INIT_STATE;
+  //          drawInitialScreen();
+  //        }
+     break;
+     case GO_STATE:
+        if (insideRegion(0, OK_BUTTON_ROW, x, y, BUTTON_W)) // GO
         {
           state = INIT_STATE;
           drawInitialScreen();
         }
-//        } else if(insideRegion(1, 10, x, y, BUTTON_W)) // OK
-//        {
-//          //TODO: Save
-//          state = INIT_STATE;
-//          drawInitialScreen();
-//        }
-      break;
+     break;
+     case ERASE_STATE:
+       if (insideRegion(0, 5, x, y, BUTTON_W)) // BACK
+        {
+          state = INIT_STATE;
+          drawInitialScreen();
+        }else if (insideRegion(0, 6, x, y, BUTTON_W)) // ERASE
+        {
+          state = INIT_STATE;
+          drawInitialScreen();
+          index = 0;
+        }
+     break;
     }

@@ -197,6 +232,7 @@
   commands[index] = type;
   duration[index] = num;
   index++;
+  num = 0;
 }

 void add(int n)
@@ -213,10 +249,11 @@
   int y1 = BUTTON_H * position_y;
   int x2 = PADDING * (position_x + 1) + button_width * (position_x + 1);
   int y2 = PADDING * (position_y + 1) + (BUTTON_H - 12) * (position_y + 1);
+#if defined DEBUG
   Display.gfx_Rectangle(x1, y1, x2, y2, RED);
   Display.gfx_Rectangle(x1, y1,x1+5,y1+5, WHITE);
-
   Display.gfx_PutPixel(x, y, PINK);
+#endif

   if(x < x1 || x > x2) return false;
   if(y < y1 || y > y2) return false;
@@ -225,23 +262,13 @@

 void drawNumber()
 {
-    str = String(num);
+  str = String(num);
   str.toCharArray(cstr,16);
-// Display.gfx_MoveTo(50,100);
-   Display.txt_MoveCursor(0,2);
-//  Display.txt_MoveCursor(1, 0);
-//  Display.txt_FontID(FONT1);
-//    Display.putstr(cstr) ;
-//  Display.txt_MoveCursor(2, 0);
-//  Display.txt_FontID(FONT2);
-//    Display.putstr(cstr) ;
-//  Display.txt_MoveCursor(3, 0);
   Display.txt_Width(TEXTWIDTH);
   Display.txt_Height(TEXTHEIGHT);
   Display.txt_FontID(FONT3);
-
+  Display.txt_MoveCursor(0,2);
   Display.putstr(cstr) ;
-//   Display.gfx_MoveTo(0,0);
 }

 void printint(int val)
@@ -262,7 +289,14 @@
   drawButton("ERASE",  0, 6, BUTTON_UP);
 }

-void drawMoveScreen()
+void drawEraseScreen()
+{
+  Display.gfx_Cls();
+  drawButton("BACK",   0, 5, BUTTON_UP);
+  drawButton("ERASE",  0, 6, BUTTON_UP);
+}
+
+void drawKeyboardScreen()
 {
   num =0;
   add(0);
@@ -348,20 +382,45 @@
 {
   //TODO:go
   Display.gfx_Cls();
-  for (int i=0; i!= index;i++)
+  drawButton("GO", 0, OK_BUTTON_ROW, BUTTON_DOWN);
+  for (int i=0; i!= index; i++)
   {
-    Display.txt_MoveCursor(i,0);
+    Display.txt_MoveCursor(i, 0);
     printCommand(i, commands[i], duration[i]);
+
+    switch(commands[i])
+    {
+      case MOVE:
+//          motors();
+          break;
+      case SHOOT:
+          break;
+    }
   }
 }

-void printCommand(int i, int command, int duration)
+void printCommand(int i,unsigned int command, unsigned int duration)
 {
   Display.txt_Width(2);
   Display.txt_Height(2);
   Display.txt_FontID(FONT3);
-  String c = "Move";
-  c=i+" "+c+" "+duration;
+  String c = commandName(command);
+  c=String(i)+" "+c+" "+duration;
   c.toCharArray(cstr,16);
   Display.putstr(cstr);
 }
+
+String commandName(unsigned int command)
+{
+  switch(command)
+  {
+    case MOVE:
+      return "MOVE";
+    case ROTATE_LEFT:
+      return "LEFT";
+    case ROTATE_RIGHT:
+      return "RIGHT";
+    case SHOOT:
+      return "SHOOT";
+  }
+}


Fixed critical bug that caused clock to stop after one second

--- stop_clock/stop_clock.ino
+++ stop_clock/stop_clock.ino
@@ -335,7 +335,6 @@
       }

-      if (t < 60)
       if (t < 3600)
       {
         // display mins and secs


Grammar correction

Grammar correction

--- usermods/Wemos_D1_mini+Wemos32_mini_shield/wled06_usermod.ino
+++ usermods/Wemos_D1_mini+Wemos32_mini_shield/wled06_usermod.ino
@@ -31,7 +31,7 @@
 // --> Second choise of cheap I2C OLED 128X64 0.96" or 1.3"
 //U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(U8X8_PIN_NONE, U8X8_PIN_SCL, U8X8_PIN_SDA); // Pins are Reset, SCL, SDA
 // --> Third choise of Heltec WiFi-Kit-8 OLED 128X32 0.91"
-//U8X8_SSD1306_128X32_UNIVISION_HW_I2C u8x8(U8X8_PIN_RESET, U8X8_PIN_SCL, U8X8_PIN_SDA); // Constracor for Heltec WiFi-Kit-8
+//U8X8_SSD1306_128X32_UNIVISION_HW_I2C u8x8(U8X8_PIN_RESET, U8X8_PIN_SCL, U8X8_PIN_SDA); // Constructor for Heltec WiFi-Kit-8
 // gets called once at boot. Do all initialization that doesn't depend on
 // network here
 void userSetup() {


EMG basic movements xBee 2.0 fail 1

EMG basic movements xBee 2.0 fail 1

--- XBee_rob_function_2.0/xBee_2.0/xBee_2.0.ino
+++ XBee_rob_function_2.0/xBee_2.0/xBee_2.0.ino
@@ -43,6 +43,7 @@
   Serial1.begin(115200);

   Serial.flush();                                       // Clear the serial buffer of garbage data before running the code.
+  Serial1.flush();
   mySerial.begin(SERVO_SET_Baudrate);                   // We now need to set Ardiuno to the new Baudrate speed 115200
   //Serial.begin(SERVO_SET_Baudrate);                     // Start serial communication on baudrate 57600
   Dynamixel.begin(mySerial);                            // Calling mySerial function which sets 10 pin as the 2nd RX serial pin, and sets pin 11 as the 2nd TX serial pin
@@ -72,14 +73,35 @@

 void loop() {
   actualName();
-  if (Serial1.read(emg1) < 70) {
-    Dynamixel.performMovement(2148, 2048, 2048, CLOSE);   //"Initial" position
-    delay(1500);
-  }else{
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  //if (Serial1.read(emg1) < 70) {
+    //Dynamixel.performMovement(2148, 2048, 2048, CLOSE);   //"Initial" position
+    //delay(1500);
+  //}else{
+  /*do{
     Dynamixel.performMovement(2148, 1850, 3250, OPEN);     //Ready position
     delay(2000);
-  }
- }
+  }while(emg2 > 70);
+ }*/
+


bugs in keys

bugs in keys

--- _56-gopro-control/a-5-http-post/a-3/a-3.ino
+++ _56-gopro-control/a-5-http-post/a-3/a-3.ino
@@ -142,11 +142,12 @@
       prevDisplay = now();
       if (timeStatus() == timeSet) {
         digitalClockDisplay();
+
+        if (x) {
+          tweeting();
+          x = false;
+        }
       }
-    }
-    if (x) {
-      tweeting();
-      x = false;
     }
   } else {
     wifi_connect();
@@ -212,7 +213,7 @@
 }

 String make_para_string(String status_all, uint32_t value_nonce, uint32_t value_timestamp) {
-  String para_string = key_consumer_key;
+  String para_string = keys[1];
   para_string += "=" ;
   para_string += tweeter[0];
   para_string += "&";
@@ -270,11 +271,11 @@
 }

-String make_signature(const char* consumer_secret, const char* access_secret, String base_string) {
-
-  String signing_key = URLEncode(consumer_secret);
+String make_signature(const char* secret_one, const char* secret_two, String base_string) {
+
+  String signing_key = URLEncode(secret_one);
   signing_key += "&";
-  signing_key += URLEncode(access_secret);
+  signing_key += URLEncode(secret_two);

   //Serial.println(signing_key);


More work on the UI to display current state.\nInitilisation process is roughed out some refactors may be required to decouple parts of the code

--- user-interface/FunctionGen-UI/FunctionGen-UI.ino
+++ user-interface/FunctionGen-UI/FunctionGen-UI.ino
@@ -6,29 +6,22 @@
 #include <Wire.h>

 #include "wave_tables.h"
-
-// Color definitions
-#define BLACK    0x0000
-#define BLUE     0x001F
-#define RED      0xF800
-#define GREEN    0x07E0
-#define CYAN     0x07FF
-#define MAGENTA  0xF81F
-#define YELLOW   0xFFE0
-#define WHITE    0xFFFF
+#include "ui.h"

 #define __TFT_CS  D0  //(D0)
 #define __TFT_DC  D8   //(D1)

-const char* ssid = "Penguins!";
-const char* password = "";
+
 const char* mdnsName = "FunktionGen";

 TFT_ILI9163C tft = TFT_ILI9163C(__TFT_CS, __TFT_DC);
+WiFiUDP server = WiFiUDP();
 WaveTable currentWave = WaveTable();
+
 uint32_t currentFrequency = 1000; // 1kHz
+

 /**
  * Draw a wave table
@@ -54,102 +47,119 @@
   }
 }

-void init_halt(const char* message) {
-    tft.setTextColor(RED);
-    tft.print("[!] Halt: "); tft.println(message);
-    while(1) { delay(1000); }
+
+void init_message(const char* message, uint16_t color=WHITE, const char icon='+') {
+  tft.setTextColor(color);
+  tft.print("["); tft.print(icon); tft.print("] "); tft.print(message);
+  Serial.print("["); Serial.print(icon); Serial.print("] "); Serial.print(message);
 }

-void init_network() {
-  tft.println("[+] Init Network");
-
-  tft.print("[-] Joining SSID: "); tft.println(ssid);
-  WiFi.begin(ssid, password);
-
-  tft.print("[-] Connecting ");
-  while (WiFi.status() != WL_CONNECTED) {
-    delay(500); tft.print(".");
-  }
-  tft.println("");
-
-  tft.print("[-] IP address: "); tft.println(WiFi.localIP());
+#define INIT_SYSTEM(message) init_message(message)
+#define INIT_SUBSYSTEM(message) init_message(message, LIGHT_GREY, '-')
+#define INIT_INFO(message) init_message(message, CYAN, '?')
+#define INIT_ERROR(message) init_message(message, RED, '!')
+#define INIT_HALT(message) init_message(message, RED, '!'); while(1) { delay(1000); }
+#define INIT_OK(value) tft.setTextColor(GREEN); tft.print(value); Serial.print(value)
+#define INIT_PRINT(value) tft.print(value); Serial.print(value)

-  tft.println("[+] Starting MDNS");
-
-  tft.print("[-] Listening on: "); tft.println(mdnsName);
+/**
+ * Initilise network
+ *
+ * @param connect_timeout - Timeout for wifi connection (in seconds)
+ */
+void init_network(uint16_t port=10001, uint8_t connect_timeout=20) {
+  INIT_SYSTEM("Init Network\n");
+
+  // Wifi
+  INIT_SUBSYSTEM("Joining SSID: "); INIT_PRINT(ssid); INIT_PRINT('\n');
+  WiFi.begin(ssid, password);
+
+  INIT_SUBSYSTEM("Connecting ");
+  connect_timeout = connect_timeout * 4; // Loop is ~1/4 second
+  while (WiFi.status() != WL_CONNECTED) {
+    if (connect_timeout-- == 0) {
+      INIT_ERROR("\nConnect timeout\n");
+      return;
+    }
+    delay(250);
+    INIT_PRINT(".");
+  }
+  INIT_PRINT('\n'); INIT_INFO("IP address: "); INIT_PRINT(WiFi.localIP()); INIT_PRINT('\n');
+
+  // Zeroconf
+  INIT_SYSTEM("Starting mDNS service\n");
+  INIT_SUBSYSTEM("Listening on: "); INIT_PRINT(mdnsName); INIT_PRINT('\n');
   if (!MDNS.begin(mdnsName)) {
-    init_halt("Error setting up MDNS responder!");
+    INIT_ERROR("Unable to start mDNS service\n");
+    return;
   }
-  tft.println("[-] Adding service: wave");
-  MDNS.addService("wave", "tcp", 10001);
+
+  INIT_SYSTEM("Start UDP server\n");
+  if (!server.begin(port)) {
+    INIT_ERROR("Unable to start UDP server\n");
+    return;
+  }
+
+  INIT_SUBSYSTEM("Publish mDNS service\n");
+  MDNS.addService("wave", "udp", port);
 }

+/**
+ * Initialise
+ */
 void initialise() {
   // Initilaise tft first.
   tft.begin();
-  tft.setTextColor(WHITE);

   // Initialise File system
-  tft.println("[+] Init FS");
+  INIT_SYSTEM("Init FS\n");
   SPIFFS.begin();
   FSInfo fs_info;
   if (SPIFFS.info(fs_info)) {
-    tft.print("[-] Total Bytes: "); tft.println(fs_info.totalBytes);
-    tft.print("[-] Used Bytes: "); tft.println(fs_info.usedBytes);
+    INIT_INFO("Total: "); INIT_PRINT(fs_info.totalBytes / 1024); INIT_PRINT("kB\n");
+    INIT_INFO("Total: "); INIT_PRINT(fs_info.usedBytes / 1024); INIT_PRINT("kB\n");
   } else {
-    tft.setTextColor(RED);
-    tft.print("[!] Failed");
-    tft.setTextColor(WHITE);
+    INIT_HALT("Failed initilising filesystem.");
   }

   // Init TWI
-  tft.println("[+] Init TWI");
+  INIT_SYSTEM("Init TWI\n");
   Wire.begin();
+
+  // Init DDS Generator
+  INIT_SYSTEM("Init DDS Generator\n");

   // Init network
   init_network();
-
-  // Init DDS Generator
-  tft.println("[+] Init DDS Generator");
-}

-void setup() {
-  initialise();
-
-  tft.setTextColor(YELLOW);
-  Dir dir = SPIFFS.openDir("/");
-  while (dir.next()) {
-    String fileName = dir.fileName();
-    if (fileName.endsWith(".wave")) {
-      tft.print(fileName); tft.print(" (");
-      File f = dir.openFile("r");
-      tft.print(f.size()); tft.println("b)");
-    }
-  }
-
-  WaveTable wave;
-
-  wt_zero(&wave);
-  uint8_t result = wt_load(&wave, "/Random.wave");
-  if (result != WAVE_FILE_OK) {
-    tft.setTextColor(RED);
-    tft.print("Error reading wave: "); tft.println(wt_errorMessage(result));
-    return;
-  } else {
-    tft.setTextColor(GREEN);
-    tft.print("Read wave: "); tft.println(wave.name);
-  }
-
-  drawWave(&tft, &wave, 1, 0, 0, CYAN);
-  wt_mirror(&wave);
-  drawWave(&tft, &wave, 1, 0, 0, MAGENTA);
-  wt_invert(&wave);
-  drawWave(&tft, &wave, 1, 0, 0, BLUE);
-}
-
-void loop(void) {
-
+  // Complete
+  INIT_OK("Init complete.");
 }

+void setup() {
+  Serial.begin(115200);
+
+  initialise();
+  delay(500);
+
+  tft.clearScreen();
+  ui_update(&tft);
+}
+
+
+char packetBuffer[0xFF];
+
+void loop(void) {
+  size_t packetSize = server.parsePacket();
+  if (packetSize) {
+    // Process UDP packet.
+    size_t len = server.read(packetBuffer, 0xFF);
+    if (len > 0) {
+      Serial.print("Received: "); Serial.println(packetBuffer);
+    }
+  }
+}
+
+


A very subtle bug in the initialization code seems to have knocked out canbus for the CANDue boards. This has been corrected.

--- GVRET.ino
+++ GVRET.ino
@@ -147,7 +147,8 @@
 			SysSettings.rxToggle = true;
 			pinMode(13, OUTPUT); //just to be sure it's an output
 			digitalWrite(13, LOW);
-		otherwise: //CANDUE
+			break;
+		default: //CANDUE
 			Logger::console("Running on CANDue hardware");
 			SysSettings.eepromWPPin = CANDUE_EEPROM_WP_PIN;
 			SysSettings.CAN0EnablePin = CANDUE_CAN0_EN_PIN;
@@ -169,6 +170,7 @@
 			digitalWrite(13, LOW);
 			digitalWrite(72, HIGH);
 			digitalWrite(73, HIGH);
+			break;
 	}
 }


fix sth

fix sth

--- ArduinoCar/ArduinoCar.ino
+++ ArduinoCar/ArduinoCar.ino
@@ -9,7 +9,7 @@
 const int trigpin=4;
 const int echopin=5;

-double SetpointL=10, SetpointR=10;
+double SetpointL=20, SetpointR=20;
 double Kp=0.6, Ki=5, Kd=0;
 double outputL, outputR;
 double inputL, inputR, speedvalueL, speedvalueR;
@@ -32,29 +32,16 @@
 }

 void loop() {
-  char key[2];
+  char key;
   if(Serial.available()>0)
   {
-      Serial.readBytes(key,sizeof(key));
+      key=char(Serial.read());
+      Serial.println(key);
   }
   else
     return;

-  switch(key[1])
-  {
-    case 'l':
-      SetpointL=10;
-      SetpointR=10;
-      break;
-    case 'h':
-      SetpointL=15;
-      SetpointR=15;
-      break;
-    default:
-      break;
-  }
-
-  switch(key[0])
+  switch(key)
   {
     case 'L':
       left();
@@ -67,6 +54,9 @@
       break;
     case 'B':
       back();
+      break;
+    case 'S':
+      stopfb();
       break;
     default:
       break;
@@ -140,6 +130,11 @@
   DirectionlastR=DirectionR;
 }

+void drive()
+{
+  analogWrite(EA,outputL);
+  analogWrite(EB,outputR);
+}
 void forbac()
 {
   digitalWrite(trigpin,LOW);
@@ -165,8 +160,7 @@
   digitalWrite(pinRb,LOW);
   DirectionL=true;
   DirectionR=true;
-  analogWrite(EA,outputL);
-  analogWrite(EB,outputR);
+  drive();
 }

 void back()
@@ -177,8 +171,7 @@
   digitalWrite(pinRb,HIGH);
   DirectionL=false;
   DirectionR=false;
-  analogWrite(EA,outputL);
-  analogWrite(EB,outputR);
+  drive();
 }

 void left()
@@ -189,8 +182,7 @@
   digitalWrite(pinRb,LOW);
   DirectionL=false;
   DirectionR=true;
-  analogWrite(EA,outputL);
-  analogWrite(EB,outputR);
+  drive();
 }

 void right()
@@ -201,8 +193,7 @@
   digitalWrite(pinRb,HIGH);
   DirectionL=true;
   DirectionR=false;
-  analogWrite(EA,outputL);
-  analogWrite(EB,outputR);
+  drive();
 }

 void stopfb()
@@ -228,4 +219,3 @@

-


unsigned switches

unsigned switches

--- reporter/arudino_program/arudino_program.ino
+++ reporter/arudino_program/arudino_program.ino
@@ -3,15 +3,15 @@
 // Author: Hunter Owens
 // Date: 24/11/2013

-const int pin30  = 1;
-const int pin70  = 2;
-const int pin110 = 3;
-const int pin150 = 4;
+const unsigned int pin30  = 1;
+const unsigned int pin70  = 2;
+const unsigned int pin110 = 3;
+const unsigned int pin150 = 4;

 //converts the reading into a cm value representing how far away the nearest
 // obj is
-long convert(int val) {
-  long res;
+unsigned long convert(int val) {
+  unsigned long res;
   res = (val / 147) * 2.54;
   return res;
 }
@@ -23,8 +23,8 @@

 void loop() {
   // res vars
-  int reading30,reading70,reading110,reading150;
-  long res30,res70,res110,res150;
+  unsigned int reading30,reading70,reading110,reading150;
+  unsigned long res30,res70,res110,res150;
   //set up the pins for input
   pinMode(pin30, INPUT);
   pinMode(pin70, INPUT);


Delete sketch_apr17aTempHumDelayFinal.ino

--- sketch_apr17aTempHumDelayFinal.ino
+++ sketch_apr17aTempHumDelayFinal.ino
@@ -1,148 +0,0 @@
-#include <dht.h> //DHT11 LIBRARY
-#include <UIPEthernet.h> //UIPE ETHERNT LIBRARY FOR THE ETHERNET MODULE ENC28J60
-#define DHT11_PIN 9 // DHT11 IS CONNECTED TO PIN NUMBER 9 (ARDUINO UNO BOARD), OR SPECIFY ANY OTHER PIN
-#define DEBUG // TURN DEBUGGING ON OR OFF, TO TURN IT OFF JUST COMMENT THIS LINE
-dht DHT; // DEFINE A "dht" OBJECT INSTANCE WITH THE NAME "DHT"
-/* ETHERNET SETTINGS
-ARDUINO UNO PINS USED FOR THE ENC28J60 MODULE: 10=CS, 11=MOSI, 12=MISO, 13=SCK
-THE ETHERNET MAC ADDRESS MUST BE UNIQUE IN THE PRIVATE LOCAL NETWORK
-REMEMBER THAT THE MAC ADDRESS IS IN HEXADECIMAL FORMAT
-IN THIS EXAMPLE WE USE THE FOLLOWING MAC ADDRESS : OE:96:03:38:94:92 */
-byte mac[] = { 0x0E, 0x96, 0x03, 0x38, 0x94, 0x92 };
-EthernetClient client; // CREATES A CLIENT WHICH CAN CONNECT TO A SPECIFIED INTERNET IP ADDRESS AND PORT
-char server[] = "192.168.1.4"; /// IP ADDRESS OF THE LOCAL SERVER WE CONNECT AND SEND DATA TO
-int  interval = 5000; // DELAY INTERVAL TO SAVE THE DATA IN THE DATABSE
-long myinterval = 6000; //3 Minutes-> 180000ms INTERVAL BETWEEN DATA READINGS, I SET IT IN 6 SECONDS FOR TESTING PURPOSES
-long previousMillis = 0;
-int status = -2; // INITIALIZE THE CONNECTION STATUS VARIABLE
-void setup() {
-  Serial.begin(9600); // OPEN SERIAL COMMUNICATIONS AND WAIT FOR A PORT TO OPEN
-  Ethernet.begin(mac); // INITIALIZES THE ETHERNET LIBRARY AND NETWORK SETTINGS
-  /* ETHERNET SERIAL PRINTS
-  INFORMATION ABOUT CLIENTS IP ADDRESS, THE SUBNET MASK OF THE NETWORK, THE GATEWAYS
-  IP ADDRESS AND FINALLY THE DNS SERVER IP ADDRESS WHICH IS THE SAME AS THE GATEWAYS IP
-  THESE INFORMATION WILL ONLY BE VISIBLE WHEN DEBUGGING IS ON */
-#ifdef DEBUG
-  Serial.println("Temperature Logger");
-  Serial.println("*********************");
-  Serial.print("IP Address   : ");
-  Serial.println(Ethernet.localIP());
-  Serial.print("Subnet Mask  : ");
-  Serial.println(Ethernet.subnetMask());
-  Serial.print("Default Gateway IP: ");
-  Serial.println(Ethernet.gatewayIP());
-  Serial.print("DNS Server IP     : ");
-  Serial.println(Ethernet.dnsServerIP());
-#endif
-}
-
-void loop() {
-  unsigned long currentMillis = millis();
-  // RESET ENC28J60 IN CASE OF FAILURE TO CONNECT WITH THE LOCAL SERVER
-  if (!client.connect(server, 80)) {
-#ifdef DEBUG
-    Serial.println("Connection Failure: Resetting ENC28j60!");
-#endif
-    Enc28J60.init(mac); //RESET AND INITIALIZE THE ENC28J60 AND STARTS PACKET TRANSMISSION-RECEPTION
-  } else {
-    client.stop();
-  }
-  /* CONNECT TO THE SPECIFIED IP ADDRESS AND PORT
-   IF A CONNECTION IS ESTABLISHED START SENDING DATA EVERY 3 MINUTES
-   DATA WILL BE SENT AFTER THE FIRST 3 MINUTES
-   ALSO WE CHECK THE STATUS OF THE SERVER
-   THE FUNCTION CONNECT() RETURNS AN INT INDICATING CONNECTION STATUTS:
-   SUCCESS (1)
-   TIMED_OUT (-1)
-   INVALID SERVER (-2)
-   TRUNCATED (-3)
-   INVALID RESPONSE (-4)*/
-  status = client.connect(server, 80);
-  if (status == 1) {
-#ifdef DEBUG
-    Serial.println("\nConnection Success");
-#endif
-    if (currentMillis - previousMillis > myinterval) {
-      previousMillis = currentMillis;
-      //READ DATA FROM THE DHT11 SENSOR
-      int chk = DHT.read11(DHT11_PIN);
-      /* THE READ11() FUNCTION RETURNS:
-      DHTLIB_OK (0): THE SENSOR SAMPLE AND ITS CHECKSUM ARE OK
-      DHTLIB_ERROR_CHECKSUM (-1): THE CHECKSUM TEST FAILED. THIS MEANS THE DATA WAS RECEIVED BUT MAY NOT BE CORRECT
-      DHTLIB_ERROR_TIMEOUT (-2): A TIME OUT OCCURRED AND COMMUNICATION HAS FAILED
-      BELOW WE CHECK THE STATUS OF THE SENSOR */
-#ifdef DEBUG
-      switch (chk) {
-        case 0:
-          Serial.print("Sensor OK");
-          break;
-        case -1:
-          Serial.print("Checksum Test Failed");
-          break;
-        case -2:
-          Serial.print("Time out Occurred, Communication Failed");
-          break;
-        default:
-          Serial.print("Unknown Error");
-          break;
-      }
-#endif
-      // PRINT THE HUMIDITY AND TEMPERATURE VALUES IN THE SERIAL MONITOR
-#ifdef DEBUG
-      Serial.print("\nValues: ");
-      Serial.print(DHT.humidity, 1);
-      Serial.print(",\t");
-      Serial.println(DHT.temperature, 1);
-      Serial.println("Connected...sendingData");
-#endif
-      // MAKE A HTTP REQUEST
-      // SPECIFY THE PHP FILE LOCATION IN THE SERVER
-      //PRINT DATA TO THE SERVER THE CLIENT IS CONNECTED TO
-      //STRUCTURE: "GET /filepath/yourfile.php?"
-      client.print( "GET /arduEth/write_data.php?");
-      client.print("hum="); //DATABASE VARIABLE IS USED
-      client.print(DHT.humidity, 1); //THE VALUE TO WRITE IN THE DATABSE FOR HUMIDITY
-      client.print("&&");
-      client.print("temp=");
-      client.print(DHT.temperature, 1); //THE VALUE TO WRITE IN THE DATABSE FOR TEMPERATURE
-      client.println( " HTTP/1.1");
-      client.print( "Host: " );
-      client.println(server);
-      client.println( "Connection: close" );
-      client.println();
-      client.println();
-      client.stop(); // DISCONNECT FROM THE SERVER
-      delay(interval); //SOME INTERVAL FOR THE DATA TO BE WRITTEN IN THE DATABASE
-    }
-  }
-  // IN CASE OF A TIME_OUT
-  else if (status == -1) {
-#ifdef DEBUG
-    Serial.println("Connection Timed Out !");
-#endif
-  }
-  // IN CASE OF AN INVALID SERVER
-  else if (status == -2) {
-#ifdef DEBUG
-    Serial.println("Invalid Server !");
-#endif
-  }
-  // IN CASE OF TRUNCATION
-  else if (status == -3) {
-#ifdef DEBUG
-    Serial.println("Truncated !");
-#endif
-  }
-  // IN CASE OF AN INVALID RESPONCE
-  else if (status == -4) {
-#ifdef DEBUG
-    Serial.println("Invalid Response !");
-#endif
-  }
-  // IN CASE OF AN UNKNOWN ERROR
-  else {
-#ifdef DEBUG
-    Serial.println("Unknown Error !");
-#endif
-  }
-}