added lcd display (testing)

added lcd display (testing)

--- LART1.ino
+++ LART1.ino
@@ -1,3 +1,4 @@
+#include <LiquidCrystal_I2C.h>
 #include <LibAPRS.h>
 #include <TinyGPSplus.h>

@@ -10,13 +11,17 @@
 #define CALLSIGN "W1AW"
 #define SSID 5

-#define UPDATE_BEACON 60000
+#define UPDATE_BEACON 10000
 long lastupdate = 0 ;

+int sent_count=0 ;
+
+
+LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7 , 3, POSITIVE);

 #define BUTTON_SENDLOC_PIN A3
 #define BUTTON_SENDLOC_WINDOW 300
-int button_sendloc_state = 1 ;
+int button_sendloc_state = 0 ;

 void check_sendloc()
 {
@@ -80,7 +85,7 @@
    APRS_setGain(gain);
    APRS_setDirectivity(dir);

-   char *comment = "LibAPRS location update" ;
+   char *comment = "LART/1 Beacon" ;
    APRS_sendLoc(comment, strlen(comment));
 }

@@ -89,19 +94,30 @@
 {
    Serial.begin(9600) ;

+   lcd.begin(16,2);
+   lcd.home();
+   lcd.print("LART/1 APRS BEAC");
+   lcd.setCursor(0,1);
+   lcd.print("Call: ") ;
+   lcd.print(CALLSIGN) ;
+   lcd.print("-") ;
+   lcd.print(SSID) ;
+
+
    APRS_init(ADC_REFERENCE, OPEN_SQUELCH);
    APRS_setCallsign(CALLSIGN, SSID);
    APRS_printSettings();

    pinMode(BUTTON_SENDLOC_PIN, INPUT_PULLUP);

-   Serial.println(F("APRS Beacon Start")) ;
+   Serial.println(F("LART1 APRS Beacon Start")) ;
    Serial.print(F("Version: ")) ;
    Serial.println(VERSION) ;
    Serial.print(F("Callsign ")) ;
    Serial.print(CALLSIGN) ;
    Serial.print(F(" SSID: ")) ;
    Serial.println(SSID) ;
+

 }

@@ -119,20 +135,31 @@
          // this sends a fixed location only
          // beta beta beta
          // dublin QTH
-         char * lat = "374226.46N" ;
-         char * lon = "1215738.98W" ;
+         char * lat =  "3742.26N" ;
+         char * lon = "12157.38W" ;
          int h = 234 ;

          locationUpdate(lat,lon,h) ;
+         sent_count++ ;
          Serial.print(F("sent lat: ")) ;
          Serial.print(lat) ;
          Serial.print(F(" lon: "));
          Serial.print(lon);
          Serial.print(F(" height: ")) ;
          Serial.println(h) ;
+         Serial.print(F(" count: ")) ;
+         Serial.println(sent_count) ;
       } else {
-         Serial.print(F("sent location disabled")) ;
+         Serial.print(F("sent location disabled\n")) ;
       }
+
+      lcd.clear();
+      lcd.home();
+      lcd.print("Send Location ") ;
+      lcd.print(sent_count) ;
    }

+
+
+
 }


Change time_boot_us from uint16t to uint64t to fit mavling function prototype. Reorder and get rid of HighRes imu data (when this messages is sent, a delay of 2 or 3 seconds appears, which is not satisfying at all)

--- Arduino/MPU9150_MS5611_IMU/MPU9150_MS5611_IMU.ino
+++ Arduino/MPU9150_MS5611_IMU/MPU9150_MS5611_IMU.ino
@@ -83,7 +83,7 @@

 */

-//#define USE_MAVLINK //Uncomment this line to use mavlink
+#define USE_MAVLINK //Uncomment this line to use mavlink
 #ifdef USE_MAVLINK
   #include "MavlinkForArduino.h"        // Mavlink interface
 #endif
@@ -128,8 +128,8 @@

 float pitch, yaw, roll;
 float deltat = 0.0f;        // integration interval for both filter schemes
-uint16_t lastUpdate = 0; // used to calculate integration interval
-uint16_t time_boot_us = 0;        // used to calculate integration interval
+uint64_t lastUpdate = 0; // used to calculate integration interval
+uint64_t time_boot_us = 0;        // used to calculate integration interval

 float ax_g, ay_g, az_g, gx_degps, gy_degps, gz_degps, mx, my, mz; // variables to hold latest sensor data values
 float q[4] = {1.0f, 0.0f, 0.0f, 0.0f};    // vector to hold quaternion
@@ -297,27 +297,29 @@
       uint16_t len = mavlink_msg_to_send_buffer(buf, &msg);
       Serial.write(buf, len);

-      //mavlink_msg_scaled_imu_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
-      // uint32_t time_boot_ms, int16_t xacc, int16_t yacc, int16_t zacc, int16_t xgyro, int16_t ygyro, int16_t zgyro, int16_t xmag, int16_t ymag, int16_t zmag)
-      mavlink_msg_raw_imu_pack(system_id, component_id, &msg, time_boot_ms, a1, a2, a3, g1, g2, g3, m1, m2, m3);
-      len = mavlink_msg_to_send_buffer(buf, &msg);
-      //Serial.write(buf, len);
-
-      mavlink_msg_scaled_imu_pack(system_id, component_id, &msg, time_boot_ms, ax_g*1000, ay_g*1000, az_g*1000, gx_degps*PI/180.0f*1000, gy_degps*PI/180.0f*1000, gz_degps*PI/180.0f*1000, mx, my, mz);
-      len = mavlink_msg_to_send_buffer(buf, &msg);
-      //Serial.write(buf, len);
-
-      //static inline uint16_t mavlink_msg_highres_imu_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
-      //						       uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated)
-      mavlink_msg_highres_imu_pack(system_id, component_id, &msg, (uint64_t)time_boot_us, ax_g*9.81, ay_g*9.81, az_g*9.81, gx_degps*PI/180.0f, gy_degps*PI/180.0f, gz_degps*PI/180.0f, my, mx, mz, press, press, altitude, temperature, a1);
-      len = mavlink_msg_to_send_buffer(buf, &msg);
-      //Serial.write(buf, len);
-
       //static inline uint16_t mavlink_msg_attitude_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
       //  uint32_t time_boot_ms, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed)
       mavlink_msg_attitude_pack(system_id, component_id, &msg, time_boot_ms, roll, pitch, yaw, gx_degps*PI/180.0f, gy_degps*PI/180.0f, gz_degps*PI/180.0f);
       len = mavlink_msg_to_send_buffer(buf, &msg);
       Serial.write(buf, len);
+
+      /*
+      //static inline uint16_t mavlink_msg_highres_imu_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
+      //						       uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated)
+      mavlink_msg_highres_imu_pack(system_id, component_id, &msg, (uint64_t)time_boot_us, ax_g*9.81, ay_g*9.81, az_g*9.81, gx_degps*PI/180.0f, gy_degps*PI/180.0f, gz_degps*PI/180.0f, my, mx, mz, press, press, altitude, temperature, a1);
+      len = mavlink_msg_to_send_buffer(buf, &msg);
+      Serial.write(buf, len);
+
+      //mavlink_msg_scaled_imu_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
+      // uint32_t time_boot_ms, int16_t xacc, int16_t yacc, int16_t zacc, int16_t xgyro, int16_t ygyro, int16_t zgyro, int16_t xmag, int16_t ymag, int16_t zmag)
+      mavlink_msg_raw_imu_pack(system_id, component_id, &msg, time_boot_ms, a1, a2, a3, g1, g2, g3, m1, m2, m3);
+      len = mavlink_msg_to_send_buffer(buf, &msg);
+      Serial.write(buf, len);
+
+      mavlink_msg_scaled_imu_pack(system_id, component_id, &msg, time_boot_ms, ax_g*1000, ay_g*1000, az_g*1000, gx_degps*PI/180.0f*1000, gy_degps*PI/180.0f*1000, gz_degps*PI/180.0f*1000, mx, my, mz);
+      len = mavlink_msg_to_send_buffer(buf, &msg);
+      Serial.write(buf, len);
+      */

 #else
       Serial.print("ax = "); Serial.print((int)1000*ax_g);


changed the animation to some nice looking colors

--- WS2812_Test.ino
+++ WS2812_Test.ino
@@ -9,45 +9,142 @@

 #include "FastSPI_LED2.h"

-#define NUM_LEDS 240
+#define NUM_LEDS 120

 CRGB leds[NUM_LEDS];

 void setup() {
-	// sanity check delay - allows reprogramming if accidently blowing power w/leds
-   	delay(2000);
+  // sanity check delay - allows reprogramming if accidently blowing power w/leds
+  delay(1000);

-   	// For safety (to prevent too high of a power draw), the test case defaults to
-   	// setting brightness to 25% brightness
-   	LEDS.setBrightness(64);
+  // For safety (to prevent too high of a power draw), the test case defaults to
+  // setting brightness to 50% brightness
+  LEDS.setBrightness(127);

-   	LEDS.addLeds<WS2811, 13>(leds, NUM_LEDS);
+  LEDS.addLeds<WS2811, 13>(leds, NUM_LEDS);
+
+  //reset all the LEDs
+  memset(leds, 0,  NUM_LEDS * sizeof(struct CRGB));
+  LEDS.show();
 }

 void loop()
 {
-  //Test LED for LED in red
   for(int i = 0; i < NUM_LEDS; i++)
   {
     memset(leds, 0,  NUM_LEDS * sizeof(struct CRGB));
-    leds[i].g = 128;
+
+    int pos = i;
+    for(int j = 0; j < 10; j++)
+    {
+      if(pos - j >= 0)
+      {
+        leds[pos - j].g = 128 - (j * 10);
+      }
+      else
+      {
+        leds[pos + NUM_LEDS - j].g = 128 - (j * 10);
+      }
+    }
+
+    pos = pos + (NUM_LEDS / 6);
+    if(pos >= NUM_LEDS)
+    {
+      pos = pos - NUM_LEDS;
+    }
+
+    for(int j = 0; j < 10; j++)
+    {
+      if(pos - j >= 0)
+      {
+        leds[pos - j].r = 128 - (j * 10);
+      }
+      else
+      {
+        leds[pos + NUM_LEDS - j].r = 128 - (j * 10);
+      }
+    }
+
+    pos = pos + (NUM_LEDS / 6);
+    if(pos >= NUM_LEDS)
+    {
+      pos = pos - NUM_LEDS;
+    }
+
+    for(int j = 0; j < 10; j++)
+    {
+      if(pos - j >= 0)
+      {
+        leds[pos - j].b = 128 - (j * 10);
+      }
+      else
+      {
+        leds[pos + NUM_LEDS - j].b = 128 - (j * 10);
+      }
+    }
+
+    pos = pos + (NUM_LEDS / 6);
+    if(pos >= NUM_LEDS)
+    {
+      pos = pos - NUM_LEDS;
+    }
+
+    for(int j = 0; j < 10; j++)
+    {
+      if(pos - j >= 0)
+      {
+        leds[pos - j].g = 128 - (j * 10);
+        leds[pos - j].r = 128 - (j * 10);
+      }
+      else
+      {
+        leds[pos + NUM_LEDS - j].g = 128 - (j * 10);
+        leds[pos + NUM_LEDS - j].r = 128 - (j * 10);
+      }
+    }
+
+    pos = pos + (NUM_LEDS / 6);
+    if(pos >= NUM_LEDS)
+    {
+      pos = pos - NUM_LEDS;
+    }
+
+    for(int j = 0; j < 10; j++)
+    {
+      if(pos - j >= 0)
+      {
+        leds[pos - j].r = 128 - (j * 10);
+        leds[pos - j].b = 128 - (j * 10);
+      }
+      else
+      {
+        leds[pos + NUM_LEDS - j].r = 128 - (j * 10);
+        leds[pos + NUM_LEDS - j].b = 128 - (j * 10);
+      }
+    }
+
+    pos = pos + (NUM_LEDS / 6);
+    if(pos >= NUM_LEDS)
+    {
+      pos = pos - NUM_LEDS;
+    }
+
+    for(int j = 0; j < 10; j++)
+    {
+      if(pos - j >= 0)
+      {
+        leds[pos - j].b = 128 - (j * 10);
+        leds[pos - j].g = 128 - (j * 10);
+      }
+      else
+      {
+        leds[pos + NUM_LEDS - j].b = 128 - (j * 10);
+        leds[pos + NUM_LEDS - j].g = 128 - (j * 10);
+      }
+    }
+
+
     LEDS.show();
-    delay(250);
-  }
-  //Test LED for LED in green
-  for(int i = 0; i < NUM_LEDS; i++)
-  {
-    memset(leds, 0,  NUM_LEDS * sizeof(struct CRGB));
-    leds[i].r = 128;
-    LEDS.show();
-    delay(250);
-  }
-  //Test LED for LED in blue
-  for(int i = 0; i < NUM_LEDS; i++)
-  {
-    memset(leds, 0,  NUM_LEDS * sizeof(struct CRGB));
-    leds[i].b = 128;
-    LEDS.show();
-    delay(250);
+    delay(100);
   }
 }


BabelFish: Remove applications for ATtiny85 (it has 8KB instead of 32KB)

--- Utils/BabelFish/BabelFish.ino
+++ Utils/BabelFish/BabelFish.ino
@@ -71,6 +71,7 @@

 #if ArduinoUno
  #define platform "ArduinoUno"
+ #define maxStorage 32768

  // Pinout reference:
  // https://i2.wp.com/marcusjenkins.com/wp-content/uploads/2014/06/ARDUINO_V2.png
@@ -107,6 +108,7 @@
 #if ArduinoNano
  // at67's setup
  #define platform "ArduinoNano"
+ #define maxStorage 32768

  // Pinout reference:
  // http://lab.dejaworks.com/wp-content/uploads/2016/08/Arduino-Nano-1024x500.png
@@ -157,6 +159,7 @@
 #if ArduinoMicro
  // WattSekunde's setup
  #define platform "ArduinoMicro"
+ #define maxStorage 32768

  // Pinout reference:
  // http://1.bp.blogspot.com/-xqhL0OrJcxo/VJhVxUabhCI/AAAAAAABEVk/loDafkdqLxM/s1600/micro_pinout.png
@@ -201,6 +204,7 @@

 #if ATtiny85
  #define platform "ATtiny85"
+ #define maxStorage 8192

  // Pins for Gigatron (must be on PORTB)
  #define gigatronDataPin  PB2
@@ -241,6 +245,8 @@
 const byte bricks_gt1[] PROGMEM = {
   #include "bricks.h"
 };
+
+#if maxStorage >= 32768
 const byte lines_gt1[] PROGMEM = {
   #include "lines.h"
 };
@@ -251,8 +257,9 @@
   #include "starfield.h"
 };
 const byte tetris_gt1[] PROGMEM = {
-  #include "tetris.h" /
-};
+  #include "tetris.h"
+};
+#endif

 struct { byte *gt1; char *name; } gt1Files[12] = {
 /* 1  */ TinyBASIC_gt1, "Tiny BASIC",
@@ -260,10 +267,16 @@
 /* 3  */ Terminal_gt1,  "Terminal",
 /* 4  */ Blinky_gt1,    "Blinky",
 /* 5  */ bricks_gt1,    "Bricks game [xbx]",
+#if maxStorage >= 32768
 /* 6  */ lines_gt1,     "Lines demo [at67]",
 /* 7  */ life3_gt1,     "Game of Life demo [at67]",
 /* 8  */ starfield_gt1, "Starfield demo [at67]",
 /* 9  */ tetris_gt1,    "Tetris game [at67]",
+#else
+/* 7  */ 0,             "(Empty)",
+/* 8  */ 0,             "(Empty)",
+/* 9  */ 0,             "(Empty)",
+#endif
 /* 10 */ 0,             "(Empty)",
 /* 11 */ 0,             "(Empty)",
 /* 12 */ 0,             "(Empty)",


Removed PPS pin reading

Removed PPS pin reading

--- WifiSense2/src/WifiSense2.ino
+++ WifiSense2/src/WifiSense2.ino
@@ -25,7 +25,6 @@
   ss.begin(GPSBaud);      // Link to GPS
   pinMode(14, OUTPUT);    // GPS chip enable pin
   digitalWrite(14, LOW);  // Shut down GPS for now...
-  pinMode(15, INPUT);     // GPS reading indicator
   Serial.printf("\n\nSDK version:%s\n\r", system_get_sdk_version());
   Serial.println(F("ESP8266 mini-sniff - MQTT version"));
   Serial.println(TinyGPSPlus::libraryVersion());


Fixed the date isuue

Fixed the date isuue

--- SafePlantOLED.ino
+++ SafePlantOLED.ino
@@ -56,6 +56,13 @@
 volatile int IBI = 600;             // holds the time between beats, must be seeded!
 volatile boolean Pulse = false;     // true when pulse wave is high, false when it's low
 volatile boolean QS = false;        // becomes true when Arduoino finds a beat.
+
+//Blood Pressure Variable
+String bloodPressure;
+
+//Strings to hold date and time
+String date = "Thu 29 Jun";
+String time = "14:15";

 //kidney logo array
 const unsigned char LOGO1[] PROGMEM = {
@@ -172,7 +179,7 @@
 void drawTeam(void) {
   u8g.setFont(u8g_font_9x15);
   u8g.drawStr(20, 25, "Powered By");
-  u8g.drawStr(0, 50, "Aparecium Labs");
+  u8g.drawStr(5, 50, "Team Scorpion");
 }

 void setup(void) {
@@ -229,87 +236,9 @@
   u8g.setFont(u8g_font_osr18n);
   u8g.setPrintPos(70, 60);

-  /**Moderation**/
-  if(BPM >= 60 && BPM < 100){
-    u8g.print(BPM);
-
-  //Less than normal
-  }else if (BPM >= 55 && BPM < 60) {
-    u8g.print("61");
-  }else if (BPM >= 50 && BPM < 55) {
-    u8g.print("63");
-  }else if (BPM >= 45 && BPM < 50) {
-    u8g.print("59");
-  }else if (BPM >= 40 && BPM < 45) {
-    u8g.print("62");
-  }else if (BPM >= 35 && BPM < 40) {
-    u8g.print("57");
-  }else if (BPM >= 30 && BPM < 35) {
-    u8g.print("65");
-  }else if (BPM >= 25 && BPM < 30) {
-    u8g.print("70");
-  }else if (BPM >= 20 && BPM < 25) {
-    u8g.print("58");
-  }else if (BPM >= 15 && BPM < 20) {
-    u8g.print("74");
-  }else if (BPM >= 10 && BPM < 15) {
-    u8g.print("73");
-  }else if (BPM >= 5 && BPM < 10) {
-    u8g.print("77");
-  }else if (BPM >= 0 && BPM < 5) {
-    u8g.print("65");
-  }else if (BPM < 0) {
-    u8g.print("55");
-
-  //Higher than Normal
-  }else if (BPM >= 100 && BPM < 105) {
-    u8g.print("79");
-  }else if (BPM >= 105 && BPM < 110) {
-    u8g.print("81");
-  }else if (BPM >= 110 && BPM < 115) {
-    u8g.print("83");
-  }else if (BPM >= 115 && BPM < 120) {
-    u8g.print("85");
-  }else if (BPM >= 125 && BPM < 130) {
-    u8g.print("87");
-  }else if (BPM >= 130 && BPM < 135) {
-    u8g.print("89");
-  }else if (BPM >= 135 && BPM < 150) {
-    u8g.print("90");
-  }else if (BPM >= 150 && BPM < 170) {
-    u8g.print("92");
-  }else if (BPM >= 170 && BPM < 190) {
-    u8g.print("93");
-  }else if (BPM >= 190 && BPM < 210) {
-    u8g.print("78");
-  }else if (BPM >= 210 && BPM < 220) {
-    u8g.print("79");
-  }else if (BPM >= 220 && BPM < 225) {
-    u8g.print("80");
-  }else if (BPM >= 225 && BPM < 230) {
-    u8g.print("76");
-  }else if (BPM >= 230 && BPM < 240) {
-    u8g.print("84");
-  }else if (BPM >= 240 && BPM < 250) {
-    u8g.print("69");
-  }else if (BPM >= 250 && BPM < 300) {
-    u8g.print("85");
-  }else if (BPM >= 300 && BPM < 350) {
-    u8g.print("83");
-  }else if (BPM >= 350 && BPM < 400) {
-    u8g.print("99");
-  }else if (BPM >= 400 && BPM < 500) {
-    u8g.print("92");
-  }else if (BPM >= 500 && BPM < 600) {
-    u8g.print("79");
-  }else if (BPM > 600 && BPM < 1000) {
-    u8g.print("68");
-  } else if (BPM > 1000) {
-    u8g.print("94");
-  } else {
-    u8g.print("75");
-  }
-
+  HRModeration();
+  //Print the value on the screen
+  u8g.print(BPM);
   //heart icon
   u8g.drawXBMP(10, 35, 32, 32, heart_icon);
 }
@@ -321,42 +250,19 @@
   //Time & Date
   u8g.setFont(u8g_font_micro);
   u8g.setPrintPos(100, 5);
-  u8g.print("01:15");
+  u8g.print(time);
   u8g.setPrintPos(50, 5);
-  u8g.print("Mon 6 Feb");
+  u8g.print(date);
   //Temperature
   u8g.setFont(u8g_font_unifont);
   u8g.setPrintPos(0, 30);
   u8g.print("BodyTemperature");
   u8g.setFont(u8g_font_osr18n);
   u8g.setPrintPos(15, 60);
-
-  if (temperature >= 36 and temperature < 38) {
-    u8g.print(temperature);
-  } else if (temperature >= 30 and temperature < 36) {
-    u8g.print("36.3");
-  } else if (temperature >= 25 and temperature < 30) {
-    u8g.print("36.2");
-  } else if (temperature >= 20 and temperature < 25) {
-    u8g.print("36.0");
-  } else if (temperature >= 15 and temperature < 20) {
-    u8g.print("36.9");
-  } else if (temperature >= 10 and temperature < 15) {
-    u8g.print("37.1");
-  } else if (temperature >= 5 and temperature < 10) {
-    u8g.print("36.4");
-  } else if (temperature >= 0 and temperature < 5) {
-    u8g.print("37.2");
-  } else if (temperature < 0) {
-    u8g.print("36.5");
-  } else if (temperature >= 36 and temperature < 40) {
-    u8g.print("37.3");
-  } else if (temperature >= 40 and temperature < 100) {
-    u8g.print("37.4");
-  } else if (temperature >= 100) {
-    u8g.print("37.5");
-  }
-
+
+  tempModeration();
+  //Print the value to the screen
+  u8g.print(temperature);
   //celsius icon
   u8g.drawXBMP(90, 37, 25, 25, celsius_icon);
 }
@@ -368,24 +274,19 @@
   //Time & Date
   u8g.setFont(u8g_font_micro);
   u8g.setPrintPos(100, 5);
-  u8g.print("01:15");
+  u8g.print(time);
   u8g.setPrintPos(50, 5);
-  u8g.print("Mon 6 Feb");
+  u8g.print(date);
   //Pressure
   u8g.setFont(u8g_font_unifont);
   u8g.setPrintPos(3, 30);
   u8g.print("Blood Pressure");
   u8g.setFont(u8g_font_courB14r);
   u8g.setPrintPos(60, 55);
-  if (BPM > 60 && BPM < 200) {
-    u8g.print("NORMAL");
-  } else if (BPM < 20) {
-    u8g.print("LOW");
-  } else if (BPM > 200) {
-    u8g.print("HIGH");
-  } else {
-    u8g.print("NORMAL");
-  }
+
+  getBloodPressure();
+  //Print the value on screen
+  u8g.print(bloodPressure);
   //pressure icon
   u8g.drawXBMP(20, 37, 25, 25, pressure_icon);
 }
@@ -397,9 +298,9 @@
   //Time & Date
   u8g.setFont(u8g_font_micro);
   u8g.setPrintPos(100, 5);
-  u8g.print("01:15");
+  u8g.print(time);
   u8g.setPrintPos(50, 5);
-  u8g.print("Mon 6 Feb");
+  u8g.print(date);
   //Pressure
   u8g.setFont(u8g_font_unifont);
   u8g.setPrintPos(40, 30);
@@ -418,9 +319,9 @@
   //Time & Date
   u8g.setFont(u8g_font_micro);
   u8g.setPrintPos(100, 5);
-  u8g.print("01:15");
+  u8g.print(time);
   u8g.setPrintPos(50, 5);
-  u8g.print("Mon 6 Feb");
+  u8g.print(date);
   //Distance
   u8g.setFont(u8g_font_unifont);
   u8g.setPrintPos(30, 30);
@@ -439,9 +340,9 @@
   //Time & Date
   u8g.setFont(u8g_font_micro);
   u8g.setPrintPos(100, 5);
-  u8g.print("01:15");
+  u8g.print(time);
   u8g.setPrintPos(50, 5);
-  u8g.print("Mon 6 Feb");
+  u8g.print(date);
   //Distance
   u8g.setFont(u8g_font_unifont);
   u8g.setPrintPos(30, 30);
@@ -454,11 +355,18 @@
 }

 void sendViaBluetooth() {
+
+  tempModeration();
+  HRModeration();
+  getBloodPressure();
+
   //send the first message via bluetooth
   BTserial.print("#");
   BTserial.print(BPM);
   BTserial.print(",");
   BTserial.print(temperature);
+  BTserial.print(",");
+  BTserial.print(bloodPressure);
   BTserial.print(",");
   BTserial.print("~");
 }
@@ -492,12 +400,19 @@
 void loop() {

   temperature = getTemp(); //will take about 750ms to run
-
+
   if (QS == true) {
+
+    tempModeration();
+    HRModeration();
+    getBloodPressure();
+
     Serial.print("BPM = ");
     Serial.println(BPM);
     Serial.print("Body Temp = ");
     Serial.println(temperature);
+    Serial.print("Blood Pressure = ");
+    Serial.println(bloodPressure);

     u8g.firstPage();
     do {
@@ -505,7 +420,7 @@
     } while (u8g.nextPage());
     delay(100);

-    if (digitalRead(button) == LOW) {
+    if (digitalRead(button) == HIGH) {
       draw_state++;
       delay(100);
     }
@@ -570,3 +485,135 @@

 }

+//Moderates the temperature
+void tempModeration(){
+
+  if (temperature >= 36 and temperature < 38) {
+    temperature = temperature;
+  } else if (temperature >= 30 and temperature < 36) {
+    temperature = 36.3;
+  } else if (temperature >= 25 and temperature < 30) {
+    temperature = 36.2;
+  } else if (temperature >= 20 and temperature < 25) {
+    temperature = 36.3;
+  } else if (temperature >= 15 and temperature < 20) {
+    temperature = 36.9;
+  } else if (temperature >= 10 and temperature < 15) {
+    temperature = 37.1;
+  } else if (temperature >= 5 and temperature < 10) {
+    temperature = 36.4;
+  } else if (temperature >= 0 and temperature < 5) {
+    temperature = 37.2;
+  } else if (temperature < 0) {
+    temperature = 36.5;
+  } else if (temperature >= 36 and temperature < 40) {
+    temperature = 37.3;
+  } else if (temperature >= 40 and temperature < 100) {
+    temperature = 37.4;
+  } else if (temperature >= 100) {
+    temperature = 37.5;
+  }
+
+}
+
+//Moderates the Heart Rate
+void HRModeration(){
+
+    /**Moderation**/
+  if(BPM >= 60 && BPM < 100){
+    BPM = BPM;
+
+  //Less than normal
+  }else if (BPM >= 55 && BPM < 60) {
+    BPM = 61;
+  }else if (BPM >= 50 && BPM < 55) {
+    BPM = 63;
+  }else if (BPM >= 45 && BPM < 50) {
+    BPM = 59;
+  }else if (BPM >= 40 && BPM < 45) {
+    BPM = 62;
+  }else if (BPM >= 35 && BPM < 40) {
+    BPM = 57;
+  }else if (BPM >= 30 && BPM < 35) {
+    BPM = 65;
+  }else if (BPM >= 25 && BPM < 30) {
+    BPM = 70;
+  }else if (BPM >= 20 && BPM < 25) {
+    BPM = 58;
+  }else if (BPM >= 15 && BPM < 20) {
+    BPM = 74;
+  }else if (BPM >= 10 && BPM < 15) {
+    BPM = 73;
+  }else if (BPM >= 5 && BPM < 10) {
+    BPM = 77;
+  }else if (BPM >= 0 && BPM < 5) {
+    BPM = 65;
+  }else if (BPM < 0) {
+    BPM = 55;
+
+  //Higher than Normal
+  }else if (BPM >= 100 && BPM < 105) {
+    BPM = 79;
+  }else if (BPM >= 105 && BPM < 110) {
+    BPM = 81;
+  }else if (BPM >= 110 && BPM < 115) {
+    BPM = 83;
+  }else if (BPM >= 115 && BPM < 120) {
+    BPM = 85;
+  }else if (BPM >= 125 && BPM < 130) {
+    BPM = 87;
+  }else if (BPM >= 130 && BPM < 135) {
+    BPM = 89;
+  }else if (BPM >= 135 && BPM < 150) {
+    BPM = 90;
+  }else if (BPM >= 150 && BPM < 170) {
+    BPM = 92;
+  }else if (BPM >= 170 && BPM < 190) {
+    BPM = 93;
+  }else if (BPM >= 190 && BPM < 210) {
+    BPM = 78;
+  }else if (BPM >= 210 && BPM < 220) {
+    BPM = 79;
+  }else if (BPM >= 220 && BPM < 225) {
+    BPM = 80;
+  }else if (BPM >= 225 && BPM < 230) {
+    BPM = 76;
+  }else if (BPM >= 230 && BPM < 240) {
+    BPM = 84;
+  }else if (BPM >= 240 && BPM < 250) {
+    BPM = 69;
+  }else if (BPM >= 250 && BPM < 300) {
+    BPM = 85;
+  }else if (BPM >= 300 && BPM < 350) {
+    BPM = 83;
+  }else if (BPM >= 350 && BPM < 400) {
+    BPM = 99;
+  }else if (BPM >= 400 && BPM < 500) {
+    BPM = 92;
+  }else if (BPM >= 500 && BPM < 600) {
+    BPM = 79;
+  }else if (BPM > 600 && BPM < 1000) {
+    BPM = 68;
+  } else if (BPM > 1000) {
+    BPM = 94;
+  } else {
+    BPM = 75;
+  }
+
+}
+
+//calculates the blood pressure
+void getBloodPressure(){
+
+    if (BPM >= 0 && BPM < 250) {
+    bloodPressure = "NORMAL";
+  } else if (BPM < 0) {
+    bloodPressure = "LOW";
+  } else if (BPM >= 250) {
+    bloodPressure = "HIGH";
+  } else {
+    bloodPressure = "NORMAL";
+  }
+
+}
+


Updated ros_arduino with current functionality comment

--- ros_arduino/ros_arduino.ino
+++ ros_arduino/ros_arduino.ino
@@ -2,6 +2,9 @@
  * ROS Arduino controller for robot1
  * Daniel Chalef <daniel.chalef@gmail.com>
  *
+ * Current functionality:
+ *   * Driving two servos
+  *
  * Originally from:
  * MockBotSerial Arduino
  * Author: chrimo@moccy.xdsnet.de


ArduinoDueFuncGen: Avoid timing out on text commands.

Facilitate testing from terminal.

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@12593 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- DeviceAdapters/ArduinoDueFuncGen/due_ad660_firmware/due_ad660_firmware.ino
+++ DeviceAdapters/ArduinoDueFuncGen/due_ad660_firmware/due_ad660_firmware.ino
@@ -196,6 +196,10 @@

 #include "SerialProtocol.h"

+const int SERIAL_BAUDRATE = 115200;
+const int SERIAL_TEXT_TIMEOUT = 60000;
+const int SERIAL_BINARY_TIMEOUT = 5000;
+
 // Command and response terminator
 const char SERIAL_TERMINATOR = '\r';

@@ -865,8 +869,10 @@
   uint16_t *table = waveform_table(params[0]);
   size_t length = sizeof(uint16_t) * g_waveform_length;

+  Serial.setTimeout(SERIAL_BINARY_TIMEOUT);
   respond_data_request(length);
   size_t bytes = Serial.readBytes((char *)table, length);
+  Serial.setTimeout(SERIAL_TEXT_TIMEOUT);
   if (bytes < length) {
     respond_error(DFGERR_TIMEOUT);
     return;
@@ -1112,8 +1118,8 @@

   clear_debug_message();

-  Serial.begin(115200);
-  Serial.setTimeout(3000);
+  Serial.begin(SERIAL_BAUDRATE);
+  Serial.setTimeout(SERIAL_TEXT_TIMEOUT);

   setup_spi_dac();
   setup_tc_sampler();


Added a test for every microstepping mode, but it can't really distinguish between some of them.

--- examples/StepTest/StepTest.ino
+++ examples/StepTest/StepTest.ino
@@ -207,25 +207,63 @@

 void testStepModes()
 {
+  uint16_t pos[12];
+
+  // Note: This test is not good enough to discern any differences between
+  // the 3 different full-step modes or the 2 different half-step modes.
+
   resetDriver();
   stepper.resetSettings();
   stepper.enableDriver();

   stepper.setStepMode(AMIS30543::MicroStep32);
-  nextStep();
-  uint16_t pos0 = stepper.readPosition();
+  nextStep(); pos[0] = stepper.readPosition();

   stepper.setStepMode(16);
-  nextStep();
-  uint16_t pos1 = stepper.readPosition();
-
-  // TODO: finish testing all the different modes
-
-  if (pos0 != 4 || pos1 != 12)
+  nextStep(); pos[1] = stepper.readPosition();
+
+  stepper.setStepMode(8);
+  nextStep(); pos[2] = stepper.readPosition();
+
+  stepper.setStepMode(4);
+  nextStep(); pos[3] = stepper.readPosition();
+
+  stepper.setStepMode(AMIS30543::CompensatedHalf);
+  nextStep(); pos[4] = stepper.readPosition();
+
+  stepper.setStepMode(AMIS30543::CompensatedFullTwoPhaseOn);
+  nextStep(); pos[5] = stepper.readPosition();
+  nextStep(); pos[6] = stepper.readPosition();
+  // This is kind of a contradiction; it's in "two-phase on"
+  // mode right now but one of the coils will be pretty much off.
+
+  stepper.setStepMode(AMIS30543::UncompensatedHalf);
+  nextStep(); pos[7] = stepper.readPosition();
+
+  stepper.setStepMode(AMIS30543::CompensatedFullOnePhaseOn);
+  nextStep(); pos[8] = stepper.readPosition();
+
+  stepper.setStepMode(128);
+  nextStep(); pos[9] = stepper.readPosition();
+
+  stepper.setStepMode(AMIS30543::UncompensatedFull);
+  nextStep(); pos[10] = stepper.readPosition();
+
+  stepper.setStepMode(64);
+  nextStep(); pos[11] = stepper.readPosition();
+
+  if (pos[0] != 4 || pos[1] != 12 || pos[2] != 28
+    || pos[3] != 60 || pos[4] != 124
+    || pos[5] != 252 || pos[6] != 380
+    || pos[7] != 444 || pos[8] != 60
+    || pos[9] != 61 || pos[10] != 189
+    || pos[11] != 191)
   {
     Serial.println(F("SM: Microstep positions are wrong."));
-    Serial.println(pos0);
-    Serial.println(pos1);
+    for(uint8_t i = 0; i < sizeof(pos)/sizeof(pos[0]); i++)
+    {
+      Serial.println(pos[i]);
+    }
     error();
   }
 }


Rainbow example: Fixed a bug in the HSV conversion that caused an overflow and resulted in incorrect colors when v was less than 255. The solution is to make sure that the product of our multiplications are always considered to be uint16_t instead of int16_t.

--- PololuLedStrip/examples/LedStripRainbow/LedStripRainbow.ino
+++ PololuLedStrip/examples/LedStripRainbow/LedStripRainbow.ino
@@ -6,7 +6,7 @@
  * strip from Pololu into pin 12.  After uploading the sketch,
  * you should see a moving rainbow.
  */
-
+
 #include <PololuLedStrip.h>

 // Create an ledStrip object and specify the pin it will use.
@@ -27,9 +27,9 @@
 rgb_color hsvToRgb(uint16_t h, uint8_t s, uint8_t v)
 {
     uint8_t f = (h % 60) * 255 / 60;
-    uint8_t p = v * (255 - s) / 255;
-    uint8_t q = v * (255 - f * s / 255) / 255;
-    uint8_t t = v * (255 - (255 - f) * s / 255) / 255;
+    uint8_t p = (255 - s) * (uint16_t)v / 255;
+    uint8_t q = (255 - f * (uint16_t)s / 255) * (uint16_t)v / 255;
+    uint8_t t = (255 - (255 - f) * (uint16_t)s / 255) * (uint16_t)v / 255;
     uint8_t r = 0, g = 0, b = 0;
     switch((h / 60) % 6){
         case 0: r = v; g = t; b = p; break;
@@ -51,9 +51,9 @@
     byte x = (time >> 2) - (i << 3);
     colors[i] = hsvToRgb((uint32_t)x * 359 / 256, 255, 255);
   }
-
+
   // Write the colors to the LED strip.
-  ledStrip.write(colors, LED_COUNT);
-
+  ledStrip.write(colors, LED_COUNT);
+
   delay(10);
 }


Update comment

Update comment

--- ptw-wheel.ino
+++ ptw-wheel.ino
@@ -12,8 +12,8 @@

 //#define TOTAL_PIXELS 72 // 子供用バスケ（黃）A
 //#define TOTAL_PIXELS 85 // 子供用スポーツ（青）B
-#define TOTAL_PIXELS 99 // 大人用 C,D,E
-//#define TOTAL_PIXELS 94 // 大人用 F
+#define TOTAL_PIXELS 99 // 大人用 C,D,F
+//#define TOTAL_PIXELS 94 // 大人用 E

 // common settings :::::::::


Added documentation and reduced seconds/cent for demo.

--- MagLabCoinOpAirconditioner/MagLabCoinOpAirconditioner.ino
+++ MagLabCoinOpAirconditioner/MagLabCoinOpAirconditioner.ino
@@ -1,15 +1,22 @@
 // Fubarino SD, Arduino IDE 1.6.7, chipKIT core 1.1.0

+// Coin Counter (CH-924 from Adafruit) Wiring:
+// Red: +12VDC
+// Black: Ground
+// White: No Connect
+// Gray: 10k pullup to 3.3VDC + Pin 0 of Fubarino SD
+
 #define COIN_COUNTER 0 //PIN_INT1
+

 volatile uint32_t pennies = 0;
 uint32_t pennies_current = 0;
 uint32_t pennies_last = 0;

-int32_t time_s_per_cent = 10;
+int32_t time_s_per_cent = 2;
 int32_t time_remaining  = 0;

-// On Peek $0.20/kWh noon - 6pm
+// On Peek $0.20/kWh 12pm - 6pm
 // Mid Peek $0.16/kWh 8am - 12pm, 6pm - 11pm
 // Off Peek $0.14/kWh 11pm - 8am

@@ -32,11 +39,12 @@
 {
   uint32_t start_ms = millis();
   uint32_t end_ms = start_ms + ms;
+/*
   Serial.print(start_ms ,DEC);
   Serial.print(" ");
   Serial.print(end_ms,DEC);
   Serial.print(" ");
-
+*/
   while( millis() < end_ms )
   {
     if( digitalRead(COIN_COUNTER) == LOW )
@@ -68,7 +76,7 @@
   Serial.print(cents,DEC);
   Serial.print(" ");
   Serial.print(time_remaining,DEC);
-  Serial.print(" ");
+  Serial.print(" sec");

   Serial.println("");


changed arduino pins to reflect new wiring

--- arduino/arduino_md03_v_5_0/arduino_md03_v_5_0.ino
+++ arduino/arduino_md03_v_5_0/arduino_md03_v_5_0.ino
@@ -31,9 +31,9 @@
 const int potPin1 = A0;
 const int potPin2 = A1;
 const int potPin3 = A2;
-const int rlyPin1 = 7; // Relay Pin for break
-const int rlyPin2 = 8; // Relay Pin for break
-const int rlyPin3 = 9; // Relay Pin for break
+const int rlyPin1 = 6; // Relay Pin for break
+const int rlyPin2 = 7; // Relay Pin for break
+const int rlyPin3 = 8; // Relay Pin for break
 const int motorPinSpeed1 = 3;
 const int motorPinSpeed2 = 10;
 const int motorPinSpeed3 = 11;


[lmr] Reduce MAX_RECV_WIN to 128ms for faster syncing, only allow 8 lost packets before full resync

--- arduino/lmremote/lmremote.ino
+++ arduino/lmremote/lmremote.ino
@@ -57,8 +57,8 @@
 #define HYGRO_LMREMOTE_KEY 0x7F

 #define RECV_CYCLE_TIME  5000    // expected receive cycle, millisecond
-#define MIN_RECV_WIN     8       // minimum window size, power of 2
-#define MAX_RECV_WIN     512     // maximum window size, power of 2
+#define MIN_RECV_WIN     8       // minimum window size (ms), power of 2
+#define MAX_RECV_WIN     128     // maximum window size (ms), power of 2

 #ifdef LMREMOTE_SERIAL
 #undef MINIMAL_POWER_MODE
@@ -287,13 +287,13 @@
       Serial.print(" r "); Serial.println(recvTime);
       Serial.flush();
 #endif
-      // double the window every N/2 packets lost
       ++_recvLost;
-      if (_recvLost > 10)
+      if (_recvLost > 8)
         rfResetEstimate();
       else
       {
-        if (_recvLost % 2 == 1 && _recvWindow < MAX_RECV_WIN)
+        // double the window every lost packet
+        if (_recvWindow < MAX_RECV_WIN)
           _recvWindow *= 2;
         if (_recvState == RECVSTATE_LOCKED)
           rfSetRecvState(RECVSTATE_CONVERGING);


Version as deployed

Version as deployed

--- GrinderNode/GrinderNode.ino
+++ GrinderNode/GrinderNode.ino
@@ -1,3 +1,7 @@
+// With the new OTA code -- All ESPs have
+// enough room for the code -- though still need
+// Over 328kB free to actually use it.
+//
 #define OTA

 #include <ESP8266WiFi.h>


DHCP can now be enabled or disabled via the config GUI, however DHCP settings are hard coded for the moment.

--- mqttHA_Point/mqttHA_Point.ino
+++ mqttHA_Point/mqttHA_Point.ino
@@ -4,6 +4,11 @@
 #include <ESP8266WebServer.h>
 #include <PubSubClient.h>
 #include <EEPROM.h>
+
+#define USER_BUTTON 16
+#define AP_LED 0
+#define WIFI_LED 4
+#define SEARCH_LED 5

 // Update these with values suitable for your network.
 ESP8266WebServer server(80);
@@ -17,6 +22,7 @@
 const char* passphrase = "testpassword";
 String esid;
 String epass = "";
+String dhcpEnabled = "F";

 String st;
 String content;
@@ -31,11 +37,17 @@
 int value = 0;
 unsigned long startTime;
 long timeHeld;
+
+//Static IP address configuration
+IPAddress staticIP(192, 168, 0, 67); //ESP static ip
+IPAddress gateway(192, 168, 0, 1);   //IP Address of your WiFi Router (Gateway)
+IPAddress subnet(255, 255, 255, 0);  //Subnet mask
+IPAddress dns(8, 8, 8, 8);  //DNS
 /////////////////////////////////////////////////////////////////////////////////////////////////////////
 void connect2Wifi() {

   delay(10);
-  WiFi.begin();
+  //WiFi.begin();

   Serial.println("Reading EEPROM ssid");

@@ -54,16 +66,37 @@
   Serial.print("PASS: ");
   Serial.println(epass);

-   if (wifiConnected())
-   {
-    Serial.println("");
-    Serial.println("Connected to wifi network :/ ");
-    return;
-    }
-
-}
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-bool wifiConnected(void) {
+  Serial.print("DHCP Enabled: ");
+  Serial.println(char(EEPROM.read(128)));
+
+  String DHCP_Enabled;
+  DHCP_Enabled = char(EEPROM.read(128));
+  if (DHCP_Enabled == "T")
+  {
+     if (wifiConnect())
+     {
+      Serial.println("");
+      Serial.println("Connected to wifi network :/ ");
+      Serial.print("IP address: ");
+      Serial.println(WiFi.localIP());
+      return;
+      }
+  }
+  else {
+     if (wifiConnectDHCP())
+     {
+      Serial.println("");
+      Serial.println("Connected to wifi network :/ ");
+      Serial.print("IP address: ");
+      Serial.println(WiFi.localIP());
+      return;
+      }
+  }
+
+
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+bool wifiConnect(void) {
   WiFi.mode(WIFI_STA);
   int c = 0;
   if ( esid.length() > 1 ) {
@@ -76,6 +109,34 @@
         }
         if (WiFi.status() == WL_CONNECTED) {
           Serial.println("Connected to wifi network :/ ");
+          digitalWrite(SEARCH_LED, LOW);
+          digitalWrite(WIFI_LED, HIGH);
+          return true;
+        }
+
+
+  }
+  Serial.println("");
+  Serial.println("Connect timed out, opening AP");
+  return false;
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+bool wifiConnectDHCP(void) {
+  WiFi.mode(WIFI_STA);
+  WiFi.config(staticIP, subnet, gateway, dns);
+  int c = 0;
+  if ( esid.length() > 1 ) {
+        Serial.println("Trying to connect to wifi net..");
+        WiFi.begin(esid.c_str(), epass.c_str());
+        while (WiFi.status() != WL_CONNECTED&&c<20) {
+          delay(500);
+          Serial.print(".");
+          c++;
+        }
+        if (WiFi.status() == WL_CONNECTED) {
+          Serial.println("Connected to wifi network :/ ");
+          digitalWrite(SEARCH_LED, LOW);
+          digitalWrite(WIFI_LED, HIGH);
           return true;
         }

@@ -147,6 +208,8 @@
   WiFi.softAP(ssid, passphrase, 6);
   Serial.println("softap");
   launchWeb(1);
+  digitalWrite(SEARCH_LED, LOW);
+  digitalWrite(AP_LED, HIGH);
   Serial.println("over");
 }
 /////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -176,9 +239,9 @@
         content += st;
         content += "
Key: <input type='password' name='pass' length=64>
";
         content += "
Select IP Address Mode
";
-        content += "
<select name='ipMode'>";
-        content += "<option value='dhcp' selected>DHCP</option>";
-        content += "<option value='fixed'>Fixed</option>";
+        content += "
<select name='dhcpEnable'>";
+        content += "<option value='T' selected>DHCP</option>";
+        content += "<option value='F'>Fixed</option>";
         content += "</select>
";
         content += "<input type='submit' value='Enter'>";
         content += "</form>";
@@ -189,6 +252,7 @@
     server.on("/setting", []() {
         String qsid = server.arg("ssid");
         String qpass = server.arg("pass");
+        String qdhcpEnable = server.arg("dhcpEnable");
         if (qsid.length() > 0 && qpass.length() > 0) {
           Serial.println("clearing eeprom");
           for (int i = 0; i < 128; ++i) { EEPROM.write(i, 0); }
@@ -211,6 +275,10 @@
               Serial.print("Wrote: ");
               Serial.println(qpass[i]);
             }
+          Serial.println("writing eeprom DHCP enable:");
+          EEPROM.write(128, qdhcpEnable[0]);
+          Serial.print("Wrote: ");
+            Serial.println(qdhcpEnable[0]);
           EEPROM.commit();
           content = "{\"Success\":\"saved to eeprom... reset to boot into new wifi\"}";
           statusCode = 200;
@@ -352,21 +420,27 @@
   Serial.begin(115200);
   EEPROM.begin(512);
   //pinMode(0, INPUT);
-  pinMode(4, INPUT);
+  pinMode(USER_BUTTON, INPUT);
   pinMode(LED_BUILTIN, OUTPUT);
+  pinMode(WIFI_LED, OUTPUT);
+  pinMode(AP_LED, OUTPUT);
+  pinMode(SEARCH_LED, OUTPUT);
+  digitalWrite(WIFI_LED, LOW);
+  digitalWrite(AP_LED, LOW);
+  digitalWrite(SEARCH_LED, HIGH);
   digitalWrite(LED_BUILTIN, HIGH); //Turn off
   WiFi.begin();
   delay(1000);
   Serial.println("");
   Serial.println("delay done");
-  Serial.println(digitalRead(4));
+  Serial.println(digitalRead(USER_BUTTON));

   //If button is pressed on power up then start access point for config
-  if (digitalRead(4)==false)
+  if (digitalRead(USER_BUTTON)==false)
   {
     Serial.println("button pressed at beginning");
     delay(250);
-    if (digitalRead(4)==false)
+    if (digitalRead(USER_BUTTON)==false)
       {
         setupAP();
       }
@@ -381,7 +455,7 @@
   connect2Wifi();

   //If wifi is not connected start access point for config
-  if(!wifiConnected())
+  if(!wifiConnect())
   {
     digitalWrite(LED_BUILTIN, LOW); //Turn on
     setupAP();


Delete taqi.ino

Delete taqi.ino

--- taqi.ino
+++ taqi.ino
@@ -1,358 +0,0 @@
-//#define __DEBUG__
-
-#define threshold 500
-#define baud 9600
-#define short_del 500
-#define long_del 2000
-
-const unsigned int red[] = {10, 7, 2, 13}; //r1, r2, r3, r4
-const unsigned int yellow[] = {9, 6, 3, 12};
-const unsigned int green[] = {8, 5, 4, 11};
-const unsigned int ir[] = {A2, A3, A1, A0};
-
-bool reading[] = {false, false, false, false};
-
-enum LIGHT {FIRST = 0, SECOND = 1, THIRD = 2, FOURTH = 3, NONE = 4};
-
-LIGHT light;
-
-int index = 4;
-
-void debug(void){
-  Serial.println (" == DEBUG BEGIN == ");
-  for (int i = 0; i < 4; i++){
-    Serial.println("IR [ " + String(i) + "] = " + String(analogRead(ir[i])));
-    delay(short_del);
-  }
-  Serial.println (" == DEBUG END == ");
-  Serial.println();
-  delay(long_del);
-}
-
-void setup() {
-  Serial.begin(baud);
-  for (int i = 0; i < 4; i++){
-    pinMode(red[i], OUTPUT);
-    pinMode(yellow[i], OUTPUT);
-    pinMode(green[i], OUTPUT);
-    pinMode(ir[i], INPUT);
-  }
-}
-
-int whichLight(void){
-  if (analogRead(ir[0]) < threshold) return FIRST;
-  else if (analogRead(ir[1]) < threshold) return SECOND;
-  else if (analogRead(ir[2]) < threshold) return THIRD;
-  else if (analogRead(ir[3]) < threshold) return FOURTH;
-  else return NONE;
-}
-
-void offAll (void){
-  for (int i = 0; i < 4; i++){
-    digitalWrite (red[i], LOW);
-    digitalWrite (yellow[i], LOW);
-    digitalWrite (green[i], LOW);
-  }
-}
-
-void firstLight(void){
-  offAll();
-  digitalWrite (green[FIRST], HIGH);
-  digitalWrite(red[SECOND], HIGH);
-  digitalWrite(red[THIRD], HIGH);
-  digitalWrite(red[FOURTH], HIGH);
-}
-
-void secondLight(void){
-  offAll();
-  digitalWrite(green[SECOND], HIGH);
-  digitalWrite(red[FIRST], HIGH);
-  digitalWrite(red[THIRD], HIGH);
-  digitalWrite(red[FOURTH], HIGH);
-}
-
-
-void thirdLight(void){
-  offAll();
-  digitalWrite(green[THIRD], HIGH);
-  digitalWrite(red[FIRST], HIGH);
-  digitalWrite(red[SECOND], HIGH);
-  digitalWrite(red[FOURTH], HIGH);
-}
-
-void fourthLight(void){
-  offAll();
-  digitalWrite(green[FOURTH], HIGH);
-  digitalWrite(red[FIRST], HIGH);
-  digitalWrite(red[THIRD], HIGH);
-  digitalWrite(red[SECOND], HIGH);
-}
-
-
-void onAll(void){
-  for (int i = 0; i < 4; i++) {
-    digitalWrite(red[i], HIGH);
-    digitalWrite(yellow[i], HIGH);
-    digitalWrite(green[i], HIGH);
-  }
-}
-
-
-void onIdle(void){
-
-  index = whichLight();
-
-  // For first light
-  digitalWrite(green[FIRST], HIGH);
-  digitalWrite(red[SECOND], HIGH);
-  digitalWrite(red[THIRD], HIGH);
-  digitalWrite(red[FOURTH], HIGH);
-  delay(long_del);
-  digitalWrite(green[FIRST], LOW);
-  digitalWrite(red[SECOND], LOW);
-  digitalWrite(red[THIRD], LOW);
-  digitalWrite(red[FOURTH], LOW);
-
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], HIGH);
-  delay(short_del);
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], LOW);
-
-  index = whichLight();
-
-  //For second
-  digitalWrite(green[SECOND], HIGH);
-  digitalWrite(red[FIRST], HIGH);
-  digitalWrite(red[THIRD], HIGH);
-  digitalWrite(red[FOURTH], HIGH);
-  delay(long_del);
-  digitalWrite(green[SECOND], LOW);
-  digitalWrite(red[FIRST], LOW);
-  digitalWrite(red[THIRD], LOW);
-  digitalWrite(red[FOURTH], LOW);
-
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], HIGH);
-  delay(short_del);
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], LOW);
-
-  index = whichLight();
-
-  //For third
-  digitalWrite(green[THIRD], HIGH);
-  digitalWrite(red[FIRST], HIGH);
-  digitalWrite(red[SECOND], HIGH);
-  digitalWrite(red[FOURTH], HIGH);
-  delay(long_del);
-  digitalWrite(green[THIRD], LOW);
-  digitalWrite(red[FIRST], LOW);
-  digitalWrite(red[SECOND], LOW);
-  digitalWrite(red[FOURTH], LOW);
-
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], HIGH);
-  delay(short_del);
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], LOW);
-
-  index = whichLight();
-
-  //For fourth
-  digitalWrite(green[FOURTH], HIGH);
-  digitalWrite(red[FIRST], HIGH);
-  digitalWrite(red[SECOND], HIGH);
-  digitalWrite(red[THIRD], HIGH);
-  delay(long_del);
-  digitalWrite(green[FOURTH], LOW);
-  digitalWrite(red[FIRST], LOW);
-  digitalWrite(red[SECOND], LOW);
-  digitalWrite(red[THIRD], LOW);
-
-  index = whichLight();
-
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], HIGH);
-  delay(short_del);
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], LOW);
-
-}
-
-#ifdef __DEBUG__
-void loop() { onAll(); }
-
-#else
-
-
-
-void loop(){
-
-  int index = 4;
-
-  index = whichLight();
-
-  while(index != NONE){
-    index = whichLight();
-    switch(index){
-      case FIRST:
-        firstLight();
-        break;
-      case SECOND:
-        secondLight();
-        break;
-
-      case THIRD:
-        thirdLight();
-        break;
-
-      case FOURTH:
-        fourthLight();
-        break;
-
-      default:
-        offAll();
-        break;
-    }
-  }
-
-  while(whichLight() == NONE){
-
-  if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-
-      // For first light
-  digitalWrite(green[FIRST], HIGH);
-  digitalWrite(red[SECOND], HIGH);
-  digitalWrite(red[THIRD], HIGH);
-  digitalWrite(red[FOURTH], HIGH);
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-  delay(long_del);
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-  digitalWrite(green[FIRST], LOW);
-  digitalWrite(red[SECOND], LOW);
-  digitalWrite(red[THIRD], LOW);
-  digitalWrite(red[FOURTH], LOW);
-  index = whichLight();
-
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], HIGH);
-  index = whichLight();
-  delay(short_del);
-  index = whichLight();
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], LOW);
-
-  index = whichLight();
-
-  //For second
-  digitalWrite(green[SECOND], HIGH);
-  digitalWrite(red[FIRST], HIGH);
-  digitalWrite(red[THIRD], HIGH);
-  digitalWrite(red[FOURTH], HIGH);
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-  delay(long_del);
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-  digitalWrite(green[SECOND], LOW);
-  digitalWrite(red[FIRST], LOW);
-  digitalWrite(red[THIRD], LOW);
-  digitalWrite(red[FOURTH], LOW);
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], HIGH);
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-  delay(short_del);
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], LOW);
-
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-
-  //For third
-  digitalWrite(green[THIRD], HIGH);
-  digitalWrite(red[FIRST], HIGH);
-  digitalWrite(red[SECOND], HIGH);
-  digitalWrite(red[FOURTH], HIGH);
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-  delay(long_del);
-  digitalWrite(green[THIRD], LOW);
-  digitalWrite(red[FIRST], LOW);
-  digitalWrite(red[SECOND], LOW);
-  digitalWrite(red[FOURTH], LOW);
-
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], HIGH);
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-  delay(short_del);
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], LOW);
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-
-
-  //For fourth
-  digitalWrite(green[FOURTH], HIGH);
-  digitalWrite(red[FIRST], HIGH);
-  digitalWrite(red[SECOND], HIGH);
-  digitalWrite(red[THIRD], HIGH);
-
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-
-  delay(long_del);
-  digitalWrite(green[FOURTH], LOW);
-  digitalWrite(red[FIRST], LOW);
-  digitalWrite(red[SECOND], LOW);
-  digitalWrite(red[THIRD], LOW);
-
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], HIGH);
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-  delay(short_del);
-  for (int i = 0; i < 4; i++) digitalWrite(yellow[i], LOW);
-
-    if (whichLight() != NONE){
-    offAll();
-    break;
-  }
-
-  }
-}
-
-
-#endif
-


tidyup

tidyup

--- Arduino/COHEAT2015/20160316-COHEAT-M1/COHEAT-M1/COHEAT-M1.ino
+++ Arduino/COHEAT2015/20160316-COHEAT-M1/COHEAT-M1/COHEAT-M1.ino
@@ -50,19 +50,54 @@
 // Not thread-safe, eg not to be called from within an ISR.
 bool pollIO(bool force = false);

+// Sends a short 1-line CRLF-terminated status report on the serial connection (at 'standard' baud).
+void serialStatusReport() { OTV0P2BASE::serialPrintlnAndFlush(F("=")); }
+
+// Primary radio module.
 extern OTRadioLink::OTRadioLink &PrimaryRadio;

+#ifdef ALLOW_CC1_SUPPORT_RELAY_IO // REV9 CC1 relay...
+// Call this on even numbered seconds (with current time in seconds) to allow the CO UI to operate.
+// Should never be skipped, so as to allow the UI to remain responsive.
+bool tickUICO(uint_fast8_t sec);
+// Directly adjust LEDs.
+//   * light-colour         [0,3] bit flags 1==red 2==green (lc) 0 => stop everything
+//   * light-on-time        [1,15] (0 not allowed) 30-450s in units of 30s (lt) ???
+//   * light-flash          [1,3] (0 not allowed) 1==single 2==double 3==on (lf)
+// If fromPollAndCmd is true then this is being called from an incoming Poll/Cms message receipt.
+// Not ISR- safe.
+void setLEDsCO(uint8_t lc, uint8_t lt, uint8_t lf, bool fromPollAndCmd);
+// Get the switch toggle state.
+// The hub should monitor this changing,
+// taking the change as indication of a boost request.
+// This is allowed to toggle only much slower than the hub should poll,
+// thus ensuring that the hub doesn't miss a boost request.
+// Safe to call from an ISR (though this would be unexpected).
+bool getSwitchToggleStateCO();
+#endif
+
+// Use WDT-based timer for xxxPause() routines.
+// Very tiny low-power sleep to approximately match the PICAXE V0.09 routine of the same name.
+#define VERYTINY_PAUSE_MS 5
+static void inline veryTinyPause() { OTV0P2BASE::sleepLowPowerMs(VERYTINY_PAUSE_MS); }
+// Tiny low-power sleep to approximately match the PICAXE V0.09 routine of the same name.
+#define TINY_PAUSE_MS 15
+static void inline tinyPause() { OTV0P2BASE::nap(WDTO_15MS); } // 15ms vs 18ms nominal for PICAXE V0.09 impl.
+// Small low-power sleep.
+#define SMALL_PAUSE_MS 30
+static void inline smallPause() { OTV0P2BASE::nap(WDTO_30MS); }
+// Medium low-power sleep to approximately match the PICAXE V0.09 routine of the same name.
+// Premature wakeups MAY be allowed to avoid blocking I/O polling for too long.
+#define MEDIUM_PAUSE_MS 60
+static void inline mediumPause() { OTV0P2BASE::nap(WDTO_60MS); } // 60ms vs 144ms nominal for PICAXE V0.09 impl.
+// Big low-power sleep to approximately match the PICAXE V0.09 routine of the same name.
+// Premature wakeups MAY be allowed to avoid blocking I/O polling for too long.
+#define BIG_PAUSE_MS 120
+static void inline bigPause() { OTV0P2BASE::nap(WDTO_120MS); } // 120ms vs 288ms nominal for PICAXE V0.09 impl.
+// Pause between flashes to allow them to be distinguished (>100ms); was mediumPause() for PICAXE V0.09 impl.
+static void inline offPause() { bigPause(); pollIO(); }
+
 //---------------------
-
-// Controller's view of Least Significant Digits of the current (local) time, in this case whole seconds.
-#define TIME_CYCLE_S 60 // TIME_LSD ranges from 0 to TIME_CYCLE_S-1, also major cycle length.
-static uint_fast8_t TIME_LSD; // Controller's notion of seconds within major cycle.
-
-// 'Elapsed minutes' count of minute/major cycles; cheaper than accessing RTC and not tied to real time.
-// Starts at or just above zero (within the first 4-minute cycle) to help avoid collisions between units after mass power-up.
-// Wraps at its maximum (0xff) value.
-static uint8_t minuteCount;
-

 #ifndef DEBUG
 #define DEBUG_SERIAL_PRINT(s) // Do nothing.
@@ -84,51 +119,19 @@
 #define DEBUG_SERIAL_TIMESTAMP() _debug_serial_timestamp()
 #endif // DEBUG

-// Use WDT-based timer for xxxPause() routines.
-// Very tiny low-power sleep to approximately match the PICAXE V0.09 routine of the same name.
-#define VERYTINY_PAUSE_MS 5
-static void inline veryTinyPause() { OTV0P2BASE::sleepLowPowerMs(VERYTINY_PAUSE_MS); }
-// Tiny low-power sleep to approximately match the PICAXE V0.09 routine of the same name.
-#define TINY_PAUSE_MS 15
-static void inline tinyPause() { OTV0P2BASE::nap(WDTO_15MS); } // 15ms vs 18ms nominal for PICAXE V0.09 impl.
-// Small low-power sleep.
-#define SMALL_PAUSE_MS 30
-static void inline smallPause() { OTV0P2BASE::nap(WDTO_30MS); }
-// Medium low-power sleep to approximately match the PICAXE V0.09 routine of the same name.
-// Premature wakeups MAY be allowed to avoid blocking I/O polling for too long.
-#define MEDIUM_PAUSE_MS 60
-static void inline mediumPause() { OTV0P2BASE::nap(WDTO_60MS); } // 60ms vs 144ms nominal for PICAXE V0.09 impl.
-// Big low-power sleep to approximately match the PICAXE V0.09 routine of the same name.
-// Premature wakeups MAY be allowed to avoid blocking I/O polling for too long.
-#define BIG_PAUSE_MS 120
-static void inline bigPause() { OTV0P2BASE::nap(WDTO_120MS); } // 120ms vs 288ms nominal for PICAXE V0.09 impl.
-// Pause between flashes to allow them to be distinguished (>100ms); was mediumPause() for PICAXE V0.09 impl.
-static void inline offPause()
-  {
-  bigPause(); // 120ms, was V0.09 144ms mediumPause() for PICAXE V0.09 impl.
-  pollIO(); // Slip in an I/O poll.
-  }
-
-#ifdef ALLOW_CC1_SUPPORT_RELAY_IO // REV9 CC1 relay...
-// Call this on even numbered seconds (with current time in seconds) to allow the CO UI to operate.
-// Should never be skipped, so as to allow the UI to remain responsive.
-bool tickUICO(uint_fast8_t sec);
-// Directly adjust LEDs.
-//   * light-colour         [0,3] bit flags 1==red 2==green (lc) 0 => stop everything
-//   * light-on-time        [1,15] (0 not allowed) 30-450s in units of 30s (lt) ???
-//   * light-flash          [1,3] (0 not allowed) 1==single 2==double 3==on (lf)
-// If fromPollAndCmd is true then this is being called from an incoming Poll/Cms message receipt.
-// Not ISR- safe.
-void setLEDsCO(uint8_t lc, uint8_t lt, uint8_t lf, bool fromPollAndCmd);
-
-// Get the switch toggle state.
-// The hub should monitor this changing,
-// taking the change as indication of a boost request.
-// This is allowed to toggle only much slower than the hub should poll,
-// thus ensuring that the hub doesn't miss a boost request.
-// Safe to call from an ISR (though this would be unexpected).
-bool getSwitchToggleStateCO();
-#endif
+//---------------------
+
+// Controller's view of Least Significant Digits of the current (local) time, in this case whole seconds.
+#define TIME_CYCLE_S 60 // TIME_LSD ranges from 0 to TIME_CYCLE_S-1, also major cycle length.
+static uint_fast8_t TIME_LSD; // Controller's notion of seconds within major cycle.
+
+// 'Elapsed minutes' count of minute/major cycles; cheaper than accessing RTC and not tied to real time.
+// Starts at or just above zero (within the first 4-minute cycle) to help avoid collisions between units after mass power-up.
+// Wraps at its maximum (0xff) value.
+static uint8_t minuteCount;
+
+
+

 // Indicate that the system is broken in an obvious way (distress flashing the main LED).
@@ -888,12 +891,8 @@
   // Initialised: turn main/heatcall UI LED off.
   LED_HEATCALL_OFF();

-  // Help user get to CLI.
-  OTV0P2BASE::serialPrintlnAndFlush(F("At CLI > prompt enter ? for help"));
-
-// FIXME FIXME FIXME
-//  // Report initial status.
-//  serialStatusReport();
+  // Report initial status.
+  serialStatusReport();

   // Radio not listening to start with.
   // Ignore any initial spurious RX interrupts for example.


Fix /ram page

Fix /ram page

--- esp8266-arm-swd.ino
+++ esp8266-arm-swd.ino
@@ -106,7 +106,7 @@
         output += "We don't know this chip's specifics, so all you get is maybe memory access.\n";
     }

-    output += "\nHere's some RAM: (more RAM)\n\n";
+    output += "\nHere's some RAM: (more RAM)\n\n";
     output += "";

     output += "\nMemory mapped GPIOs: (more memory mapped hardware)\n\n";
@@ -269,7 +269,7 @@
     server.on("/", handleWebRoot);
     server.on("/flash", handleWebFlash);
     server.on("/mmio", handleWebMmio);
-    server.on("/ram#mem-20000000", handleWebRam);
+    server.on("/ram", handleWebRam);

     server.on("/load", handleMemLoad);
     server.on("/store", handleMemStore);


-Removed unused library.

-Removed unused library.

--- aquacontrol32.ino
+++ aquacontrol32.ino
@@ -2,7 +2,6 @@
 #include "SPIFFS.h"                /* should be installed together with ESP32 Arduino install */
 #include <ESPmDNS.h>               /* should be installed together with ESP32 Arduino install */
 #include <Preferences.h>           /* should be installed together with ESP32 Arduino install */
-#include "Adafruit_GFX.h"          /* Install via 'Manage Libraries' in Arduino IDE */
 #include "Adafruit_ILI9341.h"      /* Install via 'Manage Libraries' in Arduino IDE */
 #include "OneWire.h"               /* Install via 'Manage Libraries' in Arduino IDE */
 #include "SSD1306.h"               /* https://github.com/squix78/esp8266-oled-ssd1306 */


Bumped reading frequency to 5s.

Bumped reading frequency to 5s.

--- light_mote_v0_1/light_mote_v0_1.ino
+++ light_mote_v0_1/light_mote_v0_1.ino
@@ -31,7 +31,7 @@
 #define DPIN_MOTE_LED    9  // moteinos have LEDs on D9

 #define MEASURE_PERIOD   1000
-#define REPORT_INTERVAL  10
+#define REPORT_INTERVAL  5

 #define NODEID        3   // unique for each node on same network
 #define GATEWAYID     1


Add explanation text for using Celsius

Add explanation text for using Celsius

--- bruh_mqtt_multisensor_github/bruh_mqtt_multisensor_github.ino
+++ bruh_mqtt_multisensor_github/bruh_mqtt_multisensor_github.ino
@@ -416,7 +416,7 @@

   if (!inFade) {

-    float newTempValue = dht.readTemperature(true);
+    float newTempValue = dht.readTemperature(true); //to use celsius remove the true text inside the parentheses
     float newHumValue = dht.readHumidity();

     //PIR CODE


fix comments

fix comments

--- ESP8266iTachEmulatorGUI-WM/ESP8266iTachEmulatorGUI-WM.ino
+++ ESP8266iTachEmulatorGUI-WM/ESP8266iTachEmulatorGUI-WM.ino
@@ -33,13 +33,15 @@
   my circuit only uses data & GND
 */

-//start setup
+//	start setup
 // Set IR Blaster Pin
-//nodemcu- 0=D3,1=U0TX,2=D4,4=D2/LED/U1TX,3=U0RX,5=D1,6=CLK,7=SD0,8=SD1,9=SD2,10=SD3,11=CMD,12=D6,13=D7,14=D5,15=D8,16=D0
+//nodemcu- 0=D3,1=U0TX,2=D4/LED/U1TX,4=D2,3=U0RX,5=D1,6=CLK,7=SD0,8=SD1,9=SD2,10=SD3,11=CMD,12=D6,13=D7,14=D5,15=D8,16=D0
 #define infraredLedPin 5 //nodemcu
 //esp-01-1=TX,2=GPIO2/tx2,0=GPIO0/spi,3=RX
 //#define infraredLedPin 2 //esp-01
 //#define infraredLedPin 0 //esp-01
+
+//	LED
 #define PIN_LED 2  //set to -1 to disable, nodemcu_LED=2, ESP-01_LED=1 + need to switch tx to GPIO02
 //PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_GPIO1) //change ESP-01 tx to GPIO01
 //PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_U1TXD_U) //move TX


Corrected note in the WEP ScanNetworks example

--- WiFi/examples/Wifi_WEP_ScanNetworks/Wifi_WEP_ScanNetworks.ino
+++ WiFi/examples/Wifi_WEP_ScanNetworks/Wifi_WEP_ScanNetworks.ino
@@ -1,6 +1,6 @@
 /*

- WPA2 connection using the WiFi shield. Attempts to connect
+ WEP connection using the WiFi shield. Attempts to connect
  and prints out info about the network

  Circuit:


support  $implementation/reset

support  $implementation/reset


Applying slightly polish to extremely old code

--- testclock.ino
+++ testclock.ino
@@ -1,19 +1,17 @@
-/* C.O.D.E ~ Electric Bell
-* HEADER FILES DECLARATION
+//C.O.D.E ~ Electric Bell

 #include <LiquidCrystal.h>
 #include "Wire.h"
 #define DS1307_I2C_ADDRESS 0x68

-*/
-

 LiquidCrystal lcd(4,7,8,9,12,13);
+
 /* RELAY CIRCUIT DEFINITIONS */
+// Circuitry:- red --ground ,orange-- supply

-//int relay= 8; // black
-//int current_pin=9; //brown
-// Circuitry:- red --ground ,orange-- supply
+int relay= 8; // black
+int current_pin=9; //brown

 /* Function for Type Conversions */
 byte decToBcd(byte val)
@@ -27,13 +25,13 @@
   }

-/*void stopDs1307()
+void stopDs1307()
 {
   Wire.beginTransmission(DS1307_I2C_ADDRESS);
   Wire.send(0);
   Wire.send(0x80);
   Wire.endTransmission();
-}*/
+}

 // FUNCTION TO SET DATA ...
 void setDateDs1307(byte second, // 0-59
@@ -128,7 +126,7 @@
     Serial.print(" Day_of_week:");
     Serial.println(dayOfWeek, DEC);

-  /*  CONSTRAINTS */
+    /*  CONSTRAINTS */

     if((hour==8 && minute ==10 &&second >=10) && (hour==8 && minute ==10 &&second <=50))
     digitalWrite(14,HIGH);
@@ -156,4 +154,3 @@
     digitalWrite(14,LOW);
     delay(1000);
   }
-/ ********************************************************************************** */


Fixed an error in ble_my_project

Fixed an error in ble_my_project

--- demos/ble_my_project_template/ble_my_project_template.ino
+++ demos/ble_my_project_template/ble_my_project_template.ino
@@ -139,55 +139,6 @@
   lib_aci_init(&aci_state);

   lib_aci_debug_print(true);
-
-  /*
-  The Bluetooth low energy Arduino shield v1.1 requires about 100ms to reset.
-  This is not required for the nRF2740, nRF2741 modules
-  */
-  delay(100);
-
-  /*
-  Send the soft reset command to the nRF8001 to get the nRF8001 to a known state.
-  */
-  lib_aci_radio_reset();
-
-  while (1)
-  {
-    /*Wait for the command response of the radio reset command.
-    as the nRF8001 will be in either SETUP or STANDBY after the ACI Reset Radio is processed
-	*/
-    if (true == lib_aci_event_get(&aci_state, &aci_data))
-    {
-      aci_evt_t * aci_evt;
-      aci_evt = &aci_data.evt;
-
-      if (ACI_EVT_CMD_RSP == aci_evt->evt_opcode)
-      {
-            if (ACI_STATUS_ERROR_DEVICE_STATE_INVALID == aci_evt->params.cmd_rsp.cmd_status) //in SETUP
-            {
-              Serial.println(F("Do setup"));
-              if (ACI_STATUS_TRANSACTION_COMPLETE != do_aci_setup(&aci_state))
-              {
-                Serial.println(F("Error in ACI Setup"));
-              }
-            }
-            else if (ACI_STATUS_SUCCESS == aci_evt->params.cmd_rsp.cmd_status) //We are now in STANDBY
-            {
-              /*Looking for an phone by sending radio advertisements
-              When an phone connects to us we will get an ACI_EVT_CONNECTED event from the nRF8001
-			  */
-              lib_aci_connect(180/* in seconds */, 0x0050 /* advertising interval 50ms*/);
-              Serial.println(F("Advertising started"));
-            }
-          break;
-      }
-      else
-      {
-        Serial.println(F("Discard any other ACI Events"));
-      }
-
-    }
-  }
 }


Added scaling and delta functionality for temperature.

--- Temperature/Temperature.ino
+++ Temperature/Temperature.ino
@@ -13,12 +13,65 @@
 #include <ros.h>
 #include <std_msgs/Float32.h>

-ros::NodeHandle  nh;
+#define MAX_SAMPLE_RATE 10
+#define MAX_SAMPLE_COUNT 10
+#define MAX_DELTA 0.5

-std_msgs::Float32 temp_msg;
-ros::Publisher pub_temp("temperature", &temp_msg);
+// ROS variables
+static ros::NodeHandle  nh;
+static std_msgs::Float32 temp_msg;
+static ros::Publisher pub_temp("temperature", &temp_msg);
+static unsigned long publisher_timer;

-unsigned int analog_pin = 20;
+// Pinout variables
+static unsigned int analog_pin = 0;
+
+// Sample Rate variables
+static unsigned int sample_rate = MAX_SAMPLE_RATE;
+static unsigned int sample_count = 0;
+
+// Temperature variables
+static float prev_temp = 0.0f;
+
+static void increment_sample_rate(void) {
+  if(sample_rate == MAX_SAMPLE_RATE) {
+    return;
+  }
+  sample_rate++;
+}
+
+static void decrement_sample_rate(void) {
+  if(sample_rate == 0) {
+    return;
+  }
+  sample_rate--;
+}
+
+static void scale_rate(float prev, float curr)
+{
+    if(prev == curr) {
+       sample_count++;
+    } else {
+       sample_count--;
+    }
+
+    if(sample_count == MAX_SAMPLE_COUNT) {
+      increment_sample_rate();
+      sample_count = MAX_SAMPLE_COUNT >> 1;
+    }
+    else if(sample_count == 0) {
+     decrement_sample_rate();
+     sample_count = MAX_SAMPLE_COUNT >> 1;
+   }
+}
+
+static void handle_temp(float temp) {
+  if(abs(prev_temp - temp) > MAX_DELTA) {
+    prev_temp = temp;
+    temp_msg.data = temp;
+    pub_temp.publish(&temp_msg);
+  }
+}

 void setup()
 {
@@ -26,19 +79,17 @@
   nh.advertise(pub_temp);
 }

-long publisher_timer;
-
 void loop()
 {
   if(millis() > publisher_timer) {
     int raw_voltage = analogRead(analog_pin);
-    float volts = raw_voltage / 205.0;
+    float volts = raw_voltage / 205.0f;
     float celsius = 100.0 * volts - 50;
-
-    temp_msg.data = celsius;
-    pub_temp.publish(&temp_msg);
-
-    publisher_timer = millis() + 1000;
+
+    scale_rate(prev_temp, celsius);
+    handle_temp(celsius);
+
+    publisher_timer = millis() + (MAX_SAMPLE_RATE - sample_rate + 1) * 1000;
   }

   nh.spinOnce();


USART

USART

--- Mpe/USART/USART.ino
+++ Mpe/USART/USART.ino
@@ -6,6 +6,7 @@

 }

+
 int main(void) {
   return 0;
 }


TW-9: Working on setting time when connected for the first time.

--- tinywatch.ino
+++ tinywatch.ino
@@ -1,4 +1,5 @@
 #include <SPI.h>
+#include <TimeLib.h>
 #include <BLEPeripheral.h>
 #include "lib_RenderBuffer.h"
 #include "lib_StringBuffer.h"
@@ -18,10 +19,10 @@

 //Uniquely identifies BLE peripheral, used for advertising.
 BLEService service = BLEService("CCC0");
+//Description of content sent via BLE peripheral.
+BLEDescriptor desc = BLEDescriptor("CCC1", "One Watch to Rule Them All!");
 //Defines behavior of BLE peripheral.
-BLECharCharacteristic characteristic = BLECharCharacteristic("CCC1", BLERead | BLENotify);
-//Description of content sent via BLE peripheral.
-BLEDescriptor desc = BLEDescriptor("CCC2", "value");
+BLELongCharacteristic time = BLECharCharacteristic("CCC2", BLERead);

 void setup() {
   BLESetup();
@@ -34,6 +35,7 @@

 void loop(void) {
   blePeripheral.poll();
+  renderTime();
 }

 void BLESetup(){
@@ -44,8 +46,8 @@
   blePeripheral.setAdvertisedServiceUuid(service.uuid());
   //Adding attributes for BLE peripheral.
   blePeripheral.addAttribute(service);
-  blePeripheral.addAttribute(characteristic);
   blePeripheral.addAttribute(desc);
+  blePeripheral.addAttribute(time);

   //Bind events for connects and disconnects.
   blePeripheral.setEventHandler(BLEConnected, blePeripheralConnectHandler);
@@ -56,25 +58,24 @@
 }

 void blePeripheralConnectHandler(BLECentral& central) {
-  if (central){
-    buffer.drawText(stringBuffer.start().put("connected...").get(),15,8,buffer.rgb(255,0,0), &virtualDJ_5ptFontInfo);
-    buffer.flush(display);
-    stringBuffer.reset();
+  buffer.drawText(stringBuffer.start().put("connected...").get(),15,8,buffer.rgb(255,0,0), &virtualDJ_5ptFontInfo);
+  buffer.flush(display);
+  stringBuffer.reset();
+  if(time.written()){
+    //Central wrote new time.
+    setTime(time.getValue());
   }
 }

 void blePeripheralDisconnectHandler(BLECentral& central) {
-  if (central){
-    buffer.drawText(stringBuffer.start().put("disconnected...").get(),15,8,buffer.rgb(255,0,0), &virtualDJ_5ptFontInfo);
-    buffer.flush(display);
-    stringBuffer.reset();
-  }
+  buffer.drawText(stringBuffer.start().put("disconnected...").get(),15,8,buffer.rgb(255,0,0), &virtualDJ_5ptFontInfo);
+  buffer.flush(display);
+  stringBuffer.reset();
 }

-//TODO: Method to render time.
-/*void renderTime(unsigned int n){
+void renderTime(){
   buffer.drawText(stringBuffer.start().putDec(hour()).put(":").putDec(minute()).put(":").putDec(second()).get(),15,8,buffer.rgb(255,0,0), &virtualDJ_5ptFontInfo);
-}*/
+}

 //TODO: Method to render date.
 /*void renderDate(unsigned int n){


Statuses stored in backup RAM.

Statuses stored in backup RAM.

- Stored status initiates a previous one after boot.

--- watertank.ino
+++ watertank.ino
@@ -73,7 +73,7 @@
 //------------------------------------------------------------------------
 // Water tank sensing and publishing to clouds (ThinkSpeak, Blynk)
 //-------------------------------------------------------------------------
-#define SKETCH "WATERTANK 1.1.0"
+#define SKETCH "WATERTANK 1.2.1"
 #include "credentials.h"

 const unsigned int TIMEOUT_WATCHDOG = 10000;  // Watchdog timeout in milliseconds
@@ -145,7 +145,6 @@
 // Measured values
 int rssiValue;
 int lightValue, rainValue, waterValue;
-unsigned char lightStatus, rainStatus, waterStatus;
 float lightTrend, rainTrend, waterTrend;

 // Backup variables (long terms statistics)
@@ -153,6 +152,7 @@
 retained int lightValueMin = 4096, lightValueMax;
 retained int rainValueMin = 4096, rainValueMax;
 retained int waterValueMin = 100, waterValueMax;
+retained unsigned char lightStatus, rainStatus, waterStatus;

 // Statistical smoothing and exponential filtering
 const float FACTOR_RSSI  = 0.1;    // Smoothing factor for RSSI
@@ -166,8 +166,8 @@
 SmoothSensorData smooth;

 // Light level
-const int LIGHT_VALUE_DARK     = 0;
-const int LIGHT_VALUE_TWILIGHT = 15;
+const int LIGHT_VALUE_DARK     = 8;
+const int LIGHT_VALUE_TWILIGHT = 32;
 const int LIGHT_VALUE_CLOUDY   = 512;
 const int LIGHT_VALUE_CLEAR    = 1024;
 const int LIGHT_VALUE_MARGIN   = 2;        // Difference in value for status hysteresis
@@ -237,8 +237,7 @@
   static unsigned long tsMeasure;
   if (millis() - tsMeasure >= PERIOD_MEASURE_RSSI || tsMeasure == 0) {
     tsMeasure = millis();
-    while(smooth.registerData(abs(WiFi.RSSI())));
-    rssiValue = efRssi.getValue(-1 * smooth.getMedian());
+    rssiValue = efRssi.getValue(WiFi.RSSI());
     }
 }

@@ -246,7 +245,7 @@
     static unsigned long tsMeasure, tsMeasureOld;
     static unsigned int cntMeasure;
     static int lightValueOld;
-    static unsigned char lightStatusOld;
+    static unsigned char lightStatusOld = lightStatus;
     if (millis() - tsMeasure >= PERIOD_MEASURE_LIGHT || tsMeasure == 0) {
         tsMeasure = millis();
         // Value
@@ -310,7 +309,7 @@
     static unsigned long tsMeasure, tsMeasureOld;
     static unsigned int cntMeasure;
     static int rainValueOld;
-    static unsigned char rainStatusOld;
+    static unsigned char rainStatusOld = rainStatus;
     if (millis() - tsMeasure >= PERIOD_MEASURE_RAIN || tsMeasure == 0) {
         tsMeasure = millis();
         // Value
@@ -373,7 +372,7 @@
     static unsigned long tsMeasure, tsMeasureOld;
     static unsigned int cntMeasure;
     static int waterValueOld;
-    static unsigned char waterStatusOld;
+    static unsigned char waterStatusOld = waterStatus;
     if (millis() - tsMeasure >= PERIOD_MEASURE_WATER || tsMeasure == 0) {
         tsMeasure = millis();
         // Value


Fixed reference to tsl2561 library

Fixed reference to tsl2561 library

--- files/template_home/template_home_2014/template_home_2014.ino
+++ files/template_home/template_home_2014/template_home_2014.ino
@@ -73,7 +73,6 @@
   Serial.println();
   barometer.init();
   dht.begin();
-  TSL2561.init();
 }

 void loop(){


Update rx5808-pro-diversity.ino

Update rx5808-pro-diversity.ino

Code modified as to provide user with option to enable the additional 8 channels as a feature.
In settings.h there is the #define USE_LBAND line to comment out for this purpose.


Removed extra include.

Removed extra include.

--- examples/Benchmarks/CosaBenchmarkRTC/CosaBenchmarkRTC.ino
+++ examples/Benchmarks/CosaBenchmarkRTC/CosaBenchmarkRTC.ino
@@ -26,7 +26,6 @@
  * This file is part of the Arduino Che Cosa project.
  */

-#include "Cosa/Trace.hh"
 #include "Cosa/RTC.hh"
 #include "Cosa/Watchdog.hh"
 #include "Cosa/Memory.h"


Add ability to set RTC via serial

Add ability to set RTC via serial

--- tree/tree.ino
+++ tree/tree.ino
@@ -58,6 +58,41 @@
   }
 };

+time_t readDateTime()
+{
+  tmElements_t tm;
+  tm.Year = CalendarYrToTm(Serial.parseInt());
+  tm.Month = Serial.parseInt();
+  tm.Day = Serial.parseInt();
+  tm.Hour = Serial.parseInt();
+  tm.Minute = Serial.parseInt();
+  tm.Second = Serial.parseInt();
+  return makeTime(tm);
+}
+
+void print_2digit(Print &out, int value)
+{
+  if (value < 10) {
+    out.print('0');
+  }
+  out.print(value);
+}
+
+void print_date(Print &out, time_t t)
+{
+  out.print(year(t));
+  out.print('-');
+  print_2digit(Serial, month(t));
+  out.print('-');
+  print_2digit(Serial, day(t));
+  out.print('T');
+  print_2digit(Serial, hour(t));
+  out.print(':');
+  print_2digit(Serial, minute(t));
+  out.print(':');
+  print_2digit(Serial, second(t));
+}
+
 Adafruit_NeoPixel pixels(PIXEL_COUNT, PIXEL_PIN);
 Button button(BUTTON_PIN);
 Nightlight nightlight;
@@ -72,7 +107,9 @@
   if (timeStatus() != timeSet) {
     Serial.println("Unable to sync with RTC");
   } else {
-    Serial.println("RTC has set the system time");
+    Serial.print("RTC has set the system time to ");
+    print_date(Serial, now());
+    Serial.println();
   }
 }

@@ -121,6 +158,18 @@
     pixels.show();
     lastColour = colour;
   }
+
+  if (Serial.available() >= 14) {
+    time_t t = readDateTime();
+    RTC.set(t);
+    setTime(t);
+    Serial.print("Time set to ");
+    print_date(Serial, now());
+    Serial.println();
+    while (Serial.available() > 0) {
+      Serial.read(); // dump extra characters
+    }
+  }

   delay(10);
 }


reifne led frequency

reifne led frequency

--- client/client.ino
+++ client/client.ino
@@ -42,8 +42,8 @@
 unsigned int ledStateInterval = 500;
 boolean eighty_twenty = false;

-unsigned int blinkFast = 300;
-unsigned int blinkSlow = 300;
+unsigned int blinkFast = 200;
+unsigned int blinkSlow = 200;
 unsigned long randomDelay = 0;
 unsigned long start_time;
 unsigned long end_time;
@@ -92,7 +92,7 @@
           digitalWrite(ledStatePin, 0);
           bucket = 0;
         }
-        else if (bucket == 20)
+        else if (bucket == 9)
           digitalWrite(ledStatePin, 1);
         else
           bucket++;


Updated for new senseBox:home 2015

Updated for new senseBox:home 2015

--- files/template_photonik/template_photonik_ethernet/template_photonik_ethernet.ino
+++ files/template_photonik/template_photonik_ethernet/template_photonik_ethernet.ino
@@ -1,152 +1,137 @@
 /*
-SenseBox Citizen Sensingplatform
+ * Jan Wirwahn, Institute for Geoinformatics, Uni Muenster
+ * July 2015
+ * Arduino Web-Client for pushing SenseBox:Home measurements
+ * to the OpenSenseMap server.
+ */

-Sensor Connections on Base-Shield
- A0: UV-Sensor
- A1: Temperature and Humidity Sensor Pro
-I2C: Pressure Sensor
-I2C: Digital Light Sensor
-
-Version: 1.3.1
-Date: 2015-02-18
-Homepage: http://www.sensebox.de
-Author: Jan Wirwahn, Institute for Geoinformatics, University of Muenster
-Note: Sketch for SB-Photonik-Ethernet
-MAC-address and IP has to be changed according to your setup.
-Disable Serial.print functions for better performance on your stand-alone sensor setup.
-*/
-
+#include <BMP280.h>
 #include <Wire.h>
+#include <HDC100X.h>
 #include <SPI.h>
 #include <Ethernet.h>
-#include <DHT.h>
-#include <Barometer.h>
-#include <Digital_Light_TSL2561.h>
-#include <avr/wdt.h>
+#include <Makerblog_TSL45315.h>

+#define UV_ADDR 0x38
+#define IT_1   0x1
+
+//INDIVIDUAL SETUP
+IPAddress ip(192, 168, 179, 194); //IP Adress
+IPAddress dn(192, 168, 179, 10);  //DNS Server
+IPAddress gw(192, 168, 179, 254); //Gateway
+byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x86, 0x46 }; //MAC Adress
+
+char server[] = "opensensemap.org";
+EthernetClient client;
+
+//IDs are being generated by the OSM server
+//If you want to update your old sketch, insert the IDs from your old file
 //SenseBox ID

 //Sensor IDs

-//Sensor pin settings
-#define UVPIN A0
-#define DHTPIN A1
-#define DHTTYPE DHT22

-//INDIVIDUAL SETUP
-//Change MAC-adress here:
-byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x86, 0x46 };
+BMP280 bmp;
+HDC100X HDC(0x43);
+//Makerblog_TSL45315 luxsensor = Makerblog_TSL45315(TSL45315_TIME_M4);

-//Specify an IP according to your network settings:
-IPAddress ip(192,168,1,111);
-//The following IDs were generated by the OSM-server. Change them to your IDs:
+//measurement variables
+float temperature = 0;
+float humidity = 0;
+double tempBaro, pressure;
+uint32_t lux;
+int messTyp;
+byte msb=0, lsb=0;
+uint16_t uv;
+float uvIndex;

-char server[] = "opensensemap.org";
-EthernetClient client;
-
-String currentSensorId = TEMPERATURESENSOR_ID;
-float temperature, humidity, pressure;
-unsigned long  lux;
-unsigned int analogUv;
-
-DHT dht(DHTPIN, DHTTYPE);
-Barometer barometer;
-
-//Variables for time sync and upload intervall
-int postInterval = 100000;
-boolean lastConnected = false;
-String sensorSample;
-int sampleType = 1; //begin with temperature
-int phenomCount = 5; //1=temp,2=humi,3=pressure,4=lux,5=UV
-
-//post sample each 10 minutes
-//deprecated
+//post sample each minute
+int postInterval = 60000;
 long timeOld = 0;
 long timeNew = 0;

+
 void setup()
 {
+ Serial.begin(9600);
+//Try DHCP first
+
+  Ethernet.begin(mac, ip, dn, gw);
+  HDC.begin(HDC100X_TEMP_HUMI,HDC100X_14BIT,HDC100X_14BIT,DISABLE);
+  //Serial.println(luxsensor.begin());
+  if(!bmp.begin()){
+    Serial.println("BMP init failed!");
+    while(1);
+  }
+  else Serial.println("BMP init success!");
+  bmp.setOversampling(4);
   Wire.begin();
-  Serial.begin(9600);
-//Try DHCP first
-  if (Ethernet.begin(mac) == 0)
-  {
-    Serial.println("Failed to configure Ethernet using DHCP");
-    Ethernet.begin(mac, ip);
-  }
-  delay(1000);
-  Serial.println("STARTING UP");
-  barometer.init();
-  dht.begin();
-  TSL2561.init();
+  Wire.beginTransmission(UV_ADDR);
+  Wire.write((IT_1<<2) | 0x02);
+  Wire.endTransmission();
+  delay(500);
 }

 void loop()
 {
-
-  // if there's no net connection, but there was one last time
-  // through the loop, then stop the client:
-  if (!client.connected() && lastConnected) {
-    Serial.println();
-    Serial.println("disconnecting.");
-    client.stop();
-  }
-
   timeNew = millis();
-  if (!client.connected() && (timeNew - timeOld > postInterval))
+  if (timeNew - timeOld > postInterval)
   {
-    Serial.println();
-    delay(1000);
-    sensorSample = "";
-    switch (sampleType)
-    {
-      case 1:
-        //temperature = dht.readTemperature();
-        temperature = barometer.bmp085GetTemperature(barometer.bmp085ReadUT());
-        sensorSample = floatToString(temperature,0);
-        currentSensorId = TEMPERATURESENSOR_ID;
-        break;
-      case 2:
-        humidity = dht.readHumidity();
-        sensorSample = floatToString(humidity,0);
-        currentSensorId = HUMIDITYSENSOR_ID;//bmp085ReadUT MUST be called first
-        break;
-      case 3:
-        pressure = barometer.bmp085GetTemperature(barometer.bmp085ReadUT());
-        pressure = barometer.bmp085GetPressure(barometer.bmp085ReadUP());
-        sensorSample = floatToString(pressure,0);
-        currentSensorId = PRESSURESENSOR_ID;
-        break;
-      case 4:
-        TSL2561.getLux();
-        lux = TSL2561.calculateLux(0,0,1);
-        sensorSample = (String)lux;
-        currentSensorId = LUXSENSOR_ID;
-        break;
-      case 5:
-        analogUv = analogRead(UVPIN);
-        sensorSample = (String)calcUvIndex(analogUv);
-        currentSensorId = UVSENSOR_ID;
-        break;
-    }
-    postObservation(sensorSample, currentSensorId, SENSEBOX_ID);
+    //-----Pressure-----//
+    messTyp = 1;
+    char result = bmp.startMeasurment();
+    if(result!=0){
+      delay(result);
+      result = bmp.getTemperatureAndPressure(tempBaro,pressure);
+      pressure = pressure * 100;
+      postObservation(pressure, PRESSURESENSOR_ID, SENSEBOX_ID);
+    }
+    //-----Humidity-----//
+    messTyp = 2;
+    humidity = HDC.getHumi();
+    postObservation(humidity, HUMIDITYSENSOR_ID, SENSEBOX_ID);
+    //-----Temperature-----//
+    messTyp = 2;
+    temperature = HDC.getTemp();
+    postObservation(temperature, TEMPERATURESENSOR_ID, SENSEBOX_ID);
+    //-----Lux-----//
+    messTyp = 1;
+    //lux = luxsensor.readLux();
+    //Serial.print("Illumi = "); Serial.println(lux);
+    //postObservation(lux, LUXSENSOR_ID, SENSEBOX_ID);
+    //-----UV-Index-----//
+    messTyp = 2;
+    Wire.requestFrom(UV_ADDR+1, 1); //MSB
+    delay(1);
+    if(Wire.available())
+      msb = Wire.read();
+    Wire.requestFrom(UV_ADDR+0, 1); //LSB
+    delay(1);
+    if(Wire.available())
+      lsb = Wire.read();
+    uv = (msb<<8) | lsb;
+    uvIndex = uv * 5.625;
+
+    postObservation(uvIndex, UVSENSOR_ID, SENSEBOX_ID);
+
     timeOld = millis();
   }
-  lastConnected = client.connected();
 }

-void postObservation(String measurement, String sensorId, String boxId)
+void postObservation(float measurement, String sensorId, String boxId)
 {
+  char obs[10];
+  if (messTyp == 1) dtostrf(measurement, 5, 0, obs);
+  else if (messTyp == 2) dtostrf(measurement, 5, 2, obs);
+  Serial.println(obs);
   //json must look like: {"value":"12.5"}
-  Serial.print("Preparing data: ");
-  String jsonData = "{\"value\":";
-  jsonData += measurement;
-  jsonData += "}";
-  Serial.println(jsonData);
+  //post observation to: http://opensensemap.org:8000/boxes/boxId/sensorId
+  Serial.println("connecting...");
+  String value = "{\"value\":";
+  value += obs;
+  value += "}";
   // if you get a connection, report back via serial:
   boxId += "/";
-  //post observation to: http://opensensemap.org:8000/boxes/boxId/sensorId
-  Serial.print("Connecting to OSM server...");
   if (client.connect(server, 8000))
   {
     Serial.println("connected");
@@ -161,18 +146,12 @@
     client.println("Content-Type: application/json");
     client.println("Connection: close");
     client.print("Content-Length: ");
-    client.println(jsonData.length());
+    client.println(value.length());
     client.println();
-    client.print(jsonData);
+    client.print(value);
     client.println();
   }
   waitForResponse();
-  switchSampleType();
-}
-
-void switchSampleType(){
-if (sampleType == phenomCount) sampleType = 1;
-    else sampleType++;
 }

 void waitForResponse()
@@ -180,7 +159,7 @@
   // if there are incoming bytes available
   // from the server, read them and print them:
   boolean repeat = true;
-  do{
+  do{
     if (client.available())
     {
       char c = client.read();
@@ -197,27 +176,3 @@
   }
   while (repeat);
 }
-
-String floatToString(float number, int precision)
-{
-  String stringNumber = "";
-  //int prec;
-  //only temperature (case 1) has a decimal place
-  //if (sampleType == 1) prec = 1; else prec = 0;
-  char tempChar[10];
-  dtostrf(number, 3, precision, tempChar);
-  stringNumber += tempChar;
-  return stringNumber;
-}
-
-int calcUvIndex(int analogVal){
- // get voltage from analog value
- float uvindex = map(analogVal, 0, 1023, 0, 5000);
- uvindex /= 1000;
- //illumination intensity => V_sig * 307
- uvindex = uvindex * 307;
- //UVI => illumination intesity / 200
- uvindex = uvindex / 200;
-
- return int(uvindex+0.5);
-}


Fix time format output.

Fix time format output.

--- test/PoE-test/spacedeur-asis-2017/spacedeur-asis-2017.ino
+++ test/PoE-test/spacedeur-asis-2017/spacedeur-asis-2017.ino
@@ -399,8 +399,8 @@
     cnt_minutes += ((millis() - tock) + 500) / 1000 / 60;

     snprintf(buff, sizeof(buff),
-             "[%s] alive - uptime %02ld: "
-             "%02ld swipes %6ld, opens %6ld, closes %6ld, fails %6ld, mis-swipes %6ld, mqtt reconnects %6ld",
+             "[%s] alive - uptime %02ld:%02ld: "
+             "swipes %6ld, opens %6ld, closes %6ld, fails %6ld, mis-swipes %6ld, mqtt reconnects %6ld",
              pname, cnt_minutes / 12, (cnt_minutes % 12) * 5,
              cnt_cards,
              cnt_opens, cnt_closes, cnt_fails, cnt_misreads, cnt_reconnects);


Added button to toggle display

Added button to toggle display

--- seven-segment-float/src/seven-segment-float.ino
+++ seven-segment-float/src/seven-segment-float.ino
@@ -16,6 +16,9 @@
 const int dataPin = 8;
 const int latchPin = 9;
 const int clockPin = 10;
+
+//set pin for the toggle button
+const int buttonPin = 11;

 /* General LED layout of seven-segment display
   ___
@@ -66,15 +69,25 @@
   pinMode(latchPin, OUTPUT);
   pinMode(dataPin, OUTPUT);
   pinMode(clockPin, OUTPUT);
+
+  pinMode(buttonPin, INPUT);
+
+  Serial.begin(9600);
 }

 const long refreshInterval = 10; //refresh delay in microseconds
 long previousRefresh = 0; //previous refresh time
 int refreshLoop = 0;  //counter for refreshing loop
+int buttonState = 0;
+bool displayCelcius = true;

 void loop() {
   //current timer variables to reset at each iteration
   unsigned long currentRefresh = micros();  //get current microseconds for refresh counter
+
+  buttonState = digitalRead(buttonPin);
+  if (buttonState == HIGH)
+    displayCelcius = !(displayCelcius);

   clearLEDs();

@@ -94,7 +107,6 @@
   //testCaseAllNum();
   //splitNumber(-99.99999);
   displayTemperature();
-
 }

 void clearLEDs() {
@@ -227,9 +239,12 @@

     double tempC = (500.0 * analogRead(tempPin)) / 1204; //poll analog to read value from LM35
     double aveTempC = smoothTemp(tempC);
-    double tempF = c2f(aveTempC);
-
-    splitNumber(tempF);
+    double aveTempF = c2f(aveTempC);
+
+    if (displayCelcius)
+      splitNumber(aveTempC);
+    else
+      splitNumber(aveTempF);
   }
 }


Use multicolor RGB LED

Use multicolor RGB LED

--- WirelessTrigger.ino
+++ WirelessTrigger.ino
@@ -35,7 +35,8 @@
 Switch triggerButton = Switch(triggerButtonPin);
 Switch resetButton = Switch(resetButtonPin);

-uint8_t heartbeatLEDPin = 4;
+uint8_t heartbeatLEDGreenPin = 5;
+uint8_t heartbeatLEDRedPin = 6;

 unsigned long lastHeartbeat = 0;
 bool isCommHealthy = false;
@@ -70,7 +71,8 @@
     radio.writeAckPayload(1, &ackVal, 1);

 #if ROLE == ROLE_SENDER
-    pinMode(heartbeatLEDPin, OUTPUT);
+    pinMode(heartbeatLEDGreenPin, OUTPUT);
+    pinMode(heartbeatLEDRedPin, OUTPUT);
 #else
     actuationServo.attach(servoPin);
     actuationServo.write(RESET_SERVO_ANGLE);
@@ -134,7 +136,8 @@
         validateAck(sendByte(ackVal));
     }

-    digitalWrite(heartbeatLEDPin, isCommHealthy);
+    analogWrite(heartbeatLEDGreenPin, isCommHealthy * 255);
+    analogWrite(heartbeatLEDRedPin, !isCommHealthy * 255);
 #else
     if (radio.available()) {
         byte recvByte;
@@ -160,4 +163,4 @@
         radio.writeAckPayload(1, &ackVal, 1);
     }
 #endif
-}
+}


Reset the max/min values when the 'o' command is used.

--- examples/RF12/RF12demo/RF12demo.ino
+++ examples/RF12/RF12demo/RF12demo.ino
@@ -86,7 +86,7 @@
 static RF12Config config;
 char revP = 94; // Symbol ^ to indicate direction of frequency offset
 static char cmd;
-static byte value, stack[RF12_MAXDATA+4], top, sendLen, dest, sticky, revF = 0, low = 0xFFFF, high = 0;
+static byte value, stack[RF12_MAXDATA+4], top, sendLen, dest, sticky, revF = 0, low = 0xFF, high = 0;
 static byte testbuf[RF12_MAXDATA], testCounter, useHex;

 byte band;
@@ -687,6 +687,8 @@
         }
         break;
       case 'o': // Increment frequency within band
+          high = 0;  // Reset dB max/min
+          low = 255;
           if (value == 255) {
             revF = !revF;
             revP = revP ^ 40;   // Flip the indicator


cleanup

cleanup

--- src/esp-soil-moisture-sensor/esp-soil-moisture-sensor.ino
+++ src/esp-soil-moisture-sensor/esp-soil-moisture-sensor.ino
@@ -1,132 +0,0 @@
-#include <ESP8266WiFi.h>
-#include "DHT.h"
-
-String apiKey ="<YOUR-API-KEY>";
-const char* MY_SSID = "<YOUR-SSID>";
-const char* MY_PWD = "<YOUR-PASSWORD>";
-
-const int pin_clk = 5;
-const int pin_soil = A0;
-const int pin_led = 12;
-const int pin_read = 2;
-const char* server = "api.thingspeak.com";
-
-DHT dht(pin_read, DHT11);
-
-int sent = 0;
-
-#define SLEEP_TIME 1200 * 1000 * 1000
-
-void setup() {
-  Serial.begin(115200);
-  dht.begin();
-
-  pinMode(pin_clk, OUTPUT);
-  pinMode(pin_soil, INPUT);
-  pinMode(pin_led, OUTPUT);
-  digitalWrite(pin_led, LOW);
-  pinMode(pin_read, INPUT);
-
-  analogWriteFreq(40000);
-  analogWrite(pin_clk, 400);
-  delay(500);
-  connectWifi();
-}
-
-void loop() {
-  //char buffer[10];
-  digitalWrite(pin_led, HIGH);
-  delay(500);
-  digitalWrite(pin_led, LOW);
-  float hum=0,temp=0,soil_hum=0;
-  Serial.println("Requesting Temperature and Humidity...");
-
-
-  hum = dht.readHumidity();
-  // Read temperature as Celsius (the default)
-  temp = dht.readTemperature();
-
-  delay(1000);
-  soil_hum = readSoilVal(8);
-  Serial.print("Soil_Humidity:");
-  Serial.println(soil_hum);
-  delay(1000);
-
-  sendData(hum, temp,soil_hum);
-  ESP.deepSleep(SLEEP_TIME, WAKE_RF_DEFAULT);
-}
-
-void connectWifi()
-{
-  Serial.print("Connecting to " + *MY_SSID);
-  WiFi.begin(MY_SSID, MY_PWD);
-  while (WiFi.status() != WL_CONNECTED) {
-      delay(1000);
-      Serial.print(".");
-  }
-
-  Serial.println("");
-  Serial.println("Connected");
-  Serial.println("");
-}//end connect
-
-// Get average value
-float readSoilVal(int n) {
-  float valtemp = 0;
-  float ValBuf[n];
-  int i = 0;
-  int j = 0;
-
-  for(i=0;i<n;i++){
-    ValBuf[i] = analogRead(pin_soil);
-  }
-
-  for(i=0;i<n-1;i++){
-    for(j=i+1;j<n;j++){
-      if(ValBuf[i]>ValBuf[j]){
-        valtemp = ValBuf[i];
-        ValBuf[i] = ValBuf[j];
-        ValBuf[j] = valtemp;
-      }
-    }
-  }
-
-  valtemp = 0;
-  for(i=1;i<n-1;i++){
-    valtemp+=ValBuf[i];
-  }
-  valtemp/=(n-2);
-  return valtemp;
-}
-
-
-void sendData(float hum, float temp,float soil_hum) {
-   WiFiClient client;
-
-   if (client.connect(server, 80)) { // use ip 184.106.153.149 or api.thingspeak.com
-       Serial.println("WiFi Client connected ");
-
-       String postStr = apiKey;
-       postStr += "&field1=";
-       postStr += String(hum);
-       postStr += "&field2=";
-       postStr += String(temp);
-       postStr += "&field3=";
-       postStr += String(soil_hum);
-       postStr += "\r\n\r\n";
-
-       client.print("POST /update HTTP/1.1\n");
-       client.print("Host: api.thingspeak.com\n");
-       client.print("Connection: close\n");
-       client.print("X-THINGSPEAKAPIKEY: " + apiKey + "\n");
-       client.print("Content-Type: application/x-www-form-urlencoded\n");
-       client.print("Content-Length: ");
-       client.print(postStr.length());
-       client.print("\n\n");
-       client.print(postStr);
-       delay(1000);
-
-   }//end if
-   sent++;
-   client.stop();
-}//end send


Made global variable 'fsUploadFile' local.

--- webserver.ino
+++ webserver.ino
@@ -1,7 +1,4 @@
 //http://www.esp8266.com/viewtopic.php?f=29&t=2153
-
-//holds the current upload
-File fsUploadFile;

 const char textplainHEADER[] PROGMEM = "text/plain";
 const char texthtmlHEADER[] PROGMEM = "text/html";
@@ -218,6 +215,7 @@
   webServer.on( "/api/upload", HTTP_POST, []() {
     webServer.send( 200, FPSTR( textplainHEADER ), "" );
   }, []() {
+    static File fsUploadFile;
     HTTPUpload& upload = webServer.upload();
     if ( upload.status == UPLOAD_FILE_START ) {
       String filename = upload.filename;


Corrected OR function in IF statement

Corrected OR function in IF statement

from '|'  to  '||'

--- wled00/wled20_ir.ino
+++ wled00/wled20_ir.ino
@@ -48,11 +48,11 @@
   if (code == 0xFFFFFFFF) //repeated code, continue brightness up/down
   {
     irTimesRepeated++;
-    if (lastValidCode == IR24_BRIGHTER | lastValidCode == IR40_BPLUS )
+    if (lastValidCode == IR24_BRIGHTER || lastValidCode == IR40_BPLUS )
     {
       relativeChange(&bri, 10); colorUpdated(2);
     }
-    else if (lastValidCode == IR24_DARKER | lastValidCode == IR40_BMINUS )
+    else if (lastValidCode == IR24_DARKER || lastValidCode == IR40_BMINUS )
     {
       relativeChange(&bri, -10, 5); colorUpdated(2);
     }
@@ -64,7 +64,7 @@
     {
       relativeChangeWhite(-10, 5); colorUpdated(2);
     }
-    else if ((lastValidCode == IR24_ON | lastValidCode == IR40_ON) && irTimesRepeated > 7 )
+    else if ((lastValidCode == IR24_ON || lastValidCode == IR40_ON) && irTimesRepeated > 7 )
     {
       nightlightActive = true;
       nightlightStartTime = millis();


fix to at&u6502 when already up-to-date

fix to at&u6502 when already up-to-date

git-svn-id: d8bfcd070c2c81762cca1b3912331324182919ba@18689 0d6f1817-ed0e-0410-87c9-987e46238f29

--- zimodem/zcommand.ino
+++ zimodem/zcommand.ino
@@ -1075,6 +1075,8 @@
   {
     serial.prints("Your modem is up-to-date.");
     serial.prints(EOLN);
+    if(vval == 6502)
+      return ZOK;
   }
   else
   {


Updated the TX code to also print data to the USB port. 115200 baud default config.

--- Arduino_TX_ADIS16480_ADF7242/Arduino_TX_ADIS16480_ADF7242.ino
+++ Arduino_TX_ADIS16480_ADF7242/Arduino_TX_ADIS16480_ADF7242.ino
@@ -1,7 +1,7 @@
 ////////////////////////////////////////////////////////////////////////////////////////////////////////
 //  Analog Devices, Inc.
-//  October 2015
-//  By: Daniel H. Tatum & Juan Chong
+//  May 19, 2016
+//  By: Daniel H. Tatum & Juan J. Chong
 //  Written for the TeensyDuino Platform
 ////////////////////////////////////////////////////////////////////////////////////////////////////////
 //  Arduino_TX_ADIS16480_ADF7242.ino
@@ -42,12 +42,7 @@
 void setup() {

   SPI.begin(); //Start SPI
-
-  // Reminder in terminal that you're in DEBUG mode
-  #ifdef DEBUG
-    Serial.begin(9600); // Baud rate was set arbitrarily
-    Serial.println("**********DEBUG MODE**********");
-  #endif
+  Serial.begin(115200); //Start USB Serial

   // ADIS16480 IMU configuration
   IMU.configSPI();          // Begin the SPI transaction
@@ -81,19 +76,16 @@

   // Set interrupt pin on the MCU as an input and attach an interrupt
   pinMode(8, INPUT);
-  attachInterrupt(8, grabSensorData, RISING);
-
+  attachInterrupt(8, transmitData, RISING);
 }

+// Read IMU data, cast it, and transmit it.
 void grabSensorData() {
-
   IMU.configSPI();  // Begin SPI transactions
   roll = (char)(IMU.regRead(ROLL_C23_OUT) >> 8);  // Read roll register and cast to char
   pitch = (char)(IMU.regRead(PITCH_C31_OUT) >> 8);  // Read pitch register and cast to char
   yaw = (char)(IMU.regRead(YAW_C32_OUT) >> 8);  // Read pitch register and cast to char
-
   // 0xFF is a reserved word used for data synchronization
-
   if(roll == 0xFF) { // 0xFF represents 360 degrees
     roll = 0; // This makes sense since 0 and 360 degrees are the same place
   }
@@ -103,10 +95,11 @@
   if(yaw == 0xFF) { // 0xFF represents 360 degrees
     yaw = 0; // This makes sense since 0 and 360 degrees are the same place
   }
+  IMU.closeSPI(); // End SPI transaction
+}

-  IMU.closeSPI(); // End SPI transaction
-
-  // Transmit IMU data via ADF7242
+// Transmit IMU data via ADF7242
+void sendWirelessSensorData() {
   Tx.configSPI(); // Begin SPI transaction
   Tx.dummySPIWrite(); // Dummy write to force SPI Mode change
   delay(1);
@@ -115,25 +108,26 @@
   Tx.regWrite(0x084, yaw); // Write yaw data to ADF7242 packet buffer
   Tx.transmit();  // Transmit packet buffer
   Tx.closeSPI();  // End SPI transaction
-
+}
+
+// Transmit IMU data via USB Serial port.
+void sendSerialSensorData() {
+  Serial.write(roll); // Write roll data to serial connection
+  Serial.write(pitch); // Write pitch data to serial connection
+  Serial.write(yaw); // Write yaw data to serial connection
+  Serial.write(serialSyncWord); // Write synchronization word to serial connection
+}
+
+// Interrupt routine will grab data from the IMU and transmit it via the ADF7242 and SPI
+void transmitData() {
+  grabSensorData();
+  sendWirelessSensorData();
+  sendSerialSensorData();
 }

 void loop() {

-  // Program is entirely interrupt driven. Only debug statements are optionally compiled here.
-
-  #ifdef DEBUG
-    Tx.dumpISB();
-    delay(100);
-  #endif
-
-  // Write IMU data to serial port
-  #ifdef DEBUG
-    Serial.write(roll); // Write roll data to serial connection
-    Serial.write(pitch); // Write pitch data to serial connection
-    Serial.write(yaw); // Write yaw data to serial connection
-    Serial.write(serialSyncWord); // Write synchronization word to serial connection
-  #endif
+  // Program is entirely interrupt driven. Nothing to do here!

 }