[Arduino] i2cdevlib MPU6050 example outputting readable yaw/pitch/roll.

Signed-off-by: Juri Berlanda <5bfdca9e82c53adb0603ce7083f4ba4f2da5cacf@hotmail.com>

error: pathspec 'Arduino/vj-flight-controller.ino' did not match any file(s) known to git

--- Arduino/vj-flight-controller.ino
+++ Arduino/vj-flight-controller.ino
@@ -0,0 +1,372 @@
+// I2C device class (I2Cdev) demonstration Arduino sketch for MPU6050 class using DMP (MotionApps v2.0)
+// 6/21/2012 by Jeff Rowberg <jeff@rowberg.net>
+// Updates should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib
+//
+// Changelog:
+//      2013-05-08 - added seamless Fastwire support
+//                 - added note about gyro calibration
+//      2012-06-21 - added note about Arduino 1.0.1 + Leonardo compatibility error
+//      2012-06-20 - improved FIFO overflow handling and simplified read process
+//      2012-06-19 - completely rearranged DMP initialization code and simplification
+//      2012-06-13 - pull gyro and accel data from FIFO packet instead of reading directly
+//      2012-06-09 - fix broken FIFO read sequence and change interrupt detection to RISING
+//      2012-06-05 - add gravity-compensated initial reference frame acceleration output
+//                 - add 3D math helper file to DMP6 example sketch
+//                 - add Euler output and Yaw/Pitch/Roll output formats
+//      2012-06-04 - remove accel offset clearing for better results (thanks Sungon Lee)
+//      2012-06-01 - fixed gyro sensitivity to be 2000 deg/sec instead of 250
+//      2012-05-30 - basic DMP initialization working
+
+/* ============================================
+I2Cdev device library code is placed under the MIT license
+Copyright (c) 2012 Jeff Rowberg
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+===============================================
+*/
+
+// I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files
+// for both classes must be in the include path of your project
+#include "I2Cdev.h"
+
+#include "MPU6050_6Axis_MotionApps20.h"
+//#include "MPU6050.h" // not necessary if using MotionApps include file
+
+// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
+// is used in I2Cdev.h
+#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
+    #include "Wire.h"
+#endif
+
+// class default I2C address is 0x68
+// specific I2C addresses may be passed as a parameter here
+// AD0 low = 0x68 (default for SparkFun breakout and InvenSense evaluation board)
+// AD0 high = 0x69
+MPU6050 mpu;
+//MPU6050 mpu(0x69); // <-- use for AD0 high
+
+/* =========================================================================
+   NOTE: In addition to connection 3.3v, GND, SDA, and SCL, this sketch
+   depends on the MPU-6050's INT pin being connected to the Arduino's
+   external interrupt #0 pin. On the Arduino Uno and Mega 2560, this is
+   digital I/O pin 2.
+ * ========================================================================= */
+
+/* =========================================================================
+   NOTE: Arduino v1.0.1 with the Leonardo board generates a compile error
+   when using Serial.write(buf, len). The Teapot output uses this method.
+   The solution requires a modification to the Arduino USBAPI.h file, which
+   is fortunately simple, but annoying. This will be fixed in the next IDE
+   release. For more info, see these links:
+
+   http://arduino.cc/forum/index.php/topic,109987.0.html
+   http://code.google.com/p/arduino/issues/detail?id=958
+ * ========================================================================= */
+
+
+
+// uncomment "OUTPUT_READABLE_QUATERNION" if you want to see the actual
+// quaternion components in a [w, x, y, z] format (not best for parsing
+// on a remote host such as Processing or something though)
+//#define OUTPUT_READABLE_QUATERNION
+
+// uncomment "OUTPUT_READABLE_EULER" if you want to see Euler angles
+// (in degrees) calculated from the quaternions coming from the FIFO.
+// Note that Euler angles suffer from gimbal lock (for more info, see
+// http://en.wikipedia.org/wiki/Gimbal_lock)
+//#define OUTPUT_READABLE_EULER
+
+// uncomment "OUTPUT_READABLE_YAWPITCHROLL" if you want to see the yaw/
+// pitch/roll angles (in degrees) calculated from the quaternions coming
+// from the FIFO. Note this also requires gravity vector calculations.
+// Also note that yaw/pitch/roll angles suffer from gimbal lock (for
+// more info, see: http://en.wikipedia.org/wiki/Gimbal_lock)
+#define OUTPUT_READABLE_YAWPITCHROLL
+
+// uncomment "OUTPUT_READABLE_REALACCEL" if you want to see acceleration
+// components with gravity removed. This acceleration reference frame is
+// not compensated for orientation, so +X is always +X according to the
+// sensor, just without the effects of gravity. If you want acceleration
+// compensated for orientation, us OUTPUT_READABLE_WORLDACCEL instead.
+//#define OUTPUT_READABLE_REALACCEL
+
+// uncomment "OUTPUT_READABLE_WORLDACCEL" if you want to see acceleration
+// components with gravity removed and adjusted for the world frame of
+// reference (yaw is relative to initial orientation, since no magnetometer
+// is present in this case). Could be quite handy in some cases.
+//#define OUTPUT_READABLE_WORLDACCEL
+
+// uncomment "OUTPUT_TEAPOT" if you want output that matches the
+// format used for the InvenSense teapot demo
+//#define OUTPUT_TEAPOT
+
+
+
+#define LED_PIN 13 // (Arduino is 13, Teensy is 11, Teensy++ is 6)
+bool blinkState = false;
+
+// MPU control/status vars
+bool dmpReady = false;  // set true if DMP init was successful
+uint8_t mpuIntStatus;   // holds actual interrupt status byte from MPU
+uint8_t devStatus;      // return status after each device operation (0 = success, !0 = error)
+uint16_t packetSize;    // expected DMP packet size (default is 42 bytes)
+uint16_t fifoCount;     // count of all bytes currently in FIFO
+uint8_t fifoBuffer[64]; // FIFO storage buffer
+
+// orientation/motion vars
+Quaternion q;           // [w, x, y, z]         quaternion container
+VectorInt16 aa;         // [x, y, z]            accel sensor measurements
+VectorInt16 aaReal;     // [x, y, z]            gravity-free accel sensor measurements
+VectorInt16 aaWorld;    // [x, y, z]            world-frame accel sensor measurements
+VectorFloat gravity;    // [x, y, z]            gravity vector
+float euler[3];         // [psi, theta, phi]    Euler angle container
+float ypr[3];           // [yaw, pitch, roll]   yaw/pitch/roll container and gravity vector
+
+// packet structure for InvenSense teapot demo
+uint8_t teapotPacket[14] = { '$', 0x02, 0,0, 0,0, 0,0, 0,0, 0x00, 0x00, '\r', '\n' };
+
+
+
+// ================================================================
+// ===               INTERRUPT DETECTION ROUTINE                ===
+// ================================================================
+
+volatile bool mpuInterrupt = false;     // indicates whether MPU interrupt pin has gone high
+void dmpDataReady() {
+    mpuInterrupt = true;
+}
+
+
+
+// ================================================================
+// ===                      INITIAL SETUP                       ===
+// ================================================================
+
+void setup() {
+    // join I2C bus (I2Cdev library doesn't do this automatically)
+    #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
+        Wire.begin();
+        TWBR = 24; // 400kHz I2C clock (200kHz if CPU is 8MHz)
+    #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
+        Fastwire::setup(400, true);
+    #endif
+
+    // initialize serial communication
+    // (115200 chosen because it is required for Teapot Demo output, but it's
+    // really up to you depending on your project)
+    Serial.begin(115200);
+    while (!Serial); // wait for Leonardo enumeration, others continue immediately
+
+    // NOTE: 8MHz or slower host processors, like the Teensy @ 3.3v or Ardunio
+    // Pro Mini running at 3.3v, cannot handle this baud rate reliably due to
+    // the baud timing being too misaligned with processor ticks. You must use
+    // 38400 or slower in these cases, or use some kind of external separate
+    // crystal solution for the UART timer.
+
+    // initialize device
+    Serial.println(F("Initializing I2C devices..."));
+    mpu.initialize();
+
+    // verify connection
+    Serial.println(F("Testing device connections..."));
+    Serial.println(mpu.testConnection() ? F("MPU6050 connection successful") : F("MPU6050 connection failed"));
+
+    // wait for ready
+    Serial.println(F("\nSend any character to begin DMP programming and demo: "));
+    while (Serial.available() && Serial.read()); // empty buffer
+    while (!Serial.available());                 // wait for data
+    while (Serial.available() && Serial.read()); // empty buffer again
+
+    // load and configure the DMP
+    Serial.println(F("Initializing DMP..."));
+    devStatus = mpu.dmpInitialize();
+
+    // supply your own gyro offsets here, scaled for min sensitivity
+    mpu.setXGyroOffset(220);
+    mpu.setYGyroOffset(76);
+    mpu.setZGyroOffset(-85);
+    mpu.setZAccelOffset(1788); // 1688 factory default for my test chip
+
+    // make sure it worked (returns 0 if so)
+    if (devStatus == 0) {
+        // turn on the DMP, now that it's ready
+        Serial.println(F("Enabling DMP..."));
+        mpu.setDMPEnabled(true);
+
+        // enable Arduino interrupt detection
+        Serial.println(F("Enabling interrupt detection (Arduino external interrupt 0)..."));
+        attachInterrupt(digitalPinToInterrupt(2), dmpDataReady, RISING);
+        mpuIntStatus = mpu.getIntStatus();
+
+        // set our DMP Ready flag so the main loop() function knows it's okay to use it
+        Serial.println(F("DMP ready! Waiting for first interrupt..."));
+        dmpReady = true;
+
+        // get expected DMP packet size for later comparison
+        packetSize = mpu.dmpGetFIFOPacketSize();
+    } else {
+        // ERROR!
+        // 1 = initial memory load failed
+        // 2 = DMP configuration updates failed
+        // (if it's going to break, usually the code will be 1)
+        Serial.print(F("DMP Initialization failed (code "));
+        Serial.print(devStatus);
+        Serial.println(F(")"));
+    }
+
+    // configure LED for output
+    pinMode(LED_PIN, OUTPUT);
+}
+
+
+
+// ================================================================
+// ===                    MAIN PROGRAM LOOP                     ===
+// ================================================================
+
+void loop() {
+    // if programming failed, don't try to do anything
+    if (!dmpReady) return;
+
+    // wait for MPU interrupt or extra packet(s) available
+    while (!mpuInterrupt && fifoCount < packetSize) {
+        // other program behavior stuff here
+        // .
+        // .
+        // .
+        // if you are really paranoid you can frequently test in between other
+        // stuff to see if mpuInterrupt is true, and if so, "break;" from the
+        // while() loop to immediately process the MPU data
+        // .
+        // .
+        // .
+    }
+
+    // reset interrupt flag and get INT_STATUS byte
+    mpuInterrupt = false;
+    mpuIntStatus = mpu.getIntStatus();
+
+    // get current FIFO count
+    fifoCount = mpu.getFIFOCount();
+
+    // check for overflow (this should never happen unless our code is too inefficient)
+    if ((mpuIntStatus & 0x10) || fifoCount == 1024) {
+        // reset so we can continue cleanly
+        mpu.resetFIFO();
+        Serial.println(F("FIFO overflow!"));
+
+    // otherwise, check for DMP data ready interrupt (this should happen frequently)
+    } else if (mpuIntStatus & 0x02) {
+        // wait for correct available data length, should be a VERY short wait
+        while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount();
+
+        // read a packet from FIFO
+        mpu.getFIFOBytes(fifoBuffer, packetSize);
+
+        // track FIFO count here in case there is > 1 packet available
+        // (this lets us immediately read more without waiting for an interrupt)
+        fifoCount -= packetSize;
+
+        #ifdef OUTPUT_READABLE_QUATERNION
+            // display quaternion values in easy matrix form: w x y z
+            mpu.dmpGetQuaternion(&q, fifoBuffer);
+            Serial.print("quat\t");
+            Serial.print(q.w);
+            Serial.print("\t");
+            Serial.print(q.x);
+            Serial.print("\t");
+            Serial.print(q.y);
+            Serial.print("\t");
+            Serial.println(q.z);
+        #endif
+
+        #ifdef OUTPUT_READABLE_EULER
+            // display Euler angles in degrees
+            mpu.dmpGetQuaternion(&q, fifoBuffer);
+            mpu.dmpGetEuler(euler, &q);
+            Serial.print("euler\t");
+            Serial.print(euler[0] * 180/M_PI);
+            Serial.print("\t");
+            Serial.print(euler[1] * 180/M_PI);
+            Serial.print("\t");
+            Serial.println(euler[2] * 180/M_PI);
+        #endif
+
+        #ifdef OUTPUT_READABLE_YAWPITCHROLL
+            // display Euler angles in degrees
+            mpu.dmpGetQuaternion(&q, fifoBuffer);
+            mpu.dmpGetGravity(&gravity, &q);
+            mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
+            Serial.print("ypr\t");
+            Serial.print(ypr[0] * 180/M_PI);
+            Serial.print("\t");
+            Serial.print(ypr[1] * 180/M_PI);
+            Serial.print("\t");
+            Serial.println(ypr[2] * 180/M_PI);
+        #endif
+
+        #ifdef OUTPUT_READABLE_REALACCEL
+            // display real acceleration, adjusted to remove gravity
+            mpu.dmpGetQuaternion(&q, fifoBuffer);
+            mpu.dmpGetAccel(&aa, fifoBuffer);
+            mpu.dmpGetGravity(&gravity, &q);
+            mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
+            Serial.print("areal\t");
+            Serial.print(aaReal.x);
+            Serial.print("\t");
+            Serial.print(aaReal.y);
+            Serial.print("\t");
+            Serial.println(aaReal.z);
+        #endif
+
+        #ifdef OUTPUT_READABLE_WORLDACCEL
+            // display initial world-frame acceleration, adjusted to remove gravity
+            // and rotated based on known orientation from quaternion
+            mpu.dmpGetQuaternion(&q, fifoBuffer);
+            mpu.dmpGetAccel(&aa, fifoBuffer);
+            mpu.dmpGetGravity(&gravity, &q);
+            mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
+            mpu.dmpGetLinearAccelInWorld(&aaWorld, &aaReal, &q);
+            Serial.print("aworld\t");
+            Serial.print(aaWorld.x);
+            Serial.print("\t");
+            Serial.print(aaWorld.y);
+            Serial.print("\t");
+            Serial.println(aaWorld.z);
+        #endif
+
+        #ifdef OUTPUT_TEAPOT
+            // display quaternion values in InvenSense Teapot demo format:
+            teapotPacket[2] = fifoBuffer[0];
+            teapotPacket[3] = fifoBuffer[1];
+            teapotPacket[4] = fifoBuffer[4];
+            teapotPacket[5] = fifoBuffer[5];
+            teapotPacket[6] = fifoBuffer[8];
+            teapotPacket[7] = fifoBuffer[9];
+            teapotPacket[8] = fifoBuffer[12];
+            teapotPacket[9] = fifoBuffer[13];
+            Serial.write(teapotPacket, 14);
+            teapotPacket[11]++; // packetCount, loops at 0xFF on purpose
+        #endif
+
+        // blink LED to indicate activity
+        blinkState = !blinkState;
+        digitalWrite(LED_PIN, blinkState);
+    }
+}


dht11/lcd arduino snippet, no rf24 integration yet

error: pathspec 'ArduinoRF24_I2C_DHT11/ArduinoRF24_I2C_DHT11.ino' did not match any file(s) known to git

--- ArduinoRF24_I2C_DHT11/ArduinoRF24_I2C_DHT11.ino
+++ ArduinoRF24_I2C_DHT11/ArduinoRF24_I2C_DHT11.ino
@@ -0,0 +1,75 @@
+/*
+LCD i2c library: https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library
+LCD i2c module: for example http://www.aliexpress.com/item/LCD1602-I2C-LCD-1602-module-Blue-screen-IIC-I2C-for-arduino-LCD1602-Adapter-plate/32651314933.html
+DHT11 library: https://github.com/RobTillaart/Arduino/tree/master/libraries/DHTlib
+*/
+
+#include <dht.h>
+#include <Wire.h>
+#include <LiquidCrystal_I2C.h>
+
+dht DHT;
+LiquidCrystal_I2C lcd(0x27, 16, 2);
+
+#define DHT11_PIN 5
+#define DHT11_POWER_PIN 6
+
+#define TEMP_STR "Temp: "
+#define HUM_STR "Hum: "
+
+void setup()
+{
+  Serial.begin(115200);
+  Serial.println("DHT TEST PROGRAM ");
+  Serial.print("LIBRARY VERSION: ");
+  Serial.println(DHT_LIB_VERSION);
+  Serial.println();
+  Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");
+
+  pinMode(DHT11_POWER_PIN, OUTPUT);
+  digitalWrite(DHT11_POWER_PIN, HIGH);
+
+  lcd.begin();
+  lcd.backlight();
+}
+
+void loop()
+{
+  // READ DATA
+  Serial.print("DHT11, \t");
+  int chk = DHT.read11(DHT11_PIN);
+  switch (chk)
+  {
+    case DHTLIB_OK:
+		Serial.print("OK,\t");
+		break;
+    case DHTLIB_ERROR_CHECKSUM:
+		Serial.print("Checksum error,\t");
+		break;
+    case DHTLIB_ERROR_TIMEOUT:
+		Serial.print("Time out error,\t");
+		break;
+    default:
+		Serial.print("Unknown error,\t");
+		break;
+  }
+  // DISPLAY DATA
+  Serial.print(DHT.humidity, 1);
+  Serial.print(",\t");
+  Serial.println(DHT.temperature, 1);
+
+  lcd.clear();
+  lcd.setCursor(0,0);
+  lcd.print(TEMP_STR);
+  lcd.setCursor(6,0);
+  lcd.print(DHT.temperature);
+  lcd.setCursor(0,1);
+  lcd.print(HUM_STR);
+  lcd.setCursor(6,1);
+  lcd.print(DHT.humidity);
+
+  delay(2000);
+}
+//
+// END OF FILE
+//


New (mostly working code

New (mostly working code

Lacks a pump activation counter

error: pathspec 'PH_final_code/PH_final_code.ino' did not match any file(s) known to git

--- PH_final_code/PH_final_code.ino
+++ PH_final_code/PH_final_code.ino
@@ -0,0 +1,136 @@
+
+#define outputPIN P1_5
+#define inPIN P1_4
+#define basePIN P2_1
+#define acidPIN P2_2
+
+
+unsigned long int timeSend = 0;
+unsigned long int timeSinceMotorRun = 1000000;
+boolean shutDown = false;
+boolean motorRunning = false;
+int PHtarget = 1200;      // will be updated by interface
+int PHmargin = 50;        //
+int output = 0;
+int input = 0;
+
+
+void setup()
+{
+  Serial.begin(9600);
+  Serial.setTimeout(50);
+  pinMode(outputPIN, INPUT);
+  pinMode(inPIN, INPUT);
+  pinMode(basePIN, OUTPUT);
+  pinMode(acidPIN, OUTPUT);
+  digitalWrite(basePIN, LOW);
+  digitalWrite(acidPIN, LOW);
+}
+
+void loop()
+{
+
+  if(millis() - timeSend > 1000)  // function to run every 0.25s
+  {
+  // read the input on analog pin P1.5:
+  output = analogRead(outputPIN)*2.9;  // this include a gain of 11
+  input = analogRead(inPIN)*2.9;
+
+  // print out the value we have read to the interface:
+  Serial.print("PHoutputex:");
+  Serial.print(output);
+  Serial.print("\r\n");
+  Serial.print("PHinputes:");
+  Serial.print(input);
+  Serial.print("\r\n");
+  Serial.print("PHtarget:");
+  Serial.print(PHtarget);
+  Serial.print("\r\n");
+
+  PHmaintain();  // activate motors if required;
+
+  timeSend = millis();
+  }
+
+  PHcommandListen();  // listen for commands NOTE; THIS SECTION MUST BE COMBINED WITH OTHER SUBSYSTEMS
+
+
+
+}
+
+  void PHmaintain(){
+
+   int difference = PHtarget - output;
+   Serial.print("difference:");
+   Serial.println(difference);
+
+   if(motorRunning && (millis() - timeSinceMotorRun > 2000))  // if we've been running the motor for more than 2s
+   {
+     digitalWrite(basePIN, LOW);
+     digitalWrite(acidPIN, LOW);
+     // turn both motors off
+     motorRunning = false;
+     Serial.println("Shutting motor down");
+   }
+
+   if(abs(difference) > PHmargin)  // if the PH is outside the margin
+   {
+     Serial.println("PH outside margin");
+
+     if(difference > 0 && (millis() - timeSinceMotorRun) > 5000)  // if solution is too acidic and we havn't run a motor for 10s
+     {
+      if(!shutDown){  // if we havn't shut the motors down.
+         timeSinceMotorRun = millis();
+         motorRunning = true;
+         digitalWrite(basePIN, HIGH);  // run base motor
+         Serial.println("Runnng base motor");
+       }
+     }
+
+     if(difference < 0 && (millis() - timeSinceMotorRun) > 5000)  // if solution is too alkalie and we havn't run a motor for 10s
+     {
+       if(!shutDown){  // if we havn't shut the motors down.
+         timeSinceMotorRun = millis();
+         motorRunning = true;
+          digitalWrite(acidPIN, HIGH); // run acid motor;
+          Serial.println("Runnng acid motor");
+       }
+     }
+   }
+
+  }
+
+  void PHcommandListen()  // listen and reactor to commands from the interface
+  {
+
+       while (Serial.available() > 0) {
+
+         String inString = Serial.readString();
+         inString.trim();
+         Serial.println(inString);  //DEBUG ONLY
+
+         if(inString.equals("S")){
+         Serial.println("PH is in shutdown");
+         shutDown = true;
+             digitalWrite(basePIN, LOW);
+             digitalWrite(acidPIN, LOW);
+             // turn both motors off
+             motorRunning = false;
+         }
+         if(inString.equals("XS")){
+         Serial.println("PH has resumed");
+         shutDown = false;
+         }
+         if((inString.substring(0,11)).equals("PHcommanded"))  // if we see a command
+         {
+           PHtarget = inString.substring(12).toInt();  // change the target PH
+         }
+         }
+
+
+  }
+
+
+
+
+


Start of stair sensor

Start of stair sensor

error: pathspec 'arduino/stair_sensor/stair_sensor.ino' did not match any file(s) known to git

--- arduino/stair_sensor/stair_sensor.ino
+++ arduino/stair_sensor/stair_sensor.ino
@@ -0,0 +1,127 @@
+/*
+
+ Sleep until motion is detectected,
+ then turn on the two ping sensors which detect if someone goes past and in which direction.
+
+*/
+
+// NewPing uses timer 2 and switches pinging between sensors
+// @see https://code.google.com/p/arduino-new-ping/
+#include <NewPing.h>
+
+// VirtualWire handles the RF transmission
+// @see http://www.airspayce.com/mikem/arduino/
+#include <VirtualWire.h>
+
+#define SONAR_NUM     2 // Number of sensors.
+#define MAX_DISTANCE 700 // Maximum distance (in cm) to ping.
+#define PING_INTERVAL 33 // Milliseconds between sensor pings (29ms is about the min to avoid cross-sensor echo).
+
+// Pins
+const byte PIN_RF_TX = 9;       // Pin 12 is the default sender pin but I want 9.
+const byte PIN_PING_POWER = 14; // Controls the transistor switch for both ping sensors.
+
+const byte PIN_TRIG_LEFT = 7;   // Send the ping on the left sensor.
+const byte PIN_ECHO_LEFT = 8;   // Listen for the left ping's echo.
+
+const byte PIN_TRIG_RIGHT = 5;  // Send the ping on the right sensor.
+const byte PIN_ECHO_RIGHT = 6;  // Listen for the right ping's echo.
+
+byte pingPowerState = 1;        // 0 = sensor off, 1 = sensor on.
+
+unsigned long msgId = 0;        // Each transmission has an id so the receiver knows if it missed something.
+unsigned long lastTransmit = 0; // The last time a transmission was sent.
+
+unsigned long pingTimer[SONAR_NUM]; // Holds the times when the next ping should happen for each sensor.
+unsigned int cm[SONAR_NUM];         // Where the ping distances are stored.
+uint8_t currentSensor = 0;          // Keeps track of which sensor is active.
+
+NewPing sonar[SONAR_NUM] = {     // Sensor object array.
+  NewPing(PIN_TRIG_LEFT, PIN_ECHO_LEFT, MAX_DISTANCE), // Each sensor's trigger pin, echo pin, and max distance to ping.
+  NewPing(PIN_TRIG_RIGHT, PIN_ECHO_RIGHT, MAX_DISTANCE),
+};
+
+
+/**
+ * Transmit the message.
+ */
+void transmit(char *buf)
+{
+  vw_send((uint8_t *)buf, strlen(buf));
+  // NB: ping returns 0 if transmitting while vw_wait_tx() so don't use it.
+  //vw_wait_tx(); // Wait until the whole message is gone
+  lastTransmit = millis();
+}
+
+/**
+ * ISR from timer 2 - ISR(TIMER2_COMPA_vect)
+ */
+void echoCheck()
+{
+  // If ping received, set the sensor distance to array.
+  if (sonar[currentSensor].check_timer()) {
+    cm[currentSensor] = sonar[currentSensor].ping_result / US_ROUNDTRIP_CM;
+  }
+}
+
+/**
+ * Sensor ping cycle complete, do something with the results.
+ */
+void oneSensorCycle()
+{
+  // The following code would be replaced with your code that does something with the ping results.
+  for (uint8_t i = 0; i < SONAR_NUM; i++) {
+    Serial.print(i);
+    Serial.print("=");
+    Serial.print(cm[i]);
+    Serial.print("cm ");
+  }
+  Serial.println();
+
+}
+
+void setup()
+{
+  Serial.begin(115200);
+
+  pinMode(PIN_PING_POWER, OUTPUT);
+
+  vw_set_tx_pin(PIN_RF_TX);
+  vw_setup(2000);      // Bits per sec
+
+  pingTimer[0] = millis() + 75;           // First ping starts at 75ms, gives time for the Arduino to chill before starting.
+  for (uint8_t i = 1; i < SONAR_NUM; i++) // Set the starting time for each sensor.
+    pingTimer[i] = pingTimer[i - 1] + PING_INTERVAL;
+
+}
+
+void loop()
+{
+  // PING )))
+  for (uint8_t i = 0; i < SONAR_NUM; i++) { // Loop through all the sensors.
+    if (millis() >= pingTimer[i]) {         // Is it this sensor's time to ping?
+      pingTimer[i] += PING_INTERVAL * SONAR_NUM;  // Set next time this sensor will be pinged.
+      if (i == 0 && currentSensor == SONAR_NUM - 1) oneSensorCycle(); // Sensor ping cycle complete, do something with the results.
+      sonar[currentSensor].timer_stop();          // Make sure previous timer is canceled before starting a new ping (insurance).
+      currentSensor = i;                          // Sensor being accessed.
+      cm[currentSensor] = 0;                      // Make distance zero in case there's no ping echo for this sensor.
+      sonar[currentSensor].ping_timer(echoCheck); // Do the ping (processing continues, interrupt will call echoCheck to look for echo).
+    }
+  }
+
+  // Other code that *DOESN'T* analyze ping results can go here.
+
+  if (millis() - lastTransmit > 1000) {
+    // Proof of concept to power cycle the pings
+    pingPowerState =!pingPowerState;
+    digitalWrite(PIN_PING_POWER, pingPowerState);
+
+    msgId++;
+    char buf[50];
+    sprintf(buf, "id=%lu", msgId);
+
+    transmit(buf);
+  }
+
+}
+


added piezo buzzer

added piezo buzzer

error: pathspec 'piezoBuzzer/piezoBuzzer.ino' did not match any file(s) known to git

--- piezoBuzzer/piezoBuzzer.ino
+++ piezoBuzzer/piezoBuzzer.ino
@@ -0,0 +1,44 @@
+const int buzzerPin = 9;
+const int songLength = 18;
+
+char notes[] = "cdfda ag cdfdg gf "; // a space represents a rest.
+int beats[] = {1,1,1,1,1,1,4,4,2,1,1,1,1,1,1,4,4,2};
+
+int tempo = 150;
+
+void setup() {
+  pinMode(buzzerPin, OUTPUT);
+}
+
+void loop() {
+  int i, duration;
+
+  for(i = 0; i < songLength; i++) {
+    duration = beats[i] * tempo;
+
+    if (notes[i] == ' ') {
+      delay(duration);
+    } else {
+      tone(buzzerPin, frequency(notes[i]), duration);
+      delay(duration);
+    }
+    delay(tempo/10);
+  }
+
+  // while(true){} // Loop when you only want to play this once
+}
+
+int frequency(char note) {
+  int i;
+  const int numNotes = 8;
+
+  char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
+  int frequencies[] = {262, 294, 330, 349, 392, 440, 494, 523};
+
+  for (i = 0; i < numNotes; i++) {
+    if (names[i] == note) {
+      return(frequencies[i]);
+    }
+  }
+  return(0);
+}


First simple Arduino programm

First simple Arduino programm

error: pathspec 'arduino/arduino.ino' did not match any file(s) known to git

--- arduino/arduino.ino
+++ arduino/arduino.ino
@@ -0,0 +1,38 @@
+#define EEPROM_PROFILE_START 64
+#define EEPROM_CURRENT_PROFILE_ID 0 //4 Byte
+#define EEPROM_CURRENT_BRIGHTNESS 4 //1 Byte
+
+#define TRANSMISSION_GET_PROFILE_ID 0
+#define TRANSMISSION_SET_PROFILE 1
+#define TRANSMISSION_GET_BRIGHTNESS 2
+#define TRANSMISSION_SET_BRIGHTNESS 3
+
+int led = 13;
+
+void setup() {
+  //Beginn Serial Communication
+  Serial.begin(9600);
+
+  //Init here
+
+  //Tell host boot is complete
+  Serial.println("ARDUINO BOOT COMPLETE");
+
+}
+
+void loop() {
+
+}
+
+/*
+ SerialEvent occurs whenever a new data comes in the
+ hardware serial RX.  This routine is run between each
+ time loop() runs, so using delay inside loop can delay
+ response.  Multiple bytes of data may be available.
+ */
+void serialEvent() {
+  while (Serial.available()) {
+    Serial.write(Serial.read());
+
+  }
+}


Added sensor code

Added sensor code

error: pathspec 'sensors.ino' did not match any file(s) known to git

--- sensors.ino
+++ sensors.ino
@@ -0,0 +1,232 @@
+// Include
+#include <Wire.h>
+#include "SparkFunISL29125.h"
+#include <dht.h>
+#include <OneWire.h>
+#include <DallasTemperature.h>
+
+
+
+// Air temperature/humidity: DHT11
+dht DHT;  // define object
+#define DHT11_PIN 5
+
+// Soil temperature: DS
+// Data wire is plugged into port 6 on the Arduino
+#define ONE_WIRE_BUS 6
+// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
+OneWire oneWire(ONE_WIRE_BUS);
+// Pass our oneWire reference to Dallas Temperature.
+DallasTemperature sensors(&oneWire);
+// arrays to hold device address
+DeviceAddress soilThermometer;
+
+// Soil humidity
+#define SoilMoisturePin  0  // pin A0
+#define SoilVccPin  4  // digital pin used as Vcc.  Sensor is connected from here to GND to reduce degredation of sensor
+
+// IR
+#define IRPin  1  // A1
+#define IRVccPin  3 // D3 - used to power soil moisture sensor
+
+// Light level: ISL29125
+// Declare sensor object
+SFE_ISL29125 RGB_sensor;
+
+
+// Pin allocations
+//    	- A0: soil moisture analog output
+// 		- A1: IR phototransistor analog output
+//    	- A4: SDA (RGB sensor)
+//    	- A5: SCL (RGB sensor)
+//      - D4: Soil moisture Vcc
+//      - D3: IR phototransistor Vcc
+//    	- D5: Air temperature/humidity digital output
+// 		- D4: IR phototransistor power supply
+// 		- D3: power supply for soil moisture sensor
+//    	- D6: Soil temperature digital output
+
+
+void setup(){
+  // general setup
+  Serial.begin(9600);
+  // Light Sensor
+  // Initialize the ISL29125 with simple configuration so it starts sampling
+  if (RGB_sensor.init())
+  {
+    Serial.println("Light sensor Initialization Successful\n\r");
+  }
+
+  // temperature/humidity
+  Serial.println("Dallas Temperature IC Control Library Demo");
+
+  // locate devices on the bus
+  Serial.print("Locating devices...");
+  sensors.begin();
+  Serial.print("Found ");
+  Serial.print(sensors.getDeviceCount(), DEC);
+  Serial.println(" devices.");
+
+  // report parasite power requirements
+  Serial.print("Parasite power is: ");
+  if (sensors.isParasitePowerMode()) Serial.println("ON");
+  else Serial.println("OFF");
+
+  // Assign address manually. The addresses below will beed to be changed
+  // to valid device addresses on your bus. Device address can be retrieved
+  // by using either oneWire.search(deviceAddress) or individually via
+  // sensors.getAddress(deviceAddress, index)
+  // Note that you will need to use your specific address here
+  //soilThermometer = { 0x28, 0x1D, 0x39, 0x31, 0x2, 0x0, 0x0, 0xF0 };
+
+  // Method 1:
+  // Search for devices on the bus and assign based on an index. Ideally,
+  // you would do this to initially discover addresses on the bus and then
+  // use those addresses and manually assign them (see above) once you know
+  // the devices on your bus (and assuming they don't change).
+  if (!sensors.getAddress(soilThermometer, 0)) Serial.println("Unable to find address for soil temperature sensor");
+
+  // method 2: search()
+  // search() looks for the next device. Returns 1 if a new address has been
+  // returned. A zero might mean that the bus is shorted, there are no devices,
+  // or you have already retrieved all of them. It might be a good idea to
+  // check the CRC to make sure you didn't get garbage. The order is
+  // deterministic. You will always get the same devices in the same order
+  //
+  // Must be called before search()
+  //oneWire.reset_search();
+  // assigns the first address found to soilThermometer
+  //if (!oneWire.search(soilThermometer)) Serial.println("Unable to find address for soilThermometer");
+
+  // show the addresses we found on the bus
+  Serial.print("Soil temperature sensor address: ");
+  printAddress(soilThermometer);
+  Serial.println();
+
+  // set the resolution to 9 bit (Each Dallas/Maxim device is capable of several different resolutions)
+  sensors.setResolution(soilThermometer, 9);
+
+  Serial.print("Soil temperature resolution: ");
+  Serial.print(sensors.getResolution(soilThermometer), DEC);
+  Serial.println();
+
+  // DHT11
+
+
+  // soil moisture
+  pinMode(SoilVccPin, OUTPUT);  // Vcc pin for soil moisture sensor
+  digitalWrite(SoilVccPin, LOW);   // disable sensor
+
+  // IR phototransistor
+  pinMode(IRVccPin, OUTPUT);  // set to out
+  digitalWrite(IRVccPin, LOW);  // make sure it's off
+
+  // complete
+  Serial.println("Node setup complete.");
+  Serial.println("--------------------------------------------");
+  Serial.println();
+  Serial.println("Sol Moisture, Light (RGB), Soil Temperature, Air Relative Humidity, Air Temperature, IR Level");
+  delay(5000);
+}
+
+void loop(){
+  // Soil Moisture
+  digitalWrite(SoilVccPin, HIGH);   // enable sensor
+  delay(50);  // allow power to settle
+  Serial.print(1023-(analogRead(SoilMoisturePin)));
+  Serial.print(", ");
+  digitalWrite(SoilVccPin, LOW);   // disable sensor
+
+  // Light
+    // Read sensor values (16 bit integers)
+  unsigned int red = RGB_sensor.readRed();
+  unsigned int green = RGB_sensor.readGreen();
+  unsigned int blue = RGB_sensor.readBlue();
+
+  Serial.print(red,DEC);
+  Serial.print(", ");
+  Serial.print(green,DEC);
+  Serial.print(", ");
+  Serial.print(blue,DEC);
+  Serial.print(", ");
+
+  // soil temperature
+    // call sensors.requestTemperatures() to issue a global temperature
+  // request to all devices on the bus
+  sensors.requestTemperatures(); // Send the command to get temperatures
+  // It responds almost immediately. Let's print out the data
+
+  printTemperature(soilThermometer); // Use a simple function to print out the data
+
+  // temperature and moisture
+   // READ DATA
+  int chk = DHT.read11(DHT11_PIN);
+  switch (chk)
+  {
+    case DHTLIB_OK:
+ //               Serial.print("OK,\t");
+                break;
+    case DHTLIB_ERROR_CHECKSUM:
+                Serial.print("Checksum error,\t");
+                break;
+    case DHTLIB_ERROR_TIMEOUT:
+                Serial.print("Time out error,\t");
+                break;
+    case DHTLIB_ERROR_CONNECT:
+        Serial.print("Connect error,\t");
+        break;
+    case DHTLIB_ERROR_ACK_L:
+        Serial.print("Ack Low error,\t");
+        break;
+    case DHTLIB_ERROR_ACK_H:
+        Serial.print("Ack High error,\t");
+        break;
+    default:
+                Serial.print("Unknown error,\t");
+                break;
+  }
+  // DISPLAY DATA
+  Serial.print(DHT.humidity, 1);
+  Serial.print(", ");
+  Serial.print(DHT.temperature, 1);
+  Serial.print(", ");
+
+  //IR
+  digitalWrite(IRVccPin, HIGH);   // enable sensor
+  Serial.print(analogRead(IRPin));
+  digitalWrite(IRVccPin, LOW);   // disable sensor
+
+
+  // finish
+  Serial.println();
+  delay(2000);
+
+}
+
+// soil temperature
+// function to print the temperature for a device
+void printTemperature(DeviceAddress deviceAddress)
+{
+  // method 1 - slower
+  //Serial.print("Temp C: ");
+  //Serial.print(sensors.getTempC(deviceAddress));
+  //Serial.print(" Temp F: ");
+  //Serial.print(sensors.getTempF(deviceAddress)); // Makes a second call to getTempC and then converts to Fahrenheit
+
+  // method 2 - faster
+  float tempC = sensors.getTempC(deviceAddress);
+  Serial.print(tempC);
+  Serial.print(", ");
+//  Serial.print(" Temp F: ");
+//  Serial.println(DallasTemperature::toFahrenheit(tempC)); // Converts tempC to Fahrenheit
+}
+
+// function to print a device address
+void printAddress(DeviceAddress deviceAddress)
+{
+  for (uint8_t i = 0; i < 8; i++)
+  {
+    if (deviceAddress[i] < 16) Serial.print("0");
+    Serial.print(deviceAddress[i], HEX);
+  }
+}


Add example sketch for vor_humidity.

Add example sketch for vor_humidity.

error: pathspec 'vor-arduino/examples/humidity/humidity.ino' did not match any file(s) known to git

--- vor-arduino/examples/humidity/humidity.ino
+++ vor-arduino/examples/humidity/humidity.ino
@@ -0,0 +1,16 @@
+#include "vor_humidity.h"
+#include "vor_led.h"
+
+VorHumidity humidity(A0);
+VorLed led;
+
+void setup() {
+    Serial.begin(9600);
+    while (!Serial);
+}
+
+void loop() {
+    float value = humidity.readProcessed();
+    Serial.println(value);
+    delay(1000);
+}


Vibe sign

Vibe sign

error: pathspec 'examples/vibe-sign/vibe-sign.ino' did not match any file(s) known to git

--- examples/vibe-sign/vibe-sign.ino
+++ examples/vibe-sign/vibe-sign.ino
@@ -0,0 +1,94 @@
+#include <pixl.h>
+#include <FastLED.h>
+#include <Logging.h>
+
+// Uncomment to turn off assertions
+#define NDEBUG
+
+// Weird thing I had to do to get the Logging library working with teensy
+extern "C"{
+  int _getpid(){ return -1;}
+  int _kill(int pid, int sig){ return -1; }
+  int _write(){return -1;}
+}
+
+#define LOGLEVEL LOG_LEVEL_INFOS
+
+using namespace pixl;
+
+Input* input;
+
+// Triangle
+LEDStrip triangle_strip = LEDStrip(165);
+int triangle_points[] = {37, 0, 19};
+int triangle_edges[] = {18, 19, 18};
+LEDStrip* triangle_strips[] = {&triangle_strip};
+LEDs triangle_led = LEDs(3, triangle_strips, triangle_points, triangle_edges);
+LEDs* triangle_leds[] = {&triangle_led};
+TriangleAnimation* triangle_anim;
+CircleAnimation* circle_anim;
+
+// Circle
+LEDStrip circle_strip = LEDStrip(150);
+LEDs circle_led = LEDs(circle_strip, 0, 150);
+LEDs* circle_leds[] = {&circle_led};
+
+Visualization* viz;
+
+// Audio shield setup
+AudioInputI2S audio;
+//AudioAnalyzePeak peak;
+//AudioAnalyzeNoteFrequency note;
+//AudioConnection patchCord1(audio, peak);
+//AudioConnection patchCord2(audio, note);
+AudioControlSGTL5000 audioShield;
+AudioAnalyzeFFT1024 fft;
+AudioConnection patchCord1(audio, 0, fft, 0);
+
+void setup() {
+  Log.Init(LOGLEVEL, 9600);
+  delay(1000);
+  Log.Info("Starting setup()\n");
+  Serial.flush();
+  delay(1000);
+
+  AudioMemory(12);
+  audioShield.enable();
+  audioShield.inputSelect(AUDIO_INPUT_LINEIN);
+  audioShield.lineInLevel(15);
+  //audioShield.inputSelect(AUDIO_INPUT_MIC);
+  //audioShield.micGain(100);
+  //note.begin(.99);
+
+  fft.windowFunction(AudioWindowHanning1024);
+
+  //input = new AudioShieldInput(&peak, &note);
+  input = new FFTInput(&fft);
+
+  viz = new RippleVisualization(input, 50, 1, true);
+  triangle_anim = new TriangleAnimation(viz, triangle_leds, 1);
+  circle_anim = new CircleAnimation(viz, circle_leds, 1);
+
+  triangle_anim->init(1.0);
+  circle_anim->init(1.0);
+
+  FastLED.addLeds<WS2811, 2, GRB>(triangle_strip.leds, 165);
+  FastLED.addLeds<WS2811, 2, GRB>(circle_strip.leds, 150);
+  FastLED.setBrightness(255);
+
+  Looper* looper = Looper::instance();
+  looper->addInput(input);
+  looper->addVisualization(viz);
+  looper->addAnimation(triangle_anim);
+  looper->addAnimation(circle_anim);
+  looper->setUpdatesPerSecond(30);
+
+  Log.Info("Finished setup()\n");
+  delay(100);
+}
+
+void loop() {
+  AudioNoInterrupts();
+  Looper::instance()->loop();
+  AudioInterrupts();
+}


Minor refactor while failing to grok serial readline

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/meatballhat/box-o-sand.git/'


Arduino code upload. Requires Arduino version 1.6.9 for some reason.

error: pathspec 'arduino/i2cled/i2cLedMaster.ino' did not match any file(s) known to git

--- arduino/i2cled/i2cLedMaster.ino
+++ arduino/i2cled/i2cLedMaster.ino
@@ -0,0 +1,491 @@
+#include <Adafruit_NeoPixel.h>
+#include <Wire.h>
+
+#ifdef __AVR__
+  #include <avr/power.h>
+#endif
+
+// Disables i2c pullup resistors. Disable this if you don't have any on the i2c bus.
+// It is recommended to use external pullups based on the capacitance of your i2c bus.
+#ifndef cbi
+#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
+#endif
+
+// PIN is the digital output pin used for LED control
+// NUM_LEDS is the number of LEDS on the string
+#define PIN 3
+#define NUM_LEDS 29
+
+#define I2C_ADDRESS 0x10            // Slave i2c address
+
+// Command codes. Set these to whatever you want, just make sure to update the master as well
+// 0x01 to 0xFF are available
+
+//Permanent Set
+#define SET_SINGLE_COLOR      0x15
+
+//Temporary Set
+#define COLOR_WIPE            0x20
+
+//Long Animations
+#define RAINBOW               0x50
+#define RAINBOW_CYCLE         0x51
+#define THEATER_CHASE         0x52
+#define THEATER_CHASE_RAINBOW 0x53
+
+//Short Animations
+#define FLASHER               0x60
+
+//Infinite Animations
+#define FLASHINF              0x71
+#define FLASHALT              0x72
+#define SPARKLE               0x73
+#define SPARKLE_FADE          0x74
+#define FLAME                 0x75
+#define GLOW                  0x76
+
+//Utilities
+#define RESTORE_STATE         0xFD
+#define SET_ALL               0xFE
+#define CLEAR_ALL             0xFF
+
+
+//FIRE 2012 Defines
+#define SPARKING 120
+#define COOLING  55
+
+// Parameter 1 = number of pixels in strip
+// Parameter 2 = Arduino pin number (most are valid)
+// Parameter 3 = pixel type flags, add together as needed:
+//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
+//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
+//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
+//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
+//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
+Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
+
+// Global Variables
+int x = 0;
+byte mode = 0;
+byte led = 0;
+byte r = 0;
+byte g = 0;
+byte b = 0;
+byte del = 0;
+byte rep = 0;
+
+uint32_t blank = strip.Color(0, 0, 0);
+uint32_t currColor = strip.Color(0, 0, 0);
+
+// Backup storage for LEDs to restore former state before short animations play
+byte ledMatrix[NUM_LEDS][5];
+uint32_t ledTime[NUM_LEDS];
+
+void setup() {
+  // LED Strip Init
+  strip.begin();
+  strip.setBrightness(64); // 25% brightness for now
+  strip.show(); // Initialize all pixels to 'off'
+
+  // I2C Init Code
+  Wire.begin(I2C_ADDRESS);                // join i2c bus with address #8
+
+  cbi(PORTC, 4);
+  cbi(PORTC, 5);
+
+  Wire.onReceive(receiveEvent); // register event
+
+  randomSeed(analogRead(0));
+
+  Serial.begin(9600);
+
+  //Initialize with blank LED string
+  for(int i = 0; i < NUM_LEDS; i++){
+   for(int j = 0; j < 5; j++){
+    ledMatrix[i][j] = 0;
+   }
+  }
+}
+
+void loop() {
+
+  currColor = strip.Color(r, g, b);
+
+  switch(mode) {
+    case RESTORE_STATE:         restoreState();                             break;
+    case COLOR_WIPE:            colorWipe();                                break;
+    case RAINBOW:               rainbow();                                  break;
+    case RAINBOW_CYCLE:         rainbowCycle();                             break;
+    case THEATER_CHASE:         theaterChase();                             break;
+    case THEATER_CHASE_RAINBOW: theaterChaseRainbow();                      break;
+    case FLASHER:               flasher();                                  break;
+    case FLASHINF:              flashinf();                                 break;
+    case FLASHALT:              flashalt();                                 break;
+    case SPARKLE:               sparkle();                                  break;
+    case SPARKLE_FADE:          sparkleFade();                              break;
+    case FLAME:                 flame();                                    break;
+    case GLOW:                  glow();                                     break;
+
+    case SET_ALL:
+      for(uint16_t i=0; i < NUM_LEDS; i++) {
+        strip.setPixelColor(i, currColor);
+      }
+      break;
+
+    case CLEAR_ALL:
+      for(uint16_t i=0; i < NUM_LEDS; i++) {
+        strip.setPixelColor(i, blank);
+      }
+      break;
+
+    default:
+      refresh();
+      break;
+  }
+
+  strip.show();
+}
+
+// Read 7 bytes as command over i2c
+void receiveEvent(int bytes) {
+  while(Wire.available()) {
+    mode = Wire.read();
+    led = Wire.read();
+    r = Wire.read();
+    g = Wire.read();
+    b = Wire.read();
+    del = Wire.read();
+    rep = Wire.read();
+  }
+  if(mode == SET_SINGLE_COLOR) {
+      ledMatrix[led][0] = r;
+      ledMatrix[led][1] = g;
+      ledMatrix[led][2] = b;
+      ledMatrix[led][3] = del;
+      ledMatrix[led][4] = rep;
+      mode = 0x00;
+  }
+}
+
+void refresh() {
+  for(int i = 0; i < NUM_LEDS; i++){
+    if(ledMatrix[i][4] == 1) {
+      uint32_t diff = millis() - ledTime[i];
+      if(diff <= ledMatrix[i][3]) {
+        strip.setPixelColor(i, strip.Color(ledMatrix[i][0], ledMatrix[i][1], ledMatrix[i][2]));
+      }
+      else if(diff > ledMatrix[i][3] && diff < ledMatrix[i][3]*2) {
+        strip.setPixelColor(i, strip.Color(0, 0, 0));
+      }
+      else {
+        ledTime[i] = millis();
+      }
+    }
+    else {
+      strip.setPixelColor(i, strip.Color(ledMatrix[i][0], ledMatrix[i][1], ledMatrix[i][2]));
+    }
+  }
+  strip.show();
+}
+
+// Restore back to individually set configuration
+void restoreState() {
+  mode = 0x00;
+}
+
+void flasher() {
+  for(uint16_t j=0; j < rep; j++){
+    for(uint16_t i=0; i < NUM_LEDS; i++) {
+      if(mode != FLASHER) { return; }
+      strip.setPixelColor(i, strip.Color(r, g, b));
+      strip.show();
+    }
+    delay(del);
+    for(uint16_t k=0; k < NUM_LEDS; k++) {
+      if(mode != FLASHER) { return; }
+      strip.setPixelColor(k, blank);
+      strip.show();
+    }
+    delay(del);
+  }
+  mode = 0x00;  // Run once only
+  restoreState();
+}
+
+void flashinf() {
+  while(mode == FLASHINF) {
+    for(uint16_t i = 0; i < NUM_LEDS; i++) {
+      strip.setPixelColor(i, strip.Color(r, g, b));
+      strip.show();
+    }
+    delay(del);
+    for(uint16_t k = 0; k < NUM_LEDS; k++) {
+      strip.setPixelColor(k, blank);
+      strip.show();
+    }
+    delay(del);
+  }
+}
+
+void flashalt() {
+  byte start = 0;
+  while(mode == FLASHALT) {
+    start = start ^ 1;
+    for(uint16_t i = start; i < NUM_LEDS; i += 2) {
+      strip.setPixelColor(i, strip.Color(r, g, b));
+      strip.show();
+    }
+    delay(del);
+    for(uint16_t k = 0; k < NUM_LEDS; k++) {
+      strip.setPixelColor(k, blank);
+      strip.show();
+    }
+    delay(del);
+  }
+}
+
+void sparkle() {
+  while(mode == SPARKLE) {
+    for(uint16_t i = 0; i <  NUM_LEDS; i++) {
+      byte col = (random(10)==0);
+      strip.setPixelColor(i, strip.Color(col*r, col*g, col*b));
+      strip.show();
+    }
+    delay(del);
+  }
+}
+
+void sparkleFade() {
+  static byte leds[NUM_LEDS][3];
+  memset(leds,0,sizeof(leds));
+
+  while(mode == SPARKLE_FADE) {
+    for(uint16_t i = 0; i <  NUM_LEDS; i++) {
+      if(random(rep*10) == 0) {
+        leds[i][0] = r;
+        leds[i][1] = g;
+        leds[i][2] = b;
+      }
+     leds[i][0] = constrain(leds[i][0] - 3, 0, 255);
+     leds[i][1] = constrain(leds[i][1] - 3, 0, 255);
+     leds[i][2] = constrain(leds[i][2] - 3, 0, 255);
+     strip.setPixelColor(i, strip.Color(leds[i][0], leds[i][1], leds[i][2]));
+     strip.show();
+    }
+    delay(del);
+  }
+}
+
+// Fill the dots one after the other with a color
+void colorWipe() {
+  for(uint16_t i=0; i< NUM_LEDS; i++) {
+    if(mode != COLOR_WIPE) {
+      return;
+    }
+    strip.setPixelColor(i, strip.Color(r, g, b));
+    strip.show();
+    delay(del);
+  }
+  mode = 0x00; // Run once only
+}
+
+void clearall() {
+  for(uint16_t i=0; i < NUM_LEDS; i++) {
+    strip.setPixelColor(i, blank);
+  }
+  for(int i = 0; i < NUM_LEDS; i++){
+   for(int j = 0; j < 3; j++){
+    ledMatrix[i][j] = 0;
+   }
+  }
+}
+
+// Rainbow animation, better seen on longer strips
+void rainbow() {
+  uint16_t i, j;
+  while(mode == RAINBOW) {
+    for(j=0; j < 256; j++) {
+      for(i=0; i < NUM_LEDS; i++) {
+        if(mode != RAINBOW) {
+          return;
+        }
+        strip.setPixelColor(i, Wheel((i+j) & 255));
+      }
+      strip.show();
+      delay(del);
+    }
+  }
+}
+
+// Slightly different, this makes the rainbow equally distributed throughout
+void rainbowCycle() {
+  uint16_t i, j;
+  while(mode == RAINBOW_CYCLE) {
+    for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
+      for(i=0; i<  NUM_LEDS; i++) {
+        strip.setPixelColor(i, Wheel(((i * 256 /  NUM_LEDS) + j) & 255));
+      }
+      strip.show();
+      delay(del);
+      if(mode != RAINBOW_CYCLE) {
+        return;
+      }
+    }
+  }
+}
+
+//Theatre-style crawling lights.
+void theaterChase() {
+  while(mode == THEATER_CHASE) {
+    for (int q=0; q < 3; q++) {
+      for (uint16_t i=0; i <  NUM_LEDS; i=i+3) {
+        if(mode != THEATER_CHASE) {
+          return;
+        }
+        strip.setPixelColor(i+q, currColor);    //turn every third pixel on
+      }
+      strip.show();
+
+      delay(del);
+
+      for (uint16_t i=0; i <  NUM_LEDS; i=i+3) {
+        if(mode != THEATER_CHASE) {
+          return;
+        }
+        strip.setPixelColor(i+q, 0);        //turn every third pixel off
+      }
+    }
+  }
+}
+
+//Theatre-style crawling lights with rainbow effect
+void theaterChaseRainbow() {
+  while(mode == THEATER_CHASE_RAINBOW) {
+    for (int j=0; j < 256; j++) {     // cycle all 256 colors in the wheel
+      for (int q=0; q < 3; q++) {
+        for (uint16_t i=0; i <  NUM_LEDS; i=i+3) {
+          if(mode != THEATER_CHASE_RAINBOW) {
+            return;
+          }
+          strip.setPixelColor(i+q, Wheel( (i+j) % 255));    //turn every third pixel on
+        }
+        strip.show();
+
+        delay(del);
+
+        for (uint16_t i=0; i <  NUM_LEDS; i=i+3) {
+          if(mode != THEATER_CHASE_RAINBOW) {
+            return;
+          }
+          strip.setPixelColor(i+q, 0);        //turn every third pixel off
+        }
+      }
+    }
+  }
+}
+
+void glow() {
+  byte col = 0;
+  float roll = 0;
+  float calc = 0;
+  while(mode == GLOW) {
+    roll++;
+    if(roll > TWO_PI * 100) { roll = 0; }
+    for (uint16_t i=0; i <  NUM_LEDS; i++) {
+      calc = (-cos(roll/100)+1)*255/2;
+      col = (byte)calc;
+      strip.setPixelColor(i, strip.Color(col, col, col));
+      strip.show();
+    }
+    delay(del);
+  }
+}
+
+// Fire2012 library test
+void flame() {
+  static byte heat[NUM_LEDS];
+  byte rnd;
+
+  while(mode == FLAME) {
+    // Step 1.  Cool down every cell a little
+    for( int i = 0; i < NUM_LEDS; i++) {
+      rnd = random(0, ((COOLING * 10) / NUM_LEDS) + 2);
+      if(heat[i] > rnd) { heat[i] = heat[i] - rnd; }
+      else { heat[i] = 0; }
+    }
+
+    // Step 2.  Heat from each cell drifts 'up' and diffuses a little
+    for( int k= NUM_LEDS - 3; k > 0; k--) {
+      heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
+    }
+
+    // Step 3.  Randomly ignite new 'sparks' of heat near the bottom
+    if( random(0, 255) < SPARKING ) {
+      int y = random(7);
+      rnd = random(160,255);
+      if(heat[y] + rnd < 255) { heat[y] = heat[y] + rnd; }
+      else { heat[y] = 255; }
+    }
+
+    // Step 4.  Map from heat cells to LED colors
+    for( int j = 0; j < NUM_LEDS; j++) {
+        strip.setPixelColor(j, heatColor(heat[j]));
+        strip.show();
+    }
+    delay(del);
+  }
+}
+
+uint32_t heatColor(uint8_t temperature) {
+
+  byte hr;
+  byte hg;
+  byte hb;
+
+  // Scale 'heat' down from 0-255 to 0-191,
+  // which can then be easily divided into three
+  // equal 'thirds' of 64 units each.
+  uint8_t t192 = map(temperature, 0, 255, 0, 192);
+
+  // calculate a value that ramps up from
+  // zero to 255 in each 'third' of the scale.
+  uint8_t heatramp = t192 & 0x3F; // 0..63
+  heatramp <<= 2; // scale up to 0..252
+
+  // now figure out which third of the spectrum we're in:
+  if( t192 & 0x80) {
+    // we're in the hottest third
+    hr = 255; // full red
+    hg = 255; // full green
+    hb = heatramp; // ramp up blue
+
+  } else if( t192 & 0x40 ) {
+    // we're in the middle third
+    hr = 255; // full red
+    hg = heatramp; // ramp up green
+    hb = 0; // no blue
+
+  } else {
+    // we're in the coolest third
+    hr = heatramp; // ramp up red
+    hg = 0; // no green
+    hb = 0; // no blue
+  }
+
+  return strip.Color(hr, hg, hb);
+}
+
+// Input a value 0 to 255 to get a color value.
+// The colours are a transition r - g - b - back to r.
+uint32_t Wheel(byte WheelPos) {
+  WheelPos = 255 - WheelPos;
+  if(WheelPos < 85) {
+    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
+  }
+  if(WheelPos < 170) {
+    WheelPos -= 85;
+    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
+  }
+  WheelPos -= 170;
+  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
+}


slightly less current to avoid damages & injuries

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/trinamic/T-Bone.git/'


Deep Sleep

Deep Sleep

error: pathspec 'examples/_1040_Sleep/_1040_Sleep.ino' did not match any file(s) known to git

--- examples/_1040_Sleep/_1040_Sleep.ino
+++ examples/_1040_Sleep/_1040_Sleep.ino
@@ -0,0 +1,35 @@
+#include <ESPert.h>
+
+ESPert_LED led;
+ESPert espert;
+
+const int sleepTimeS = 10;
+
+void setup() {
+  int status = digitalRead(16);
+  espert.init();
+  espert.oled.init();
+  espert.oled.clear();
+  espert.oled.println( "Status: "+String(status) );
+
+  led.init( 12 );
+}
+
+void loop() {
+
+  espert.println( "ON" );
+  led.on();
+  delay( 1000 );
+  Serial.println( "OFF" );
+  led.off();
+  delay( 1000 );
+
+  espert.println( "ON" );
+  led.on();
+  delay( 1000 );
+  Serial.println( "OFF" );
+  led.off();
+  delay( 1000 );
+
+  ESP.deepSleep(sleepTimeS * 1000000);
+}


Ajout du sketch Arduino

Ajout du sketch Arduino

error: pathspec 'wake-on-ring.ino' did not match any file(s) known to git

--- wake-on-ring.ino
+++ wake-on-ring.ino
@@ -0,0 +1,77 @@
+// Ce sketch arduino permet d'allumer un ordinateur via le Wake on Ring
+// en appliquant une tension sur le pin 9 du port série
+// Au MIPS-lab, il faut envoyer en UDP à l'arduino "lamex" où x est le numéro de la
+// lame du Cray à activer.
+
+#include <SPI.h>
+#include <Ethernet.h>
+#include <EthernetUdp.h>
+
+byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0x4F, 0x39 }; // Défini l'adresse MAC
+IPAddress ip(192, 168, 42, 250); // Défini l'adresse IP
+
+int localPort = 9694; // Défini le port
+
+int pin_LAME1 = 5;
+int pin_LAME2 = 6;
+int pin_LAME3 = 2;
+int pin_LAME4 = 3;
+
+int lame = 0;
+char packetBuffer[32];	// Où sont stockés les données reçues.x
+char ReplyBuffer[] = " OK "; // Réponse de l'arduino
+int demande = 0;
+
+EthernetUDP Udp;
+
+void setup() {
+	Ethernet.begin(mac,ip); // Initialise le shield ethernet
+	Udp.begin(localPort); // Initialise la communication UDP
+	Serial.begin(9600);
+	pinMode(pin_LAME1, OUTPUT);
+	pinMode(pin_LAME2, OUTPUT);
+	pinMode(pin_LAME3, OUTPUT);
+	pinMode(pin_LAME4, OUTPUT);
+	pin_LAME1 = LOW;
+	pin_LAME2 = LOW;
+	pin_LAME3 = LOW;
+	pin_LAME4 = LOW;
+}
+
+void loop() {
+	int packetSize = Udp.parsePacket();
+	if(packetSize) { // Si il y a un paquet
+		Udp.read(packetBuffer,32); // le lire
+		lame = packetBuffer[4]-'0'; // et convertir le 5e caractére en chiffre (char -> int)
+		switch (lame) {
+			case 1:
+				pin_LAME1 = HIGH;
+				Serial.println("Active la lame 1");
+				delay(1000);
+				pin_LAME1 = LOW;
+				break;
+			case 2:
+				pin_LAME2 = HIGH;
+				Serial.println("Active la lame 2");
+				delay(1000);
+				pin_LAME2 = LOW;
+				break;
+			case 3:
+				pin_LAME3 = HIGH;
+				Serial.println("Active la lame 3");
+				delay(1000);
+				pin_LAME3 = LOW;
+				break;
+			case 4:
+				pin_LAME4 = HIGH;
+				Serial.println("Active la lame 4");
+				delay(1000);
+				pin_LAME4 = LOW;
+				break;
+		}
+		Udp.beginPacket(Udp.remoteIP(), 9694);
+		Udp.write(ReplyBuffer);
+		Udp.endPacket();
+	}
+	delay(10);
+}


Successfully contacted acm-web

Successfully contacted acm-web

error: pathspec 'Documentation/unit' did not match any file(s) known to git
error: pathspec 'tests/ciao_test/ciao_test.ino' did not match any file(s) known to git


Edited multiserial sketch to be in a proper folder and also use the newer GEVCU4 values.

error: pathspec 'util/MultiSerial/MultiSerial.ino' did not match any file(s) known to git

--- util/MultiSerial/MultiSerial.ino
+++ util/MultiSerial/MultiSerial.ino
@@ -0,0 +1,53 @@
+/*
+ Transmit serial data back and forth between two ports
+ in order to flash new firmware to ichip with the ichip config tool.
+
+ Note: Steps 1-5 have to be completed within 30 seconds (30000ms)
+
+ Steps:
+ 1) reset arduino (e.g. power cycle)
+ 2) start ichip software
+ 3) menu "serial ports", select com port of ardiuno, set baud rate to 9600
+ 4) click on "ichip uploader via serial"
+ 5) select EBI flash 16 Megabit (if window doesn't appear, start over, act faster)
+ 6) Click FW Update, select .imf file and wait until finished, close ichip program
+ 7) power cycle arduino/gevcu and wait 20-30sec
+ 8) menu "serial ports", set baud rate to 115200
+ 9) go to configuration page
+
+ check-out http://www.youtube.com/watch?v=vS60htz6h1g at 00:35:00
+
+ */
+
+bool flag = true;
+void setup() {
+	SerialUSB.begin(9600); // use SerialUSB only as the programming port doesn't work
+	Serial2.begin(9600); // use Serial3 for GEVCU2, use Serial2 for GEVCU3+4
+//	pinMode(43, INPUT);
+}
+
+void loop() {
+	while (Serial2.available()) {
+		SerialUSB.write(Serial2.read());
+	}
+	while (SerialUSB.available()) {
+		Serial2.write(SerialUSB.read());
+	}
+
+	/*if (flag && millis() > 30000) {
+		SerialUSB.begin(115200);
+		Serial2.begin(115200);
+		flag = false;
+	}*/
+}
+
+    /*"FD"
+    "BDRA"
+    "WLCH=1
+    "WLSI=!GEVCU"
+    "DIP=192.168.3.10"
+    "DPSZ=10"
+    "RPG=secret"
+    "WPWD=secret"
+    "AWS=1"
+    "DOWN" */


attiny85 wdt sleep

attiny85 wdt sleep

error: pathspec '_24-attiny85-wdt-sleep/_24-attiny85-wdt-sleep.ino' did not match any file(s) known to git

--- _24-attiny85-wdt-sleep/_24-attiny85-wdt-sleep.ino
+++ _24-attiny85-wdt-sleep/_24-attiny85-wdt-sleep.ino
@@ -0,0 +1,32 @@
+// Using low poer for attiny85
+// https://github.com/johnnie502/Low-Power
+#include <LowPower.h>
+#include <avr/interrupt.h>
+#include <avr/sleep.h>
+
+void setup() {
+  pinMode(3, OUTPUT);
+  for (int k = 0; k < 10; k = k + 1) {
+    if (k % 2 == 0) {
+      digitalWrite(3, HIGH);
+    }
+    else {
+      digitalWrite(3, LOW);
+    }
+    delay(250);
+  }
+}
+
+void loop() {
+  sleep16seconds();
+  digitalWrite(3, HIGH);
+  delay(1000);
+  digitalWrite(3, LOW);
+}
+
+
+void sleep16seconds() {
+  for (int i = 0; i < 2; i++) {
+     LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
+  }
+}


Programming Test 1 initial upload

Programming Test 1 initial upload

error: pathspec 'ProgramingTest1/ProgramingTest1.ino' did not match any file(s) known to git

--- ProgramingTest1/ProgramingTest1.ino
+++ ProgramingTest1/ProgramingTest1.ino
@@ -0,0 +1,32 @@
+#include <Servo.h>
+
+#define MAX_SIGNAL 2000
+#define MIN_SIGNAL 700
+#define MOTOR_PIN 9
+
+Servo motor;
+
+void setup() {
+  Serial.begin(9600);
+  Serial.println("Program begin...");
+  Serial.println("This program will calibrate the ESC.");
+
+  motor.attach(MOTOR_PIN);
+
+  Serial.println("Now writing maximum output.");
+  Serial.println("Turn on power source, then wait 2 seconds and press any key.");
+  motor.writeMicroseconds(MAX_SIGNAL);
+
+  // Wait for input
+  while (!Serial.available());
+  Serial.read();
+
+  // Send min output
+  Serial.println("Sending minimum output");
+  motor.writeMicroseconds(MIN_SIGNAL);
+
+}
+
+void loop() {
+
+}


Update masterCode.ino

Update masterCode.ino

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/lolisa/2014-15.git/'


added goomba

added goomba

error: pathspec 'PixelViews/Goomba/Goomba.ino' did not match any file(s) known to git

--- PixelViews/Goomba/Goomba.ino
+++ PixelViews/Goomba/Goomba.ino
@@ -0,0 +1,81 @@
+#include <FastLED.h>
+
+#define LED_PIN     5
+#define COLOR_ORDER GRB
+#define CHIPSET     WS2811
+#define BRIGHTNESS  200
+
+const uint8_t kMatrixWidth = 20;
+const uint8_t kMatrixHeight = 10;
+const bool    kMatrixSerpentineLayout = false;
+
+uint16_t XY( uint8_t x, uint8_t y)
+{
+  uint16_t i;
+
+  if( kMatrixSerpentineLayout == false) {
+    i = (y * kMatrixWidth) + x;
+  }
+
+  if( kMatrixSerpentineLayout == true) {
+    if( y & 0x01) {
+      // Odd rows run backwards
+      uint8_t reverseX = (kMatrixWidth - 1) - x;
+      i = (y * kMatrixWidth) + reverseX;
+    } else {
+      // Even rows run forwards
+      i = (y * kMatrixWidth) + x;
+    }
+  }
+
+  return i;
+}
+
+#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
+CRGB leds_plus_safety_pixel[ NUM_LEDS + 1];
+CRGB* const leds( leds_plus_safety_pixel + 1);
+
+uint16_t XYsafe( uint8_t x, uint8_t y)
+{
+  if( x >= kMatrixWidth) return -1;
+  if( y >= kMatrixHeight) return -1;
+  return XY(x,y);
+}
+
+// Demo that USES "XY" follows code below
+
+void loop()
+{
+//  FastLED.show();
+//  FastLED.setBrightness(BRIGHTNESS);
+}
+
+void set_led_rgb(int x, int y, int r, int g, int b)
+{
+  leds[ XY(x, y) ] = CRGB( r, g, b );
+}
+
+void ShowGoomba()
+{
+  // Shows a Goomba, see https://raw.githubusercontent.com/cbries/rgbwall/master/Photos,%20Images,%20Videos/Goomba01.jpg
+  set_led_rgb(0, 0, 13, 9, 7);  set_led_rgb(1, 0, 13, 5, 0);  set_led_rgb(2, 0, 8, 3, 0); set_led_rgb(3, 0, 5, 2, 1); set_led_rgb(4, 0, 5, 4, 4); set_led_rgb(5, 0, 7, 3, 0); set_led_rgb(6, 0, 10, 4, 0);  set_led_rgb(7, 0, 13, 5, 0);  set_led_rgb(8, 0, 13, 5, 0);  set_led_rgb(9, 0, 13, 5, 0);  set_led_rgb(10, 0, 13, 5, 0); set_led_rgb(11, 0, 13, 5, 0); set_led_rgb(12, 0, 11, 4, 0); set_led_rgb(13, 0, 8, 3, 0);  set_led_rgb(14, 0, 5, 4, 4);  set_led_rgb(15, 0, 5, 3, 1);  set_led_rgb(16, 0, 7, 2, 0);  set_led_rgb(17, 0, 13, 5, 0); set_led_rgb(18, 0, 13, 8, 5); set_led_rgb(19, 0, 14, 11, 10);
+  set_led_rgb(0, 1, 13, 5, 0);  set_led_rgb(1, 1, 13, 5, 0);  set_led_rgb(2, 1, 13, 5, 0);  set_led_rgb(3, 1, 13, 6, 2);  set_led_rgb(4, 1, 13, 12, 10);  set_led_rgb(5, 1, 2, 2, 2); set_led_rgb(6, 1, 5, 2, 0); set_led_rgb(7, 1, 13, 5, 0);  set_led_rgb(8, 1, 13, 5, 0);  set_led_rgb(9, 1, 13, 5, 0);  set_led_rgb(10, 1, 13, 5, 0); set_led_rgb(11, 1, 13, 5, 0); set_led_rgb(12, 1, 7, 3, 0);  set_led_rgb(13, 1, 0, 0, 0);  set_led_rgb(14, 1, 13, 12, 9);  set_led_rgb(15, 1, 13, 8, 4); set_led_rgb(16, 1, 13, 5, 0); set_led_rgb(17, 1, 13, 5, 0); set_led_rgb(18, 1, 13, 5, 0); set_led_rgb(19, 1, 13, 6, 1);
+  set_led_rgb(0, 2, 13, 5, 0);  set_led_rgb(1, 2, 13, 5, 0);  set_led_rgb(2, 2, 13, 5, 0);  set_led_rgb(3, 2, 13, 6, 2);  set_led_rgb(4, 2, 13, 12, 10);  set_led_rgb(5, 2, 2, 2, 2); set_led_rgb(6, 2, 0, 0, 0); set_led_rgb(7, 2, 0, 0, 0); set_led_rgb(8, 2, 0, 0, 0); set_led_rgb(9, 2, 0, 0, 0); set_led_rgb(10, 2, 0, 0, 0);  set_led_rgb(11, 2, 0, 0, 0);  set_led_rgb(12, 2, 0, 0, 0);  set_led_rgb(13, 2, 0, 0, 0);  set_led_rgb(14, 2, 13, 12, 9);  set_led_rgb(15, 2, 13, 8, 4); set_led_rgb(16, 2, 13, 5, 0); set_led_rgb(17, 2, 13, 5, 0); set_led_rgb(18, 2, 13, 5, 0); set_led_rgb(19, 2, 13, 6, 2);
+  set_led_rgb(0, 3, 13, 5, 0);  set_led_rgb(1, 3, 13, 5, 0);  set_led_rgb(2, 3, 13, 5, 0);  set_led_rgb(3, 3, 13, 6, 2);  set_led_rgb(4, 3, 13, 12, 10);  set_led_rgb(5, 3, 2, 2, 2); set_led_rgb(6, 3, 2, 1, 1); set_led_rgb(7, 3, 5, 4, 4); set_led_rgb(8, 3, 7, 3, 0); set_led_rgb(9, 3, 8, 3, 0); set_led_rgb(10, 3, 8, 3, 0);  set_led_rgb(11, 3, 5, 4, 4);  set_led_rgb(12, 3, 3, 2, 2);  set_led_rgb(13, 3, 0, 0, 0);  set_led_rgb(14, 3, 13, 12, 9);  set_led_rgb(15, 3, 13, 8, 4); set_led_rgb(16, 3, 13, 5, 0); set_led_rgb(17, 3, 13, 5, 0); set_led_rgb(18, 3, 13, 5, 0); set_led_rgb(19, 3, 13, 5, 0);
+  set_led_rgb(0, 4, 13, 5, 0);  set_led_rgb(1, 4, 13, 5, 0);  set_led_rgb(2, 4, 13, 5, 0);  set_led_rgb(3, 4, 13, 6, 2);  set_led_rgb(4, 4, 13, 12, 10);  set_led_rgb(5, 4, 2, 2, 2); set_led_rgb(6, 4, 5, 4, 4); set_led_rgb(7, 4, 13, 12, 10);  set_led_rgb(8, 4, 13, 5, 0);  set_led_rgb(9, 4, 13, 5, 0);  set_led_rgb(10, 4, 13, 5, 0); set_led_rgb(11, 4, 13, 12, 10); set_led_rgb(12, 4, 8, 7, 6);  set_led_rgb(13, 4, 0, 0, 0);  set_led_rgb(14, 4, 13, 12, 9);  set_led_rgb(15, 4, 13, 8, 4); set_led_rgb(16, 4, 13, 5, 0); set_led_rgb(17, 4, 13, 5, 0); set_led_rgb(18, 4, 13, 5, 0); set_led_rgb(19, 4, 13, 5, 0);
+  set_led_rgb(0, 5, 13, 5, 0);  set_led_rgb(1, 5, 13, 5, 0);  set_led_rgb(2, 5, 13, 5, 0);  set_led_rgb(3, 5, 13, 6, 2);  set_led_rgb(4, 5, 13, 12, 10);  set_led_rgb(5, 5, 13, 12, 10);  set_led_rgb(6, 5, 13, 12, 10);  set_led_rgb(7, 5, 13, 11, 10);  set_led_rgb(8, 5, 13, 5, 0);  set_led_rgb(9, 5, 13, 5, 0);  set_led_rgb(10, 5, 13, 5, 0); set_led_rgb(11, 5, 13, 12, 10); set_led_rgb(12, 5, 13, 12, 10); set_led_rgb(13, 5, 13, 12, 10); set_led_rgb(14, 5, 13, 12, 9);  set_led_rgb(15, 5, 13, 8, 4); set_led_rgb(16, 5, 13, 5, 0); set_led_rgb(17, 5, 13, 5, 0); set_led_rgb(18, 5, 13, 5, 0); set_led_rgb(19, 5, 13, 5, 0);
+  set_led_rgb(0, 6, 13, 5, 0);  set_led_rgb(1, 6, 13, 5, 0);  set_led_rgb(2, 6, 13, 5, 0);  set_led_rgb(3, 6, 13, 5, 1);  set_led_rgb(4, 6, 13, 8, 4);  set_led_rgb(5, 6, 13, 8, 4);  set_led_rgb(6, 6, 13, 8, 4);  set_led_rgb(7, 6, 13, 8, 4);  set_led_rgb(8, 6, 13, 5, 0);  set_led_rgb(9, 6, 13, 5, 0);  set_led_rgb(10, 6, 13, 5, 0); set_led_rgb(11, 6, 13, 8, 4); set_led_rgb(12, 6, 13, 8, 4); set_led_rgb(13, 6, 13, 8, 4); set_led_rgb(14, 6, 13, 8, 4); set_led_rgb(15, 6, 13, 6, 2); set_led_rgb(16, 6, 13, 5, 0); set_led_rgb(17, 6, 13, 5, 0); set_led_rgb(18, 6, 13, 5, 0); set_led_rgb(19, 6, 13, 5, 0);
+  set_led_rgb(0, 7, 13, 5, 0);  set_led_rgb(1, 7, 13, 5, 0);  set_led_rgb(2, 7, 13, 5, 0);  set_led_rgb(3, 7, 13, 5, 0);  set_led_rgb(4, 7, 13, 5, 0);  set_led_rgb(5, 7, 13, 5, 0);  set_led_rgb(6, 7, 13, 5, 0);  set_led_rgb(7, 7, 13, 5, 0);  set_led_rgb(8, 7, 13, 5, 0);  set_led_rgb(9, 7, 13, 5, 0);  set_led_rgb(10, 7, 13, 5, 0); set_led_rgb(11, 7, 13, 5, 0); set_led_rgb(12, 7, 13, 5, 0); set_led_rgb(13, 7, 13, 5, 0); set_led_rgb(14, 7, 13, 5, 0); set_led_rgb(15, 7, 13, 5, 0); set_led_rgb(16, 7, 13, 5, 0); set_led_rgb(17, 7, 13, 5, 0); set_led_rgb(18, 7, 13, 5, 0); set_led_rgb(19, 7, 13, 5, 0);
+  set_led_rgb(0, 8, 13, 5, 0);  set_led_rgb(1, 8, 13, 5, 0);  set_led_rgb(2, 8, 13, 5, 0);  set_led_rgb(3, 8, 13, 5, 0);  set_led_rgb(4, 8, 13, 5, 0);  set_led_rgb(5, 8, 13, 9, 6);  set_led_rgb(6, 8, 13, 12, 10);  set_led_rgb(7, 8, 13, 12, 10);  set_led_rgb(8, 8, 13, 12, 10);  set_led_rgb(9, 8, 13, 12, 10);  set_led_rgb(10, 8, 13, 12, 10); set_led_rgb(11, 8, 13, 12, 10); set_led_rgb(12, 8, 13, 12, 10); set_led_rgb(13, 8, 13, 10, 8);  set_led_rgb(14, 8, 13, 5, 0); set_led_rgb(15, 8, 13, 5, 0); set_led_rgb(16, 8, 13, 5, 0); set_led_rgb(17, 8, 13, 5, 0); set_led_rgb(18, 8, 13, 5, 0); set_led_rgb(19, 8, 13, 6, 2);
+  set_led_rgb(0, 9, 14, 11, 8); set_led_rgb(1, 9, 14, 11, 9); set_led_rgb(2, 9, 14, 11, 9); set_led_rgb(3, 9, 13, 10, 7); set_led_rgb(4, 9, 13, 9, 6);  set_led_rgb(5, 9, 13, 11, 8); set_led_rgb(6, 9, 13, 12, 10);  set_led_rgb(7, 9, 13, 12, 10);  set_led_rgb(8, 9, 13, 12, 10);  set_led_rgb(9, 9, 13, 12, 10);  set_led_rgb(10, 9, 13, 12, 10); set_led_rgb(11, 9, 13, 12, 10); set_led_rgb(12, 9, 13, 12, 10); set_led_rgb(13, 9, 13, 11, 9);  set_led_rgb(14, 9, 13, 9, 6); set_led_rgb(15, 9, 14, 10, 7);  set_led_rgb(16, 9, 14, 11, 9);  set_led_rgb(17, 9, 14, 11, 9);  set_led_rgb(18, 9, 14, 11, 9);  set_led_rgb(19, 9, 14, 11, 9);
+}
+
+void setup() {
+  // LEDColorCorrection { TypicalSMD5050 =0xFFB0F0, TypicalLEDStrip =0xFFB0F0, Typical8mmPixel =0xFFE08C, TypicalPixelString =0xFFE08C, UncorrectedColor =0xFFFFFF }
+  FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(UncorrectedColor);
+  FastLED.setBrightness( BRIGHTNESS );
+
+  ShowGoomba();
+  FastLED.show();
+  FastLED.setBrightness(BRIGHTNESS);
+}


Potentiometer drive with Arduino

Potentiometer drive with Arduino

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/orhaneee/iot-robotarm.git/'


finish TODO; do tuning

finish TODO; do tuning

error: pathspec 'exploration' did not match any file(s) known to git
error: pathspec 'testing/src/main.ino' did not match any file(s) known to git


different brake for rotation & goAhead

different brake for rotation & goAhead


catch sneaky CRC errors

catch sneaky CRC errors

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/wsnook/farm.git/'


more changes

more changes

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/markwatneyy/ttt_arduino.git/'


New sketch DT_BlinkLightArray

New sketch DT_BlinkLightArray

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/DavidTangye/sketchbook.git/'


Sender file for one way communication between two arduinos

error: pathspec 'arduino/RF_send.ino' did not match any file(s) known to git

--- arduino/RF_send.ino
+++ arduino/RF_send.ino
@@ -0,0 +1,44 @@
+#include <SPI.h>
+#include "RF24.h"
+
+RF24 myRadio (7, 8);
+byte addresses[][6] = {"0"};
+
+struct package
+{
+  int id=1;
+  float temperature = 18.3;
+  char  text[100] = "Text to be transmitted";
+};
+
+
+typedef struct package Package;
+Package data;
+
+
+void setup()
+{
+  Serial.begin(115200);
+  delay(1000);
+  myRadio.begin();
+  myRadio.setChannel(115);
+  myRadio.setPALevel(RF24_PA_MAX);
+  myRadio.setDataRate( RF24_250KBPS ) ;
+  myRadio.openWritingPipe( addresses[0]);
+  delay(1000);
+}
+
+void loop()
+{
+  myRadio.write(&data, sizeof(data));
+
+  Serial.print("\nPackage:");
+  Serial.print(data.id);
+  Serial.print("\n");
+  Serial.println(data.temperature);
+  Serial.println(data.text);
+  data.id = data.id + 1;
+  data.temperature = data.temperature+0.1;
+  delay(1000);
+
+}


sending sms with location

sending sms with location

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/werar/iothome.git/'


Add simple sketch to test Ultrasonic sensor

error: pathspec 'Arduino/libraries/UA_Sensors/examples/BasicUltrasonic/BasicUltrasonic.ino' did not match any file(s) known to git

--- Arduino/libraries/UA_Sensors/examples/BasicUltrasonic/BasicUltrasonic.ino
+++ Arduino/libraries/UA_Sensors/examples/BasicUltrasonic/BasicUltrasonic.ino
@@ -0,0 +1,21 @@
+/*
+  Test Ultrasonic sensor readings
+
+  Created 2 7 2014
+  Modified 2 7 2014
+*/
+
+// Ultrasonic sensor settings
+const byte ULTRASONIC_PIN = A6;
+
+void setup()
+{
+  Serial.begin(9600);
+}
+
+
+void loop()
+{
+  Serial.println(analogRead(ULTRASONIC_PIN));
+  delay(1000);
+}


AES dcumentation

AES dcumentation

Signed-off-by: Edi Permadi <163b49ac0c44ca5b49677bf42f3f8680b3bd9867@gmail.com>

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/edipermadi/teensy-hsm.git/'


Cosmetic

Cosmetic

Signed-off-by: Edi Permadi <163b49ac0c44ca5b49677bf42f3f8680b3bd9867@gmail.com>


successfully tested

successfully tested

error: pathspec 'unit' did not match any file(s) known to git
error: pathspec 'tests/checksum_test/checksum_test.ino' did not match any file(s) known to git


Added Version 2 using Arduino Mega and LCD display

error: pathspec 'mwsLRWHFv2/mwsLRWHFv2.ino' did not match any file(s) known to git

--- mwsLRWHFv2/mwsLRWHFv2.ino
+++ mwsLRWHFv2/mwsLRWHFv2.ino
@@ -0,0 +1,618 @@
+/*
+ Weather Shield Example
+ By: Nathan Seidle
+ SparkFun Electronics
+ Date: November 16th, 2013
+ License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).
+
+ Much of this is based on Mike Grusin's USB Weather Board code: https://www.sparkfun.com/products/10586
+
+ This code reads all the various sensors (wind speed, direction, rain gauge, humidty, pressure, light, batt_lvl)
+ and reports it over the serial comm port. This can be easily routed to an datalogger (such as OpenLog) or
+ a wireless transmitter (such as Electric Imp).
+
+ Measurements are reported once a second but windspeed and rain gauge are tied to interrupts that are
+ calcualted at each report.
+
+ This example code assumes the GP-635T GPS module is attached.
+
+ */
+
+#include <Wire.h> //I2C needed for sensors
+#include "MPL3115A2.h" //Pressure sensor
+#include "HTU21D.h" //Humidity sensor
+#include <SoftwareSerial.h> //Needed for GPS
+#include <TinyGPS++.h> //GPS parsing
+#include <LiquidCrystal_I2C.h>//16x2 LCD library
+//It requires using fm's LiquidCrystal library replacement:
+//https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
+
+//This is for the 16x2 LCD
+LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
+
+//this is for RTC
+int clockAddress = 0x68;  // This is the I2C address
+int command = 0;  // This is the command char, in ascii form, sent from the serial port
+long previousMillis = 0;  // will store last time Temp was updated
+byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
+
+byte decToBcd(byte val)
+{
+  return ( (val/10*16) + (val%10) );
+}
+
+// Convert binary coded decimal to normal decimal numbers
+byte bcdToDec(byte val)
+{
+  return ( (val/16*10) + (val%16) );
+}
+
+// Gets the date and time from the ds1307 and prints result
+char* getDateDs1307(int flag) {
+  //if flag == 0 : date output
+  //if flag == 1 : time output
+  // Reset the register pointer
+  Wire.beginTransmission(clockAddress);
+  Wire.write(byte(0x00));
+  Wire.endTransmission();
+
+  Wire.requestFrom(clockAddress, 7);
+
+  // A few of these need masks because certain bits are control bits
+  second     = bcdToDec(Wire.read() & 0x7f);
+  minute     = bcdToDec(Wire.read());
+
+  // Need to change this if 12 hour am/pm
+  hour       = bcdToDec(Wire.read() & 0x3f);
+  dayOfWeek  = bcdToDec(Wire.read());
+  dayOfMonth = bcdToDec(Wire.read());
+  month      = bcdToDec(Wire.read());
+  year       = bcdToDec(Wire.read());
+
+  char sza[32];
+  if (flag==0)
+    sprintf(sza, "%02d-%02d-%02d",year,month,dayOfMonth);
+  if (flag==1)
+    sprintf(sza, "%02d:%02d:%02d",hour,minute,second);
+  return(sza);
+}
+//end of RTC
+
+
+TinyGPSPlus gps;
+
+static const int RXPin = 5, TXPin = 4; //GPS is attached to pin 4(TX from GPS) and pin 5(RX into GPS)
+SoftwareSerial ss(RXPin, TXPin);
+
+MPL3115A2 myPressure; //Create an instance of the pressure sensor
+HTU21D myHumidity; //Create an instance of the humidity sensor
+
+//Hardware pin definitions
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// digital I/O pins
+const byte WSPEED = 3;
+const byte RAIN = 2;
+const byte STAT1 = 7;
+const byte STAT2 = 8;
+const byte GPS_PWRCTL = 6; //Pulling this pin low puts GPS to sleep but maintains RTC and RAM
+
+// analog I/O pins
+const byte REFERENCE_3V3 = A3;
+const byte LIGHT = A1;
+const byte BATT = A2;
+const byte WDIR = A0;
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+//Global Variables
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+long lastSecond; //The millis counter to see when a second rolls by
+byte seconds; //When it hits 60, increase the current minute
+byte seconds_2m; //Keeps track of the "wind speed/dir avg" over last 2 minutes array of data
+byte minutes; //Keeps track of where we are in various arrays of data
+byte minutes_10m; //Keeps track of where we are in wind gust/dir over last 10 minutes array of data
+
+long lastWindCheck = 0;
+volatile long lastWindIRQ = 0;
+volatile byte windClicks = 0;
+
+//We need to keep track of the following variables:
+//Wind speed/dir each update (no storage)
+//Wind gust/dir over the day (no storage)
+//Wind speed/dir, avg over 2 minutes (store 1 per second)
+//Wind gust/dir over last 10 minutes (store 1 per minute)
+//Rain over the past hour (store 1 per minute)
+//Total rain over date (store one per day)
+
+byte windspdavg[120]; //120 bytes to keep track of 2 minute average
+int winddiravg[120]; //120 ints to keep track of 2 minute average
+float windgust_10m[10]; //10 floats to keep track of 10 minute max
+int windgustdirection_10m[10]; //10 ints to keep track of 10 minute max
+volatile float rainHour[60]; //60 floating numbers to keep track of 60 minutes of rain
+
+//These are all the weather values that wunderground expects:
+int winddir = 0; // [0-360 instantaneous wind direction]
+float windspeedms = 0; // [mph instantaneous wind speed]
+float windgustms = 0; // [mph current wind gust, using software specific time period]
+int windgustdir = 0; // [0-360 using software specific time period]
+float windspdms_avg2m = 0; // [mph 2 minute average wind speed mph]
+int winddir_avg2m = 0; // [0-360 2 minute average wind direction]
+float windgustms_10m = 0; // [mph past 10 minutes wind gust mph ]
+int windgustdir_10m = 0; // [0-360 past 10 minutes wind gust direction]
+float humidity = 0; // [%]
+float tempf = 0; // [temperature F]
+float rainin = 0; // [rain inches over the past hour)] -- the accumulated rainfall in the past 60 min
+volatile float dailyrainin = 0; // [rain inches so far today in local time]
+//float baromin = 30.03;// [barom in] - It's hard to calculate baromin locally, do this in the agent
+float pressure = 0;
+//float dewptf; // [dewpoint F] - It's hard to calculate dewpoint locally, do this in the agent
+
+float batt_lvl = 11.8; //[analog value from 0 to 1023]
+float light_lvl = 455; //[analog value from 0 to 1023]
+//Rain time stamp
+int Rainindi=0;
+//Variables used for GPS
+//float flat, flon; // 39.015024 -102.283608686
+//unsigned long age;
+//int year;
+//byte month, day, hour, minute, second, hundredths;
+
+// volatiles are subject to modification by IRQs
+volatile unsigned long raintime, rainlast, raininterval, rain, Rainindinter, Rainindtime, Rainindlast;
+
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+//Interrupt routines (these are called by the hardware interrupts, not by the main code)
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void rainIRQ()
+// Count rain gauge bucket tips as they occur
+// Activated by the magnet and reed switch in the rain gauge, attached to input D2
+{
+  raintime = millis(); // grab current time
+  raininterval = raintime - rainlast; // calculate interval between this and last event
+
+    if (raininterval > 10) // ignore switch-bounce glitches less than 10mS after initial edge
+  {
+    dailyrainin += 0.011*25.4; //Each dump is 0.011" of water
+    rainHour[minutes] += 0.011*25.4; //Increase this minute's amount of rain
+
+    rainlast = raintime; // set up for next event
+  }
+
+  //Rain or not (1 or 0)
+  if(rainin >0)
+  {
+    Rainindi=1;
+    Rainindtime = millis();
+  }
+  if(rainin ==0)
+  {
+   Rainindi=0;
+   Rainindlast = millis();
+   Rainindlast = Rainindtime;
+  }
+  Rainindinter = Rainindlast - Rainindtime;
+
+}
+
+void wspeedIRQ()
+// Activated by the magnet in the anemometer (2 ticks per rotation), attached to input D3
+{
+  if (millis() - lastWindIRQ > 10) // Ignore switch-bounce glitches less than 10ms (142MPH max reading) after the reed switch closes
+  {
+    lastWindIRQ = millis(); //Grab the current time
+    windClicks++; //There is 1.492MPH for each click per second.
+  }
+
+}
+
+
+void setup()
+{
+  Serial.begin(9600);
+
+  // set up the LCD's number of columns and rows:
+  lcd.begin(16, 2);
+  lcd.backlight();
+
+  ss.begin(9600); //Begin listening to GPS over software serial at 9600. This should be the default baud of the module.
+  Serial.print(F("lon,lat,altitude,sats,date,GMTtime,RTCdate,RTCtime,winddir"));
+  Serial.print(F(",windspeedms,windgustms,windgustdir,windspdms_avg2m,winddir_avg2m,windgustms_10m,windgustdir_10m"));
+  Serial.print(F(",humidity,tempc,rainhourmm,raindailymm,rainindicate,rainduration,pressure,batt_lvl,light_lvl"));
+
+  pinMode(STAT1, OUTPUT); //Status LED Blue
+  pinMode(STAT2, OUTPUT); //Status LED Green
+
+  pinMode(GPS_PWRCTL, OUTPUT);
+  digitalWrite(GPS_PWRCTL, HIGH); //Pulling this pin low puts GPS to sleep but maintains RTC and RAM
+
+  pinMode(WSPEED, INPUT_PULLUP); // input from wind meters windspeed sensor
+  pinMode(RAIN, INPUT_PULLUP); // input from wind meters rain gauge sensor
+
+  pinMode(REFERENCE_3V3, INPUT);
+  pinMode(LIGHT, INPUT);
+
+  //Configure the pressure sensor
+  myPressure.begin(); // Get sensor online
+  myPressure.setModeBarometer(); // Measure pressure in Pascals from 20 to 110 kPa
+  myPressure.setOversampleRate(7); // Set Oversample to the recommended 128
+  myPressure.enableEventFlags(); // Enable all three pressure and temp event flags
+
+  //Configure the humidity sensor
+  myHumidity.begin();
+
+  seconds = 0;
+  lastSecond = millis();
+
+  // attach external interrupt pins to IRQ functions
+  attachInterrupt(0, rainIRQ, FALLING);
+  attachInterrupt(1, wspeedIRQ, FALLING);
+
+  // turn on interrupts
+  interrupts();
+
+  //Serial.println("Weather Shield online!");
+
+}
+
+void loop()
+{
+  //Keep track of which minute it is
+  if(millis() - lastSecond >= 1000)
+  {
+    digitalWrite(STAT1, HIGH); //Blink stat LED
+
+    lastSecond += 1000;
+
+    //Take a speed and direction reading every second for 2 minute average
+    if(++seconds_2m > 119) seconds_2m = 0;
+
+    //Calc the wind speed and direction every second for 120 second to get 2 minute average
+    float currentSpeed = get_wind_speed();
+    //float currentSpeed = random(5); //For testing
+    int currentDirection = get_wind_direction();
+    windspdavg[seconds_2m] = (int)currentSpeed;
+    winddiravg[seconds_2m] = currentDirection;
+    //if(seconds_2m % 10 == 0) displayArrays(); //For testing
+
+    //Check to see if this is a gust for the minute
+    if(currentSpeed > windgust_10m[minutes_10m])
+    {
+      windgust_10m[minutes_10m] = currentSpeed;
+      windgustdirection_10m[minutes_10m] = currentDirection;
+    }
+
+    //Check to see if this is a gust for the day
+    if(currentSpeed > windgustms)
+    {
+      windgustms = currentSpeed;
+      windgustdir = currentDirection;
+    }
+
+    if(++seconds > 59)
+    {
+      seconds = 0;
+
+      if(++minutes > 59) minutes = 0;
+      if(++minutes_10m > 9) minutes_10m = 0;
+
+      rainHour[minutes] = 0; //Zero out this minute's rainfall amount
+      windgust_10m[minutes_10m] = 0; //Zero out this minute's gust
+    }
+
+    //Report all readings every second
+    printWeather();
+
+    digitalWrite(STAT1, LOW); //Turn off stat LED
+  }
+
+  smartdelay(800); //Wait 1 second, and gather GPS data
+}
+
+//While we delay for a given amount of time, gather GPS data
+static void smartdelay(unsigned long ms)
+{
+  unsigned long start = millis();
+  do
+  {
+    while (ss.available())
+      gps.encode(ss.read());
+  } while (millis() - start < ms);
+}
+
+
+//Calculates each of the variables that wunderground is expecting
+void calcWeather()
+{
+  //Calc winddir
+  winddir = get_wind_direction();
+
+  //Calc windspeed
+  windspeedms = get_wind_speed();
+
+  //Calc windgustms
+  //Calc windgustdir
+  //Report the largest windgust today
+  windgustms = 0;
+  windgustdir = 0;
+
+  //Calc windspdms_avg2m
+  float temp = 0;
+  for(int i = 0 ; i < 120 ; i++)
+    temp += windspdavg[i];
+  temp /= 120.0;
+  windspdms_avg2m = temp;
+
+  //Calc winddir_avg2m
+  temp = 0; //Can't use winddir_avg2m because it's an int
+  for(int i = 0 ; i < 120 ; i++)
+    temp += winddiravg[i];
+  temp /= 120;
+  winddir_avg2m = temp;
+
+  //Calc windgustms_10m
+  //Calc windgustdir_10m
+  //Find the largest windgust in the last 10 minutes
+  windgustms_10m = 0;
+  windgustdir_10m = 0;
+  //Step through the 10 minutes
+  for(int i = 0; i < 10 ; i++)
+  {
+    if(windgust_10m[i] > windgustms_10m)
+    {
+      windgustms_10m = windgust_10m[i];
+      windgustdir_10m = windgustdirection_10m[i];
+    }
+  }
+
+  //Calc humidity
+  humidity = myHumidity.readHumidity();
+  //float temp_h = myHumidity.readTemperature();
+  //Serial.print(" TempH:");
+  //Serial.print(temp_h, 2);
+
+  //Calc tempf from pressure sensor
+  tempf = myPressure.readTemp();
+  //Serial.print(" TempP:");
+  //Serial.print(tempf, 2);
+
+  //Total rainfall for the day is calculated within the interrupt
+  //Calculate amount of rainfall for the last 60 minutes
+  rainin = 0;
+  for(int i = 0 ; i < 60 ; i++)
+    rainin += rainHour[i];
+
+  //Calc pressure
+  pressure = myPressure.readPressure();
+
+  //Calc dewptf
+
+  //Calc light level
+  light_lvl = get_light_level();
+
+  //Calc battery level
+  batt_lvl = get_battery_level();
+
+}
+
+//Returns the voltage of the light sensor based on the 3.3V rail
+//This allows us to ignore what VCC might be (an Arduino plugged into USB has VCC of 4.5 to 5.2V)
+float get_light_level()
+{
+  float operatingVoltage = analogRead(REFERENCE_3V3);
+
+  float lightSensor = analogRead(LIGHT);
+
+  operatingVoltage = 3.3 / operatingVoltage; //The reference voltage is 3.3V
+
+  lightSensor = operatingVoltage * lightSensor;
+
+  return(lightSensor);
+}
+
+//Returns the voltage of the raw pin based on the 3.3V rail
+//This allows us to ignore what VCC might be (an Arduino plugged into USB has VCC of 4.5 to 5.2V)
+//Battery level is connected to the RAW pin on Arduino and is fed through two 5% resistors:
+//3.9K on the high side (R1), and 1K on the low side (R2)
+float get_battery_level()
+{
+  float operatingVoltage = analogRead(REFERENCE_3V3);
+
+  float rawVoltage = analogRead(BATT);
+
+  operatingVoltage = 3.30 / operatingVoltage; //The reference voltage is 3.3V
+
+  rawVoltage = operatingVoltage * rawVoltage; //Convert the 0 to 1023 int to actual voltage on BATT pin
+
+  rawVoltage *= 4.90; //(3.9k+1k)/1k - multiple BATT voltage by the voltage divider to get actual system voltage
+
+  return(rawVoltage);
+}
+
+//Returns the instataneous wind speed
+float get_wind_speed()
+{
+  float deltaTime = millis() - lastWindCheck; //750ms
+
+  deltaTime /= 1000.0; //Convert to seconds
+
+  float windSpeed = (float)windClicks / deltaTime; //3 / 0.750s = 4
+
+  windClicks = 0; //Reset and start watching for new wind
+  lastWindCheck = millis();
+
+  //windSpeed *= 1.492; //4 * 1.492 = 5.968MPH
+
+  /* Serial.println();
+   Serial.print("Windspeed:");
+   Serial.println(windSpeed);*/
+
+  return(windSpeed);
+}
+
+//Read the wind direction sensor, return heading in degrees
+int get_wind_direction()
+{
+  unsigned int adc;
+
+  adc = analogRead(WDIR); // get the current reading from the sensor
+
+  // The following table is ADC readings for the wind direction sensor output, sorted from low to high.
+  // Each threshold is the midpoint between adjacent headings. The output is degrees for that ADC reading.
+  // Note that these are not in compass degree order! See Weather Meters datasheet for more information.
+
+  if (adc < 380) return (113);
+  if (adc < 393) return (68);
+  if (adc < 414) return (90);
+  if (adc < 456) return (158);
+  if (adc < 508) return (135);
+  if (adc < 551) return (203);
+  if (adc < 615) return (180);
+  if (adc < 680) return (23);
+  if (adc < 746) return (45);
+  if (adc < 801) return (248);
+  if (adc < 833) return (225);
+  if (adc < 878) return (338);
+  if (adc < 913) return (0);
+  if (adc < 940) return (293);
+  if (adc < 967) return (315);
+  if (adc < 990) return (270);
+  return (-1); // error, disconnected?
+}
+
+
+//Prints the various variables directly to the port
+//I don't like the way this function is written but Arduino doesn't support floats under sprintf
+void printWeather()
+{
+  calcWeather(); //Go calc all the various sensors
+
+  Serial.println();
+  //Serial.print("$,lon=");
+  Serial.print(gps.location.lng(), 6);
+  Serial.print(",");
+  Serial.print(gps.location.lat(), 6);
+  Serial.print(",");
+  Serial.print(gps.altitude.meters());
+  Serial.print(",");
+  Serial.print(gps.satellites.value());
+
+  char sz[32];
+  Serial.print(",date=");
+  sprintf(sz, "%02d-%02d-%02d", gps.date.year(), gps.date.month(), gps.date.day());
+  Serial.print(sz);
+
+  Serial.print(",time=");
+  sprintf(sz, "%02d:%02d:%02d", gps.time.hour(), gps.time.minute(), gps.time.second());
+  Serial.print(sz);
+
+  //Serial.print(",RTCdate=20");
+  Serial.print(",");
+  sprintf(sz, "%s", getDateDs1307(0));
+  Serial.print(sz);
+  //Serial.print(",RTCtime=");
+  Serial.print(",");
+  sprintf(sz, "%s", getDateDs1307(1));
+  Serial.print(sz);
+
+  Serial.print(",");
+  Serial.print(winddir);
+  Serial.print(",");
+  Serial.print(windspeedms, 1);
+  Serial.print(",");
+  Serial.print(windgustms, 1);
+  Serial.print(",");
+  Serial.print(windgustdir);
+  Serial.print(",");
+  Serial.print(windspdms_avg2m, 1);
+  Serial.print(",");
+  Serial.print(winddir_avg2m);
+  Serial.print(",");
+  Serial.print(windgustms_10m, 1);
+  Serial.print(",");
+  Serial.print(windgustdir_10m);
+  Serial.print(",");
+  Serial.print(humidity, 1);
+  Serial.print(",");
+  Serial.print(tempf, 1);
+  Serial.print(",");
+  Serial.print(rainin, 2);
+  Serial.print(",");
+  Serial.print(dailyrainin, 2);
+  Serial.print(",");
+  Serial.print(Rainindi,1);
+  Serial.print(",");
+  Serial.print(Rainindinter);
+  Serial.print(",");
+  Serial.print(pressure, 2);
+  Serial.print(",");
+  Serial.print(batt_lvl, 2);
+  Serial.print(",");
+  Serial.print(light_lvl, 2);
+  Serial.print(",");
+
+  //--------------------------
+  //PRINT TO LCD
+  //--------------------------
+
+  lcd.clear();
+  lcd.print(F("Lon:"));
+  lcd.print(gps.location.lng(), 6);
+  lcd.setCursor(0, 2);
+  lcd.print(F("Lat:"));
+  lcd.print(gps.location.lat(), 6);
+  delay(5000);
+
+  lcd.clear();
+  sprintf(sz, "%02d-%02d-%02d", gps.date.year(), gps.date.month(), gps.date.day());
+  lcd.print(sz);
+  lcd.setCursor(0, 2);
+  sprintf(sz, "%02d:%02d:%02d", gps.time.hour(), gps.time.minute(), gps.time.second());
+  lcd.print(sz);
+  lcd.print(F(" GMT"));
+  delay(5000);
+
+  lcd.clear();
+  lcd.print(F("WD: "));
+  lcd.print(get_wind_direction());
+  lcd.print(F(" N=0 CW"));
+  lcd.setCursor(0, 2);
+  lcd.print(F("WS:"));
+  lcd.print(get_wind_speed(), 1);
+  lcd.print(F(" m/s"));
+  delay(5000);
+
+  lcd.clear();
+  lcd.print(F("H:"));
+  lcd.print(myHumidity.readHumidity(),2);
+  lcd.print(F(" %"));
+  lcd.setCursor(0, 2);
+  lcd.print(F("T:"));
+  lcd.print(myPressure.readTemp(),2);
+  lcd.print(F(" C"));
+  delay(5000);
+
+  //Not enough dynamic memory in UNO
+  lcd.clear();
+  lcd.print("R:");
+  lcd.print(dailyrainin);
+  lcd.print("(mm/d)");
+  lcd.setCursor(0, 2);
+  lcd.print(F("P:"));
+  lcd.print(myPressure.readPressure()/100.0,2);
+  lcd.print(F(" hPa"));
+  delay(5000);
+
+  //Not enough dynamic memory in UNO
+  lcd.clear();
+  lcd.print(F("Battery Level"));
+  lcd.print(get_battery_level());
+  lcd.clear();
+  lcd.print(F("Sunlight"));
+  lcd.setCursor(0, 2);
+  lcd.print(get_light_level());
+  delay(2000);
+
+
+}
+
+