Adding the two color led

Adding the two color led

--- ReaperRemote.ino
+++ ReaperRemote.ino
@@ -23,6 +23,13 @@

 const int ledPin = LED_BUILTIN;

+const int ledRed = A3;
+const int ledYellow = A4;
+
+#define LED_RED     1
+#define LED_YELLOW  2
+#define LED_OFF     0
+
 bool isConnected = false;

 unsigned int cycle_ble = 0;
@@ -67,6 +74,25 @@
   /* no action, ignoring the incomming data */
 }

+void showLED(unsigned char state)
+{
+  switch(state)
+  {
+    case LED_YELLOW:
+      digitalWrite(ledYellow, HIGH);
+      digitalWrite(ledRed, LOW);
+      break;
+    case LED_RED:
+      digitalWrite(ledYellow, LOW);
+      digitalWrite(ledRed, HIGH);
+      break;
+    case LED_OFF:
+    default:
+      digitalWrite(ledYellow, LOW);
+      digitalWrite(ledRed, LOW);
+  }
+}
+
 void setup()
 {
   Serial.begin(115200);
@@ -76,6 +102,9 @@

   pinMode(ledPin, OUTPUT);
   digitalWrite(ledPin, LOW);
+
+  pinMode(A3, OUTPUT);
+  pinMode(A4, OUTPUT);

   Serial.println(F("Reaper Remote by Allesnetz.com"));

@@ -168,13 +197,13 @@
   if (button1.toggled()) {
     if (button1.read() == Button::PRESSED) {
       Serial.println("Button 1 has been pressed");
-      digitalWrite(ledPin, HIGH);
+      showLED(LED_RED);
       if (isConnected) {
         sendMuteCommand(true);
       }
     } else {
       Serial.println("Button 1 has been released");
-      digitalWrite(ledPin, LOW);
+      showLED(LED_OFF);
       if (isConnected) {
         sendMuteCommand(false);
       }
@@ -185,14 +214,14 @@
   if (button2.toggled()) {
     if (button2.read() == Button::PRESSED) {
       Serial.println("Button 2 has been pressed");
-      digitalWrite(ledPin, HIGH);
+      showLED(LED_YELLOW);
       if (isConnected) {
         // Send the note to reaper to set the marker
         sendMidiNote(true, 0, 0, 64);
       }
     } else {
       Serial.println("Button 2 has been released");
-      digitalWrite(ledPin, LOW);
+      showLED(LED_OFF);
       if (isConnected) {
         sendMidiNote(false, 0, 0, 64);
       }


Fixes launching settings screen auto toggling sound issue.

--- arduboy-game/arduboy-game.ino
+++ arduboy-game/arduboy-game.ino
@@ -379,7 +379,8 @@
 void settingsScreen() {
   long lastDebounceTime = millis();  // the last time the button was pressed
   bool exit_settings_menu = false;
-  byte selectedItem;
+  bool isRealSoundChange = false;
+  byte selectedItem = SETTINGS_SOUND;

   arduboy.clear();
   printText("SETTINGS", 20, 2, 2);
@@ -391,7 +392,6 @@
     unsigned long currentMilliseconds = millis();
     bool isGreater = (currentMilliseconds - lastDebounceTime) > DEBOUNCE_DELAY;

-
     if (isGreater) {

       if (arduboy.pressed(DOWN_BUTTON)) {
@@ -447,8 +447,12 @@
             break;

           case SETTINGS_SOUND:
-            soundOn = !soundOn;
-            printsoundOnOff();
+            if (isRealSoundChange) {
+              soundOn = !soundOn;
+              printsoundOnOff();
+            } else {
+              isRealSoundChange = true;
+            }
             break;

           case SETTINGS_RESET_HIGH_SCORE:


Also include the "pings"

Also include the "pings"

--- water_heater_monitor/water_heater_monitor.ino
+++ water_heater_monitor/water_heater_monitor.ino
@@ -24,6 +24,18 @@
 }

 void loop () {
+  unsigned long now = millis();
+
+  // If we haven't updated in 5 minutes, send along a "PING" to keep showing something.
+  if (now > lastWebUpdateTime + 300000 || now < lastWebUpdateTime) {
+    //strcpy(eagle_data, "0.05  120.0  110.0  12.0  159.0  100.0  110.0  ON  OFF  ");
+    //postToPhant();
+
+    data_index = 0;
+    eagle_data[data_index] = '\0';
+    postToPhant();
+  }
+
   delay(100);
 }


Working now!

Working now!

--- Arduino/Arduino.ino
+++ Arduino/Arduino.ino
@@ -12,7 +12,6 @@
 Servo upDown;         // up-down

 // SENSORS
-// Nothing here yet
 long gyroX, gyroY, gyroZ;
 float rotX, rotY, rotZ;

@@ -99,7 +98,6 @@
   leftRight.attach(LR_PIN);
   upDown.attach(UD_PIN);

-  Serial.write("asdf");
   // Set up MPU
   setupMPU();
   Serial.write("setupped");
@@ -123,15 +121,20 @@
 // UPDATE
 void loop() {
   // Get information from the sensors
-  // Nothing here yet
   recordGyroData();
-  processGyroData();
-  Serial.write("processed");
-  if(prevX - rotX > 5 || prevX - rotX < -5 || prevY - rotY > 5 || prevY - rotY < -5 || prevZ - rotZ > 5 || prevZ - rotZ < -5){
+  //processGyroData();
+  //Serial.write("processed");
+  if(prevX - rotX > 5 || prevX - rotX < -5 || prevY - rotY > 5 || prevY - rotY < -5 || prevZ - rotZ > 5 || prevZ - rotZ < -5)
+  {
     prevX = rotX;
     prevY = rotY;
     prevZ = rotZ;
-    //serial Send info??
+    Serial.write(MPU_X_PREFIX);
+    Serial.write(int(rotX));
+    Serial.write(MPU_Y_PREFIX);
+    Serial.write(int(rotY));
+    Serial.write(MPU_Z_PREFIX);
+    Serial.write(int(rotZ));
   }
   // Process information from the sensors
   // Nothing here yet
@@ -263,12 +266,12 @@
   Wire.write(0x43); //Starting register for Gyro Readings
   Wire.endTransmission();
   Wire.requestFrom(0b1101000,6); //Request Gyro Registers (43 - 48)
-  while(Wire.available() < 6);
+  //while(Wire.available() < 6);
   gyroX = Wire.read()<<8|Wire.read(); //Store first two bytes into accelX
   gyroY = Wire.read()<<8|Wire.read(); //Store middle two bytes into accelY
   gyroZ = Wire.read()<<8|Wire.read(); //Store last two bytes into accelZ
   processGyroData();
-  Serial.write("processed");
+  //Serial.write("processed");
 }

 void processGyroData() {


Update mqtt.ino

Update mqtt.ino

I removed the second subscription,
then i created a php site that updates my database,
every 5 minutes the arduino informs the database if the AC is on or off.

--- Mqtt/mqtt.ino
+++ Mqtt/mqtt.ino
@@ -1,76 +1,77 @@
 #include <ESP8266WiFi.h>
-#include <DHT.h>                               //  Humidity & Temperature sensor library
-#include "Adafruit_MQTT.h"                     //
-#include "Adafruit_MQTT_Client.h"              // Mqtt library from adafruit
+#include <DHT.h>
+#include "Adafruit_MQTT.h"
+#include "Adafruit_MQTT_Client.h"

-#define WLAN_SSID  "Your ssid"
-#define WLAN_PASS  "Your password"
+#define WLAN_SSID  "Ren"
+#define WLAN_PASS  "ewpsoldiermx9pua6j"
+
+#define arduino_pubsub " #1 SUBSCRIPTION"         //
+#define arduino_response " #1 RESPONSE"           //
+#define arduino_temp "#2 PUBLISH "                //  PUB-SUB
+#define arduino_hum "#2 PUBLISH"                  //
+#define arduino_watt "#2 PUBLISH"                 //
+
+#define MQTT_SERVER "MQTT"                                            // MQTT Server
+#define mqtt_port  1883

-#define arduino_status " "                                       // STATUS  subscribe/publish
-#define arduino_status_response " "                     //
+void MQTT_connect();
+/************ Global State (you don't need to change this!) ******************/
+WiFiClient client;
+DHT dht(2  , DHT11, 15);

-#define arduino_pubsub " "       //   Arduino  subscribe/publish
-#define arduino_response " "     //
-#define arduino_temp " "         //
-#define arduino_hum " "          //
-#define arduino_watt " "         //
+const char* host = "";
+String urlon = "STRING FOR ON";
+String urloff = "STRING FOR OFF";
+long previousMillis = 0;
+long interval = 60000*5;   // 5 minutes delay
+boolean gotMessage = false;
+char c;

-#define MQTT_SERVER "test.mosca.io"                                            // MQTT Server
-#define mqtt_port  1883
-
-/************ Global State (you don't need to change this!) ******************/
-WiFiClient client;
 // Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
 Adafruit_MQTT_Client mqtt(&client, MQTT_SERVER, mqtt_port );
 /****************************** Feeds ***************************************/
 Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, arduino_pubsub, 1);
-Adafruit_MQTT_Subscribe statusreport = Adafruit_MQTT_Subscribe(&mqtt, arduino_status, 1);
+//Adafruit_MQTT_Subscribe statusreport = Adafruit_MQTT_Subscribe(&mqtt, arduino_status, 1);
 /*************************** Sketch Code ************************************/
-
-
-void MQTT_connect();
-DHT dht(2  , DHT11, 15);                   // pin 2 on esp8266-01 (GPIO2)
-char c;                                    // for the messages from the arduino
-int i, isConnected = 0;

 void setup() {
   Serial.begin(115200);
   delay(10);
-  dht.begin();                 // sensor start
-  WiFi.begin(WLAN_SSID, WLAN_PASS);
-  while (WiFi.status() != WL_CONNECTED) {
+  dht.begin();                                            // Humidity-Temp Sensor
+  WiFi.begin(WLAN_SSID, WLAN_PASS);                       // Start wifi
+  while (WiFi.status() != WL_CONNECTED) {                 // Connect
     delay(500);
   }
   // Setup MQTT subscription for onoff & slider feed.
-  mqtt.subscribe(&onoffbutton);
-  mqtt.subscribe(&statusreport);
+  mqtt.subscribe(&onoffbutton);                           // Subscription #1
+  //mqtt.subscribe(&statusreport);                        // Subscription #2
 }

 // LOOP ----------------
 void loop() {
-
-
-  if (!mqtt.connected()) {
-    MQTT_connect();               // keep connection alive
+
+  if (!mqtt.connected()) {                                // connect to broker
+    MQTT_connect();
   }
-
-  Adafruit_MQTT_Subscribe *subscription;
-  while ((subscription = mqtt.readSubscription(3000))) {             // check if you have message from subscriptions
-    if (subscription == &onoffbutton) {                              // check if message is from room control
+
+  Adafruit_MQTT_Subscribe *subscription;                  // Subscribe again
+
+  while ((subscription = mqtt.readSubscription(3000))) {  // if message arrived
+    if (subscription == &onoffbutton) {
       if (strcmp((char *)onoffbutton.lastread, "connect") == 0) {
-        isConnected = 1;
         mqtt.publish(arduino_response, "connected", 1);
+        iscon(5);
       } else if (strcmp((char *)onoffbutton.lastread, "disconnect") == 0) {
-        isConnected = 0;
-      } else if (strcmp((char *)onoffbutton.lastread, "AC1") == 0) {
-        Serial.print("AC1");                      // sent ac1 to the arduino
+      } else if (strcmp((char *)onoffbutton.lastread, "AC1") == 0) {
+        Serial.print("AC1");
         delay(50);
-        calcWatt(1);                              // update the watt on site
+        calcWatt(1);
       } else if (strcmp((char *)onoffbutton.lastread, "AC0") == 0) {
         Serial.print("AC0");
         delay(50);
@@ -80,47 +81,48 @@
         mqtt.publish(arduino_response, "done", 1);
       }
     }
-    if (subscription == &statusreport) {                             // check if message is from index page
-      if (strcmp((char *)statusreport.lastread, "statusreport") == 0) {
-        calcWatt(4);                                                 // inform the watt value
-      }
-    }
   }
-
-
-
-  if (isConnected) {
-
-    float h = dht.readHumidity();
-    char hum[1];
-    dtostrf(h, 2, 0, hum);
-    mqtt.publish(arduino_hum, hum, 1);
-
-    float t = dht.readTemperature();
-    char temp[1];
-    dtostrf(t, 2, 0, temp);
-    mqtt.publish(arduino_temp, temp, 1);
-
-    calcWatt(5);
-
-    isConnected = 0;
-  }
-
-

   // ping the server to keep the mqtt connection alive
   if (! mqtt.ping()) {
     mqtt.disconnect();
-    isConnected = 0;
+  }
+
+  unsigned long currentMillis = millis();
+  if (currentMillis - previousMillis > interval) {
+    Serial.println("Success");
+    previousMillis = currentMillis;
+    calcWatt(4);
   }
 }

+
+
+
+void iscon(int mode) {
+  float h = dht.readHumidity();
+  char hum[1];
+  dtostrf(h, 2, 0, hum);
+  mqtt.publish(arduino_hum, hum, 1);
+
+  float t = dht.readTemperature();
+  char temp[1];
+  dtostrf(t, 2, 0, temp);
+  mqtt.publish(arduino_temp, temp, 1);
+
+  calcWatt(mode);
+
+}
+
+// 5 - genika
+// 4 - bash update
+// 1,0 control panel
+
 void calcWatt(int mode) {
-
+  int i = 0;
   char message[8] = "";
-  i = 0;
   Serial.print("Watt");
-  while (!Serial.available()) {}
+  //while (!Serial.available()) {}
   while (Serial.available()) {
     message[i++] = Serial.read();
     delay(10);
@@ -129,29 +131,36 @@
     mqtt.publish(arduino_response, "done", 1);
   } else if (atof(message) < 120 && atof(message) > 0 && mode == 0) {
     mqtt.publish(arduino_response, "done", 1);
-  } else if (atof(message) >= 120 && mode == 4) {
-    mqtt.publish(arduino_status_response, "enpeton", 1);
-  } else if (atof(message) < 120 && mode == 4) {
-    mqtt.publish(arduino_status_response, "enpetoff", 1);
+  } else if (atof(message) >= 120 && mode == 4) {                                     //
+    client.connect(host, 80);                                                         //
+    client.print(String("GET ") + urlon + " HTTP/1.1\r\n" +                           //
+               "Host: " + host + "\r\n" +                                             //
+               "Connection: close\r\n\r\n");                                          //
+  } else if (atof(message) < 120 && mode == 4) {                                      //  UPDATE THE DATABASE SO WE CAN CHECK WHICH AC
+    client.connect(host, 80);                                                         //   IS ON AND WHICH ONE IS CLOSED.
+    client.print(String("GET ") + urloff + " HTTP/1.1\r\n" +                          //
+               "Host: " + host + "\r\n" +                                             //
+               "Connection: close\r\n\r\n");                                          //
+  }                                                                                //
+  if ( mode != 4) {
+    delay(10);
+    mqtt.publish(arduino_watt, message, 1);
   }
-    if ( mode != 4) {
-      delay(10);
-      mqtt.publish(arduino_watt, message, 1);
+
+}
+
+// Function to connect and reconnect as necessary to the MQTT server.
+// Should be called in the loop function and it will take care if connecting.
+void MQTT_connect() {
+  int8_t ret;
+  uint8_t retries = 5;
+  while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected
+    mqtt.disconnect();
+    delay(5000);  // wait 5 seconds
+    retries--;
+    if (retries == 0) {
+      // basically die and wait for WDT to reset me
+      while (1);
     }
   }
-
-  // Function to connect and reconnect as necessary to the MQTT server.
-  // Should be called in the loop function and it will take care if connecting.
-  void MQTT_connect() {
-    int8_t ret;
-    uint8_t retries = 5;
-    while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected
-      mqtt.disconnect();
-      delay(5000);  // wait 5 seconds
-      retries--;
-      if (retries == 0) {
-        // basically die and wait for WDT to reset me
-        while (1);
-      }
-    }
-  }
+}


Added setServo function, set radiodata from uint32 to uint8

--- Sketch2/nano.ino
+++ Sketch2/nano.ino
@@ -35,9 +35,8 @@

 Servo servo[5]; // 4=motor, 0=left, 1=right=-left, 2=height-ctr, 3=side-ctr

-//byte addresses[][6] = { "1Node","2Node" };
 uint64_t readingPipe = 0xF0F0F0F0AA;
-//bool radioNumber = 1; // radio ID
+uint64_t writingPipe = 0xF0F0F0F0BB;
 RF24 radio(CE_PIN, CSN_PIN);
 unsigned int radioRead=0, servoWrite;

@@ -47,8 +46,8 @@
 unsigned int motorCtrlLast = 0;

 struct {
-	unsigned int servo[3]; // 0=roll, 1=height, 2=side
-	unsigned int motor; // servo position values
+	uint8_t servo[3]; // 0=roll, 1=height, 2=side
+	uint8_t motor; // servo position values
 }radioData;

 void setup() {
@@ -74,41 +73,27 @@
 }

 void loop() {
-	//if (radio.available() && millis() - radioRead > 50) {
-		//while(radio.available())
+
 	radio.startListening();
 	if (radio.available()) {
 		radio.read(&radioData, sizeof(radioData));
 	}
-		//radioRead = millis();
-	//}
-
-	// As long as getting data -> read it
-
-
-	//while (radio.available()) {
-	//}
-	//Serial.println(radioData.motor);

 	if (millis() - servoWrite > 200) {
 		Serial.println(radioData.motor);
 		// MOTOR SERVO
-		if (radioData.motor >= 0 && radioData.motor <= 180) {
-			servo[4].write(radioData.motor);
-		}
+		setServo(4, radioData.motor);
+		setServo(0, radioData.servo[0]);
+		setServo(1, 180-radioData.servo[0]);
+		setServo(2, radioData.servo[1]);
+		setServo(3, radioData.servo[2]);

-		// CONTROL SERVOS
-		if (radioData.servo[0] >= 0 && radioData.servo[0] <= 180) {
-			servo[0].write(radioData.servo[0]);
-			servo[1].write(180 - radioData.servo[0]);
-		}
-		if (radioData.servo[1] >= 0 && radioData.servo[1] <= 180) {
-			servo[2].write(radioData.servo[1]);
-		}
-
-		if (radioData.servo[2] >= 0 && radioData.servo[2] <= 180) {
-			servo[3].write(radioData.servo[2]);
-		}
 		servoWrite = millis();
 	}
 }
+
+void setServo(uint8_t id, uint8_t value) {
+	if (value >= 0 && value <= 180) {
+		servo[id].write(value)
+	}
+}


Use a moving average to smooth values

Use a moving average to smooth values

--- rubseq.ino
+++ rubseq.ino
@@ -2,10 +2,10 @@
 #include <math.h>
 #include "moving_average.h"

-#define DEBUG
+// #define DEBUG

 #define     FORCE_SENSOR_PIN 0
-#define     POTENTIOMETER_PIN 1
+#define     POTENTIOMETER_PIN 5
 #define 	MIDI_PITCHBEND_MIN   -8192.0
 #define 	MIDI_PITCHBEND_MAX   8191.0

@@ -20,6 +20,7 @@
 char last_midi_velocity = 0;
 int velocity;
 int potentiometer_reading;
+MovingAverage potentiometer_reading_average;
 char note;
 int pitch;
 char octave = 4;
@@ -39,6 +40,13 @@
     velocity = velocity > 4 ? velocity : 0; // Force sensor uncertainty

     potentiometer_reading = analogRead(POTENTIOMETER_PIN);
+
+    if(!potentiometer_reading) {
+        return;
+    }
+
+    potentiometer_reading_average.add(potentiometer_reading);
+    potentiometer_reading = potentiometer_reading_average.average();

     note = potentiometer_reading * RANGE / 1023;
     pitch = 127 / 2 * (potentiometer_reading * (RANGE / 1023.0) - note) + 127 / 2;
@@ -88,6 +96,7 @@
         last_midi_note = -1;
         last_midi_velocity = 0;
     }
+
     #ifdef DEBUG
     Serial.print("Playing note #");
     Serial.print((int) last_midi_note);


getting slightly closer to fht but its still not working

--- FhtTest/FhtTest.ino
+++ FhtTest/FhtTest.ino
@@ -19,36 +19,39 @@

 #define PIN            6
 #define NUMPIXELS      7
-Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
+Adafruit_NeoPixel _pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
+
+byte _pixelBins[NUMPIXELS];

 void setup()
 {
   const int analogReferenceMode = EXTERNAL;
   const int audioPin = 0;

-  pixels.begin(); // This initializes the NeoPixel library.
+  Serial.begin(9600); // use the serial port
+
+  _pixels.begin(); // This initializes the NeoPixel library.

-  Serial.begin(9600); // use the serial port
   //TIMSK0 = 0; // turn off timer0 for lower jitter
   ADCSRA = 0xe5; // set the adc to free running mode
   ADMUX = (analogReferenceMode << 6) | (audioPin & 0x07);
   DIDR0 = 0x01; // turn off the digital input for adc0
+
+  memset(_pixelBins, 0, sizeof(_pixelBins));
 }

-void PrintData(int *data, int count)
+void PrintData(byte *data, int count)
 {
   static int lastPrint = 0;

-  if (millis() > lastPrint + 1000)
+  if (millis() > lastPrint + 100)
   {
     char buf[256];
     char *loc = buf;
-    for (int i = 0; i < count; i++)
+    for (int i = 0; i < NUMPIXELS; i++)
     {
-      sprintf(loc, "%d ", fht_log_out[i]);
+      sprintf(loc, "%d ", _pixelBins[i]);
       loc += strlen(loc);
-      //Serial.write(255); // send a start byte
-      //Serial.write(fht_log_out, FHT_N/2); // send out the data
     }

     lastPrint = millis();
@@ -59,29 +62,34 @@

 void ShowValues(byte *data, int count)
 {
+  byte _newBinValues[NUMPIXELS];
+  memset(_newBinValues, 0, NUMPIXELS);
+
+  for (int i = 0; i < count; i++)
+  {
+    int binIndex = (int)((float)i / count * NUMPIXELS);
+    _newBinValues[binIndex] += (float)data[i] * NUMPIXELS / count;
+  }
+
+  const float degrade = 0.7f;
+
+  for (int i = 0; i < NUMPIXELS; i++)
+  {
+    _pixelBins[i] = _pixelBins[i] * degrade + _newBinValues[i] * (1.0f - degrade);
+  }
+
   static int lastPrint = 0;

-  if (millis() > lastPrint + 0)
-  {
-    byte pixelBins[NUMPIXELS];
-    memset(pixelBins, 0, sizeof(pixelBins));
-
-    for(int i = 0; i < count; i++)
-    {
-      int binIndex = (int)((float)i / count * NUMPIXELS);
-      pixelBins[binIndex]++;
-    }
-
-    for(int i = 0; i < count; i++)
+  if (millis() > lastPrint + 100)
+  {
+    for (int i = 0; i < NUMPIXELS; i++)
     {
       Color3F c = Color3F(255, 255, 255);
-
-      byte dataPoint = data[i];
-      float brightness = (float)max(dataPoint - 50, 0) / 255;
-      pixels.setPixelColor(i, pixels.Color(c.R * brightness, c.G * brightness, c.B * brightness));
+      float brightness = (float)_pixelBins[i] / 255;
+      _pixels.setPixelColor(i, _pixels.Color(c.R * brightness, c.G * brightness, c.B * brightness));
     }

-    pixels.show();
+    _pixels.show();
   }
 }

@@ -109,8 +117,8 @@
     fht_mag_log(); // take the output of the fht
     sei();

-    //PrintData(fht_input, FHT_N / 2);
-
+    PrintData(fht_log_out, FHT_N / 2);
+
     ShowValues(fht_log_out, FHT_N / 2);
   }
 }


minor cleanup

minor cleanup

--- TICC/TICC.ino
+++ TICC/TICC.ino
@@ -7,7 +7,7 @@
 // Portions Copyright Jeremy McDermond NH6Z 2016
 // Licensed under BSD 2-clause license

-extern const char SW_VERSION[17] = "20170129.1";    // 29 January 2017 - version 1
+extern const char SW_VERSION[17] = "20170202.1";    // 2 February 2017 - version 1

 //#define DETAIL_TIMING     // if enabled, prints execution time

@@ -82,7 +82,7 @@
   // print banner
   Serial.println();
   Serial.println("# TAPR TICC Timestamping Counter");
-  Serial.println("# Copyright 2017 N8UR, K9TRG, NH6Z, WA8YWQ");
+  Serial.println("# Copyright 2017 N8UR, K9TRV, NH6Z, WA8YWQ");
   Serial.println();

   Serial.println("#####################");


Changed pin definitions in Settings example

--- examples/Settings/Settings.ino
+++ examples/Settings/Settings.ino
@@ -41,10 +41,10 @@
 // SX1276 module and user-specified pinout
 // we ran out of Uno digital pins, so here we use
 // analog ones
-// NSS pin:   A0
-// DIO0 pin:  A1
-// DIO1 pin:  A2
-SX1276 loraSX1276 = new LoRa(A0, A1, A2);
+// NSS pin:   14 (A0)
+// DIO0 pin:  15 (A1)
+// DIO1 pin:  16 (A2)
+SX1276 loraSX1276 = new LoRa(14, 15, 16);

 void setup() {
   Serial.begin(9600);


removed default state

removed default state

--- examples/Template/Template.ino
+++ examples/Template/Template.ino
@@ -145,12 +145,7 @@
           state = States::first;
           cycle = true;
           break;
-*/
-        default:
-          cycle = true;
-          state = States::first;
-          Serial.println("def");
-          break;
+*/
       }
       char   buffer[HELIUM_MAX_DATA_SIZE];
       size_t used = root.printTo(buffer, HELIUM_MAX_DATA_SIZE);


Update bb-8-Head-stabiliser-controller.ino

--- Head/Stabiliser/Arduino-firmware/bb-8-Head-stabiliser-controller/bb-8-Head-stabiliser-controller.ino
+++ Head/Stabiliser/Arduino-firmware/bb-8-Head-stabiliser-controller/bb-8-Head-stabiliser-controller.ino
@@ -1,3 +1,4 @@
+String version = "0.1.2";
 /*
   - OPEN BB-X -
  A open source BB-8 for create you own BB-8!
@@ -119,9 +120,9 @@
 int16_t gx, gy, gz;

 // I2C
-int adress = 2;
-int PING   = 13; // PIN
-
+int adress         = 2;
+int PING           = 13; // PIN
+int PING_MASTER    = 12;
 // VARIABLE
 int x              = 0;
 int y              = 0;
@@ -140,6 +141,7 @@
 int multiplier     = 15;
 int emergencyStop  = 11; // PIN
 int eStop          = 12; // PIN
+bool emgStop       = false;

 bool runX          = false;
 bool runY          = false;
@@ -171,38 +173,53 @@
 bool LED_PING   = false;
 bool BOOT = false;

-
-
+bool ifPing    = false;
+int tmpPing    = 0;
+int tmpPing2   = 0;
+int pingMaster = 0;

 //=============================================================================//
 //   SETUP
 //=============================================================================//
 void setup()
 {
-    pinMode( pinEnable , OUTPUT );
-    pinMode( pinDirX   , OUTPUT );
-    pinMode( pinStepX  , OUTPUT );
-    pinMode( pinDirY   , OUTPUT );
-    pinMode( pinStepY  , OUTPUT );
-    pinMode( PING      , OUTPUT );
-    pinMode( Z_POSITION, INPUT  );
+    pinMode( pinEnable   , OUTPUT );
+    pinMode( pinDirX     , OUTPUT );
+    pinMode( pinStepX    , OUTPUT );
+    pinMode( pinDirY     , OUTPUT );
+    pinMode( pinStepY    , OUTPUT );
+    pinMode( PING        , OUTPUT );
+    pinMode( PING_MASTER , INPUT  );
+    pinMode( Z_POSITION  , INPUT  );

     Serial.begin(9600);
-
-    Serial.println("Initializing I2C devices...");
-    Serial.print("I2C Adress = ");
-    Serial.println(adress);
+    Serial.println("Booting up...");
+    Serial.println(" ");
+    Serial.println("_ Astromech Industrie _");
+    Serial.print("  BB-8 Version ");
+    Serial.println(version);
+    Serial.println("===================");
+    Serial.println(" ");
+
+
+
+
+    Serial.print("Initializing I2C devices...  I2C ADRESS :");
+    Serial.print(adress);

     Wire.begin(adress);
-    //Wire.onReceive(); // register event
-

     accelgyro.initialize();
-
-
-    Serial.println("Testing device connections...");
-    Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
+	Serial.println(" [ OK ]");
+
+    Serial.print("Connect to the MPU6050 : ");
+    Serial.println(accelgyro.testConnection());
+    //Serial.println(accelgyro.testConnection() ? "Connection successful" : "Connection failed");
+
+    Serial.println("Booting successful !");
+    Serial.println("====================");
+

 }

@@ -266,6 +283,7 @@
     	{
         	Serial.println("ROll BB-8 ROLL !");
       	    production = true;
+      	    emgStop = false;
     	}

     	if (strcmp(strtok(msg, " "), "STOP") == 0)
@@ -274,9 +292,15 @@
     	    production = false;
     	}

+    	if (strcmp(strtok(msg, " "), "RESET") == 0)
+    	{
+    		Serial.println("RESET");
+    	    production = false;
+    	}
+
     	if (strcmp(strtok(msg, " "), "BOOT") == 0)
     	{
-    		Serial.println("STOP");
+
     	    BOOT = true;
     	    Serial.println("BOOTING UP...");
     	    delay(2000);
@@ -324,7 +348,7 @@
   		{
   			if(!xok)
   			{
-  				Serial.println("STAT x1 ");
+  				Serial.println("BOOT x1 ");
   				xok = true;
   				delay(2000);
   			}
@@ -353,13 +377,13 @@
   		{
   			if(!yok)
   			{
-  				Serial.println("STAT y1 ");
+  				Serial.println("BOOT y1 ");
   				yok = true;
   				delay(2000);
   			}
   		}

-  		// SET W IN POSITION
+  		// SET Z IN POSITION

   		if(!Z_POSITION)
   		{
@@ -372,7 +396,7 @@
   		{
   		  	if(!zok)
   			{
-  				Serial.println("STAT z1 ");
+  				Serial.println("BOOT z1 ");
   				zok = true;
   				Zangle = 0;
   				delay(2000);
@@ -392,7 +416,7 @@

 	// PRODUCTION CODE
     //-------------------------------------------------------------------------//
-    if(production)  //-
+    if(production && !emgStop)  //-
     {

   		// X //
@@ -506,6 +530,16 @@

   } //-
+
+  // Check if the Master-Board are ALIVE
+
+  if(digitalRead(PING_MASTER) && !ifPing)
+  {
+  	ifPing = true;
+  	pingMaster++;
+  }
+
+  if(digitalRead(PING_MASTER) && ifPing) ifPing = false;

   	// SEND SERIAL DATA
@@ -523,6 +557,32 @@
     	else LED_PING = true;
     	digitalWrite(PING, LED_PING);

+
+    	tmpPing2++;
+
+    	if(pingMaster > tmpPing)
+    	{
+    		tmpPing = pingMaster;
+    		tmpPing2 = 0;
+    	}
+    	if(tmpPing2 > 3) emgStop = true;
+
+
+
+    	if(!accelgyro.testConnection());
+    	{
+    		production = false;
+    		emgStop = true;
+    		accelgyro.initialize();
+    		if(accelgyro.testConnection())
+    		{
+    			production = true;
+    		}
+    	}
+
+
+
+    	/*

     	// SEND STATUT
     	Serial.print("STAT x");
@@ -541,5 +601,7 @@
     	Serial.print(Zangle);

     	Serial.println(" ");
+
+    	*/
     }
 }


Display digit as it is spoken

Display digit as it is spoken

--- noisy.ino
+++ noisy.ino
@@ -37,5 +37,12 @@

 void loop()
 {
-  saydigit(GD.random(10)); delay(1000);
+  int n = GD.random(10);
+
+  GD.Clear();
+  GD.cmd_number(240, 136, 31, OPT_CENTER, n);
+  GD.swap();
+
+  saydigit(n);
+  delay(1000);
 } //' }A


Delete lm35.ino.ino

Delete lm35.ino.ino

--- lm35.ino.ino
+++ lm35.ino.ino
@@ -1,22 +0,0 @@
-int val;
-int tempPin = A0;
-
-void setup()
-{
-Serial.begin(9600);
-}
-void loop()
-{
-val = analogRead(tempPin);
-float mv = ( val/1024.0)*3000;
-float cel = mv/10;
-float farh = (cel*9)/5 + 32;
-
-Serial.print("TEMPRATURE = ");
-Serial.print(cel);
-Serial.print("*C");
-Serial.println();
-delay(1000);
-
-}
-


Delete ST_Anything_Generic_Test_Sketch.ino


Add conversion of sequence to string and send over serial

--- Arduino_Code/Arduino_Code.ino
+++ Arduino_Code/Arduino_Code.ino
@@ -42,7 +42,6 @@
  recString.reserve(200);
  //seqSize = 0;
  seqIndex = 0;
- Serial.println("-----Start-----");
 }

 void loop() {
@@ -88,17 +87,13 @@
         {
           playerCreating = true;
           seqIndex = 0;
-          Serial.println("PLAYER, CREATE YOUR ENGINES");
         }
         timeOfLastChange = millis();

       }
       //LED is off and change must be made
       else if (!LEDon && (millis() - timeOfLastChange >= 500))
-      {
-          Serial.print("Turning on LED ");
-          Serial.println(seqArr[seqIndex]);
-
+      {
           digitalWrite(led[seqArr[seqIndex]], HIGH);
           LEDon = true;
           timeOfLastChange = millis();
@@ -112,8 +107,6 @@
       {
         if (!prevBtns[i] && digitalRead(btn[i]))
         {
-          Serial.print("YOU'RE PRESSING BTN ");
-          Serial.println(i);
           prevBtns[i] = true;
         }
         else if(prevBtns[i] && (digitalRead(btn[i]) == false))
@@ -121,15 +114,15 @@
           prevBtns[i] = false;
           seqArr[seqIndex] = i;
           seqIndex += 1;
-          Serial.print("Added this button to sequence: ");
-          Serial.println(i);
           if (seqIndex == seqSize)
           {
-            Serial.println("YOU ARE DONE ENTERING. YOUR SEQUENCE:");
+            //Convert int array to string
+            String oString;
             for (int i = 0; i < seqSize; i++)
             {
-              Serial.println(seqArr[i]);
+              oString = String(oString + String(seqArr[i]));
             }
+            Serial.println(oString);
             playerCreating = false;
             //TAKE THIS OUT LATER
             arduinoTurn = false;
@@ -188,9 +181,7 @@
       //PROCESS SEQUENCE
       }
       if (recString.charAt(0) == 's') {
-        Serial.print("Received sequence containing this many digits: ");
         seqSize = (recString.length()-1)/2;
-        Serial.println(seqSize);
         /*
         int* seq = new int[(recString.length()-1)/2];
         Serial.println(sizeof(*seq));


Fixed calculation of uv intensity

Fixed calculation of uv intensity

--- files/template_home/template_home.ino
+++ files/template_home/template_home.ino
@@ -118,7 +118,7 @@
   sleep(1);
   if (Wire.available()) lsb = Wire.read();
   uvValue = (msb << 8) | lsb;
-  return uvValue * 5;
+  return uvValue * 5.625;
 }

 int printHexToStream(const uint8_t *data, uint8_t length, Print &stream) // prints 8-bit data in hex


updated arduino code for 60hz tracking

updated arduino code for 60hz tracking

--- arduino/flea3_multi_pin_trigger_uno/flea3_multi_pin_trigger_uno.ino
+++ arduino/flea3_multi_pin_trigger_uno/flea3_multi_pin_trigger_uno.ino
@@ -8,9 +8,11 @@

 void loop()
 {
-  //100fps
+  //60fps - 8333
+  //80fps - 6250
+  //100fps - 5000
   PORTD = B10100000; //Set pins HIGH
-  delayMicroseconds(5000);
+  delayMicroseconds(8333);
   PORTD = B00000000; //Set pins LOW
-  delayMicroseconds(5000);
+  delayMicroseconds(8333);
 }


Set backlight later on in the loop. Brackets, whitespace and indentation. Variable names.

--- tfttask.ino
+++ tfttask.ino
@@ -10,28 +10,23 @@
 const bool     TFT_SHOW_RAW           = false;            /* show raw PWM values */
 const bool     HIGH_VIZ_PERCENTAGE    = true;             /* show channel percent values in TFT_TEXT_COLOR instead of the channel color to improve visibility */

-enum tftFontsize_t
-{
-  size0, size1, size2
-};
-
-enum displayState
-{
+enum tftFontsize_t {
+  SMALL, NORMAL, LARGE
+};
+
+enum displayState {
   normal, menu
 };

-struct tftPoint_t
-{
+struct tftPoint_t {
   uint16_t x;
   uint16_t y;
 };

-class tftButton
-{
+class tftButton {
   public:

-    struct button_t
-    {
+    struct button_t {
       uint16_t       x;
       uint16_t       y;
       uint16_t       w;
@@ -48,8 +43,7 @@

     void updateText( const button_t &button );

-    inline bool pressed( const button_t &button, const tftPoint_t &location )
-    {
+    inline bool pressed( const button_t &button, const tftPoint_t &location ) {
       return ( location.x > button.x && location.x < button.x + button.w ) && ( location.y > button.y && location.y < button.y + button.h );
     }

@@ -57,29 +51,25 @@

     void updateSlider( const button_t &area, const float &value, const float &rangeLow, const float &rangeHigh );

-    void updateSensorLabel( const button_t &tempArea, char * newLabel );
+    void updateSensorLabel( const button_t &tempArea, const char * newLabel );
 };

 tftButton button;

-const tftButton::button_t LIGHTSON_BUTTON
-{
-  10, 60, TFT_BUTTON_WIDTH, TFT_BUTTON_HEIGHT, ILI9341_BLUE, ILI9341_YELLOW, ILI9341_YELLOW, size0, "ON"
-};
-
-const tftButton::button_t LIGHTSOFF_BUTTON
-{
-  10, 115, TFT_BUTTON_WIDTH, TFT_BUTTON_HEIGHT, ILI9341_BLUE, ILI9341_YELLOW, ILI9341_YELLOW, size0, "OFF"
-};
-
-const tftButton::button_t LIGHTSAUTO_BUTTON
-{
-  10, 170, TFT_BUTTON_WIDTH, TFT_BUTTON_HEIGHT, ILI9341_BLUE, ILI9341_YELLOW, ILI9341_YELLOW, size0, "AUTO"
-};
-
-const tftButton::button_t EXIT_BUTTON
-{
-  210, 170, TFT_BUTTON_WIDTH, TFT_BUTTON_HEIGHT, ILI9341_BLUE, ILI9341_YELLOW, ILI9341_YELLOW, size0, "EXIT"
+const tftButton::button_t LIGHTSON_BUTTON {
+  10, 60, TFT_BUTTON_WIDTH, TFT_BUTTON_HEIGHT, ILI9341_BLUE, ILI9341_YELLOW, ILI9341_YELLOW, SMALL, "ON"
+};
+
+const tftButton::button_t LIGHTSOFF_BUTTON {
+  10, 115, TFT_BUTTON_WIDTH, TFT_BUTTON_HEIGHT, ILI9341_BLUE, ILI9341_YELLOW, ILI9341_YELLOW, SMALL, "OFF"
+};
+
+const tftButton::button_t LIGHTSAUTO_BUTTON {
+  10, 170, TFT_BUTTON_WIDTH, TFT_BUTTON_HEIGHT, ILI9341_BLUE, ILI9341_YELLOW, ILI9341_YELLOW, SMALL, "AUTO"
+};
+
+const tftButton::button_t EXIT_BUTTON {
+  210, 170, TFT_BUTTON_WIDTH, TFT_BUTTON_HEIGHT, ILI9341_BLUE, ILI9341_YELLOW, ILI9341_YELLOW, SMALL, "EXIT"
 };

 /* slider for backlight control - note: XPOS is center of slider*/
@@ -89,15 +79,13 @@
 const uint16_t BL_SLIDER_HEIGHT = 160;

 /* area to check for touch to control backlight */
-const tftButton::button_t BL_SLIDER_AREA
-{
-  BL_SLIDER_XPOS - BL_SLIDER_WIDTH / 2, BL_SLIDER_YPOS, BL_SLIDER_WIDTH, BL_SLIDER_HEIGHT, 0, 0, ILI9341_YELLOW, size0, "", "back light"
+const tftButton::button_t BL_SLIDER_AREA {
+  BL_SLIDER_XPOS - BL_SLIDER_WIDTH / 2, BL_SLIDER_YPOS, BL_SLIDER_WIDTH, BL_SLIDER_HEIGHT, 0, 0, ILI9341_YELLOW, SMALL, "", "back light"
 };

 /* buttons used on main screen */
-const tftButton::button_t MENU_BUTTON
-{
-  210, 10, TFT_BUTTON_WIDTH, TFT_BUTTON_HEIGHT, ILI9341_BLUE, ILI9341_YELLOW, ILI9341_YELLOW, size0, "MENU"
+const tftButton::button_t MENU_BUTTON {
+  210, 10, TFT_BUTTON_WIDTH, TFT_BUTTON_HEIGHT, ILI9341_BLUE, ILI9341_YELLOW, ILI9341_YELLOW, SMALL, "MENU"
 };

 tftButton::button_t tempArea[MAX_NUMBER_OF_SENSORS];
@@ -110,8 +98,7 @@

 void drawSensors();

-void IRAM_ATTR tftTask( void * pvParameters )
-{
+void tftTask( void * pvParameters ) {
   const TickType_t tftTaskdelayTime = ( 1000 / UPDATE_FREQ_TFT) / portTICK_PERIOD_MS;

   tft.fillScreen( TFT_BACK_COLOR );
@@ -127,24 +114,21 @@

   ( preferences.getString( "tftorientation", "normal" ) == "normal" ) ? tftOrientation = TFT_ORIENTATION_NORMAL : tftOrientation = TFT_ORIENTATION_UPSIDEDOWN;
   tft.setRotation( tftOrientation );
-  while ( !xDimmerTaskHandle )
-  {
-    vTaskDelay( 10 / portTICK_PERIOD_MS );
-  }
+
+  while ( !xDimmerTaskHandle ) vTaskDelay( 10 / portTICK_PERIOD_MS );
+
   ledcWrite( TFT_BACKLIGHT_CHANNEL, 0 );

-  while (1)
-  {
-    switch ( tftState )
-    {
-      case normal:
+  while (1) {
+    switch ( tftState ) {
+      case normal: {
         showStatus();
         break;
-
-      case menu:
+      }
+      case menu: {
         showMenu();
         break;
-
+      }
       default:
         break;
     }
@@ -152,18 +136,16 @@
   }
 }

-void showMenu()
-{
+void showMenu() {
   static lightState_t displayedLightStatus;

-  if ( tftClearScreen )
-  {
+  if ( tftClearScreen ) {
     tft.fillScreen( TFT_BACK_COLOR );
     drawMenuButtons();
     button.drawSlider( BL_SLIDER_AREA );
     button.updateSlider( BL_SLIDER_AREA, tftBrightness, 0, 100 );

-    tftButton::button_t versionString = { 0, ILI9341_TFTWIDTH - 20, ILI9341_TFTHEIGHT, 20, TFT_BACK_COLOR, ILI9341_RED, ILI9341_YELLOW, size2 };
+    tftButton::button_t versionString = { 0, ILI9341_TFTWIDTH - 20, ILI9341_TFTHEIGHT, 20, TFT_BACK_COLOR, ILI9341_RED, ILI9341_YELLOW, LARGE };

     snprintf( versionString.text, sizeof( versionString.text ), sketchVersion );
     button.updateText( versionString );
@@ -173,50 +155,41 @@
   }

   /* check if tftBrightness has changed */
-  if ( map( tftBrightness, 0, 100, 0, backlightMaxvalue ) != ledcRead( TFT_BACKLIGHT_CHANNEL ) )
-  { /* set new backlight value */
-    ledcWrite( TFT_BACKLIGHT_CHANNEL, map( tftBrightness, 0, 100, 0, backlightMaxvalue ) );
+  if ( map( tftBrightness, 0, 100, 0, backlightMaxvalue ) != ledcRead( TFT_BACKLIGHT_CHANNEL ) ) {
+    ledcWrite( TFT_BACKLIGHT_CHANNEL, map( tftBrightness, 0, 100, 0, backlightMaxvalue ) ); /* set new backlight value */
     button.updateSlider( BL_SLIDER_AREA, tftBrightness, 0, 100 );
   }

   /* check if light status has changed */
-  if ( displayedLightStatus != leds.state() )
-  {
+  if ( displayedLightStatus != leds.state() ) {
     drawMenuButtons();
     displayedLightStatus = leds.state();
   }

   /* process touch screen input */
-  if ( touch.tirqTouched() )
-  {
+  if ( touch.tirqTouched() ) {
     TS_Point p = touch.getPoint();
-
     tftPoint_t clickedLocation = mapToTft( p.x, p.y );

     if ( button.pressed( LIGHTSON_BUTTON , clickedLocation ) )
-    {
       leds.setState( LIGHTS_ON );
-    }
+
     else if ( button.pressed( LIGHTSOFF_BUTTON , clickedLocation ) )
-    {
       leds.setState( LIGHTS_OFF );
-    }
+
     else if ( button.pressed( LIGHTSAUTO_BUTTON , clickedLocation ) )
-    {
       leds.setState( LIGHTS_AUTO );
-    }
-    else if ( button.pressed( BL_SLIDER_AREA , clickedLocation ) )
-    {
+
+    else if ( button.pressed( BL_SLIDER_AREA , clickedLocation ) ) {
       static uint16_t oldLocation;
-      if (  clickedLocation.y != oldLocation )
-      {
+      if (  clickedLocation.y != oldLocation ) {
         tftBrightness = map( clickedLocation.y , BL_SLIDER_YPOS, BL_SLIDER_HEIGHT + BL_SLIDER_YPOS, 100, 0 );
         preferences.putFloat( "tftbrightness", tftBrightness );
         oldLocation = clickedLocation.y;
       }
     }
-    else if ( button.pressed( EXIT_BUTTON , clickedLocation ) )
-    {
+
+    else if ( button.pressed( EXIT_BUTTON , clickedLocation ) ) {
       ledcWrite( TFT_BACKLIGHT_CHANNEL, 0 );
       tftClearScreen = true;
       tftState = normal;
@@ -224,35 +197,25 @@
   }
 }

-void newSensors()
-{
+void newSensors() {
   tft.startWrite();
   tft.writeFillRect( 210, 60, TFT_BUTTON_WIDTH, 120, TFT_BACK_COLOR );
   tft.endWrite();

-  sensorName_t sensorName;
-  for ( uint8_t num = 0; num < logger.sensorCount(); num++ )
-  {
+  sensorName_t name;
+  for ( uint8_t num = 0; num < logger.sensorCount(); num++ ) {
     tempArea[num].x = 220;
     tempArea[num].y = 70 + num * 40;
     tempArea[num].w = TFT_BUTTON_WIDTH - 20;
     tempArea[num].h = 30;
     tempArea[num].color = TFT_BACK_COLOR;
     tempArea[num].labelcolor = ILI9341_WHITE;
-    tempArea[num].fontsize = size2;
-    button.updateSensorLabel( tempArea[num], (char *)logger.getSensorName( num, sensorName ) );
-  }
-}
-
-void updateSensorLabels(  )
-{
-  sensorName_t sensorName;
-  for ( uint8_t thisSensor = 0; thisSensor < logger.sensorCount(); thisSensor++ )
-    button.updateSensorLabel( tempArea[thisSensor], (char *)logger.getSensorName( thisSensor, sensorName ) );
-}
-
-void showStatus()
-{
+    tempArea[num].fontsize = LARGE;
+    button.updateSensorLabel( tempArea[num], logger.getSensorName( num, name ) );
+  }
+}
+
+void showStatus() {
   const uint16_t BARS_BOTTOM      = 190;
   const uint16_t BARS_HEIGHT      = BARS_BOTTOM - 10;
   const uint16_t BARS_BORDER      = 12;
@@ -264,11 +227,10 @@

   uint16_t channelColor565[NUMBER_OF_CHANNELS];

-  if ( tftClearScreen )
-  {
+  if ( tftClearScreen ) {
     tft.fillScreen( TFT_BACK_COLOR );
     button.draw( MENU_BUTTON );
-    showIPAddress(  );
+    showIPAddress();
     displayedWiFiStatus = WiFi.status();
   }

@@ -276,109 +238,87 @@
   static uint16_t oldColor565[NUMBER_OF_CHANNELS];

   tft.startWrite();
-  for ( uint8_t channelNumber = 0; channelNumber < NUMBER_OF_CHANNELS; channelNumber++ )
-  {
-    uint32_t color = strtol( &channel[channelNumber].color[1], NULL, 16 );
-    channelColor565[channelNumber] = tft.color565( ( color & 0xFF0000 ) >> 16, ( color & 0x00FF00 ) >> 8, color & 0x0000FF  );
+  for ( uint8_t num = 0; num < NUMBER_OF_CHANNELS; num++ ) {
+    uint32_t color = strtol( &channel[num].color[1], NULL, 16 );
+    channelColor565[num] = tft.color565( ( color & 0xFF0000 ) >> 16, ( color & 0x00FF00 ) >> 8, color & 0x0000FF  );

     /* only draw channels that changed percentage or color */
-    if ( tftClearScreen || oldPercentage[ channelNumber ] != channel[channelNumber].currentPercentage ||
-         oldColor565[ channelNumber ] != channelColor565[ channelNumber ] )
-    {
+    if ( tftClearScreen || oldPercentage[ num ] != channel[num].currentPercentage ||
+         oldColor565[ num ] != channelColor565[ num ] ) {
       // redraw the top part of the bar
-      tft.writeFillRect( channelNumber * BARS_WIDTH + BARS_BORDER,
+      tft.writeFillRect( num * BARS_WIDTH + BARS_BORDER,
                          BARS_BOTTOM - BARS_HEIGHT,
                          BARS_WIDTH - BARS_BORDER * 2,
-                         BARS_HEIGHT - channel[channelNumber].currentPercentage * HEIGHT_FACTOR + 1, /* + 1 is a fudge factor to delete the bottom pixel TODO: fix it... */
+                         BARS_HEIGHT - channel[num].currentPercentage * HEIGHT_FACTOR + 1, /* + 1 is a fudge factor to delete the bottom pixel TODO: fix it... */
                          TFT_BACK_COLOR );
       // redraw the bottom part of the bar
-      tft.writeFillRect( channelNumber * BARS_WIDTH + BARS_BORDER,
-                         BARS_BOTTOM - channel[channelNumber].currentPercentage * HEIGHT_FACTOR,
+      tft.writeFillRect( num * BARS_WIDTH + BARS_BORDER,
+                         BARS_BOTTOM - channel[num].currentPercentage * HEIGHT_FACTOR,
                          BARS_WIDTH - BARS_BORDER * 2,
-                         channel[channelNumber].currentPercentage * HEIGHT_FACTOR,
-                         channelColor565[channelNumber]);
+                         channel[num].currentPercentage * HEIGHT_FACTOR,
+                         channelColor565[num]);
     }
   }
   tft.endWrite();

   uint32_t averageLedBrightness = 0;

-  for ( uint8_t channelNumber = 0; channelNumber < NUMBER_OF_CHANNELS; channelNumber++ )
-  {
+  for ( uint8_t num = 0; num < NUMBER_OF_CHANNELS; num++ ) {
     /* only write percentage if changed */
-    if ( tftClearScreen || channel[channelNumber].currentPercentage != oldPercentage[channelNumber] )
-    {
+    if ( tftClearScreen || channel[num].currentPercentage != oldPercentage[num] ) {
       tftButton::button_t label;

       if ( TFT_SHOW_RAW )
-      {
-        snprintf( label.text, sizeof( label.text ), "%04X", ledcRead( channelNumber ) );
-      }
+        snprintf( label.text, sizeof( label.text ), "%04X", ledcRead( num ) );
       else
-      {
-        threeDigitPercentage( label.text, sizeof( label.text ), channel[channelNumber].currentPercentage, SHOW_PERCENTSIGN );
-      }
-      label.x = channelNumber * BARS_WIDTH;
+        threeDigitPercentage( label.text, sizeof( label.text ), channel[num].currentPercentage, SHOW_PERCENTSIGN );
+      label.x = num * BARS_WIDTH;
       label.y = BARS_BOTTOM + 4;
       label.w = BARS_WIDTH;
       label.h = 10;
-      label.fontsize = size0;
+      label.fontsize = SMALL;
       label.color = TFT_BACK_COLOR;
       label.bordercolor = 0;
-      label.labelcolor = channelColor565[channelNumber];
+      label.labelcolor = channelColor565[num];
       int16_t x, y;
       uint16_t w, h;

-      tft.setTextSize( size0 );
+      tft.setTextSize( SMALL );
       tft.getTextBounds( label.text, 0, 0, &x, &y, &w, &h );
       tft.setCursor( ( label.x + label.w / 2 ) - ( w / 2 ),
                      ( label.y + label.h / 2 ) - ( h / 2 ) );
       if ( HIGH_VIZ_PERCENTAGE )
-      {
         tft.setTextColor( TFT_TEXT_COLOR, TFT_BACK_COLOR );
-      }
       else
-      {
-        tft.setTextColor( channelColor565[channelNumber], TFT_BACK_COLOR );
-      }
+        tft.setTextColor( channelColor565[num], TFT_BACK_COLOR );
       tft.print(label.text);
     }
-    oldColor565[ channelNumber ] = channelColor565[ channelNumber];
-    oldPercentage[ channelNumber ] = channel[channelNumber].currentPercentage;
-    averageLedBrightness += ledcRead( channelNumber );
-  }
-
-  averageLedBrightness = averageLedBrightness / NUMBER_OF_CHANNELS;
-
-  uint16_t rawBrightness = map( tftBrightness, 0, 100, 0, backlightMaxvalue );
-
-  ledcWrite( TFT_BACKLIGHT_CHANNEL, ( averageLedBrightness > rawBrightness ) ? rawBrightness : averageLedBrightness );
+    oldColor565[ num ] = channelColor565[ num];
+    oldPercentage[ num ] = channel[num].currentPercentage;
+    averageLedBrightness += ledcRead( num ); //backlight will be set later on...
+  }

   static uint8_t      lastCount{0};
   static sensorName_t displayedName[MAX_NUMBER_OF_SENSORS];
   static float        displayedTemp[MAX_NUMBER_OF_SENSORS];

-  if ( tftClearScreen || logger.sensorCount() != lastCount )
-  {
+  if ( tftClearScreen || logger.sensorCount() != lastCount ) {
     memset( displayedName, 0, sizeof( displayedName ) );
     newSensors();
     lastCount = logger.sensorCount();
   }

-  for ( uint8_t num = 0; num < logger.sensorCount(); num++ )
-  {
+  for ( uint8_t num = 0; num < logger.sensorCount(); num++ ) {
     //if the name changed update the display
     sensorName_t name;
     logger.getSensorName( num, name );
-    if ( tftClearScreen || strcmp( displayedName[num], name ) )
-    {
+    if ( tftClearScreen || strcmp( displayedName[num], name ) ) {
       button.updateSensorLabel( tempArea[num], name );
       memcpy( displayedName[num], name, sizeof( sensorName_t ) );
     }

     // if the temperature changed update the display
-    if ( tftClearScreen || ( displayedTemp[num] != logger.sensorTemp( num ) ) )
-    {
+    if ( tftClearScreen || ( displayedTemp[num] != logger.sensorTemp( num ) ) ) {
       snprintf( tempArea[num].text, sizeof( tempArea[num].text ), " %.1f%c ", logger.sensorTemp( num ), char(247) );
       button.updateText( tempArea[num] );
       displayedTemp[num] = logger.sensorTemp( num );
@@ -388,44 +328,44 @@
   tftClearScreen = false;

   struct tm timeinfo;
-  if ( getLocalTime( &timeinfo, 0 ) ) {
+  if ( getLocalTime( &timeinfo, 0 ) ) {  //don't wait!
     const tftButton::button_t clockArea {
-      10, 205, 110, 30, TFT_BACK_COLOR, ILI9341_YELLOW, TFT_TEXT_COLOR, size2
+      10, 205, 110, 30, TFT_BACK_COLOR, ILI9341_YELLOW, TFT_TEXT_COLOR, LARGE
     };
-
     static uint16_t oldtimeinfo;
     if ( timeinfo.tm_sec != oldtimeinfo ) {
       char buff[15];
       strftime( buff, sizeof( buff ), "%T", &timeinfo );
-
       int16_t x, y;
       uint16_t w, h;
-
       tft.setTextSize( clockArea.fontsize );
       tft.getTextBounds( buff, 0, 0, &x, &y, &w, &h);
       tft.setCursor( ( clockArea.x + clockArea.w / 2 ) - ( w / 2 ),
                      ( clockArea.y + clockArea.h / 2 ) - ( h / 2 ) );
       tft.setTextColor( TFT_TEXT_COLOR, TFT_BACK_COLOR );
       tft.print( buff );
-
       oldtimeinfo = timeinfo.tm_sec;
     }
   }

-  if ( displayedWiFiStatus != WiFi.status() )
-  {
+  if ( displayedWiFiStatus != WiFi.status() ) {
     showIPAddress( );
     displayedWiFiStatus = WiFi.status();
   }
-
-  if ( touch.tirqTouched() )
-  {
+  //all screen items are refreshed, now lets set the backlight
+
+  averageLedBrightness = averageLedBrightness / NUMBER_OF_CHANNELS;
+
+  uint16_t rawBrightness = map( tftBrightness, 0, 100, 0, backlightMaxvalue );
+
+  ledcWrite( TFT_BACKLIGHT_CHANNEL, ( averageLedBrightness > rawBrightness ) ? rawBrightness : averageLedBrightness );
+
+  if ( touch.tirqTouched() ) {
     tftPoint_t clickedLocation;

     TS_Point p = touch.getPoint();
     clickedLocation = mapToTft( p.x, p.y );
-    if ( button.pressed( MENU_BUTTON , clickedLocation ) )
-    {
+    if ( button.pressed( MENU_BUTTON , clickedLocation ) ) {
       ledcWrite( TFT_BACKLIGHT_CHANNEL, 0 );
       tftState = menu;
       tftClearScreen = true;
@@ -433,8 +373,7 @@
   }
 }

-void drawMenuButtons()
-{
+void drawMenuButtons() {
   tftButton::button_t tempButton;

   tempButton = LIGHTSON_BUTTON;
@@ -452,17 +391,14 @@
   button.draw( EXIT_BUTTON );
 }

-static uint16_t mapUint16( const uint16_t &x, const uint16_t &in_min, const uint16_t &in_max, const uint16_t &out_min, const uint16_t &out_max)
-{
+uint16_t mapUint16( const uint16_t &x, const uint16_t &in_min, const uint16_t &in_max, const uint16_t &out_min, const uint16_t &out_max) {
   return ( x - in_min ) * ( out_max - out_min ) / ( in_max - in_min ) + out_min;
 }

-static struct tftPoint_t mapToTft( const uint16_t &touchX, const uint16_t &touchY )
-{
+struct tftPoint_t mapToTft( const uint16_t &touchX, const uint16_t &touchY ) {
   const uint16_t XPT_RES = 4096;

-  if ( !TOUCH_IS_INVERTED )
-  {
+  if ( !TOUCH_IS_INVERTED ) {
     if (  tftOrientation == TFT_ORIENTATION_UPSIDEDOWN )
       return { mapUint16( touchX, 0, XPT_RES, 0, 320 ),
                mapUint16( touchY, 0, XPT_RES, 0, 240 ) };
@@ -471,8 +407,7 @@
       return { mapUint16( touchX, 0, XPT_RES, 320, 0 ),
                mapUint16( touchY, 0, XPT_RES, 240, 0 ) };
   }
-  else
-  {
+  else {
     if (  tftOrientation == TFT_ORIENTATION_UPSIDEDOWN )
       return { mapUint16( touchX, 0, XPT_RES, 320, 0 ),
                mapUint16( touchY, 0, XPT_RES, 240, 0 ) };
@@ -484,19 +419,13 @@
 }

 void showIPAddress() {
-
   const tftButton::button_t networkArea {
-    140, 205, 170, 30, 0, ILI9341_YELLOW, ILI9341_YELLOW, size2, "", ""
+    140, 205, 170, 30, 0, ILI9341_YELLOW, ILI9341_YELLOW, LARGE, "", ""
   };
-
-  tcpip_adapter_ip_info_t ip_info;
-
-  ESP_ERROR_CHECK( tcpip_adapter_get_ip_info( TCPIP_ADAPTER_IF_STA, &ip_info ) );
   char buff[15];
-  snprintf( buff, sizeof( buff ), "%s", ip4addr_ntoa( &ip_info.ip ) );
-
   int16_t x, y;
   uint16_t w, h;
+  snprintf( buff, sizeof( buff ), "%s", WiFi.localIP().toString().c_str() );
   tft.setTextSize( networkArea.fontsize );
   tft.getTextBounds( buff, 0, 0, &x, &y, &w, &h);
   tft.setCursor( ( networkArea.x + networkArea.w / 2 ) - w / 2,
@@ -505,11 +434,10 @@
   tft.print( buff );
 }

-void drawSensors()
-{
-  sensorName_t sensorName;
-  for ( uint8_t thisSensor = 0; thisSensor < logger.sensorCount(); thisSensor++ )
-    button.updateSensorLabel( tempArea[thisSensor], (char *)logger.getSensorName( thisSensor, sensorName ) );
+void drawSensors() {
+  sensorName_t name;
+  for ( uint8_t num = 0; num < logger.sensorCount(); num++ )
+    button.updateSensorLabel( tempArea[num], logger.getSensorName( num, name ) );
 }

 //tftButton:: functions
@@ -523,7 +451,7 @@
   uint16_t w, h;

   if ( area.label ) {
-    tft.setTextSize(size0);
+    tft.setTextSize(SMALL);
     tft.getTextBounds( (char *)area.label, 0, 0, &x, &y, &w, &h );
     tft.setCursor( ( area.x + area.w / 2 ) - w / 2,
                    ( area.y + area.h + 3 ) );
@@ -532,7 +460,7 @@
   }

   if ( area.text ) {
-    tft.setTextSize(size0);
+    tft.setTextSize(SMALL);
     tft.getTextBounds( (char *)area.text, 0, 0, &x, &y, &w, &h );
     tft.setCursor( ( area.x + area.w / 2 ) - w / 2,
                    ( area.y - 17 ) );
@@ -561,7 +489,7 @@
   snprintf( knob.text, sizeof( knob.text ), " %i%% ", int(value) );
   int16_t x, y;
   uint16_t w, h;
-  tft.setTextSize(size2);
+  tft.setTextSize(LARGE);
   tft.getTextBounds( (char *)knob.text, 0, 0, &x, &y, &w, &h );
   tft.setCursor( ( area.x + area.w / 2 ) - ( w / 2 ),
                  ( area.y - 20 ) );
@@ -600,12 +528,12 @@
   }
 }

-void tftButton::updateSensorLabel( const tftButton::button_t &tempArea, char * newLabel ) {
+void tftButton::updateSensorLabel( const tftButton::button_t &tempArea, const char * newLabel ) {
   int16_t x, y;
   uint16_t w, h;

   tft.fillRect( tempArea.x - 2, tempArea.y - 6, tempArea.w + 4, 8, TFT_BACK_COLOR );
-  tft.setTextSize( size0 );
+  tft.setTextSize( SMALL );
   tft.getTextBounds( newLabel, 0, 0, &x, &y, &w, &h);
   tft.setCursor( ( tempArea.x + tempArea.w / 2 ) - w / 2,
                  ( tempArea.y - 6 ) );


Arduino code for the remote.

Arduino code for the remote.

--- controller.ino
+++ controller.ino
@@ -10,7 +10,6 @@
 int LH = 0;
 int RV = 0;
 int RH = 0;
-

 void setup() {
 Serial.begin(115200);


Fix help message. '!' command no longer exists in the example.

--- Arduino/example/walk/walk.ino
+++ Arduino/example/walk/walk.ino
@@ -92,7 +92,7 @@
                   "but not persisted until saving it.");
   Serial.println("W -- save trim data to EEPROM");
   Serial.println("R -- load trim data from EEPROM");
-  Serial.println("! -- toggle swing mode");
+  Serial.println("? -- show this message");
 }

 WalkController walk_controller;


inlining function so that INO is content to build

--- sketch/bertha/src/bertha.ino
+++ sketch/bertha/src/bertha.ino
@@ -12,15 +12,14 @@
 }

 void loop() {
+
   BerthaBuffer request = io->nextRequest();
-  BerthaBuffer response = processRequest(request);
-  io->send(response);
-  io->reset();
-}

-BerthaBuffer processRequest(BerthaBuffer request) {
   Command* command = CommandFactory::createCommand(request);
   BerthaBuffer response = command->execute();
   delete command;
-  return response;
+
+  io->send(response);
+  io->reset();
+
 }


updated DHT checksum code and formatted data readout

--- software/sensors/sensors.ino
+++ software/sensors/sensors.ino
@@ -5,7 +5,7 @@
     Andy Stevenson-Jones

     Arduino reads sensors and returns formatted data through the COM port
-    Format: "Soil Moisture, Light (RGB), Soil Temperature, Air Relative Humidity, Air Temperature, IR Level"
+    Format: "Soil Moisture, Light (RGB), Soil Temperature, Air Temperature, Air Relative Humidity, IR Level"
 */

@@ -37,7 +37,7 @@
  */

  /*
-  * MESSAGR STRUCTURE
+  * MESSAGE STRUCTURE
       msg[0] = SoilMoisture UB
       msg[1] = SoilMoisture LB;
       msg[2] = red UB
@@ -150,7 +150,7 @@
   Serial.println("Node setup complete.");
   Serial.println("--------------------------------------------");
   Serial.println();
-  Serial.println("Soil Moisture, Light (RGB), Soil Temperature, Air Relative Humidity, Air Temperature, IR Level");
+  Serial.println("Soil Moisture, Light (RGB), Soil Temperature, Air Temperature, Air Relative Humidity, IR Level, DHT checksum error");
   delay(2000);
 }

@@ -178,28 +178,35 @@

   // DHT AIR T/RH SENSOR
   int chk = DHT.read11(DHT11_PIN);
+  int dht_checksum_error=0; // variable to hold error codes
   switch (chk)
   {
     case DHTLIB_OK:
       //               Serial.print("OK,\t");
       break;
     case DHTLIB_ERROR_CHECKSUM:
-      Serial.print("Checksum error,\t");
+      //Serial.print("Checksum error,\t");
+      dht_checksum_error |= 0x01;
       break;
     case DHTLIB_ERROR_TIMEOUT:
-      Serial.print("Time out error,\t");
+      //Serial.print("Time out error,\t");
+      dht_checksum_error |= 0x02;
       break;
     case DHTLIB_ERROR_CONNECT:
-      Serial.print("Connect error,\t");
+      //Serial.print("Connect error,\t");
+      dht_checksum_error |= 0x04;
       break;
     case DHTLIB_ERROR_ACK_L:
-      Serial.print("Ack Low error,\t");
+      //Serial.print("Ack Low error,\t");
+      dht_checksum_error |= 0x08;
       break;
     case DHTLIB_ERROR_ACK_H:
-      Serial.print("Ack High error,\t");
+      //Serial.print("Ack High error,\t");
+      dht_checksum_error |= 0x10;
       break;
     default:
-      Serial.print("Unknown error,\t");
+      //Serial.print("Unknown error,\t");
+      dht_checksum_error |= 0x80;
       break;
   }
   // display data
@@ -255,6 +262,8 @@
   Serial.print(AirHumidity, DEC); // Air Humidity
   Serial.print(", ");
   Serial.print(photoIR);  // IR level
+  Serial.print(", ");
+  Serial.print(dht_checksum_error);  // DHT checksum error

   // finish


Added Geiger Counter Update

Added Geiger Counter Update

--- Mod/Mod_Geiger/Mod_Geiger.ino
+++ Mod/Mod_Geiger/Mod_Geiger.ino
@@ -1,4 +1,3 @@
-#include <OSSex.h>

 /* It's the end times. The world is a vast desolated scorched crumb.
  * The only technology that has survived are Comingle's Sex Toys
@@ -14,15 +13,14 @@
  * {♥} COMINGLE --  2014/12/04 -- Share Freely
  */

-
-
+#include <OSSex.h>

 void setup() {
   // 0 for all Multivibes currently.
   Toy.setID(0);

   // Blip all the motors and flash the LED to show that everything is working and the device is on.
-  startupSequence();
+  startupSequence();s

   pinMode(Toy.device.inPins[1], INPUT);


increase threshold to 140

increase threshold to 140

--- sensor_clock_2.ino
+++ sensor_clock_2.ino
@@ -25,7 +25,7 @@
 #define SLEEP_INTERVAL 250 //0.25s
 #define SLEEP_LONG_INTERVAL 45000 //45s

-#define LIGHT_THRESHOLD 70
+#define LIGHT_THRESHOLD 140

 #define OFF_HOUR 00
 #define OFF_MIN 00


baton slower rotation

baton slower rotation

--- baton/baton.ino
+++ baton/baton.ino
@@ -22,7 +22,7 @@
 #define DISCO_TWIRL_2 8

 int maxPatternId = 8;
-int rotationInMillseconds = 4000; // 20 seconds for production
+int rotationInMillseconds = 8000; // 20 seconds for production

 bool holdPattern = false;
 int patternId = BEAUTIFUL_SPARKLES;


Some improvements of serial debugging

Some improvements of serial debugging

--- src/iris/iris.ino
+++ src/iris/iris.ino
@@ -109,7 +109,6 @@
 {
   if (isManualMode())
   {
-    Serial.println(getJoystickValue());
     moveServo(getJoystickValue());
   }
 }
@@ -158,21 +157,21 @@
     {
       time += "0";
     }
-    time += (String) gps.time.hour() + ":";
+    time += (String)gps.time.hour() + ":";

     // ...minutes...
     if (gps.time.minute() < 10)
     {
       time += "0";
     }
-    time += (String) gps.time.minute() + ":";
+    time += (String)gps.time.minute() + ":";

     // ...and seconds
     if (gps.time.second() < 10)
     {
       time += "0";
     }
-    time += (String) gps.time.minute();
+    time += (String)gps.time.minute();

     return time;
   }
@@ -217,7 +216,7 @@
     ftoa(latitude, gps.location.lat(), 6);
     if (showCardinal)
     {
-      return (String) latitude + "N";
+      return (String)latitude + "N";
     }
     return latitude;
   }
@@ -239,7 +238,7 @@
     ftoa(longitude, gps.location.lng(), 6);
     if (showCardinal)
     {
-      return (String) longitude + "E";
+      return (String)longitude + "E";
     }
     return longitude;
   }
@@ -255,7 +254,7 @@
 {
   if (gps.speed.isValid())
   {
-    return (String) gps.speed.knots() + " knots";
+    return (String)gps.speed.knots() + " knots";
   }
   return "Invalid speed...";
 }
@@ -269,7 +268,7 @@
 {
   if (gps.speed.isValid())
   {
-    return (String) gps.course.deg() + "deg";
+    return (String)gps.course.deg() + "deg";
   }
   return "Invalid course...";
 }
@@ -283,7 +282,7 @@
 {
   if (gps.speed.isValid())
   {
-    return (String) gps.altitude.meters() + "m";
+    return (String)gps.altitude.meters() + "m";
   }
   return "Invalid altitude...";
 }
@@ -296,7 +295,7 @@
 {
   if (gps.speed.isValid())
   {
-    return (String) gps.satellites.value();
+    return (String)gps.satellites.value();
   }
   return "Invalid satellites...";
 }
@@ -341,13 +340,13 @@
 {
   if (MIN_POSITION <= position && position <= MAX_POSITION)
   {
-    Serial.println("Moving servo to position: " + position);
+    Serial.println("Moving servo to position: " + (String)position);
     lastValidPosition = position;
     analogWrite(SERVO_PIN, position);
   }
   else
   {
-    Serial.println("Wanted servo position is invalid, moving servo to last valid position: " + lastValidPosition);
+    Serial.println("Wanted servo position is invalid, moving servo to last valid position: " + (String)lastValidPosition);
     analogWrite(SERVO_PIN, lastValidPosition);
   }
 }
@@ -385,7 +384,7 @@
 int getServoFeedback()
 {
   int feedback = analogRead(SERVO_FEEDBACK_PIN);
-  Serial.println("Feedback: " + feedback);
+  Serial.println("Feedback: " + (String)feedback);
   return feedback;
 }


code optimization

code optimization

--- Pad/pad/pad.ino
+++ Pad/pad/pad.ino
@@ -34,7 +34,6 @@
 int delay_strip2 = 500;
 CRGB strip2[NUM_LEDS_STRIP2];

-
 const int responseDelay = 70;
 const int mouseReaction = 20;

@@ -53,7 +52,7 @@
     pinMode(mouse[i], INPUT_PULLUP);
   }

-  Serial.begin(9600);
+  //Serial.begin(9600);
   // initialize mouse control:
   Mouse.begin();
   Keyboard.begin();
@@ -62,28 +61,17 @@
 }

 void loop() {
-  // move the leds strips!
-  strip();
-  // check buttons states for move the body
-  for ( byte i = 0; i < 6; i++) {
-    button_read = digitalRead(Button[i]);
-    if (button_read == LOW) {
-      Serial.println("ok");
-      button_(i);
-      delay(responseDelay);
-      Keyboard.releaseAll();
-    }
+  // strip function
+  for (int dot = 0; dot < NUM_LEDS_STRIP1; dot++) {
+    strip1[dot] = CRGB::Blue;
+    FastLED.show();
+
+    button_check();
+
+    delay(30);
+    // clear this led for the next time around the loop
+    strip1[dot] = CRGB::Black;
   }
-  // check buttons states for move the eyes
-  for ( byte i = 0; i < 4; i++) {
-    mouse_read = digitalRead(mouse[i]);
-    if (mouse_read == LOW) {
-      //Serial.println("ok");
-      delay(responseDelay);
-      mouse_(i);
-    }
-  }
-
 }

 void mouse_(byte i) {
@@ -113,13 +101,22 @@
     Keyboard.press(' ');
 }

-// strip function
-void strip() {
-  for (int dot = 0; dot < NUM_LEDS_STRIP1; dot++) {
-    strip1[dot] = CRGB::Blue;
-    FastLED.show();
-    // clear this led for the next time around the loop
-    strip1[dot] = CRGB::Black;
-    delay(30);
+void button_check() {
+  for ( byte i = 0; i < 6; i++) {
+    // check buttons states for move the body
+    button_read = digitalRead(Button[i]);
+    // check buttons states for move the eyes
+    mouse_read = digitalRead(mouse[i]);
+    if (button_read == LOW) {
+      //Serial.println("ok");
+      button_(i);
+      delay(responseDelay);
+      Keyboard.releaseAll();
+    }
+    if (mouse_read == LOW && i < 4) {
+      //Serial.println("ok");
+      delay(responseDelay);
+      mouse_(i);
+    }
   }
 }


Simplified collision detection

Simplified collision detection

--- contrib/manicminer.ino
+++ contrib/manicminer.ino
@@ -634,6 +634,14 @@
   return level_base() + (y << 5) + x;
 }

+static void rd2(byte &a, byte &b, uint32_t addr)
+{
+  byte u[2];
+  GD.rd_n(u, addr, 2);
+  a = u[0];
+  b = u[1];
+}
+
 // crumble block at s, which is the sequence
 // 2 -> 8 -> 9 -> 10 -> 11 -> 12 -> 13 -> 14 -> AIR

@@ -647,43 +655,43 @@
     GD.wr(s, nexts[r]);
 }

+static byte any(byte code, byte a, byte b, byte c, byte d)
+{
+  return ((a == code) ||
+          (b == code) ||
+          (c == code) ||
+          (d == code));
+}
+
 // is it legal for willy to be at (x,y)
 static int canbe(byte x, byte y)
 {
   uint32_t addr = atxy(x / 8, y / 8);
-  return
-    (GD.rd(addr) != ELEM_WALL) &&
-    (GD.rd(addr+1) != ELEM_WALL) &&
-    (GD.rd(addr+32) != ELEM_WALL) &&
-    (GD.rd(addr+33) != ELEM_WALL);
+  byte a, b, c, d;
+  rd2(a, b, addr);
+  rd2(c, d, addr + 32);
+  return !any(ELEM_WALL, a, b, c, d);
 }

 // is Willy standing in a solar ray?
 static int inray(byte x, byte y)
 {
   uint32_t addr = atxy(x / 8, y / 8);
+  byte a, b, c, d;
+  rd2(a, b, addr);
+  rd2(c, d, addr + 32);
   return
-    (GD.rd(addr) > 0x80 ) ||
-    (GD.rd(addr+1) > 0x80) ||
-    (GD.rd(addr+32) > 0x80) ||
-    (GD.rd(addr+33) > 0x80);
+    (a > 0x80 ) ||
+    (b > 0x80) ||
+    (c > 0x80) ||
+    (d > 0x80);
 }

 static void under_willy(byte &a, byte &b, byte &c, byte &d)
 {
   uint32_t addr = atxy(state.wx / 8, state.wy / 8);
-  a = GD.rd(addr);
-  b = GD.rd(addr+1);
-  c = GD.rd(addr+32);
-  d = GD.rd(addr+33);
-}
-
-static byte any(byte code, byte a, byte b, byte c, byte d)
-{
-  return ((a == code) |
-          (b == code) |
-          (c == code) |
-          (d == code));
+  rd2(a, b, addr);
+  rd2(c, d, addr + 32);
 }

 static byte collide_16x16(byte x, byte y)
@@ -700,8 +708,10 @@
   // Animate conveyors:
   byte conveyor_offset = (7 & state.t) ^ (state.conveyordir ? 0 : 7);
   uint32_t level_chars = TILES_MEM + 15 * 64 * state.level;
-  GD.wr_n(level_chars + 4 * 64, state.conveyor0 + conveyor_offset, 8);
-  GD.wr_n(level_chars + 4 * 64 + 3 * 8, state.conveyor1 + (7 ^ conveyor_offset), 8);
+  GD.cmd_memwrite(level_chars + 4 * 64, 8);
+  GD.copyram(state.conveyor0 + conveyor_offset, 8);
+  GD.cmd_memwrite(level_chars + 4 * 64 + 3 * 8, 8);
+  GD.copyram(state.conveyor1 + (7 ^ conveyor_offset), 8);

   // Willy movement
   // See http://www.seasip.demon.co.uk/Jsw/manic.mac
@@ -726,9 +736,9 @@
     // sprintf(debug, "jumping=%d index=%d (%d,%d)", state.jumping, index, state.wx, state.wy);
   }
   uint32_t feet_addr = atxy(state.wx >> 3, (state.wy + 16) >> 3);
-  byte elem0 = GD.rd(feet_addr);
-  byte elem1 = GD.rd(feet_addr + 1);
-  byte elem = ((1 <= elem0) && (elem0 <= 31)) ? elem0 : elem1;
+  byte elems[2];
+  GD.rd_n(elems, feet_addr, 2);
+  byte elem = ((1 <= elems[0]) && (elems[0] <= 31)) ? elems[0] : elems[1];

   byte dx = 0xff;
   byte first_jump = (con & CONTROL_JUMP) && state.lastdx == 0xff;
@@ -987,11 +997,11 @@
     load_level();
     state.alive = 1;
     while (state.alive) {
-uint32_t t0 = GD.rd32(REG_FRAMES);
       draw_all();
+uint32_t t0 = millis();
       move_all();
-uint32_t t1 = GD.rd32(REG_FRAMES);
-      printf("Took %d frames\n", (t1 - t0) & 0xff);
+uint32_t t1 = millis();
+      printf("Took %d millis\n", (t1 - t0));
     }
   }
   game_over();


Implementing HTTP GET pull, adding XS1 push, improving code

--- arduino/arduino.ino
+++ arduino/arduino.ino
@@ -18,7 +18,7 @@
 //#define USE_NEOPIXEL
 #define NEOPIXEL_PIN 6

-//#define USE_XS1_SERVER
+#define USE_XS1_SERVER
 #define XS1_IP (10, 11, 10, 18)
 #define XS1_URL "/control?callback=cname&cmd=set_state_sensor&number=9&value="

@@ -54,13 +54,15 @@
 void networkConnect();
 void wifiConnect();
 void ethernetConnect();
-
 void serverCheck();
 String serverHeader(String);
+String requestHeader(String url);
+bool networkRequest(IPAddress server, String url);

 void triggerCheck();
 void gotTriggered();

+void push();
 void xs1Push();
 void strombewusstPush();

@@ -84,6 +86,10 @@
   WiFiServer server = WiFiServer(SERVER_PORT);
   WiFiUDP udp;
   int connectionStatus = WL_IDLE_STATUS;
+#endif
+
+#ifdef USE_NETWORK
+  char requestBuffer[128];
 #endif

 #ifdef USE_STROMBEWUSST_SERVER
@@ -258,34 +264,13 @@
   int pointer = millis() / 1000 / TIMEFRAME % STORAGE_HOURS;
   if (pointer != storagePointer)
   {
-    #ifdef USE_STROMBEWUSST_SERVER
-      strombewusstPush();
+    #ifdef USE_NETWORK
+      push();
     #endif
-    #ifdef USE_XS1_SERVER
-      xs1Push();
-    #endif
+
     storagePointer = pointer;
     pointerChanged();
   }
-}
-
-#ifdef USE_XS1_SERVER
-void xs1Push()
-{
-
-}
-#endif
-
-void strombewusstPush()
-{
-  // Make sure we have either the Ethernet or WiFi shield enabled
-  #ifdef USE_STROMBEWUSST_SERVER
-    // Set the last byte the the current frame's value
-    udpBuffer[33] = storage[storagePointer];
-    udp.beginPacket(STROMBEWUSST_SERVER, STROMBEWUSST_PORT);
-    udp.write(udpBuffer);
-    udp.endPacket();
-  #endif
 }

 void pointerChanged()
@@ -297,6 +282,65 @@
   Serial.println("Pointer changed to "+String(storagePointer));
 }

+
+
+void push()
+{
+   #ifdef USE_STROMBEWUSST_SERVER
+    strombewusstPush();
+  #endif
+  #ifdef USE_XS1_SERVER
+    xs1Push();
+  #endif
+}
+
+#ifdef USE_XS1_SERVER
+void xs1Push()
+{
+  IPAddress server XS1_IP;
+  String url = XS1_URL+String(storage[storagePointer]);
+  if (networkRequest(server, url) == true)
+  {
+    Serial.println("XS1 updated");
+  } else
+  {
+    Serial.println("XS1 update failed");
+  }
+}
+#endif
+
+#ifdef USE_NETWORK
+bool networkRequest(IPAddress server, String url)
+{
+  if (client.connect(server, 80))
+  {
+    requestHeader(url).toCharArray(requestBuffer, 128);
+    client.write(requestBuffer);
+    return true;
+  } else
+  {
+    return false;
+  }
+
+}
+
+String requestHeader(String url)
+{
+ return "GET "+url+"HTTP/1.1\r\nConnection: close\r\n\r\n";
+}
+#endif
+
+#ifdef USE_STROMBEWUSST_SERVER
+void strombewusstPush()
+{
+  // Set the last byte the the current frame's value
+  udpBuffer[33] = storage[storagePointer];
+  udp.beginPacket(STROMBEWUSST_SERVER, STROMBEWUSST_PORT);
+  udp.write(udpBuffer);
+  udp.endPacket();
+}
+#endif
+
 #ifdef USE_NETWORK
 String generateJSON()
 {


clean up code and adding timezone function


Test Infrared detection, switches to dimmed mode. Works.

--- StripDimmer.ino
+++ StripDimmer.ino
@@ -6,8 +6,13 @@

 const int ledPin = 13;

+const int irPin = 6;
+
+const int irTime = 10000;
+unsigned long onUntilMillis;
+
 int lowRed   = 22;
-int lowGreen = 5;
+int lowGreen = 8;
 int lowBlue  = 0;

 int highRed  = 255;
@@ -16,7 +21,6 @@

 const int capsens_signal_pin = 4;
 const int capsens_sense_pin = 3;
-

 // 10M resistor between pins, add 1n4148 from sense to 5V and 10k from sense to toucharea
 CapacitiveSensor capsense = CapacitiveSensor(capsens_signal_pin,capsens_sense_pin);
@@ -28,11 +32,25 @@
   pinMode(greenPin, OUTPUT);
   pinMode(bluePin, OUTPUT);
   pinMode(ledPin, OUTPUT);
+  pinMode(irPin, INPUT);

   stripColor(0,0,0);
 }

 void loop() {
+    checkIr();
+
+    if (millis()<onUntilMillis){
+      dimLow(1);
+    } else {
+      dimLow(0);
+    }
+
+    return;
+
+    digitalWrite(ledPin, digitalRead(irPin));
+    return;
+
     dimLow(0);
     waitForTouch();
     dim1();
@@ -48,6 +66,14 @@
   digitalWrite(ledPin,HIGH);
   while(capsense.capacitiveSensor(30) < 10000) { };
   digitalWrite(ledPin,LOW);
+}
+
+void checkIr(){
+  boolean irState = digitalRead(irPin);
+  digitalWrite(ledPin, irState);
+  if(irState){
+    onUntilMillis = millis() + irTime;
+  }
 }

 void dim1(){


updated main_control to renable logging of RPM, lightsystem and camera_calibration images for raspi cam

--- arduino/car_control/src/main_control_nano/main_control_nano.ino
+++ arduino/car_control/src/main_control_nano/main_control_nano.ino
@@ -36,7 +36,7 @@
 #define SONAR_NUM     2 // Number of sensors.
 #define MAX_DISTANCE 200 // Maximum distance (in cm) to ping.

-bool is_logging = false;
+bool is_logging = true;

 /* Define available CmdMessenger commands */
 enum {
@@ -240,7 +240,7 @@
     steer_input = pulseIn(STEER_IN, HIGH, 25000);
     throttle_input = pulseIn(THROTTLE_IN, HIGH, 25000);
     //Serial.println(steer_input);
-    Serial.println(throttle_input);
+    //Serial.println(throttle_input);

     //toggle red led while waiting to arm
     toggle_LED(LED_RED, true);
@@ -387,7 +387,7 @@
      rpm = 30 * 1000/(millis() - timeold) * half_revolutions;
      timeold = millis();
      half_revolutions = 0;
-     if (is_logging) commander.sendBinCmd(cmd_rpm, rpm);
+     commander.sendBinCmd(cmd_rpm, rpm);
   }
 }


We found a bug. In the connection we flipped the target with the source.

--- ServerSketch/ServerSketch.ino
+++ ServerSketch/ServerSketch.ino
@@ -824,9 +824,9 @@
       if(g_aPins[i].connections[j] && i !=j )
       {
         aJsonObject* poConnObject = aJson.createObject();
-        sprintf(caPinNumBuffer,"%d",i);
+        sprintf(caPinNumBuffer,"%d",j);
         aJson.addItemToObject(poConnObject,"source",aJson.createItem(caPinNumBuffer));
-        sprintf(caPinNumBuffer,"%d",j);
+        sprintf(caPinNumBuffer,"%d",i);
         aJson.addItemToObject(poConnObject,"target",aJson.createItem(caPinNumBuffer));
         aJson.addItemToArray(paConnections,poConnObject);
       }
@@ -1114,10 +1114,12 @@

     //////////////////////////////////////////
     // Test sending message
+    /*
     aJsonObject *msg = getJsonBoardState();
     aJson.print(msg, &serial_stream);
     Serial.println("");
     aJson.deleteItem(msg);
+    */
     //////////////////////////////////////////

     last_print = millis();


mqtt not published if mqtt is not the interface

--- src/sonoff-relay.ino
+++ src/sonoff-relay.ino
@@ -32,7 +32,7 @@
 /* Set relay to ON */
 void SonoffRelay::on() {
   if (get()==RELAY_OFF) digitalWrite(RELAY, HIGH);
-  publish();
+  if (Configuration.interface == 1) publish();
   if (Configuration.debugger) Serial << "Relay set to ON" << endl;
   Eeprom.saveRelayState(RELAY_ON);
   Led.blink();
@@ -41,7 +41,7 @@
 /* Set relay to OFF */
 void SonoffRelay::off() {
   if (get()==RELAY_ON) digitalWrite(RELAY, LOW);
-  publish();
+  if (Configuration.interface == 1) publish();
   if (Configuration.debugger) Serial << "Relay set to OFF" << endl;
   Eeprom.saveRelayState(RELAY_OFF);
   Led.blink();


added test for the shift register

added test for the shift register

--- tictactoe/testShift/testShift.ino
+++ tictactoe/testShift/testShift.ino
@@ -1,6 +1,6 @@
 #include <Shiftduino.h>

-Shiftduino sd(30, 31 , 32, 2);
+Shiftduino sd(22, 24 , 23, 3);

 int colorPin1 = 0;
 int colorPin2 = 1;
@@ -14,30 +14,31 @@

 void loop()
 {
-  int color0 = analogRead(0);
-  Serial.println(color0);
-  int color1 = analogRead(1);
+  int color0 = analogRead(A8);

-  if(color0 > 700 && color0 < 770) {
-    sd.setPin(1, 0); //R1
-    sd.setPin(0, 1); //G1
-  } else if(color0 > 590 && color0 < 650){
-    sd.setPin(1, 1); //R1
-    sd.setPin(0, 0); //G1
+  int color1 = analogRead(A6);
+  Serial.println(color1);
+
+  if(color0 > 190 && color0 < 225) {
+    sd.setPin(0, 0); //R1
+    sd.setPin(1, 1); //G1
+  } else if(color0 > 135 && color0 < 145){
+    sd.setPin(0, 1); //R1
+    sd.setPin(1, 0); //G1
   } else{
     sd.setPin(1, 0); //R1
     sd.setPin(0, 0); //G1
   }

-  if(color1 > 700 && color1 < 770) {
-    sd.setPin(8, 1); //G2
-    sd.setPin(9, 0); //R2
-  } else if(color1 > 590 && color1 < 650){
-    sd.setPin(8, 0); //G2
-    sd.setPin(9, 1); //R2
+  if(color1 > 190 && color1 < 225) {
+    sd.setPin(2, 1); //G2
+    sd.setPin(3, 0); //R2
+  } else if(color1 > 80 && color1 < 120){
+    sd.setPin(2, 0); //G2
+    sd.setPin(3, 1); //R2
   } else{
-    sd.setPin(8, 0); //G2
-    sd.setPin(9, 0); //R2
+    sd.setPin(2, 0); //G2
+    sd.setPin(3, 0); //R2
   }

   /*


Update arduino_md03_v_5_0.ino

Update arduino_md03_v_5_0.ino

Removed LCD...

--- arduino/arduino_md03_v_5_0/arduino_md03_v_5_0.ino
+++ arduino/arduino_md03_v_5_0/arduino_md03_v_5_0.ino
@@ -1,9 +1,8 @@
 /***************************************************
            ArcEyes MD03 I2C sandbox
-             by David Wilman
-   MD03 over I2C code by By James Henderson 2012
 ****************************************************/

+/*
 #include <Wire.h>
 #include <LCD.h>
 #include <LiquidCrystal_I2C.h>
@@ -19,6 +18,7 @@
  #define D6_pin  6
  #define D7_pin  7
  LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
+*/

 const int potPin1 = A0;
 const int potPin2 = A1;
@@ -81,14 +81,18 @@
 String statusString = "";        // a string to hold the output

 void setup(){
+  /*
   Wire.begin(); //start I2C bus
   delay(100); //wait for bus to stabalise
+  */
   pinMode(rlyPin1,OUTPUT); // Setup pins
   pinMode(rlyPin2,OUTPUT); // Setup pins
   pinMode(rlyPin3,OUTPUT); // Setup pins
   pinMode(motorPinDir1,OUTPUT); // Setup pins
   pinMode(motorPinDir2,OUTPUT); // Setup pins
   pinMode(motorPinDir3,OUTPUT); // Setup pins
+
+  /*
   lcd.begin (16,2); // 2 rows x 16 char
   // Switch on the backlight
   lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
@@ -100,6 +104,7 @@
   lcd.print("SandBox");
   delay(30);
   //lcd.clear();
+  */

   //serial
   Serial.begin(115200);
@@ -192,6 +197,7 @@
 }

 // Debug: Show current commands on lcd
+*/
 void lcd_command() {
   lcd.clear();
   lcd.setCursor(0,0);
@@ -200,6 +206,7 @@
           +" L"+String(cmd.lid_pwm)+" "+String(cmd.lid_direction)
           );
 }
+*/

 // Send command to the motors
 void do_command() {


Send status

Send status

--- arduino/arduino_md03_v_5_0/arduino_md03_v_5_0.ino
+++ arduino/arduino_md03_v_5_0/arduino_md03_v_5_0.ino
@@ -41,12 +41,18 @@
 long previousMillis = 0;  // store the time LCD was last updated
 long interval = 50; // time setween lcd updates

+struct Status {
+  int yaw_pos;
+  int pitch_pos;
+  int lid_pos;
+};
+
+Status stat = { 0, 0, 0 };

 //serial
 String inputString = "";         // a string to hold incoming data
 boolean stringComplete = false;  // whether the string is complete
-
-
+String statusString = "";        // a string to hold the output

 void setup(){
   Wire.begin(); //start I2C bus
@@ -71,16 +77,21 @@

   //serial
-
-    Serial.begin(9600);
+  Serial.begin(9600);
   // reserve 200 bytes for the inputString:
   inputString.reserve(200);
+  statusString.reserve(200);
 }

 void loop(){
-  direct1 = manualSpeedControl(motorPinSpeed1, potPin1, rlyPin1, motorPinDir1, direct1, speedControl1);
-  direct2 = manualSpeedControl(motorPinSpeed2, potPin2, rlyPin2, motorPinDir2, direct2, speedControl2);
-  direct3 = manualSpeedControl(motorPinSpeed3, potPin3, rlyPin3, motorPinDir3, direct3, speedControl3);
+  static unsigned long send_time = millis();
+  stat.pitch_pos = analogRead(potPin1);
+  stat.yaw_pos = analogRead(potPin2);
+  stat.lid_pos = analogRead(potPin3);
+
+  //direct1 = manualSpeedControl(motorPinSpeed1, potPin1, rlyPin1, motorPinDir1, direct1, speedControl1);
+  //direct2 = manualSpeedControl(motorPinSpeed2, potPin2, rlyPin2, motorPinDir2, direct2, speedControl2);
+  //direct3 = manualSpeedControl(motorPinSpeed3, potPin3, rlyPin3, motorPinDir3, direct3, speedControl3);

     // print the string when a newline arrives:
   if (stringComplete) {
@@ -90,9 +101,19 @@
     stringComplete = false;
   }

-
+  if (millis() - send_time >= 10) {
+    send_time = millis();
+    send_status();
+  }
 }

+void send_status() {
+  statusString = "";
+  statusString += "yaw_pos=" + String(stat.yaw_pos) + ";";
+  statusString += "pitch_pos=" + String(stat.pitch_pos) + ";";
+  statusString += "lid_pos=" + String(stat.lid_pos) + ";";
+  Serial.println(statusString);
+}

 byte manualSpeedControl(int speedPin, byte potPin, int rlyPin, int dirPin, byte direct, int speedControl){
     int potVal = analogRead(potPin);


Delete C_CDETPO-Industruino.ino

Delete C_CDETPO-Industruino.ino

--- BMS_Francais/Examples/C_CDETPO-Industruino/C_CDETPO-Industruino.ino
+++ BMS_Francais/Examples/C_CDETPO-Industruino/C_CDETPO-Industruino.ino
@@ -1,221 +0,0 @@
-/*-------------------------------------------------------------------------------------------------------------------------------------------*
-* SE2R : C_CDETPO - Fonction de temporisation de commande à l'action et à l'arrêt                                                03/06/2015 *
- *-------------------------------------------------------------------------------------------------------------------------------------------*
- *        C_CDETPO(boolean CDE, boolean DFT, float CPT[], int RES[], int CFG)                                                     03/06/2015 *
- *                CDE : Demande calculée ou donnée par l'utilisateur (peut être le résultat d'une fonction appelée plus haut)                *
- *                DFT : Défaut de l'équipement commandé. True signale un équipement en état normal. Un false signale un défaut               *
- *                CPT : [00] Compteur de temporisation                                                                                *
- *                      [01] Tempo entre le front montant de la demande CDE avant l'action sur la commande                                   *
- *                      [02] Tempo entre le front descendant de la demande CDE avant la désactivation de la commande                         *
- *                      [03] Temps de cycle automate calculé par la fonction                                                                 *
- *                      [04] Mémorisation de la variable système Millis pour le calcul du temps de cycle                                     *
- *                RES : [00] Commande de l'équipement - forcément un tableau de taille au moins 1                                            *
- *                CFG : Commande de forçage.                                                                                *
- *                      <0 : RES maintenu à false                                                                                *
- *                      0  : RES figée dans son dernier état connu                                                                           *
- *                      1  : RES soumise à CDE (à TMA et TAR près) et à DFT                                                                  *
- *                      2  : RES soumise seulement à DFT (comme si CDE était true en permanence)                                             *
- *                      3  : RES  maintenu à true indépendamment de DFT et CDE                                                               *
- *                      >3 : RES maintenu à false                                                                                *
- *-------------------------------------------------------------------------------------------------------------------------------------------*
- * Copyright SE2R under the APACHE Licence                                                                                *
- *-------------------------------------------------------------------------------------------------------------------------------------------*
- * Plate-formes testées : Industruino 32U8 et 1286                                                                                *
- *-------------------------------------------------------------------------------------------------------------------------------------------*
- * 27/05/2015 : DD, SE2R : Testée et validée sur banc                                                                                *
- * 27/05/2015 : DD, SE2R : Cette fonction nécessite l'utilisation de S_SCANTS pour accéder à la valeur du cycle automate                     *
- * 03/06/2015 : DD, SE2R : Intégration du calcul de temps de cycle, passage de la commande en boolean et simplification du code              *
- * 03/06/2015 : DD, SE2R : Passage en mode void et ajout des commentaires d'appartenance à C_CDETPO                                          *
- *-------------------------------------------------------------------------------------------------------------------------------------------*/
-
-// Déclaration des bibliothèques nécessaires à l'exécution du programme ---------------------------------------------------------------------*
-#include <DIS.h>                        // Biblio   - SE2R - Fonctions de dialogue et d'affichage sur l'écran UC1701 Industruino
-static DIS DIS;                         // Biblio   - Activation du constructeur de la bibliothèque de fonctions d'affichage
-static UC1701 lcd;
-#include <BMS.h>                        // Biblio   - SE2R - Fonctions de contrôle et régulation
-static BMS BMS;                         // Biblio   - Activation du constructeur de la bibliothèque de fonctions d'affichage
-
-// Déclaration des variables nécessaires à l'exécution de la fonction -----------------------------------------------------------------------*
-boolean FCO_XXXX[1];                    // C_CDELEM - [00] Commande de marche depuis l'extérieur
-boolean EDx_TEL_XXXX[9];                // Système  - [00] Inutilisée
-                                        //            [01] Etat de la lecture de la voie digitale 1 si elle est une entrée
-                                        //            [02] Etat de la lecture de la voie digitale 2 si elle est une entrée
-                                        //            [03] Etat de la lecture de la voie digitale 3 si elle est une entrée
-                                        //            [04] Etat de la lecture de la voie digitale 4 si elle est une entrée
-                                        //            [05] Etat de la lecture de la voie digitale 5 si elle est une entrée
-                                        //            [06] Etat de la lecture de la voie digitale 6 si elle est une entrée
-                                        //            [07] Etat de la lecture de la voie digitale 7 si elle est une entrée
-                                        //            [08] Etat de la lecture de la voie digitale 8 si elle est une entrée
-boolean SDx_TSL_XXXX[9];                // Système  - [00] Mémoire temporaire utilisée pour les calculs
-                                        //            [01] Etat de la commande de la voie digitale 1 si elle est une sortie
-                                        //            [02] Etat de la commande de la voie digitale 1 si elle est une sortie
-                                        //            [04] Etat de la commande de la voie digitale 1 si elle est une sortie
-                                        //            [05] Etat de la commande de la voie digitale 1 si elle est une sortie
-                                        //            [07] Etat de la commande de la voie digitale 1 si elle est une sortie
-                                        //            [08] Etat de la commande de la voie digitale 1 si elle est une sortie
-float VTT_XXXX[5];                      // C_CDETPO - [00] Compteur des temporisations
-                                        //            [01] Tempo entre le front montant de la demande CDE avant l'action sur la commande
-                                        //            [02] Tempo entre le front descendant de la demande CDE avant la désactivation de la commande
-                                        //            [03] Temps de cycle automate calculé par la fonction
-                                        //            [04] Mémorisation de la variable système Millis pour le calcul du temps de cycle
-int VCO_XXXX[1];                        // C_CDETPO - [00] Commande de forçage par l'extérieur
-
-// Déclaration des variables nécessaires au fonctionnement de l'écran -----------------------------------------------------------------------*
-String TCM_PRES[21] = {                 // EcranLCD - Table de chaînes de caractères de présentation
-  "                     ",  // 00
-  "-  Menu  Principal  -",
-  "Retour Accueil      ",
-  "Demande             ",
-  "forcage             ",
-  "Chrono              ",
-  "Defaut               ",
-  "Cde M/A              ",
-  "- Selection + Enter -",
-  "- Commande  Mar/Arr -",
-  "-      Forcage      -",  // 10
-  "- Tempo a la marche -",
-  "-  Tempo a l'arret  -",
-  " ",
-  " ",
-  " ",
-  " ",
-  " ",
-  " ",
-  " ",
-  " "};                      // 20
-
-
-String TCM_UNIT[21] = {                 // EcranLCD - Table de chaînes de caractères d'unités standard
-  "        ",  // 00
-  "oC      ",
-  "%       ",
-  "s       ",
-  "V       ",
-  "mV      ",  // 05
-  "",
-  "",
-  "",
-  "",
-  "",          // 10
-  "   Arret ",
-  "  Marche ",
-  " F.Arret ",
-  " Debraye ",
-  "    Auto ", // 15
-  "F.Marche ",
-  "V.Marche ",
-  "  Defaut ",
-  "  Normal ",
-  "  " };      // 20
-
-boolean FCO_PRUP[5];                    // EcranLCD - Information de touche "Up" appuyée
-boolean FCO_PREN[5];                    // EcranLCD - Information de touche "Enter" appuyée
-boolean FCO_PRDN[5];                    // EcranLCD - Information de touche "Down" appuyée
-int VNT_MENU[2];                        // EcranLCD - Table d'adressage des menus
-int VNC_MENU[10];                       // EcranLCD - Table des numéros de menus
-int VNC_PRUP[11];                       // EcranLCD - Table des numéros de menus de destination par la touche "Up"
-int VNC_PREN[10];                       // EcranLCD - Table des numéros de menus de destination par la touche "Enter"
-int VNC_PRDN[10];                       // EcranLCD - Table des numéros de menus de destination par la touche "Down"
-float VTT_SCRN[10];                     // EcranLCD - Table des temporisations
-int VNX_MN02[12];                       // EcranLCD - Table des menus de destimation et des index du menu 02 - Principal
-boolean FCM_XXXX[1];                    // G_MODV1B - Mémoire de la demande de marche
-int VTM_XXXX[7];                        // G_MODV1M - Mémoire de calcul de la commande de la fonction pour VCO_XXXX - Forçage
-float VTM_TPAM[11];                     // G_MODV1F - Mémoire de calcul de la commande de la fonction pour VTT_XXXX[1] - Tempo à la marche
-float VTM_TPMA[11];                     // G_MODV1F - Mémoire de calcul de la commande de la fonction pour VTT_XXXX[2] - Tempo à l'arrêt
-
-void setup() {                          // Initialisation -----------------------------------------------------------------------------------*
-Indio.digitalMode(1,INPUT);             // Système  - Affectation de la voie Dx1 en tant qu'entrée digitale
-Indio.digitalMode(5,OUTPUT);            // Système  - Affectation de la voie Dx5 en tant que sortie digitale
-VCO_XXXX[0] = 1;                        // C_CDELEM - Passage du forçage en position auto
-
-VTT_SCRN[1] = 180;                      // G_TOUCHx - Temporisation d'inactivité sur le rétroéclairage
-VTT_SCRN[2] = 240;                      // G_TOUCHx - Temporisation d'inactivité de retour à l'écran principal
-VTT_SCRN[3] = 20;                       // G_TOUCHx - Temporisation d'antirebond de la touche "Enter"
-VTT_SCRN[4] = 15;                       // G_TOUCHx - Temporisation d'antiredond des touches "Up" et "Down"
-VNT_MENU[0] = 6;                        // G_NAVIGM - Taille des tables d'index et de destinations
-VNT_MENU[1] = 1;                        // G_NAVIGM - Initialisation du pointeur de destinations
-
-//                                      // G_NAVIGM - Tables d'adressage de l'écran LCD
-VNC_MENU[0] = 1;
-VNC_MENU[1] = 1;
-VNC_MENU[2] = 2;
-VNC_MENU[3] = 3;
-VNC_MENU[4] = 4;
-VNC_MENU[5] = 5;
-VNC_MENU[6] = 6;
-VNC_PRUP[1] =   1; VNC_PREN[1] =   2; VNC_PRDN[1] =   2;
-VNC_PRUP[2] =   2; VNC_PREN[2] =   2; VNC_PRDN[2] =   2;
-VNC_PRUP[3] =   3; VNC_PREN[3] =   2; VNC_PRDN[3] =   3;
-VNC_PRUP[4] =   4; VNC_PREN[4] =   2; VNC_PRDN[4] =   4;
-VNC_PRUP[5] =   5; VNC_PREN[5] =   6; VNC_PRDN[5] =   5;
-VNC_PRUP[6] =   6; VNC_PREN[6] =   2; VNC_PRDN[6] =   6;
-VNC_PRUP[7] =   2;
-
-VNX_MN02[0] = 0;						// G_CHOIX8 - Table des menus de destination et des index du menu 11 - Initialisation index
-VNX_MN02[1] = 1;
-VNX_MN02[2] = 3;
-VNX_MN02[3] = 4;
-VNX_MN02[4] = 5;
-VNX_MN02[5] = 0;
-VNX_MN02[6] = 0;
-VNX_MN02[7] = 0;
-VNX_MN02[8] = 1;
-VNX_MN02[9] = 4;
-VNX_MN02[10] = 1;
-
-VTM_XXXX[1] = 0; VTM_XXXX[2] = 2; VTM_XXXX[3] = 1; VTM_XXXX[4] = VCO_XXXX;
-VTM_TPAM[1] = 0; VTM_TPAM[2] = 600; VTM_TPAM[3] = 1;  VTM_TPAM[4] = VTT_XXXX[1];  VTM_TPAM[8] = 100;
-VTM_TPMA[1] = 0; VTM_TPMA[2] = 600; VTM_TPMA[3] = 1;  VTM_TPMA[4] = VTT_XXXX[2];  VTM_TPMA[8] = 100;
-
-//                                      // EcranLCD - Paramétrage spécifique Industruino 1286
-pinMode(23, INPUT);                     // EcranLCD - Spécifique 1286 - Touche flèche basse
-pinMode(24, INPUT);                     // EcranLCD - Spécifique 1286 - Touche entrée
-pinMode(25, INPUT);                     // EcranLCD - Spécifique 1286 - Touche flèche haute
-pinMode(26, OUTPUT);                    // EcranLCD - Spécifique 1286 - Sortie de commande du rétroéclairage
-
-/*                                      // EcranLCD - Paramétrage spécifique Industruino 32U8
-pinMode(13, OUTPUT);                    // EcranLCD - Spécifique 32U8 - Sortie de commande du rétroéclairage
-*/
-lcd.begin();                            // EcranLCD - Initialisation de l'écran LCD
-lcd.clear();                            // EcranLCD - Effacement de l'écran LCD
-}
-
-void loop() {                            // Exécution ---------------------------------------------------------------------------------------*
-if (Indio.digitalRead(1) == HIGH) { EDx_TEL_XXXX[1] = false; } else { EDx_TEL_XXXX[1] = true; }
-BMS.C_CDETPO(FCO_XXXX[0], EDx_TEL_XXXX[1], VTT_XXXX, SDx_TSL_XXXX, VCO_XXXX[0]);
-if (SDx_TSL_XXXX[0] == true ) { SDx_TSL_XXXX[5] = true; } else  { SDx_TSL_XXXX[5] = false; }
-if (SDx_TSL_XXXX[5] == true ) { Indio.digitalWrite(5,HIGH); } else {Indio.digitalWrite(5,LOW); }
-
-//                                      // EcranLCD - Gestion des touches spécifique Industruino 1286
-DIS.G_TOUCH2(VNC_MENU, VTT_SCRN, FCO_PRUP, FCO_PREN, FCO_PRDN);
-/*                                      // EcranLCD - Gestion des touches spécifique Industruino 32U8
-DIS.G_TOUCH1(VNC_MENU, VTT_SCRN, FCO_PRUP, FCO_PREN, FCO_PRDN);
-*/
-
-if (VNC_MENU[0] ==  1) { lcd.setCursor(0, 0); lcd.clearLine(); }
-DIS.G_MESS1L(VNC_MENU, 1, 1, 0, "   www.eControls.eu  ");
-DIS.G_MESS1L(VNC_MENU, 1, 2, 0, "    SE2R Softwares   ");
-DIS.G_MESS1L(VNC_MENU, 1, 3, 0, "  Industruino  1286  ");
-// DIS.G_MESS1L(VNC_MENU, 1, 3, 0, "  Industruino  32U8  ");
-if (VNC_MENU[0] ==  1) { lcd.setCursor(0, 4); lcd.clearLine(); }
-DIS.G_MESS1L(VNC_MENU, 1, 5, 0, "Fonction BMS.C_CDETPO");
-DIS.G_MESS1L(VNC_MENU, 1, 6, 0, "A# TESTS     C# 00001");
-DIS.G_MESS1L(VNC_MENU, 1, 7, 0, "V.1.01     03/06/2015");
-
-DIS.G_CHOIX8(VNC_MENU, 2, FCO_PRUP, FCO_PREN, FCO_PRDN, VNX_MN02);
-DIS.G_MESS1L(VNC_MENU, 2, 0, 0, TCM_PRES[1]);
-DIS.G_MESS1L(VNC_MENU, 2, 1, 6, TCM_PRES[2]);
-DIS.G_VISV1B(VNC_MENU, 2, 2, 6, FCO_XXXX[0], TCM_PRES[3], TCM_UNIT[11], TCM_UNIT[12]);
-DIS.G_VISV1M(VNC_MENU, 2, 3, 6, VCO_XXXX[0], TCM_PRES[4], TCM_UNIT[14]);
-DIS.G_VISV1F(VNC_MENU, 2, 4, 6, VTT_XXXX[0], TCM_PRES[4], TCM_UNIT[3]);
-DIS.G_VISV1B(VNC_MENU, 2, 5, 0, EM1_MII_MPLX[4], TCM_PRES[6], TCM_UNIT[18], TCM_UNIT[19]);
-DIS.G_VISV1B(VNC_MENU, 2, 6, 0, SDx_MPL_XXXX[5], TCM_PRES[7], TCM_UNIT[11], TCM_UNIT[12]);
-DIS.G_MESS1L(VNC_MENU, 2, 7, 0, TCM_PRES[8]);
-
-DIS.G_MODV1B(VNC_MENU, 3, FCO_PRUP, FCO_PREN, FCO_PRDN, FCO_XXXX, 0, FCM_XXXX, TCM_PRES[9] , " Commande operateur ", TCM_UNIT[13], TCM_UNIT[14], true);
-DIS.G_MODV1M(VNC_MENU, 4, FCO_PRUP, FCO_PREN, FCO_PRDN, VCO_XXXX, 0, VTM_XXXX, TCM_PRES[10], "Arr/Deb/Auto/Mar/VMa", TCM_UNIT, 14, true, 0);
-DIS.G_MODV1F(VNC_MENU, 5, FCO_PRUP, FCO_PREN, FCO_PRDN, VTT_XXXX, 1, VTM_TPAM, TCM_PRES[11], "de Demande a  Marche", TCM_UNIT[3], true, 0);
-DIS.G_MODV1F(VNC_MENU, 6, FCO_PRUP, FCO_PREN, FCO_PRDN, VTT_XXXX, 2, VTM_TPMA, TCM_PRES[12], "de Demande a   Arret", TCM_UNIT[3], true, 0);
-
-DIS.G_NAVIGM(VNC_MENU, VNT_MENU, FCO_PRUP, FCO_PREN, FCO_PRDN , VNC_PRUP, VNC_PREN, VNC_PRDN);
-}


test update

test update

--- _09_ir_tx_rx/_09_ir_tx_rx.ino
+++ _09_ir_tx_rx/_09_ir_tx_rx.ino
@@ -266,8 +266,10 @@

   // event Timer
   int updateTempCEvent      = t.every(2000, doUpdateTempC);
+  int updateTempCArrayEvent = t.every(4000, doUpdateTempCArray);
+  /*
   int updateTempCArrayEvent = t.every(300000, doUpdateTempCArray);
-
+  */
   // PIR
   attachInterrupt(0, PIRCHECKING, CHANGE);
 }
@@ -344,24 +346,22 @@
   sensors.requestTemperatures();
   float tempC  = sensors.getTempC(insideThermometer);

-  if ( isnan(tempC) ) {
-    Serial.println("Failed to read from sensor!");
-    return;
-  }
-
   return tempC;
 }

 void alarm_set()
 {
+  /*
   if (( o_beepMode == 1) || (setUpStatus == 0) || (o_magic != magic_number ))  {
     digitalWrite(BZ_OU_PIN, LOW);
     delay(50);
     digitalWrite(BZ_OU_PIN, HIGH);
   }
   irrecv.enableIRIn();
-}
+  */
+}
+

 // eeprom
 int initialise_boolean_select()