Adding ColorPalette example

Adding ColorPalette example

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

--- examples/ColorPalette/ColorPalette.ino
+++ examples/ColorPalette/ColorPalette.ino
@@ -0,0 +1,189 @@
+#include <FastLED.h>
+
+#define LED_PIN     5
+#define NUM_LEDS    50
+#define BRIGHTNESS  64
+#define LED_TYPE    WS2811
+#define COLOR_ORDER GRB
+CRGB leds[NUM_LEDS];
+
+#define UPDATES_PER_SECOND 100
+
+// This example shows several ways to set up and use 'palettes' of colors
+// with FastLED.
+//
+// These compact palettes provide an easy way to re-colorize your
+// animation on the fly, quickly, easily, and with low overhead.
+//
+// USING palettes is MUCH simpler in practice than in theory, so first just
+// run this sketch, and watch the pretty lights as you then read through
+// the code.  Although this sketch has eight (or more) different color schemes,
+// the entire sketch compiles down to about 6.5K on AVR.
+//
+// FastLED provides a few pre-configured color palettes, and makes it
+// extremely easy to make up your own color schemes with palettes.
+//
+// Some notes on the more abstract 'theory and practice' of
+// FastLED compact palettes are at the bottom of this file.
+
+
+
+CRGBPalette16 currentPalette;
+TBlendType    currentBlending;
+
+extern CRGBPalette16 myRedWhiteBluePalette;
+extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM;
+
+
+void setup() {
+  delay( 3000 ); // power-up safety delay
+  FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
+  FastLED.setBrightness(  BRIGHTNESS );
+
+  currentPalette = RainbowColors_p;
+  currentBlending = BLEND;
+}
+
+
+void loop()
+{
+  ChangePalettePeriodically();
+
+  static uint8_t startIndex = 0;
+  startIndex = startIndex + 1; /* motion speed */
+
+  FillLEDsFromPaletteColors( startIndex);
+
+  FastLED.show();
+  FastLED.delay(1000 / UPDATES_PER_SECOND);
+}
+
+void FillLEDsFromPaletteColors( uint8_t colorIndex)
+{
+  uint8_t brightness = 255;
+
+  for( int i = 0; i < NUM_LEDS; i++) {
+    leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
+    colorIndex += 3;
+  }
+}
+
+
+// There are several different palettes of colors demonstrated here.
+//
+// FastLED provides several 'preset' palettes: RainbowColors_p, RainbowStripeColors_p,
+// OceanColors_p, CloudColors_p, LavaColors_p, ForestColors_p, and PartyColors_p.
+//
+// Additionally, you can manually define your own color palettes, or you can write
+// code that creates color palettes on the fly.  All are shown here.
+
+void ChangePalettePeriodically()
+{
+  uint8_t secondHand = (millis() / 1000) % 60;
+  static uint8_t lastSecond = 99;
+
+  if( lastSecond != secondHand) {
+    lastSecond = secondHand;
+    if( secondHand ==  0)  { currentPalette = RainbowColors_p;         currentBlending = BLEND; }
+    if( secondHand == 10)  { currentPalette = RainbowStripeColors_p;   currentBlending = NOBLEND;  }
+    if( secondHand == 15)  { currentPalette = RainbowStripeColors_p;   currentBlending = BLEND; }
+    if( secondHand == 20)  { SetupPurpleAndGreenPalette();             currentBlending = BLEND; }
+    if( secondHand == 25)  { SetupTotallyRandomPalette();              currentBlending = BLEND; }
+    if( secondHand == 30)  { SetupBlackAndWhiteStripedPalette();       currentBlending = NOBLEND; }
+    if( secondHand == 35)  { SetupBlackAndWhiteStripedPalette();       currentBlending = BLEND; }
+    if( secondHand == 40)  { currentPalette = CloudColors_p;           currentBlending = BLEND; }
+    if( secondHand == 45)  { currentPalette = PartyColors_p;           currentBlending = BLEND; }
+    if( secondHand == 50)  { currentPalette = myRedWhiteBluePalette_p; currentBlending = NOBLEND;  }
+    if( secondHand == 55)  { currentPalette = myRedWhiteBluePalette_p; currentBlending = BLEND; }
+  }
+}
+
+// This function fills the palette with totally random colors.
+void SetupTotallyRandomPalette()
+{
+  for( int i = 0; i < 16; i++) {
+    currentPalette[i] = CHSV( random8(), 255, random8());
+  }
+}
+
+// This function sets up a palette of black and white stripes,
+// using code.  Since the palette is effectively an array of
+// sixteen CRGB colors, the various fill_* functions can be used
+// to set them up.
+void SetupBlackAndWhiteStripedPalette()
+{
+  // 'black out' all 16 palette entries...
+  fill_solid( currentPalette, 16, CRGB::Black);
+  // and set every fourth one to white.
+  currentPalette[0] = CRGB::White;
+  currentPalette[4] = CRGB::White;
+  currentPalette[8] = CRGB::White;
+  currentPalette[12] = CRGB::White;
+
+}
+
+// This function sets up a palette of purple and green stripes.
+void SetupPurpleAndGreenPalette()
+{
+  CRGB purple = CHSV( HUE_PURPLE, 255, 255);
+  CRGB green  = CHSV( HUE_GREEN, 255, 255);
+  CRGB black  = CRGB::Black;
+
+  currentPalette = CRGBPalette16(
+    green,  green,  black,  black,
+    purple, purple, black,  black,
+    green,  green,  black,  black,
+    purple, purple, black,  black );
+}
+
+
+// This example shows how to set up a static color palette
+// which is stored in PROGMEM (flash), which is almost always more
+// plentiful than RAM.  A static PROGMEM palette like this
+// takes up 64 bytes of flash.
+const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM =
+{
+  CRGB::Red,
+  CRGB::Gray, // 'white' is too bright compared to red and blue
+  CRGB::Blue,
+  CRGB::Black,
+
+  CRGB::Red,
+  CRGB::Gray,
+  CRGB::Blue,
+  CRGB::Black,
+
+  CRGB::Red,
+  CRGB::Red,
+  CRGB::Gray,
+  CRGB::Gray,
+  CRGB::Blue,
+  CRGB::Blue,
+  CRGB::Black,
+  CRGB::Black
+};
+
+
+
+// Additionl notes on FastLED compact palettes:
+//
+// Normally, in computer graphics, the palette (or "color lookup table")
+// has 256 entries, each containing a specific 24-bit RGB color.  You can then
+// index into the color palette using a simple 8-bit (one byte) value.
+// A 256-entry color palette takes up 768 bytes of RAM, which on Arduino
+// is quite possibly "too many" bytes.
+//
+// FastLED does offer traditional 256-element palettes, for setups that
+// can afford the 768-byte cost in RAM.
+//
+// However, FastLED also offers a compact alternative.  FastLED offers
+// palettes that store 16 distinct entries, but can be accessed AS IF
+// they actually have 256 entries; this is accomplished by interpolating
+// between the 16 explicit entries to create fifteen intermediate palette
+// entries between each pair.
+//
+// So for example, if you set the first two explicit entries of a compact
+// palette to Green (0,255,0) and Blue (0,0,255), and then retrieved
+// the first sixteen entries from the virtual palette (of 256), you'd get
+// Green, followed by a smooth gradient from green-to-blue, and then Blue.
+


add new wheel calibration test

add new wheel calibration test

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

--- testing/arduino/omniwheel4_EncoderC.ino
+++ testing/arduino/omniwheel4_EncoderC.ino
@@ -0,0 +1,222 @@
+#include "Arduino.h"
+
+int motorPin1_1 = 4;
+int motorPin1_2 = 5;
+int motorPin1_speed = 3;
+int motorPin1_A = A7;
+
+int motorPin2_1 = 7;
+int motorPin2_2 = 8;
+int motorPin2_speed = 6;
+int motorPin2_A = A6;
+
+int motorPin3_1 = 10;
+int motorPin3_2 = 11;
+int motorPin3_speed = 9;
+int motorPin3_A = A5;
+
+int globalSpeedInit = 255;
+int reducedSpeed = globalSpeedInit * 0.09;
+
+void setup()
+{
+    Serial.begin(9600);
+    while (!Serial)
+        ;
+    Serial.println("Init");
+
+    pinMode(motorPin1_1, OUTPUT);
+    pinMode(motorPin1_2, OUTPUT);
+    pinMode(motorPin1_speed, OUTPUT);
+    pinMode(motorPin1_A, INPUT);
+
+    pinMode(motorPin2_1, OUTPUT);
+    pinMode(motorPin2_2, OUTPUT);
+    pinMode(motorPin2_speed, OUTPUT);
+    pinMode(motorPin2_A, INPUT);
+
+    pinMode(motorPin3_1, OUTPUT);
+    pinMode(motorPin3_2, OUTPUT);
+    pinMode(motorPin3_speed, OUTPUT);
+    pinMode(motorPin3_A, INPUT);
+
+}
+
+
+void SetMotor(int pinSpeed, int pin1, int pin2, int speed)
+{
+    analogWrite(pinSpeed, abs(speed));
+    if (speed < 0)
+    {
+        analogWrite(pin1, 0);
+        analogWrite(pin2, 255);
+    }
+    else
+    {
+        analogWrite(pin1, 255);
+        analogWrite(pin2, 0);
+    }
+
+    if (speed == 0)
+    {
+        analogWrite(pin1, 0);
+        analogWrite(pin2, 0);
+    }
+}
+
+int motor1_RPMCount = 0;
+int motor1_State = 0;
+int motor1_Lookup[55];
+int motor1_MaxRPM = 0;
+
+int motor2_RPMCount = 0;
+int motor2_State = 0;
+int motor2_Lookup[55];
+int motor2_MaxRPM = 0;
+
+int motor3_RPMCount = 0;
+int motor3_State = 0;
+int motor3_Lookup[55];
+
+unsigned long time = 0;
+
+
+
+
+typedef struct SpeedMappingEntity {
+  int RPM;
+  int Speed;
+  int MappedSpeed;
+};
+
+SpeedMappingEntity SpeedMapping_Motor1[255];
+SpeedMappingEntity SpeedMapping_Motor2[255];
+SpeedMappingEntity SpeedMapping_Motor3[255];
+
+
+int init = 0;
+unsigned long initTimestamp = 0;
+int initSpeed = 255;
+
+
+// 1 Rotation == 80 Gearbox Ratio ==
+//      4 CPR (counts per revolution) * 80 == 320 Counts per Rotation
+int pulsesPerRotation = 320
+
+
+
+
+
+void loop()
+{
+    time = millis();
+
+    UpdateRPM();
+
+    Calibration();
+
+
+}
+
+void Calibration()
+{
+    if (init >= 2)
+    {
+        return;
+    }
+
+    if(init == 0)
+    {
+        motor1_RPMCount = 0;
+        motor2_RPMCount = 0;
+        motor3_RPMCount = 0;
+
+        initSpeed = 255;
+
+        SetWheelsTo(initSpeed);
+        initTimestamp = time;
+        init = 1;
+        return;
+    }
+
+    if (initTimestamp + 250 <= time && initSpeed == 255)
+    {
+
+    }
+
+    if (initTimestamp + 250 <= time && initSpeed > 0)
+    {
+        //motor1_Lookup[motor1_RPMCount] = initSpeed;
+        //motor2_Lookup[motor2_RPMCount] = initSpeed;
+        //motor3_Lookup[motor3_RPMCount] = initSpeed;
+
+
+        SpeedMapping_Motor1[initSpeed].RPM = motor1_RPMCount
+        SpeedMapping_Motor1[initSpeed]Speed = initSpeed
+        SpeedMapping_Motor1[initSpeed]MappedSpeed =
+
+        // 255 - 245 - 235 - 225 - 215 - 205 - 195 - 185 - 175 - 165 - 155 - 145
+        if (initSpeed > 150)
+        {
+            initSpeed -= 10;
+        }
+        // 140 - 135 - 130 - 125 - 120 - 115 - 110 - 105 - 100 - 95 - 90 - 85 - 80 - 75
+        else if(initSpeed > 75)
+        {
+            initSpeed -= 5;
+        }
+        // 75 - 0
+        else
+        {
+            initSpeed -= 1;
+        }
+
+        SetWheelsTo(initSpeed);
+        initTimestamp = time;
+
+        motor1_RPMCount = 0;
+        motor2_RPMCount = 0;
+        motor3_RPMCount = 0;
+        return;
+    }
+    else if (initSpeed <= 0)
+    {
+        init = 2;
+    }
+}
+
+void SetWheelsTo(int speed)
+{
+    SetMotor(motorPin1_speed, motorPin1_1, motorPin1_2, speed);
+    SetMotor(motorPin2_speed, motorPin2_1, motorPin2_2, speed);
+    SetMotor(motorPin3_speed, motorPin3_1, motorPin3_2, speed);
+}
+
+
+
+void UpdateRPM()
+{
+    time = millis();
+
+    int state = (analogRead(motorPin1_A) < 500) ? 0 : 1;
+    if(state != motor1_State)
+    {
+        motor1_RPMCount++;
+        motor1_State = state;
+    }
+
+    state = (analogRead(motorPin2_A) < 500) ? 0 : 1;
+    if(state != motor2_State)
+    {
+        motor2_RPMCount++;
+        motor2_State = state;
+    }
+
+    state = (analogRead(motorPin3_A) < 500) ? 0 : 1;
+    if(state != motor3_State)
+    {
+        motor3_RPMCount++;
+        motor3_State = state;
+    }
+}
+


New sketch to experiment with Pentatonic Scales

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

--- SoMoV5/SoMoV5_Pentatonic/SoMoV5_Pentatonic.ino
+++ SoMoV5/SoMoV5_Pentatonic/SoMoV5_Pentatonic.ino
@@ -0,0 +1,216 @@
+
+// Based on:
+// I2C device class (I2Cdev) demonstration Arduino sketch for MPU9150
+// 1/4/2013 original by Jeff Rowberg <jeff@rowberg.net> at https://github.com/jrowberg/i2cdevlib
+//          modified by Aaron Weiss <aaron@sparkfun.com>
+//          modified by Leif Bloomquist <leif@sonicwear.ca>
+//
+// Changelog:
+//     2011-10-07 - initial release
+//     2013-1-4   - added raw magnetometer output
+//     2014-02-17 - modified to demonstrate SoMo v4.0 board (LB)
+//     2015-03-11 - modified to demonstrate SoMo v5.0 board (LB)
+
+
+#include <SoftwareSerial.h>
+
+// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
+// is used in I2Cdev.h
+#include "Wire.h"
+
+// 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.h"
+
+// class default I2C address is 0x68
+// specific I2C addresses may be passed as a parameter here
+// AD0 low = 0x68 (default for InvenSense evaluation board)
+// AD0 high = 0x69
+MPU6050 accelgyro;
+
+int16_t ax, ay, az;
+int16_t gx, gy, gz;
+int16_t mx, my, mz;
+
+#define POWER 1
+#define RX    17
+#define TX    4
+
+#define ACCEL_CENTER 0         // Assume same for x, y, and z
+#define ACCEL_RANGE  16000
+#define ACCEL_MAX    (ACCEL_CENTER+ACCEL_RANGE)
+#define ACCEL_MIN    (ACCEL_CENTER-ACCEL_RANGE)
+
+SoftwareSerial radioSerial(RX, TX);
+
+// MIDI note values for the C Major Pentatonic Scale.
+byte pentatonic[] = { C   D  E  G  A
+                  //  0,  2, 4, 7, 9,       // Octave 0
+                  //  12,14,16,19,21,       // Octave 1
+                  //  24,26,28,31,33,       // Octave 2
+                      36,38,40,43,45,       // Octave 3
+                      48,50,52,55,57,       // Octave 4
+                      60,62,64,67,69,       // Octave 5
+                      72,74,76,79,81,       // Octave 6
+                      84,86,88,91,93        // Octave 7
+                  //  96,98,100,103,105,    // Octave 8
+                  //  108,110,112,115,117,  // Octave 9
+                  //  120,122,124,127,      // Octave 10
+                   };
+
+int arraylength = sizeof(pentatonic);
+
+void setup()
+{
+    // join I2C bus (I2Cdev library doesn't do this automatically)
+    Wire.begin();
+
+    // initialize serial communication
+    Serial.begin(38400);
+
+    // initialize device
+    Serial.println("Initializing I2C devices...");
+    accelgyro.initialize();
+
+    // verify connection
+    Serial.println("Testing device connections...");
+    Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
+
+    // Soft Serial for XBee Radio
+    radioSerial.begin(57600);
+
+    // Turn on SoMo Power LED
+    pinMode(POWER, OUTPUT);
+    digitalWrite(POWER, HIGH);
+}
+
+void loop()
+{
+    digitalWrite(POWER, HIGH);
+
+    // read raw accel/gyro measurements from device
+    accelgyro.getMotion9(&ax, &ay, &az, &gx, &gy, &gz, &mx, &my, &mz);
+
+    // Scale Data
+    float angle = Scale(ax, ACCEL_MIN, ACCEL_MAX);
+    float acceleration = ScaleAccelMagnitude(ax, ay, az);
+
+    // Map to a note
+    byte note = pentatonic[round(angle*(arraylength-1))];
+
+    // Determine volume (velocity)
+    byte velocity = round(acceleration*127);
+
+    Serial.print("Angle = ");
+    Serial.print(angle);
+    Serial.print("\tNote = ");
+    Serial.print(note);
+    Serial.print("\tVelocity = ");
+    Serial.println(velocity);
+
+
+    digitalWrite(POWER, LOW);
+
+    if (velocity > 20)
+    {
+      // Transmit
+      sendMIDI(0x90,note,velocity);   // Channel 1, Note On
+      delay(10);
+      sendMIDI(0x80,note,0);          // Channel 1, Note Off
+    }
+
+    delay(10);  // Milliseconds
+}
+
+void sendMIDI(byte cmd, byte data1, byte data2)
+{
+   radioSerial.write(cmd);
+   radioSerial.write(data1);
+   radioSerial.write(data2);
+}
+
+
+// Return a value 0.0 to 1.0 representing the magnitude of x/y/z acceleration with gravity removed
+float ScaleAccelMagnitude(long x, long y, long z)
+{
+  float tempx = ScaleAbs(x, ACCEL_CENTER, ACCEL_RANGE);
+  float tempy = ScaleAbs(y, ACCEL_CENTER, ACCEL_RANGE);
+  float tempz = ScaleAbs(z, ACCEL_CENTER, ACCEL_RANGE);
+
+  float temp1 = sq(tempx) + sq(tempy) + sq(tempz);
+  float magnitudein = sqrt(temp1);
+
+  // Extremely naive gravity removal
+  float magnitudeout = magnitudein-1.0;
+
+  // Lower bound here
+  if (magnitudeout < 0.0) magnitudeout = 0.0;
+
+  // Scale the output to make it less sensitive.  **Adjust this as needed**
+  float magnitudescaled = magnitudeout / 2.5;
+
+  // Upper Bound
+  if (magnitudescaled > 1.0) magnitudescaled = 1.0;
+
+  return magnitudescaled;
+}
+
+#define GYRO_CENTER 0        // Assume same for x, y, and z
+#define GYRO_RANGE  32000
+#define GYRO_MAX    (GYRO_CENTER+GYRO_RANGE)
+#define GYRO_MIN    (GYRO_CENTER-GYRO_RANGE)
+
+// Map an input between MIN and MAX to 0 to 127
+byte GyroToCC(long in)
+{
+  float temp = Scale(in, GYRO_MIN, GYRO_MAX);
+  return temp*127;
+}
+
+#define MAG_CENTER 0        // Assume same for x, y, and z
+#define MAG_RANGE  32000
+#define MAG_MAX    (MAG_CENTER+MAG_RANGE)
+#define MAG_MIN    (MAG_CENTER-MAG_RANGE)
+
+// Map an input between MIN and MAX to 0 to 127
+byte MagToCC(long in)
+{
+  float temp = Scale(in, MAG_MIN, MAG_MAX);
+  return temp*127;
+}
+
+
+// Scale one of the inputs to between 0.0 and 1.0
+float Scale(long in, long smin, long smax)
+{
+  // Bound
+  if (in > smax) in=smax;
+  if (in < smin) in=smin;
+
+  // Change zero-offset
+  in = in-smin;
+
+  // Scale between 0.0 and 1.0    (0.5 would be halfway)
+  float temp = (float)in/((float)smax-(float)smin);
+  return temp;
+}
+
+
+// Scale one of the inputs to return distance from center (0.0=centered, 1.0=min or max, may exceed 1.0)
+float ScaleAbs(long in, long center, long range)
+{
+  // Get the absolute distance from center
+  long temp = in-center;
+  long val = abs(temp);
+
+  // Scale
+  float out = (float)val/(float)range;
+
+  // *Don't* Bound.
+
+  return out;
+}
+
+
+


Dang's Thanksgiving Code - Latest

Dang's Thanksgiving Code - Latest

3DOF Control Accounting for reversed Joint 2
To Do List:
- Make Safety Parameters
- Make Code Readable IE rename variables
- Split functions and code into different files
- Fix the dead zones and map the deadzones

error: pathspec 'Robotic' did not match any file(s) known to git
error: pathspec 'Arm/Titan16_3DOF/InverseKinematicsRoboticArm.ino' did not match any file(s) known to git


Add second exampe sketch

Add second exampe sketch

Demonstrates multiple structures and manual data flashing

Signed-off-by: Chris Evich <a32d953222fb20f0b25108e8e79a82f157e67554@anonomail.me>

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

--- examples/NibblesAndBits/NibblesAndBits.ino
+++ examples/NibblesAndBits/NibblesAndBits.ino
@@ -0,0 +1,105 @@
+/*
+ * Example code for Eep template class
+ * Copyright (C) 2015 Christopher C. Evich
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <Eep.h>
+
+enum Stuff { StuffA, StuffB, StuffC };
+
+struct Junk {
+    bool small;
+    int64_t large;
+};
+
+union Things {
+    Stuff nibbles;
+    Junk bits;
+};
+
+struct Doodads {
+    Stuff foo;
+    Junk bar;
+    Things baz;
+};
+
+const Eep::Magic stuffMagic = 0x12345678;
+const Eep::Magic junkMagic = 0x87654321;
+const Eep::Magic doodadsMagic = 0x42424242;
+
+typedef Eep::Eep<Stuff, 1, stuffMagic> StuffEep;
+typedef Eep::Eep<Junk, 1, junkMagic> JunkEep;
+typedef Eep::Eep<Doodads, 1, doodadsMagic> DoodadsEep;
+
+#define NOEEPROMINIT
+// This allows allocating and initializing EEPROM manually.
+// The resulting .eep file can then be burned seperately.
+// e.g. avrdude -p m328p -c usbtiny -D -P usb
+//      -U eeprom:w:/tmp/build5073703394233512791.tmp/NibblesAndBits.cpp.eep:i
+
+template<> Eep::Block<Stuff> StuffEep::block_eeprom EEMEM = {
+    .magic = stuffMagic,
+    .version = 1,
+    .data = StuffB,
+    // You can #define EEPDEBUG after flashing invalid crc
+    // and it will tell you the correct value.  Or you can
+    // calculate it by hand.
+    .crc = 0x1E92
+};
+
+template<> Eep::Block<Junk> JunkEep::block_eeprom EEMEM = {
+    .magic = junkMagic,
+    .version = 1,
+    .data = {false, 0x42},
+    // Both format() and save() will automatically re-calculate crc
+    .crc = 0xD63E
+};
+
+template<> Eep::Block<Doodads> DoodadsEep::block_eeprom EEMEM = {
+    .magic = doodadsMagic,
+    .version = 1,
+    .data = {
+        .foo = StuffA,
+        .bar = {true, -1234567890LL},
+        .baz = {.nibbles = StuffC}
+    },
+    // Don't forget to re-flash w/ correct values :)
+    .crc = 0xF2
+};
+
+void setup(void) {
+    Serial.begin(115200);
+    delay(1);  // Serial client sometimes needs extra time to initialize
+    Serial.println(F("\nSetup()"));
+
+    // Data must be flashed separately, no defaults provided!
+    StuffEep stuffEep;
+    JunkEep junkEep;
+    DoodadsEep doodadsEep;
+
+    // Data is still validated however.
+    Stuff* stuff = stuffEep.data();
+    Junk* junk = junkEep.data();
+    Doodads* doodads = doodadsEep.data();
+    if (stuff && junk && doodads)
+        Serial.println(F("Yay, you flashed them all!"));
+    else
+        Serial.println(F("Eeprom content is invalid!"));
+}
+
+void loop(void) {
+}


Add quantizer function.

Add quantizer function.

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


LEDs control for left/right eye experiment added

error: pathspec 'Heart-And-Brain/Arduino' did not match any file(s) known to git
error: pathspec 'Code/HeartAndBrainLeonardoWithEyeLEDs/HeartAndBrainLeonardoWithEyeLEDs.ino' did not match any file(s) known to git


tweaked demo sketch

tweaked demo sketch

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

--- ardesp/power_switch_test/power_switch_test.ino
+++ ardesp/power_switch_test/power_switch_test.ino
@@ -0,0 +1,40 @@
+/*
+  Example for outlets which are configured with two rotary/sliding switches.
+
+  http://code.google.com/p/rc-switch/
+*/
+
+#include <RCSwitch.h>
+
+RCSwitch mySwitch = RCSwitch();
+
+void setup() {
+
+  // Transmitter is connected to Arduino Pin #10
+  mySwitch.enableTransmit(4);
+
+  // Optional set pulse length.
+  // mySwitch.setPulseLength(320);
+
+}
+
+void loop() {
+
+  // Switch on:
+  // The first parameter represents the setting of the first rotary switch.
+  // In this example it's switched to "1" or "A" or "I".
+  //
+  // The second parameter represents the setting of the second rotary switch.
+  // In this example it's switched to "4" or "D" or "IV".
+  mySwitch.switchOn(1, 1);
+
+  // Wait a second
+  delay(1000);
+
+  // Switch off
+  mySwitch.switchOff(1, 1);
+
+  // Wait another second
+  delay(1000);
+
+}


added initial led falling star teensy code

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

--- Arduino/FallingStar_SerialTeensyPropShield/FallingStar_SerialTeensyPropShield.ino
+++ Arduino/FallingStar_SerialTeensyPropShield/FallingStar_SerialTeensyPropShield.ino
@@ -0,0 +1,117 @@
+#include "FastLED.h"
+
+// How many leds in your strip?
+#define NUM_LEDS 32
+
+// For led chips like Neopixels, which have a data line, ground, and power, you just
+// need to define DATA_PIN.  For led chipsets that are SPI based (four wires - data, clock,
+// ground, and power), like the LPD8806, define both DATA_PIN and CLOCK_PIN
+#define DATA_PIN 11
+
+#define DEFAULT_DURATION 3000
+#define CAUGHT_DURATION 1500
+
+// Define the array of leds
+CRGB leds[NUM_LEDS];
+
+
+void setup() {
+  Serial.begin(9600);
+  Serial.println("resetting");
+  LEDS.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
+  LEDS.setBrightness(84);
+
+
+  pinMode(7, OUTPUT);
+  digitalWrite(7, HIGH);  // enable access to LEDs
+
+  fireLED(DEFAULT_DURATION / 10);
+
+}
+
+void fadeall() {
+  for (int i = 0; i < NUM_LEDS; i++) {
+    leds[i].nscale8(200);
+  }
+}
+void alloff() {
+  for (int i = 0; i < NUM_LEDS; i++) {
+    leds[i] = CRGB(0, 0, 0);
+  }
+}
+
+void loop() {
+
+  int incomingByte;
+
+  if (Serial.available() > 0) {
+    incomingByte = Serial.read();
+  }
+
+  if (incomingByte == 'a') {
+    fireLED(DEFAULT_DURATION);
+  }
+
+  if (incomingByte == 'x') {
+    caughtLED(CAUGHT_DURATION);
+
+  }
+}
+
+void fireLED(int duration) {
+
+  static uint8_t hue = 0;
+
+  int delayIncrement = duration / NUM_LEDS;
+
+  // First slide the led in one direction
+  for (int i = 0; i < NUM_LEDS; i++) {
+    // Set the i'th led to red
+    leds[i] = CHSV(75, 128, 255);
+    // Show the leds
+    FastLED.show();
+    // now that we've shown the leds, reset the i'th led to black
+    // leds[i] = CRGB::Black;
+    fadeall();
+    // Wait a little bit before we loop around and do it again
+    delay(delayIncrement);
+  }
+
+  for (int i = 0; i < 200; i++) {
+
+    fadeall();
+    leds[30] = CHSV(75, 128, 255);
+    leds[29] = CHSV(75, 128, 255);
+    FastLED.show();
+    delay(10);
+  }
+
+  alloff();
+  FastLED.show();
+}
+
+void caughtLED(int duration) {
+  static uint8_t hue = 0;
+  int delayIncrement = duration / NUM_LEDS;
+
+  for (int i = NUM_LEDS - 1; i >= 0; i--) {
+    // Set the i'th led to red
+    leds[i] = CHSV(200, 128, 255);
+    // Show the leds
+    FastLED.show();
+    // now that we've shown the leds, reset the i'th led to black
+    // leds[i] = CRGB::Black;
+    fadeall();
+    // Wait a little bit before we loop around and do it again
+    delay(delayIncrement);
+  }
+  alloff();
+  FastLED.show();
+}
+
+
+
+
+
+
+


Base arduino sketch

Base arduino sketch

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

--- Arduio/HimiditySensor/HimiditySensor.ino
+++ Arduio/HimiditySensor/HimiditySensor.ino
@@ -0,0 +1,12 @@
+int sensorPin = A0;
+int sensorValue = 0;
+void setup() {
+  Serial.begin(1200);
+}
+void loop() {
+  sensorValue = analogRead(sensorPin);
+  Serial.print("A0:");
+  Serial.print(sensorValue);
+  Serial.print("\n");
+  delay(1000);
+}


Adding first draft of WaterMain project

Adding first draft of WaterMain project

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

--- projects/WaterMain/Arduino/Arduino.ino
+++ projects/WaterMain/Arduino/Arduino.ino
@@ -0,0 +1,36 @@
+#define SENSOR_PIN A0
+#define HIGH_ZONE 522
+#define LOW_ZONE 502
+
+int currentState;
+unsigned long counter = 0;
+
+void setup()
+{
+  Serial.begin(9600);
+}
+
+void loop()
+{
+  readMagnet();
+}
+
+void readMagnet()
+{
+  int field = analogRead(SENSOR_PIN);
+  int state;
+  // Magnetic field read is split in 3 zones: definite LOW, unknown (e.g. maintain), and definite HIGH
+  if (field >= HIGH_ZONE) {
+    state = HIGH;
+  } else if (field <= LOW_ZONE) {
+    state = LOW;
+  } else {
+    // Nothing changed, so we can exit
+    return;
+  }
+  // If we've changed states, need to increment the counter
+  if (state != currentState) {
+    counter++;
+    currentState = state;
+  }
+}


Adding some logging

Adding some logging

* Seem to have fixed not turning on the lights at the right time

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/buelowp/sleepintimer.git/'


improved comments and cleaned arduino sketch

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/ekwoodrich/nirha.git/'


Use Arduino as an Eddystone Beacon

Use Arduino as an Eddystone Beacon

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/rwood-moz/iot-hacking.git/'


New controller design for PS2

New controller design for PS2

Easier to use, easier to build, hopefully universal for all controllers you want to use (Xbox 360, Xbox One, PS4, etc...)

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

--- ps2_controller_v2/ps2_controller_v2.ino
+++ ps2_controller_v2/ps2_controller_v2.ino
@@ -0,0 +1,510 @@
+// This project uses 4 8-bit shift register, such as 74HC595 or HCF4094, in cascading format
+/*
+  PS2 Controller for Arduino UNO by WhatAboutGaming
+  For use in the Twitch.TV stream TwitchTriesToPlay.
+  https://www.twitch.tv/twitchtriestoplay
+  https://github.com/WhatAboutGaming/Twitch-Plays-Stuff
+
+  Reference:
+  https://gist.github.com/scanlime/5042071
+  http://store.curiousinventor.com/guides/PS2/
+  http://www.lynxmotion.com/images/files/ps2cmd01.txt
+  http://procrastineering.blogspot.com/2010/12/simulated-ps2-controller-for.html
+*/
+
+#define latchPin 2 // HCF4094/74HC595 Latch/Strobe Input
+#define dataPin 3 // HCF4094/74HC595 Data Input
+#define clockPin 4 // HCF4094/74HC595 Clock Input
+#define outputEnable 5 // HCF4094/74HC595 Output Enable Input, the HCF4094 allows output when the output enable input level is HIGH, the 74HC595 allows output when the output enable input level is LOW
+
+#define buttonSelect 0 // Left 10
+#define buttonL3 1 // Right 9
+#define buttonR3 2 // Right 10
+#define buttonStart 3 // Left 12
+
+#define buttonDUp 4 // Left 3
+#define buttonDRight 5 // Left 4
+#define buttonDDown 6 // Left 6
+#define buttonDLeft 7 // Left 5
+
+#define buttonL2 8 // Left 7
+#define buttonR2 9 // Right 4
+#define buttonL1 10 // Left 8
+#define buttonR1 11 // Right 3
+
+#define buttonTriangle 12 // Right 6
+#define buttonCircle 13 // Right 8
+#define buttonCross 14 // Right 7
+#define buttonSquare 15 // Right 5
+
+#define axisRxHalf 16 // Left 14
+#define axisRxFull 17 // Left 14
+
+#define axisRyHalf 18 // Left 13
+#define axisRyFull 19 // Left 13
+
+#define axisLxHalf 20 // Left 15
+#define axisLxFull 21 // Left 15
+
+#define axisLyHalf 22 // Left 16
+#define axisLyFull 23 // Left 16
+
+#define buttonAnalog 24 // Left 11
+
+#define leftMotor A0 // Left 9
+#define rightMotor A1 // Right 11
+#define analogLed A2 // Right 12
+
+// Left 9 = Left Motor In = A0
+// Right 11 = Right Motor In = A1
+// Right 12 = Analog LED = A2
+bool defaultStatus[] = {LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, HIGH, LOW, HIGH, LOW, HIGH, LOW, HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW};
+bool inputStatus[] = {LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, HIGH, LOW, HIGH, LOW, HIGH, LOW, HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW};
+unsigned int commandArray[] = {buttonSelect, buttonL3, buttonR3, buttonStart, buttonDUp, buttonDRight, buttonDDown, buttonDLeft, buttonL2, buttonR2, buttonL1, buttonR1, buttonTriangle, buttonCircle, buttonCross, buttonSquare, axisRxHalf, axisRxFull, axisRyHalf, axisRyFull, axisLxHalf, axisLxFull, axisLyHalf, axisLyHalf, buttonAnalog, 25, 26, 27, 28, 29, 30, 31};
+unsigned int motorArray[] = {leftMotor, rightMotor, analogLed};
+
+boolean isInputting = false;
+boolean isInputtingDelayed = false;
+
+unsigned long inputDelay = 0;
+unsigned long previousInputDelay = 0;
+unsigned long currentMillis = 0;
+
+unsigned long sendInputOnce = 0; // 0 = Send only once, 1 = Send for every iteration of Loop
+
+boolean sentInputOnce = false;
+boolean sendInputOnlyOnce = false;
+
+unsigned long baudRate = 2000000;
+
+byte serial_rx_buffer[12];
+byte serial_rx_buffer_inverted[12];
+byte serial_rx_buffer_controller[12];
+byte serial_rx_buffer_inverted_controller[12];
+unsigned long serial_rx_buffer_counter = 0;
+unsigned long controller = 0;
+
+void setup()
+{
+  Serial.begin(baudRate);
+
+  pinMode(leftMotor, INPUT_PULLUP);
+  pinMode(rightMotor, INPUT_PULLUP);
+  pinMode(analogLed, INPUT_PULLUP);
+
+  pinMode(latchPin, OUTPUT);
+  pinMode(dataPin, OUTPUT);
+  pinMode(clockPin, OUTPUT);
+  pinMode(outputEnable, OUTPUT);
+
+  digitalWrite(outputEnable, HIGH);
+
+  digitalWrite(latchPin, LOW);
+  for (int i = 31; i >= 0; i--)
+  {
+    digitalWrite(clockPin, LOW);
+    digitalWrite(dataPin, defaultStatus[i]);
+    digitalWrite(clockPin, HIGH);
+  }
+  digitalWrite(latchPin, HIGH);
+}
+void loop()
+{
+  currentMillis = millis();
+  if (Serial.available() > 0) {
+
+    controller = Serial.readBytes(serial_rx_buffer, sizeof(serial_rx_buffer)) && 0xFF;
+
+    //  Set Start Byte (Preamble Byte) and End Byte (Postamble Byte)
+    //  1 == 0x01
+    if ((serial_rx_buffer[0] == 0x01) && (serial_rx_buffer[11] == 0x01)) {
+
+      //  Count bytes and parse ASCII values to their respective commands, such as buttons and axis
+      for (serial_rx_buffer_counter = 0; serial_rx_buffer_counter < sizeof(serial_rx_buffer); serial_rx_buffer_counter++) {
+        Serial.write(serial_rx_buffer[serial_rx_buffer_counter]); //  This line writes the serial data back to the computer as a way to check if the Arduino isn't interpreting wrong values
+        //  Invert 0 to 255 and vice versa to make it easier to determine which commands to enable or not, and their values
+        //Serial.println("TEST 0");
+        serial_rx_buffer_inverted[serial_rx_buffer_counter] = ( serial_rx_buffer[serial_rx_buffer_counter]);
+        serial_rx_buffer_controller[serial_rx_buffer_counter] = serial_rx_buffer[serial_rx_buffer_counter];
+        serial_rx_buffer_inverted_controller[serial_rx_buffer_counter] = ( serial_rx_buffer_controller[serial_rx_buffer_counter]);
+      }
+
+      if (sendInputOnce == 0)
+      {
+        sendInputOnlyOnce = true;
+        sentInputOnce = false;
+      }
+      if (sendInputOnce != 0)
+      {
+        sendInputOnlyOnce = false;
+        sentInputOnce = true;
+      }
+
+      //Serial.print('\n');
+      Serial.flush();
+      // Make the button presses actually work
+      isInputting = true;
+      previousInputDelay = currentMillis;
+    }
+  }
+  pressButtons();
+}
+
+void pressButtons() {
+
+  if (isInputtingDelayed == false) {
+    //  Define input delay (If Buffer Array Element 9 and 10 !=0)
+    inputDelay = (unsigned long)serial_rx_buffer[9] << 8 | (unsigned long)serial_rx_buffer[10];
+  }
+  if (isInputting == true)
+  {
+    if (sendInputOnlyOnce == true)
+    {
+      if (sentInputOnce == false)
+      {
+        for (serial_rx_buffer_counter = 0; serial_rx_buffer_counter < sizeof(serial_rx_buffer_controller); serial_rx_buffer_counter++) {
+          Serial.write(serial_rx_buffer_controller[serial_rx_buffer_counter]); //  This line writes the serial data back to the computer as a way to check if the Arduino isn't interpreting wrong values
+          //  Invert 0 to 255 and vice versa to make it easier to determine which commands to enable or not, and their values
+          serial_rx_buffer_inverted_controller[serial_rx_buffer_counter] = (serial_rx_buffer_controller[serial_rx_buffer_counter]);
+          sentInputOnce = true;
+          //Serial.println("TEST 1A");
+        }
+        //Serial.println("TEST 1C");
+      }
+      //Serial.println("TEST 1D");
+    }
+
+    if (sendInputOnlyOnce == false)
+    {
+      if (sentInputOnce == true)
+      {
+        for (serial_rx_buffer_counter = 0; serial_rx_buffer_counter < sizeof(serial_rx_buffer_controller); serial_rx_buffer_counter++) {
+          Serial.write(serial_rx_buffer_controller[serial_rx_buffer_counter]); //  This line writes the serial data back to the computer as a way to check if the Arduino isn't interpreting wrong values
+          //  Invert 0 to 255 and vice versa to make it easier to determine which commands to enable or not, and their values
+          serial_rx_buffer_inverted_controller[serial_rx_buffer_counter] = (serial_rx_buffer_controller[serial_rx_buffer_counter]);
+          //sentInputOnce = true;
+          //Serial.println("TEST 1B");
+        }
+      }
+    }
+    //Serial.print('\n');
+    Serial.flush();
+    //  Press Button
+
+    //  First 8 buttons, Buffer Array Element 1
+    //  SELECT, L3, R3, START, DUP, DRIGHT, DDOWN, DLEFT
+    inputStatus[0] = (serial_rx_buffer_inverted_controller[1] & B00000001);
+    inputStatus[1] = (serial_rx_buffer_inverted_controller[1] & B00000010);
+    inputStatus[2] = (serial_rx_buffer_inverted_controller[1] & B00000100);
+    inputStatus[3] = (serial_rx_buffer_inverted_controller[1] & B00001000);
+    inputStatus[4] = (serial_rx_buffer_inverted_controller[1] & B00010000);
+    inputStatus[5] = (serial_rx_buffer_inverted_controller[1] & B00100000);
+    inputStatus[6] = (serial_rx_buffer_inverted_controller[1] & B01000000);
+    inputStatus[7] = (serial_rx_buffer_inverted_controller[1] & B10000000);
+
+    //  Second 8 buttons, Buffer Array Element 2
+    //  L2, R2, L1, R1, Triangle/Delta, Circle/O, Cross/X, Square
+    inputStatus[8] = (serial_rx_buffer_inverted_controller[2] & B00000001);
+    inputStatus[9] = (serial_rx_buffer_inverted_controller[2] & B00000010);
+    inputStatus[10] = (serial_rx_buffer_inverted_controller[2] & B00000100);
+    inputStatus[11] = (serial_rx_buffer_inverted_controller[2] & B00001000);
+    inputStatus[12] = (serial_rx_buffer_inverted_controller[2] & B00010000);
+    inputStatus[13] = (serial_rx_buffer_inverted_controller[2] & B00100000);
+    inputStatus[14] = (serial_rx_buffer_inverted_controller[2] & B01000000);
+    inputStatus[15] = (serial_rx_buffer_inverted_controller[2] & B10000000);
+
+    //  4 Axis, Buffer Array Elements 3, 4, 5, 6
+    //  RX, RY, LX, LY
+
+    //RX STICK
+    if (serial_rx_buffer_inverted_controller[3] > 127)
+    {
+      // Push RX Stick to Right
+      inputStatus[16] = HIGH;
+      inputStatus[17] = HIGH;
+    }
+
+    if (serial_rx_buffer_inverted_controller[3] < 127)
+    {
+      // Push RX Stick to Left
+      inputStatus[16] = LOW;
+      inputStatus[17] = LOW;
+    }
+
+    if (serial_rx_buffer_inverted_controller[3] == 127)
+    {
+      // Keep RX Stick Centered
+      inputStatus[16] = HIGH;
+      inputStatus[17] = LOW;
+    }
+
+    //RY STICK
+    if (serial_rx_buffer_inverted_controller[4] > 127)
+    {
+      // Push RY Stick to Up
+      inputStatus[18] = HIGH;
+      inputStatus[19] = HIGH;
+    }
+
+    if (serial_rx_buffer_inverted_controller[4] < 127)
+    {
+      // Push RY Stick to Down
+      inputStatus[18] = LOW;
+      inputStatus[19] = LOW;
+    }
+
+    if (serial_rx_buffer_inverted_controller[4] == 127)
+    {
+      // Keep RY Stick Centered
+      inputStatus[18] = HIGH;
+      inputStatus[19] = LOW;
+    }
+
+    //LX STICK
+    if (serial_rx_buffer_inverted_controller[5] > 127)
+    {
+      // Push LX Stick to Right
+      inputStatus[20] = HIGH;
+      inputStatus[21] = HIGH;
+    }
+
+    if (serial_rx_buffer_inverted_controller[5] < 127)
+    {
+      // Push LX Stick to Left
+      inputStatus[20] = LOW;
+      inputStatus[21] = LOW;
+    }
+
+    if (serial_rx_buffer_inverted_controller[5] == 127)
+    {
+      // Keep LX Stick Centered
+      inputStatus[20] = HIGH;
+      inputStatus[21] = LOW;
+    }
+
+    //LY STICK
+    if (serial_rx_buffer_inverted_controller[6] > 127)
+    {
+      // Push LY Stick to Down
+      inputStatus[22] = HIGH;
+      inputStatus[23] = HIGH;
+    }
+
+    if (serial_rx_buffer_inverted_controller[6] < 127)
+    {
+      // Push LY Stick to Up
+      inputStatus[22] = LOW;
+      inputStatus[23] = LOW;
+    }
+
+    if (serial_rx_buffer_inverted_controller[6] == 127)
+    {
+      // Keep LY Stick Centered
+      inputStatus[22] = HIGH;
+      inputStatus[23] = LOW;
+    }
+
+    //  Analog button (Used to change between Digital and Analog modes in older games), Buffer Array Element 7
+    //  All other bits in this Buffer Array Element are unused
+    inputStatus[24] = (serial_rx_buffer_inverted_controller[7] & B00000001);
+
+    digitalWrite(latchPin, LOW);
+    for (int i = 31; i >= 0; i--)
+    {
+      digitalWrite(clockPin, LOW);
+      digitalWrite(dataPin, inputStatus[i]);
+      digitalWrite(clockPin, HIGH);
+    }
+    digitalWrite(latchPin, HIGH);
+
+    //  Buffer Array Element 8 is unused in this code, but is existing in case changes are needed
+
+    //  Buffer Array Elements 9 and 10 are used to tell the Arduino how long commands are executed, on a delay ranging from 1-65535ms
+    //if (serial_rx_buffer[9] != 0x00)
+    //if (serial_rx_buffer[10] != 0x00)
+    if (inputDelay != 0) {
+      isInputtingDelayed = true;
+
+      //  The block below executes Soft Delay for holding the buttons down
+      if (isInputtingDelayed == true) {
+        if (currentMillis - previousInputDelay >= inputDelay) {
+          //  Now we need to stop the Soft Delay
+
+          //  Depress Buttons (Only if Buffer Array Element 9 and 10 != 0x00)
+          serial_rx_buffer_controller[1] = 0x00;
+          serial_rx_buffer_controller[2] = 0x00;
+          serial_rx_buffer_controller[3] = 0x7F;
+          serial_rx_buffer_controller[4] = 0x7F;
+          serial_rx_buffer_controller[5] = 0x7F;
+          serial_rx_buffer_controller[6] = 0x7F;
+          serial_rx_buffer_controller[7] = 0x00;
+          serial_rx_buffer_controller[8] = 0x00;
+          //serial_rx_buffer_controller[9] = 0x00;
+          //serial_rx_buffer_controller[10] = 0x00;
+
+          for (serial_rx_buffer_counter = 0; serial_rx_buffer_counter < sizeof(serial_rx_buffer_controller); serial_rx_buffer_counter++) {
+            Serial.write(serial_rx_buffer_controller[serial_rx_buffer_counter]); //  This line writes the serial data back to the computer as a way to check if the Arduino isn't interpreting wrong values
+            //  Invert 0 to 255 and vice versa to make it easier to determine which commands to enable or not, and their values
+            serial_rx_buffer_inverted_controller[serial_rx_buffer_counter] = (serial_rx_buffer_controller[serial_rx_buffer_counter]);
+            //Serial.println("TEST 2");
+          }
+
+          //  Reset delay to 0
+          serial_rx_buffer_controller[1] = 0x00;
+          serial_rx_buffer_controller[2] = 0x00;
+          serial_rx_buffer_controller[3] = 0x7F;
+          serial_rx_buffer_controller[4] = 0x7F;
+          serial_rx_buffer_controller[5] = 0x7F;
+          serial_rx_buffer_controller[6] = 0x7F;
+          serial_rx_buffer_controller[7] = 0x00;
+          serial_rx_buffer_controller[8] = 0x00;
+          serial_rx_buffer_controller[9] = 0x00;
+          serial_rx_buffer_controller[10] = 0x00;
+
+          for (serial_rx_buffer_counter = 0; serial_rx_buffer_counter < sizeof(serial_rx_buffer_controller); serial_rx_buffer_counter++) {
+            Serial.write(serial_rx_buffer_controller[serial_rx_buffer_counter]); //  This line writes the serial data back to the computer as a way to check if the Arduino isn't interpreting wrong values
+            //  Invert 0 to 255 and vice versa to make it easier to determine which commands to enable or not, and their values
+            serial_rx_buffer_inverted_controller[serial_rx_buffer_counter] = (serial_rx_buffer_controller[serial_rx_buffer_counter]);
+            //Serial.println("TEST 3");
+          }
+
+          //  First 8 buttons, Buffer Array Element 1
+          //  SELECT, L3, R3, START, DUP, DRIGHT, DDOWN, DLEFT
+          inputStatus[0] = (serial_rx_buffer_inverted_controller[1] & B00000001);
+          inputStatus[1] = (serial_rx_buffer_inverted_controller[1] & B00000010);
+          inputStatus[2] = (serial_rx_buffer_inverted_controller[1] & B00000100);
+          inputStatus[3] = (serial_rx_buffer_inverted_controller[1] & B00001000);
+          inputStatus[4] = (serial_rx_buffer_inverted_controller[1] & B00010000);
+          inputStatus[5] = (serial_rx_buffer_inverted_controller[1] & B00100000);
+          inputStatus[6] = (serial_rx_buffer_inverted_controller[1] & B01000000);
+          inputStatus[7] = (serial_rx_buffer_inverted_controller[1] & B10000000);
+
+          //  Second 8 buttons, Buffer Array Element 2
+          //  L2, R2, L1, R1, Triangle/Delta, Circle/O, Cross/X, Square
+          inputStatus[8] = (serial_rx_buffer_inverted_controller[2] & B00000001);
+          inputStatus[9] = (serial_rx_buffer_inverted_controller[2] & B00000010);
+          inputStatus[10] = (serial_rx_buffer_inverted_controller[2] & B00000100);
+          inputStatus[11] = (serial_rx_buffer_inverted_controller[2] & B00001000);
+          inputStatus[12] = (serial_rx_buffer_inverted_controller[2] & B00010000);
+          inputStatus[13] = (serial_rx_buffer_inverted_controller[2] & B00100000);
+          inputStatus[14] = (serial_rx_buffer_inverted_controller[2] & B01000000);
+          inputStatus[15] = (serial_rx_buffer_inverted_controller[2] & B10000000);
+
+          //  4 Axis, Buffer Array Elements 3, 4, 5, 6
+          //  RX, RY, LX, LY
+
+          //RX STICK
+          if (serial_rx_buffer_inverted_controller[3] > 127)
+          {
+            // Push RX Stick to Right
+            inputStatus[16] = HIGH;
+            inputStatus[17] = HIGH;
+          }
+
+          if (serial_rx_buffer_inverted_controller[3] < 127)
+          {
+            // Push RX Stick to Left
+            inputStatus[16] = LOW;
+            inputStatus[17] = LOW;
+          }
+
+          if (serial_rx_buffer_inverted_controller[3] == 127)
+          {
+            // Keep RX Stick Centered
+            inputStatus[16] = HIGH;
+            inputStatus[17] = LOW;
+          }
+
+          //RY STICK
+          if (serial_rx_buffer_inverted_controller[4] > 127)
+          {
+            // Push RY Stick to Up
+            inputStatus[18] = HIGH;
+            inputStatus[19] = HIGH;
+          }
+
+          if (serial_rx_buffer_inverted_controller[4] < 127)
+          {
+            // Push RY Stick to Down
+            inputStatus[18] = LOW;
+            inputStatus[19] = LOW;
+          }
+
+          if (serial_rx_buffer_inverted_controller[4] == 127)
+          {
+            // Keep RY Stick Centered
+            inputStatus[18] = HIGH;
+            inputStatus[19] = LOW;
+          }
+
+          //LX STICK
+          if (serial_rx_buffer_inverted_controller[5] > 127)
+          {
+            // Push LX Stick to Right
+            inputStatus[20] = HIGH;
+            inputStatus[21] = HIGH;
+          }
+
+          if (serial_rx_buffer_inverted_controller[5] < 127)
+          {
+            // Push LX Stick to Left
+            inputStatus[20] = LOW;
+            inputStatus[21] = LOW;
+          }
+
+          if (serial_rx_buffer_inverted_controller[5] == 127)
+          {
+            // Keep LX Stick Centered
+            inputStatus[20] = HIGH;
+            inputStatus[21] = LOW;
+          }
+
+          //LY STICK
+          if (serial_rx_buffer_inverted_controller[6] > 127)
+          {
+            // Push LY Stick to Down
+            inputStatus[22] = HIGH;
+            inputStatus[23] = HIGH;
+          }
+
+          if (serial_rx_buffer_inverted_controller[6] < 127)
+          {
+            // Push LY Stick to Up
+            inputStatus[22] = LOW;
+            inputStatus[23] = LOW;
+          }
+
+          if (serial_rx_buffer_inverted_controller[6] == 127)
+          {
+            // Keep LY Stick Centered
+            inputStatus[22] = HIGH;
+            inputStatus[23] = LOW;
+          }
+
+          //  Analog button (Used to change between Digital and Analog modes in older games), Buffer Array Element 7
+          //  All other bits in this Buffer Array Element are unused
+          inputStatus[24] = (serial_rx_buffer_inverted_controller[7] & B00000001);
+
+          digitalWrite(latchPin, LOW);
+          for (int i = 31; i >= 0; i--)
+          {
+            digitalWrite(clockPin, LOW);
+            digitalWrite(dataPin, inputStatus[i]);
+            digitalWrite(clockPin, HIGH);
+          }
+          digitalWrite(latchPin, HIGH);
+
+          //  Buffer Array Element 8 is unused in this code, but is existing in case changes are needed
+          //Serial.print('\n');
+          Serial.flush();
+
+          isInputtingDelayed = false;
+          isInputting = false;
+          //sentInputOnce = true;
+          previousInputDelay += inputDelay;
+          inputDelay = 0;
+        }
+      }
+    }
+  }
+}


added simple h-bridge driving example

added simple h-bridge driving example

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

--- motor_example.ino
+++ motor_example.ino
@@ -0,0 +1,59 @@
+#define PERIOD_US 1000
+#define INPUT_A 7
+#define INPUT_B 8
+
+void setup() {
+  // put your setup code here, to run once:
+  pinMode(INPUT_A, OUTPUT);
+  pinMode(INPUT_B, OUTPUT);
+
+  digitalWrite(INPUT_A, LOW);
+  digitalWrite(INPUT_B, LOW);
+
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+
+  run_pwm(.5, 0);
+
+}
+
+//give a floating-poing value between 0 and 1 for strength
+//give an integer (0,1) for direction
+void run_pwm(float strength, int direction)
+{
+  int high_time, low_time;
+  int which_pin;
+
+  //check for bad input
+  if(strength > 1.0)
+  {
+    strength = 1.0;
+  }
+  else if (strength < 0.0)
+  {
+    strength = 0.0;
+  }
+
+  //direction logic
+  if(direction == 1)
+  {
+    which_pin = INPUT_A;
+  }
+  else
+  {
+    which_pin = INPUT_B;
+  }
+
+  //compute delay time for duty cycle
+  high_time = strength*PERIOD_US;
+  low_time = PERIOD_US - high_time;
+
+  digitalWrite(which_pin, HIGH);
+  delayMicroseconds(high_time);
+  digitalWrite(which_pin, LOW);
+  delayMicroseconds(low_time);
+
+}
+


Create example.ino

Create example.ino

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


Added example

Added example

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

--- examples/timerExample/timerExample.ino
+++ examples/timerExample/timerExample.ino
@@ -0,0 +1,34 @@
+#include <Timer.h>
+
+Timer timer;
+
+const unsigned long duration = 1000;
+unsigned long remaining;
+
+void setup()
+{
+  Serial.begin(9600);
+
+  Serial.print(F("Starting Timer, with duration: "));
+  Serial.println(duration);
+
+  timer.start(duration);
+
+  for (byte i=0; i<5; i++) {
+    remaining = timer.remaining();
+
+    Serial.print(F("remaining after "));
+    Serial.print(i * 25);
+    Serial.print(F("%: "));
+    Serial.print(remaining);
+    Serial.print(F(", isComplete: "));
+    Serial.println((timer.isComplete()) ? "True" : "False" );
+
+    delay(duration / 4);
+  }
+
+}
+
+void loop()
+{
+}


Create arduino.ino

Create arduino.ino

3 buttons to send a Yo! via serial port, than relay.sh

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

--- arduino.ino
+++ arduino.ino
@@ -0,0 +1,52 @@
+// include the library code:
+#include <LiquidCrystal.h>
+
+/* The circuit:
+ * LCD RS pin to digital pin 12
+ * LCD Enable pin to digital pin 11
+ * LCD D4 pin to digital pin 5
+ * LCD D5 pin to digital pin 4
+ * LCD D6 pin to digital pin 3
+ * LCD D7 pin to digital pin 2
+ * LCD R/W pin to ground
+ * 10K resistor:
+ * ends to +5V and ground
+ * wiper to LCD VO pin (pin 3)
+ */
+// initialize the library with the numbers of the interface pins
+//YoLunchLiquidCrystal lcd(12, 11, 5, 4, 3, 2);
+
+const int JAP_BTN =    2;
+const int THAI_BTN =   7;
+const int VIET_BTN =  13;
+
+void setup()
+{
+  // Start the hardware serial port
+  Serial.begin(9600);
+
+  // initialize the pushbutton pin as an input:
+  pinMode(JAP_BTN , INPUT);
+  pinMode(THAI_BTN, INPUT);
+  pinMode(VIET_BTN, INPUT);
+
+}
+
+void loop()
+{
+  // read the state of the pushbutton value:
+  if( digitalRead(JAP_BTN) ==  HIGH ) {
+    Serial.println("6d75ec65-b3c9-2012-56f3-600495c2a747");
+    delay(600);
+  }
+  if( digitalRead(THAI_BTN) ==  HIGH ) {
+    Serial.println("184aecbf-b424-7fa6-9a20-69b7fa5025c9");
+    delay(600);
+  }
+  if( digitalRead(VIET_BTN) ==  HIGH ) {
+    Serial.println("8f5bbbd0-01c8-5926-51e5-a3a0767582f4");
+    delay(600);
+  }
+}
+
+


Add example

Add example

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

--- examples/Widgets/TimeInput/TimeInput.ino
+++ examples/Widgets/TimeInput/TimeInput.ino
@@ -0,0 +1,65 @@
+/**************************************************************
+ * Blynk is a platform with iOS and Android apps to control
+ * Arduino, Raspberry Pi and the likes over the Internet.
+ * You can easily build graphic interfaces for all your
+ * projects by simply dragging and dropping widgets.
+ *
+ *   Downloads, docs, tutorials: http://www.blynk.cc
+ *   Blynk community:            http://community.blynk.cc
+ *   Social networks:            http://www.fb.com/blynkapp
+ *                               http://twitter.com/blynk_app
+ *
+ * Blynk library is licensed under MIT license
+ * This example code is in public domain.
+ *
+ **************************************************************
+ *
+ * App project setup:
+ *   Time Input widget on V1.
+ *
+ **************************************************************/
+
+#define BLYNK_PRINT Serial
+#include <SPI.h>
+#include <Ethernet.h>
+#include <BlynkSimpleEthernet.h>
+
+// You should get Auth Token in the Blynk App.
+// Go to the Project Settings (nut icon).
+char auth[] = "YourAuthToken";
+
+void setup()
+{
+  Serial.begin(9600);
+  Blynk.begin(auth);
+}
+
+BLYNK_WRITE(V1) {
+  TimeInputParam time_input(param);
+
+  // Process start time
+  if (BlynkDateTime& t = time_input.getStart())
+  {
+    Serial.println(String("Start: ") + t.hour() + ":" + t.minute() + ":" + t.second() + " " +
+                   t.day() + "."  + t.month() + "."  + t.year());
+  }
+
+  // Process stop time, if present
+  if (BlynkDateTime& t = time_input.getStop())
+  {
+    Serial.println(String("Stop: ")  + t.hour() + ":" + t.minute() + ":" + t.second() + " " +
+                   t.day() + "."  + t.month() + "."  + t.year());
+  }
+
+  // Process timezone
+  Serial.println(String("Time zone: ") + time_input.getTZ());
+
+  // TODO: Process weekdays
+
+  Serial.println();
+}
+
+void loop()
+{
+  Blynk.run();
+}


Create frcleds.ino

Create frcleds.ino

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

--- frcleds.ino
+++ frcleds.ino
@@ -0,0 +1,134 @@
+#include <Adafruit_NeoPixel.h>
+
+
+// Parameter 1 = number of pixels in strip
+// Parameter 2 = pin number (most are valid)
+// Parameter 3 = pixel type flags, add together as needed:
+//   NEO_RGB     Pixels are wired for RGB bitstream
+//   NEO_GRB     Pixels are wired for GRB bitstream
+//   NEO_KHZ400  400 KHz bitstream (e.g. FLORA pixels)
+//   NEO_KHZ800  800 KHz bitstream (e.g. High Density LED strip)
+Adafruit_NeoPixel strip = Adafruit_NeoPixel(30, 6, NEO_GRB + NEO_KHZ800);
+
+#define STATEPIN 2
+
+void setup()
+{
+  pinMode(STATEPIN, INPUT);
+
+  strip.begin();
+  strip.show();
+
+  for ( int i = 0; i < strip.numPixels()/2; i++ )
+  {
+    strip.setPixelColor(i, strip.Color(255,0,0));
+    strip.setPixelColor(strip.numPixels()-i, strip.Color(0,0,255));
+    strip.show();
+    delay(100);
+  }
+}
+
+void loop()
+{
+  if ( !digitalRead(STATEPIN) )
+    cycle(strip.Color(255,0,0));
+  else
+    lazorRed();
+}
+
+void cycle(uint32_t color)
+{
+  _cycle(0, color);
+  delay(100);
+  _cycle(1, color);
+  delay(100);
+  _cycle(2, color);
+  delay(100);
+}
+
+void _cycle(int a, uint32_t color)
+{
+    for ( uint16_t b = 0; b < strip.numPixels(); b++ )
+    {
+      if ( b%3 == a )
+      {
+        strip.setPixelColor(b, color);
+      }
+      else
+      {
+        strip.setPixelColor(b, strip.Color(0,0,0));
+      }
+    }
+    strip.show();
+}
+
+
+void lazor(uint32_t color)
+{
+  for ( uint16_t a = 0; a < strip.numPixels(); a++ )
+  {
+    for ( uint16_t b = 0; b < strip.numPixels(); b++ )
+    {
+      strip.setPixelColor(b,strip.Color(0,0,0));
+    }
+    strip.setPixelColor(a, color);
+    strip.show();
+    delay(30-a);
+  }
+}
+
+void lazorRed()
+{
+  for ( uint16_t a = 0; a < strip.numPixels(); a++ )
+  {
+    for ( uint16_t b = 0; b < strip.numPixels(); b++ )
+    {
+      strip.setPixelColor(b,strip.Color(100, 100, 100));
+    }
+    strip.setPixelColor(a, strip.Color(255, 0, 0));
+    strip.setPixelColor(a-1, strip.Color(170, 0, 0));
+    strip.setPixelColor(a-2, strip.Color(170, 0, 0));
+    strip.setPixelColor(a-3, strip.Color(170, 0, 0));
+
+    strip.setPixelColor(a-4,strip.Color(170, 112, 0));
+    strip.setPixelColor(a-5, strip.Color(127, 84, 0));
+    strip.setPixelColor(a-6, strip.Color(127, 84, 0));
+    strip.setPixelColor(a-7, strip.Color(127, 84, 0));
+    strip.show();
+    delay(13);
+  }
+}
+
+void solid(uint32_t color)
+{
+  for ( uint16_t b = 0; b < strip.numPixels(); b++ )
+  {
+    strip.setPixelColor(b,color);
+  }
+  strip.show();
+}
+
+void fadeFlash()
+{
+  for ( int i = 0; i < 255; i++ )
+  {
+    for ( uint16_t b = 0; b < strip.numPixels(); b++ )
+    {
+        strip.setPixelColor(b,strip.Color(i, 0, 0));
+    }
+
+    strip.show();
+    delay(2);
+  }
+
+  for ( int i = 255; i > 0; i-- )
+  {
+    for ( uint16_t b = 0; b < strip.numPixels(); b++ )
+    {
+        strip.setPixelColor(b,strip.Color(i, 0, 0));
+    }
+
+    strip.show();
+    delay(2);
+  }
+}


Countdown timer project

Countdown timer project

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

--- countdown-timer/countdown-timer.ino
+++ countdown-timer/countdown-timer.ino
@@ -0,0 +1,300 @@
+// include the libraries for Windows Virtual Shields
+#include <ArduinoJson.h>
+#include <VirtualShield.h>
+#include <Text.h>
+#include <Speech.h>
+#include <Recognition.h>
+
+// include the library for the LED matrix
+#include <NS_Rainbow.h>
+
+// define the shield
+VirtualShield shield;
+
+// connect to the screen
+Text screen = Text(shield);
+
+// connect text to speech
+Speech speech = Speech(shield);
+
+// connect speech to text
+Recognition recognition = Recognition(shield);
+
+// define the pin to be used for the LED matrix
+const int ledPin = 9;
+
+// define the pin to be used for the piezo buzzer
+const int buzzerPin = 3;
+
+// define the matrix with 64 LEDs and the pin it is connected to
+NS_Rainbow matrix = NS_Rainbow(64, ledPin);
+
+// track the current x position of the drop within each column
+int xPosition[8];
+
+// track the color of the drop within each column
+uint32_t xColor[8];
+
+// use a timer to indicate when a drop should move within each column
+unsigned long dropTimer[8];
+
+// track the fall rate for the drop within each column
+int dropRate[8];
+
+// track the x position of last lit LED within each column
+int lastOn[8];
+
+// track the x position where the drops have stacked
+int stackRow[8];
+
+// track the columns in which the drops are stacked all the way to the top
+boolean columnFull[8];
+
+// track the color of the drop when it is stacked for each LED
+uint32_t lastColor[8][8];
+
+// set upper and lower bounds for the drop rate
+int minRate = 100;
+int maxRate = 250;
+
+// track the rate at which drops stack
+unsigned long stackRate;
+
+// use a timer to indicate when drops should stack
+unsigned long stackTimer;
+
+// track the number of full columns
+int fullCount;
+
+// set loop counters for the rows and columns
+int x, y;
+
+String startMessage = "Set the timer for one, two, or five minutes";
+
+void setup()
+{
+  // initialize the LED matrix
+  delay(100);
+  matrix.begin();
+
+  // clear all the LEDs
+  // and show the blank matrix
+  matrix.clear();
+  matrix.show();
+
+  // set the brightness of the matrix
+  // within a range of 0 - 255
+  matrix.setBrightness(128);
+
+  // begin Virtual Shields for Arduino communication.
+  // You may specify a baud rate as a parameter, default is 115200
+  shield.begin();
+}
+
+void loop()
+{
+  // clear the phone's screen
+  screen.clear();
+
+  // print and speak instructions
+  screen.print(startMessage);
+  speech.speak(startMessage);
+  delay(3000);
+
+  // blocks until a word is recognized
+  if (recognition.listenFor("one,two,five", false))
+  {
+    switch (recognition.recognizedIndex)
+    {
+      case 1:
+        // start timer with a duration of one minute in milliseconds
+        startTimer(60000);
+        break;
+      case 2:
+        // start timer with a duration of two minutes in milliseconds
+        startTimer(120000);
+        break;
+      case 3:
+        // start timer with a duration of five minutes in milliseconds
+        startTimer(300000);
+        break;
+    }
+  }
+}
+
+void startTimer(unsigned long timer)
+{
+  // reset full column counter
+  fullCount = 0;
+
+  // itereate through each column
+  for (y = 0; y < 8; y++)
+  {
+    // start drops at the top of each column - i.e. x = 0
+    xPosition[y] = 0;
+
+    // clear column stacks
+    columnFull[y] = false;
+    stackRow[y] = 8;
+
+    // randomly generate the drop rate for each column
+    // and set the timer
+    dropRate[y] = random(minRate, maxRate);
+    dropTimer[y] = millis() + dropRate[y];
+
+    // randomly generate a drop color for each column
+    xColor[y] = random(0xFFFFFF);
+  }
+
+  // calculate the rate at which drops will stack
+  // divide the timer by the number of LEDs in the matrix
+  // and then set the stacking timer
+  stackRate = timer / 64;
+  stackTimer = millis() + stackRate;
+
+  while (fullCount != 8)
+  {
+    // iterate through each column
+    for (y = 0; y < 8; y++)
+    {
+      // check if the column is already full
+      if (columnFull[y] == false)
+      {
+        // since the column isn't full
+        // check if it's time to move the drop
+        if (millis() > dropTimer[y])
+        {
+          // since it's time to move the drop
+          // check if the drop has reached the top of the stack
+          if (xPosition[y] == stackRow[y])
+          {
+            // since the drop has reached the top of the stack
+            // check if it's time to stack the droplet
+            if (millis() > stackTimer)
+            {
+              // it's time to stack the drop
+              // so don't turn it off
+              // move the stack row up the column
+              stackRow[y] = stackRow[y] - 1;
+
+              // record the color of the drop when it is stacked
+              lastColor[stackRow[y]][y] = xColor[y];
+
+              // restart the stack timer
+              stackTimer = stackTimer + stackRate;
+
+              // check if the column is full
+              if (stackRow[y] == 0)
+              {
+                // since the column is full
+                // set columnFull to true
+                // and increment the number of full columns
+                columnFull[y] = true;
+                fullCount++;
+              }
+            }
+            else
+            {
+              // drop has reached the top of the stack
+              // but it's not time to stack the drop
+              // so just 'turn off' the drop
+              // and display the LEDs which have just been set
+              matrix.setColor(convertRowCol(lastOn[y], y), 0, 0, 0);
+              matrix.show();
+            }
+
+            // restart the drop at the top
+            xPosition[y] = 0;
+
+            // generate a new drop rate for the column
+            dropRate[y] = random(minRate, maxRate);
+
+            // generate a new color for the column
+            xColor[y] = random(0xFFFFFF);
+          }
+          else
+          {
+            // the drop has not reached the top of the stack
+            // check if drop is at the top of the column
+            if (xPosition[y] != 0)
+            {
+              // drop is not at the top of the column
+              // so turn off the last drop
+              matrix.setColor(convertRowCol(lastOn[y], y), 0, 0, 0);
+            }
+
+            // turn on the current drop
+            matrix.setColor(convertRowCol(xPosition[y], y), xColor[y]);
+
+            // display the LEDs which have just been set
+            matrix.show();
+
+            // remember position of current drop
+            lastOn[y] = xPosition[y];
+
+            // increment the x position for the next drop within the column
+            xPosition[y]++;
+          }
+
+          // restart the drop timer
+          dropTimer[y] = millis() + dropRate[y];
+        }
+      }
+    }
+  }
+
+  // all columns are full so the countdown has ended
+  alarm();
+}
+
+// convert (row,col) position to sequential position
+int convertRowCol(int row, int col)
+{
+  // return the sequential position
+  return (row*8)+col;
+}
+
+// once the timer ends, sound the alarm
+void alarm()
+{
+  // clear all the LEDs
+  // and show the blank matrix
+  matrix.clear();
+  matrix.show();
+
+  // alarm is sounded for 5 cycles
+  for (int z = 0; z < 5; z++)
+  {
+    // iterate through the rows
+    for (x = 0; x < 8; x++)
+    {
+      // iterate through the columns
+      for (y = 0; y < 8; y++)
+      {
+        // turn on each drop using its last color
+        matrix.setColor(convertRowCol(x, y), lastColor[x][y]);
+      }
+    }
+
+    // display the LEDs which have just been set
+    matrix.show();
+
+    // turn on the buzzer
+    // at a frequency roughly equivalent to G6
+    tone(buzzerPin, 1568);
+
+    // wait 1.5 seconds
+    delay(1500);
+
+    // clear all the LEDs
+    // and show the blank matrix
+    matrix.clear();
+    matrix.show();
+
+    // turn off the buzzer
+    noTone(buzzerPin);
+
+    // wait 1.5 seconds
+    delay(1500);
+  }
+}


Add my first (still empty) Arduino sketch

Signed-off-by: Gianpaolo Macario <f8885408b8c3d931b330bae3c3a28a3af912c463@gmail.com>

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

--- sketch_feb14b/sketch_feb14b.ino
+++ sketch_feb14b/sketch_feb14b.ino
@@ -0,0 +1,9 @@
+void setup() {
+  // put your setup code here, to run once:
+
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+
+}


added arduino laser power relay code

added arduino laser power relay code

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

--- Laser_power_relay/Laser_power_relay.ino
+++ Laser_power_relay/Laser_power_relay.ino
@@ -0,0 +1,22 @@
+int incomingByte = 0;   // for incoming serial data
+const int led = 12;
+
+void setup() {
+  Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
+  pinMode(led, OUTPUT);
+}
+void loop() {
+
+  // send data only when you receive data:
+  if (Serial.available() > 0) {
+    // read the incoming byte:
+    incomingByte = Serial.read();
+    if ( incomingByte > 48) {
+      digitalWrite(led, HIGH);
+    }
+    if ( incomingByte < 49) {
+      digitalWrite(led, LOW);
+    }
+
+  }
+}


update

update

error: pathspec 'RokibIUTEEE/Arduino' did not match any file(s) known to git
error: pathspec 'Code/HomeSecurity/HomeSecurity.ino' did not match any file(s) known to git


add05

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

--- Arduino05_03_pullup/Arduino05_03_pullup.ino
+++ Arduino05_03_pullup/Arduino05_03_pullup.ino
@@ -0,0 +1,11 @@
+void setup() {
+  pinMode(2, INPUT_PULLUP);
+}
+
+void loop() {
+  if(digitalRead(2) == LOW)
+  {
+    // Button wurde gedrueckt
+    // das wird ausgefuehrt...
+  }
+}


Bluetooth mode

Bluetooth mode

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

--- OTTO_todo/OTTO_todo.ino
+++ OTTO_todo/OTTO_todo.ino
@@ -0,0 +1,1103 @@
+
+//----------------------------------------------------------------
+//-- Zowi basic firmware v2 adapted to Otto
+//-- (c) BQ. Released under a GPL licencse
+//-- 04 December 2015
+//-- Authors:  Anita de Prado: ana.deprado@bq.com
+//--           Jose Alberca:   jose.alberca@bq.com
+//--           Javier Isabel:  javier.isabel@bq.com
+//--           Juan Gonzalez (obijuan): juan.gonzalez@bq.com
+//--           Irene Sanz : irene.sanz@bq.com
+//-----------------------------------------------------------------
+//-- Experiment with all the features that Otto has thanks to Zowi!
+//-----------------------------------------------------------------
+
+#include <Servo.h>
+#include <Oscillator.h>
+#include <EEPROM.h>
+#include <BatReader.h>
+#include <US.h>
+#include <LedMatrix.h>
+
+//-- Library to manage external interruptions
+#include <EnableInterrupt.h>
+
+//-- Library to manage serial commands
+#include <OttoSerialCommand.h>
+OttoSerialCommand SCmd;  //The SerialCommand object
+
+//-- Otto Library
+#include <Otto.h>
+Otto Otto;  //This is Otto!
+
+//---------------------------------------------------------
+//-- First step: Configure the pins where the servos are attached
+/*
+         ---------------
+        |     O   O     |
+        |---------------|
+YR 3==> |               | <== YL 2
+         ---------------
+            ||     ||
+            ||     ||
+RR 5==>   -----   ------  <== RL 4
+         |-----   ------|
+*/
+
+  #define PIN_YL 2 //servo[0]
+  #define PIN_YR 3 //servo[1]
+  #define PIN_RL 4 //servo[2]
+  #define PIN_RR 5 //servo[3]
+
+//---Otto Buttons
+#define PIN_SecondButton 6
+#define PIN_ThirdButton 7
+
+///////////////////////////////////////////////////////////////////
+//-- Global Variables -------------------------------------------//
+///////////////////////////////////////////////////////////////////
+
+const char programID[]="Otto_todo"; //Each program will have a ID
+
+const char name_fac='$'; //Factory name
+const char name_fir='#'; //First name
+
+//-- Movement parameters
+int T=1000;              //Initial duration of movement
+int moveId=0;            //Number of movement
+int moveSize=15;         //Asociated with the height of some movements
+
+//---------------------------------------------------------
+//-- Otto has 5 modes:
+//--    * MODE = 0: Otto is awaiting
+//--    * MODE = 1: Dancing mode!
+//--    * MODE = 2: Obstacle detector mode
+//--    * MODE = 3: Noise detector mode
+//--    * MODE = 4: OttoPAD or any Teleoperation mode (listening SerialPort).
+//---------------------------------------------------------
+volatile int MODE=0; //State of Otto in the principal state machine.
+
+volatile bool buttonPushed=false;  //Variable to remember when a button has been pushed
+volatile bool buttonAPushed=false; //Variable to remember when A button has been pushed
+volatile bool buttonBPushed=false; //Variable to remember when B button has been pushed
+
+unsigned long previousMillis=0;
+
+int randomDance=0;
+int randomSteps=0;
+
+bool obstacleDetected = false;
+
+
+///////////////////////////////////////////////////////////////////
+//-- Setup ------------------------------------------------------//
+///////////////////////////////////////////////////////////////////
+void setup(){
+
+  //Serial communication initialization
+  Serial.begin(115200);
+
+  pinMode(PIN_SecondButton,INPUT);
+  pinMode(PIN_ThirdButton,INPUT);
+
+  //Set the servo pins
+  Otto.init(PIN_YL,PIN_YR,PIN_RL,PIN_RR,true);
+
+  //Uncomment this to set the servo trims manually and save on EEPROM
+    //Otto.setTrims(TRIM_YL, TRIM_YR, TRIM_RL, TRIM_RR);
+    //Otto.saveTrimsOnEEPROM(); //Uncomment this only for one upload when you finaly set the trims.
+
+  //Set a random seed
+  randomSeed(analogRead(A6));
+
+  //Interrumptions
+  enableInterrupt(PIN_SecondButton, secondButtonPushed, RISING);
+  enableInterrupt(PIN_ThirdButton, thirdButtonPushed, RISING);
+
+  //Setup callbacks for SerialCommand commands
+  SCmd.addCommand("S", receiveStop);      //  sendAck & sendFinalAck
+  SCmd.addCommand("L", receiveLED);       //  sendAck & sendFinalAck
+  SCmd.addCommand("T", recieveBuzzer);    //  sendAck & sendFinalAck
+  SCmd.addCommand("M", receiveMovement);  //  sendAck & sendFinalAck
+  SCmd.addCommand("H", receiveGesture);   //  sendAck & sendFinalAck
+  SCmd.addCommand("K", receiveSing);      //  sendAck & sendFinalAck
+  SCmd.addCommand("C", receiveTrims);     //  sendAck & sendFinalAck
+  SCmd.addCommand("G", receiveServo);     //  sendAck & sendFinalAck
+  SCmd.addCommand("R", receiveName);      //  sendAck & sendFinalAck
+  SCmd.addCommand("E", requestName);
+  SCmd.addCommand("D", requestDistance);
+  SCmd.addCommand("N", requestNoise);
+  SCmd.addCommand("B", requestBattery);
+  SCmd.addCommand("I", requestProgramId);
+  SCmd.addDefaultHandler(receiveStop);
+
+
+
+  //Otto wake up!
+  Otto.sing(S_connection);
+  Otto.home();
+
+
+  //If Otto's name is '&' (factory name) means that is the first time this program is executed.
+  //This first time, Otto mustn't do anything. Just born at the factory!
+  //5 = EEPROM address that contains first name character
+  if (EEPROM.read(5)==name_fac){
+
+    EEPROM.put(5, name_fir); //From now, the name is '#'
+    EEPROM.put(6, '\0');
+    Otto.putMouth(culito);
+
+    while(true){
+       delay(1000);
+    }
+  }
+
+
+  //Send Otto name, programID & battery level.
+  requestName();
+  delay(50);
+  requestProgramId();
+  delay(50);
+  requestBattery();
+
+  //Checking battery
+  OttoLowBatteryAlarm();
+
+
+ // Animation Uuuuuh - A little moment of initial surprise
+ //-----
+  for(int i=0; i<2; i++){
+      for (int i=0;i<8;i++){
+        if(buttonPushed){break;}
+        Otto.putAnimationMouth(littleUuh,i);
+        delay(150);
+      }
+  }
+ //-----
+
+
+  //Smile for a happy Otto :)
+  if(!buttonPushed){
+    Otto.putMouth(smile);
+    Otto.sing(S_happy);
+    delay(200);
+  }
+
+
+  //If Otto's name is '#' means that Otto hasn't been baptized
+  //In this case, Otto does a longer greeting
+  //5 = EEPROM address that contains first name character
+  if (EEPROM.read(5)==name_fir){
+
+    if(!buttonPushed){
+        Otto.jump(1,700);
+        delay(200);
+    }
+
+    if(!buttonPushed){
+        Otto.shakeLeg(1,T,1);
+    }
+
+    if(!buttonPushed){
+        Otto.putMouth(smallSurprise);
+        Otto.swing(2,800,20);
+        Otto.home();
+    }
+  }
+
+
+  if(!buttonPushed){
+    Otto.putMouth(happyOpen);
+  }
+
+  previousMillis = millis();
+
+}
+
+
+
+///////////////////////////////////////////////////////////////////
+//-- Principal Loop ---------------------------------------------//
+///////////////////////////////////////////////////////////////////
+void loop() {
+
+
+  if (Serial.available()>0 && MODE!=4){
+
+    MODE=4;
+    Otto.putMouth(happyOpen);
+
+    //Disable Pin Interruptions
+    disableInterrupt(PIN_SecondButton);
+    disableInterrupt(PIN_ThirdButton);
+
+    buttonPushed=false;
+  }
+
+
+  //First attemp to initial software
+  if (buttonPushed){
+
+    Otto.home();
+
+    delay(100); //Wait for all buttons
+    Otto.sing(S_buttonPushed);
+    delay(200); //Wait for all buttons
+
+    if      ( buttonAPushed && !buttonBPushed){ MODE=1; Otto.sing(S_mode1);}
+    else if (!buttonAPushed && buttonBPushed) { MODE=2; Otto.sing(S_mode2);}
+    else if ( buttonAPushed && buttonBPushed) { MODE=3; Otto.sing(S_mode3);} //else
+
+    Otto.putMouth(MODE);
+
+    int showTime = 2000;
+    while((showTime>0)){ //Wait to show the MODE number
+
+        showTime-=10;
+        delay(10);
+    }
+
+    Otto.putMouth(happyOpen);
+
+    buttonPushed=false;
+    buttonAPushed=false;
+    buttonBPushed=false;
+
+  }else{
+
+    switch (MODE) {
+
+      //-- MODE 0 - Otto is awaiting
+      //---------------------------------------------------------
+      case 0:
+
+        //Every 80 seconds in this mode, Otto falls asleep
+        if (millis()-previousMillis>=80000){
+            OttoSleeping_withInterrupts(); //ZZzzzzz...
+            previousMillis=millis();
+        }
+
+        break;
+
+
+      //-- MODE 1 - Dance Mode!
+      //---------------------------------------------------------
+      case 1:
+
+        randomDance=random(5,21); //5,20
+        if((randomDance>14)&&(randomDance<19)){
+            randomSteps=1;
+            T=1600;
+        }
+        else{
+            randomSteps=random(3,6); //3,5
+            T=1000;
+        }
+
+        Otto.putMouth(random(10,21));
+
+        for (int i=0;i<randomSteps;i++){
+            move(randomDance);
+            if(buttonPushed){break;}
+        }
+        break;
+
+
+      //-- MODE 2 - Obstacle detector mode
+      //---------------------------------------------------------
+      case 2:
+
+        if(obstacleDetected){
+
+            if(!buttonPushed){
+              Otto.putMouth(bigSurprise);
+              Otto.sing(S_surprise);
+              Otto.jump(5, 500);
+            }
+
+            if(!buttonPushed){
+              Otto.putMouth(confused);
+              Otto.sing(S_cuddly);
+            }
+
+            //Otto takes two steps back
+            for(int i=0;i<3;i++){
+              if(buttonPushed){break;}
+              Otto.walk(1,1300,-1);
+            }
+
+            delay(100);
+            obstacleDetector();
+            delay(100);
+
+
+           //If there are no obstacles and no button is pressed, Otto shows a smile
+           if((obstacleDetected==true)||(buttonPushed==true)){break;}
+           else{
+              Otto.putMouth(smile);
+              delay(50);
+              obstacleDetector();
+           }
+
+
+           //If there are no obstacles and no button is pressed, Otto shows turns left
+           for(int i=0; i<3; i++){
+              if((obstacleDetected==true)||(buttonPushed==true)){break;}
+              else{
+                  Otto.turn(1,1000,1);
+                  obstacleDetector();
+              }
+           }
+
+            //If there are no obstacles and no button is pressed, Otto is happy
+            if((obstacleDetected==true)||(buttonPushed==true)){break;}
+            else{
+                Otto.home();
+                Otto.putMouth(happyOpen);
+                Otto.sing(S_happy_short);
+                delay(200);
+            }
+
+
+        }else{
+
+            Otto.walk(1,1000,1); //Otto walk straight
+            obstacleDetector();
+        }
+
+        break;
+
+
+      //-- MODE 3 - Noise detector mode
+      //---------------------------------------------------------
+      case 3:
+        if (Otto.getNoise()>=650){ //740
+
+          delay(50);  //Wait for the possible 'lag' of the button interruptions.
+                      //Sometimes, the noise sensor detect the button before the interruption takes efect
+
+          if(!buttonPushed){
+
+            Otto.putMouth(bigSurprise);
+            Otto.sing(S_OhOoh);
+
+            if(buttonPushed){break;}
+            Otto.putMouth(random(10,21));
+            randomDance=random(5,21);
+            move(randomDance);
+            Otto.home();
+            delay(500); //Wait for possible noise of the servos while get home
+          }
+
+          if(!buttonPushed){Otto.putMouth(happyOpen);}
+        }
+        break;
+
+
+      //-- MODE 4 - OttoPAD or any Teleoperation mode (listening SerialPort)
+      //---------------------------------------------------------
+      case 4:
+
+        SCmd.readSerial();
+
+        //If Otto is moving yet
+        if (Otto.getRestState()==false){
+          move(moveId);
+        }
+
+        break;
+
+
+      default:
+          MODE=4;
+          break;
+    }
+
+  }
+
+}
+
+
+
+///////////////////////////////////////////////////////////////////
+//-- Functions --------------------------------------------------//
+///////////////////////////////////////////////////////////////////
+
+//-- Function executed when second button is pushed
+void secondButtonPushed(){
+
+    buttonAPushed=true;
+
+    if(!buttonPushed){
+        buttonPushed=true;
+        Otto.putMouth(smallSurprise);
+    }
+}
+
+//-- Function executed when third button is pushed
+void thirdButtonPushed(){
+
+    buttonBPushed=true;
+
+    if(!buttonPushed){
+        buttonPushed=true;
+        Otto.putMouth(smallSurprise);
+    }
+}
+
+
+//-- Function to read distance sensor & to actualize obstacleDetected variable
+void obstacleDetector(){
+
+   int distance = Otto.getDistance();
+
+        if(distance<15){
+          obstacleDetected = true;
+        }else{
+          obstacleDetected = false;
+        }
+}
+
+
+//-- Function to receive Stop command.
+void receiveStop(){
+
+    sendAck();
+    Otto.home();
+    sendFinalAck();
+
+}
+
+
+//-- Function to receive LED commands
+void receiveLED(){
+
+    //sendAck & stop if necessary
+    sendAck();
+    Otto.home();
+
+    //Examples of receiveLED Bluetooth commands
+    //L 000000001000010100100011000000000
+    //L 001111111111111111111111111111111 (todos los LED encendidos)
+    unsigned long int matrix;
+    char *arg;
+    char *endstr;
+    arg=SCmd.next();
+    //Serial.println (arg);
+    if (arg != NULL) {
+      matrix=strtoul(arg,&endstr,2);    // Converts a char string to unsigned long integer
+      Otto.putMouth(matrix,false);
+    }else{
+      Otto.putMouth(xMouth);
+      delay(2000);
+      Otto.clearMouth();
+    }
+
+    sendFinalAck();
+
+}
+
+
+//-- Function to receive buzzer commands
+void recieveBuzzer(){
+
+    //sendAck & stop if necessary
+    sendAck();
+    Otto.home();
+
+    bool error = false;
+    int frec;
+    int duration;
+    char *arg;
+
+    arg = SCmd.next();
+    if (arg != NULL) { frec=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    arg = SCmd.next();
+    if (arg != NULL) { duration=atoi(arg); } // Converts a char string to an integer
+    else {error=true;}
+
+    if(error==true){
+
+      Otto.putMouth(xMouth);
+      delay(2000);
+      Otto.clearMouth();
+
+    }else{
+
+      Otto._tone(frec, duration, 1);
+    }
+
+    sendFinalAck();
+
+}
+
+
+//-- Function to receive TRims commands
+void receiveTrims(){
+
+    //sendAck & stop if necessary
+    sendAck();
+    Otto.home();
+
+    int trim_YL,trim_YR,trim_RL,trim_RR;
+
+    //Definition of Servo Bluetooth command
+    //C trim_YL trim_YR trim_RL trim_RR
+    //Examples of receiveTrims Bluetooth commands
+    //C 20 0 -8 3
+    bool error = false;
+    char *arg;
+    arg=SCmd.next();
+    if (arg != NULL) { trim_YL=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    arg = SCmd.next();
+    if (arg != NULL) { trim_YR=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    arg = SCmd.next();
+    if (arg != NULL) { trim_RL=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    arg = SCmd.next();
+    if (arg != NULL) { trim_RR=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    if(error==true){
+
+      Otto.putMouth(xMouth);
+      delay(2000);
+      Otto.clearMouth();
+
+    }else{ //Save it on EEPROM
+      Otto.setTrims(trim_YL, trim_YR, trim_RL, trim_RR);
+      Otto.saveTrimsOnEEPROM(); //Uncomment this only for one upload when you finaly set the trims.
+    }
+
+    sendFinalAck();
+
+}
+
+
+//-- Function to receive Servo commands
+void receiveServo(){
+
+    sendAck();
+    moveId = 30;
+
+    //Definition of Servo Bluetooth command
+    //G  servo_YL servo_YR servo_RL servo_RR
+    //Example of receiveServo Bluetooth commands
+    //G 90 85 96 78
+    bool error = false;
+    char *arg;
+    int servo_YL,servo_YR,servo_RL,servo_RR;
+
+    arg=SCmd.next();
+    if (arg != NULL) { servo_YL=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    arg = SCmd.next();
+    if (arg != NULL) { servo_YR=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    arg = SCmd.next();
+    if (arg != NULL) { servo_RL=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    arg = SCmd.next();
+    if (arg != NULL) { servo_RR=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    if(error==true){
+
+      Otto.putMouth(xMouth);
+      delay(2000);
+      Otto.clearMouth();
+
+    }else{ //Update Servo:
+
+      int servoPos[4]={servo_YL, servo_YR, servo_RL, servo_RR};
+      Otto._moveServos(200, servoPos);   //Move 200ms
+
+    }
+
+    sendFinalAck();
+
+}
+
+
+//-- Function to receive movement commands
+void receiveMovement(){
+
+    sendAck();
+
+    if (Otto.getRestState()==true){
+        Otto.setRestState(false);
+    }
+
+    //Definition of Movement Bluetooth commands
+    //M  MoveID  T   MoveSize
+    char *arg;
+    arg = SCmd.next();
+    if (arg != NULL) {moveId=atoi(arg);}
+    else{
+      Otto.putMouth(xMouth);
+      delay(2000);
+      Otto.clearMouth();
+      moveId=0; //stop
+    }
+
+    arg = SCmd.next();
+    if (arg != NULL) {T=atoi(arg);}
+    else{
+      T=1000;
+    }
+
+    arg = SCmd.next();
+    if (arg != NULL) {moveSize=atoi(arg);}
+    else{
+      moveSize =15;
+    }
+}
+
+
+//-- Function to execute the right movement according the movement command received.
+void move(int moveId){
+
+  bool manualMode = false;
+
+  switch (moveId) {
+    case 0:
+      Otto.home();
+      break;
+    case 1: //M 1 1000
+      Otto.walk(1,T,1);
+      break;
+    case 2: //M 2 1000
+      Otto.walk(1,T,-1);
+      break;
+    case 3: //M 3 1000
+      Otto.turn(1,T,1);
+      break;
+    case 4: //M 4 1000
+      Otto.turn(1,T,-1);
+      break;
+    case 5: //M 5 1000 30
+      Otto.updown(1,T,moveSize);
+      break;
+    case 6: //M 6 1000 30
+      Otto.moonwalker(1,T,moveSize,1);
+      break;
+    case 7: //M 7 1000 30
+      Otto.moonwalker(1,T,moveSize,-1);
+      break;
+    case 8: //M 8 1000 30
+      Otto.swing(1,T,moveSize);
+      break;
+    case 9: //M 9 1000 30
+      Otto.crusaito(1,T,moveSize,1);
+      break;
+    case 10: //M 10 1000 30
+      Otto.crusaito(1,T,moveSize,-1);
+      break;
+    case 11: //M 11 1000
+      Otto.jump(1,T);
+      break;
+    case 12: //M 12 1000 30
+      Otto.flapping(1,T,moveSize,1);
+      break;
+    case 13: //M 13 1000 30
+      Otto.flapping(1,T,moveSize,-1);
+      break;
+    case 14: //M 14 1000 20
+      Otto.tiptoeSwing(1,T,moveSize);
+      break;
+    case 15: //M 15 500
+      Otto.bend(1,T,1);
+      break;
+    case 16: //M 16 500
+      Otto.bend(1,T,-1);
+      break;
+    case 17: //M 17 500
+      Otto.shakeLeg(1,T,1);
+      break;
+    case 18: //M 18 500
+      Otto.shakeLeg(1,T,-1);
+      break;
+    case 19: //M 19 500 20
+      Otto.jitter(1,T,moveSize);
+      break;
+    case 20: //M 20 500 15
+      Otto.ascendingTurn(1,T,moveSize);
+      break;
+    default:
+        manualMode = true;
+      break;
+  }
+
+  if(!manualMode){
+    sendFinalAck();
+  }
+
+}
+
+
+//-- Function to receive gesture commands
+void receiveGesture(){
+
+    //sendAck & stop if necessary
+    sendAck();
+    Otto.home();
+
+    //Definition of Gesture Bluetooth commands
+    //H  GestureID
+    int gesture = 0;
+    char *arg;
+    arg = SCmd.next();
+    if (arg != NULL) {gesture=atoi(arg);}
+    else
+    {
+      Otto.putMouth(xMouth);
+      delay(2000);
+      Otto.clearMouth();
+    }
+
+    switch (gesture) {
+      case 1: //H 1
+        Otto.playGesture(OttoHappy);
+        break;
+      case 2: //H 2
+        Otto.playGesture(OttoSuperHappy);
+        break;
+      case 3: //H 3
+        Otto.playGesture(OttoSad);
+        break;
+      case 4: //H 4
+        Otto.playGesture(OttoSleeping);
+        break;
+      case 5: //H 5
+        Otto.playGesture(OttoFart);
+        break;
+      case 6: //H 6
+        Otto.playGesture(OttoConfused);
+        break;
+      case 7: //H 7
+        Otto.playGesture(OttoLove);
+        break;
+      case 8: //H 8
+        Otto.playGesture(OttoAngry);
+        break;
+      case 9: //H 9
+        Otto.playGesture(OttoFretful);
+        break;
+      case 10: //H 10
+        Otto.playGesture(OttoMagic);
+        break;
+      case 11: //H 11
+        Otto.playGesture(OttoWave);
+        break;
+      case 12: //H 12
+        Otto.playGesture(OttoVictory);
+        break;
+      case 13: //H 13
+        Otto.playGesture(OttoFail);
+        break;
+      default:
+        break;
+    }
+
+    sendFinalAck();
+}
+
+//-- Function to receive sing commands
+void receiveSing(){
+
+    //sendAck & stop if necessary
+    sendAck();
+    Otto.home();
+
+    //Definition of Sing Bluetooth commands
+    //K  SingID
+    int sing = 0;
+    char *arg;
+    arg = SCmd.next();
+    if (arg != NULL) {sing=atoi(arg);}
+    else
+    {
+      Otto.putMouth(xMouth);
+      delay(2000);
+      Otto.clearMouth();
+    }
+
+    switch (sing) {
+      case 1: //K 1
+        Otto.sing(S_connection);
+        break;
+      case 2: //K 2
+        Otto.sing(S_disconnection);
+        break;
+      case 3: //K 3
+        Otto.sing(S_surprise);
+        break;
+      case 4: //K 4
+        Otto.sing(S_OhOoh);
+        break;
+      case 5: //K 5
+        Otto.sing(S_OhOoh2);
+        break;
+      case 6: //K 6
+        Otto.sing(S_cuddly);
+        break;
+      case 7: //K 7
+        Otto.sing(S_sleeping);
+        break;
+      case 8: //K 8
+        Otto.sing(S_happy);
+        break;
+      case 9: //K 9
+        Otto.sing(S_superHappy);
+        break;
+      case 10: //K 10
+        Otto.sing(S_happy_short);
+        break;
+      case 11: //K 11
+        Otto.sing(S_sad);
+        break;
+      case 12: //K 12
+        Otto.sing(S_confused);
+        break;
+      case 13: //K 13
+        Otto.sing(S_fart1);
+        break;
+      case 14: //K 14
+        Otto.sing(S_fart2);
+        break;
+      case 15: //K 15
+        Otto.sing(S_fart3);
+        break;
+      case 16: //K 16
+        Otto.sing(S_mode1);
+        break;
+      case 17: //K 17
+        Otto.sing(S_mode2);
+        break;
+      case 18: //K 18
+        Otto.sing(S_mode3);
+        break;
+      case 19: //K 19
+        Otto.sing(S_buttonPushed);
+        break;
+      default:
+        break;
+    }
+
+    sendFinalAck();
+}
+
+
+//-- Function to receive Name command
+void receiveName(){
+
+    //sendAck & stop if necessary
+    sendAck();
+    Otto.home();
+
+    char newOttoName[11] = "";  //Variable to store data read from Serial.
+    int eeAddress = 5;          //Location we want the data to be in EEPROM.
+    char *arg;
+    arg = SCmd.next();
+
+    if (arg != NULL) {
+
+      //Complete newOttoName char string
+      int k = 0;
+      while((*arg) && (k<11)){
+          newOttoName[k]=*arg++;
+          k++;
+      }
+
+      EEPROM.put(eeAddress, newOttoName);
+    }
+    else
+    {
+      Otto.putMouth(xMouth);
+      delay(2000);
+      Otto.clearMouth();
+    }
+
+    sendFinalAck();
+
+}
+
+
+//-- Function to send Otto's name
+void requestName(){
+
+    Otto.home(); //stop if necessary
+
+    char actualOttoName[11]= "";  //Variable to store data read from EEPROM.
+    int eeAddress = 5;            //EEPROM address to start reading from
+
+    //Get the float data from the EEPROM at position 'eeAddress'
+    EEPROM.get(eeAddress, actualOttoName);
+
+    Serial.print(F("&&"));
+    Serial.print(F("E "));
+    Serial.print(actualOttoName);
+    Serial.println(F("%%"));
+    Serial.flush();
+}
+
+
+//-- Function to send ultrasonic sensor measure (distance in "cm")
+void requestDistance(){
+
+    Otto.home();  //stop if necessary
+
+    int distance = Otto.getDistance();
+    Serial.print(F("&&"));
+    Serial.print(F("D "));
+    Serial.print(distance);
+    Serial.println(F("%%"));
+    Serial.flush();
+}
+
+
+//-- Function to send noise sensor measure
+void requestNoise(){
+
+    Otto.home();  //stop if necessary
+
+    int microphone= Otto.getNoise(); //analogRead(PIN_NoiseSensor);
+    Serial.print(F("&&"));
+    Serial.print(F("N "));
+    Serial.print(microphone);
+    Serial.println(F("%%"));
+    Serial.flush();
+}
+
+
+//-- Function to send battery voltage percent
+void requestBattery(){
+
+    Otto.home();  //stop if necessary
+
+    //The first read of the batery is often a wrong reading, so we will discard this value.
+    double batteryLevel = Otto.getBatteryLevel();
+
+    Serial.print(F("&&"));
+    Serial.print(F("B "));
+    Serial.print(batteryLevel);
+    Serial.println(F("%%"));
+    Serial.flush();
+}
+
+
+//-- Function to send program ID
+void requestProgramId(){
+
+    Otto.home();   //stop if necessary
+
+    Serial.print(F("&&"));
+    Serial.print(F("I "));
+    Serial.print(programID);
+    Serial.println(F("%%"));
+    Serial.flush();
+}
+
+
+//-- Function to send Ack comand (A)
+void sendAck(){
+
+  delay(30);
+
+  Serial.print(F("&&"));
+  Serial.print(F("A"));
+  Serial.println(F("%%"));
+  Serial.flush();
+}
+
+
+//-- Function to send final Ack comand (F)
+void sendFinalAck(){
+
+  delay(30);
+
+  Serial.print(F("&&"));
+  Serial.print(F("F"));
+  Serial.println(F("%%"));
+  Serial.flush();
+}
+
+
+
+//-- Functions with animatics
+//--------------------------------------------------------
+
+void OttoLowBatteryAlarm(){
+
+    double batteryLevel = Otto.getBatteryLevel();
+
+    if(batteryLevel<45){
+
+      while(!buttonPushed){
+
+          Otto.putMouth(thunder);
+          Otto.bendTones (880, 2000, 1.04, 8, 3);  //A5 = 880
+
+          delay(30);
+
+          Otto.bendTones (2000, 880, 1.02, 8, 3);  //A5 = 880
+          Otto.clearMouth();
+          delay(500);
+      }
+    }
+}
+
+void OttoSleeping_withInterrupts(){
+
+  int bedPos_0[4]={100, 80, 60, 120};
+
+  if(!buttonPushed){
+    Otto._moveServos(700, bedPos_0);
+  }
+
+  for(int i=0; i<4;i++){
+
+    if(buttonPushed){break;}
+      Otto.putAnimationMouth(dreamMouth,0);
+      Otto.bendTones (100, 200, 1.04, 10, 10);
+
+    if(buttonPushed){break;}
+      Otto.putAnimationMouth(dreamMouth,1);
+      Otto.bendTones (200, 300, 1.04, 10, 10);
+
+    if(buttonPushed){break;}
+      Otto.putAnimationMouth(dreamMouth,2);
+      Otto.bendTones (300, 500, 1.04, 10, 10);
+
+    delay(500);
+
+    if(buttonPushed){break;}
+      Otto.putAnimationMouth(dreamMouth,1);
+      Otto.bendTones (400, 250, 1.04, 10, 1);
+
+    if(buttonPushed){break;}
+      Otto.putAnimationMouth(dreamMouth,0);
+      Otto.bendTones (250, 100, 1.04, 10, 1);
+
+    delay(500);
+  }
+
+  if(!buttonPushed){
+    Otto.putMouth(lineMouth);
+    Otto.sing(S_cuddly);
+  }
+
+  Otto.home();
+  if(!buttonPushed){Otto.putMouth(happyOpen);}
+
+}


Added `cold-brew.ino` with calls to `coldbrew.h`.

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

--- cold-brew.ino
+++ cold-brew.ino
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2016 FirstBuild
+ *
+ * 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.
+ *
+ */
+
+#include "coldbrew.h"
+
+ColdBrew coldBrew;
+
+void enableInterrupt(void) {
+  OCR0A = 0xaf;
+  TIMSK0 |= (1 << OCIE0A);
+}
+
+SIGNAL(TIMER0_COMPA_vect) {
+  coldBrew.tick();
+}
+
+void setup(void) {
+  coldBrew.setup();
+  enableInterrupt();
+}
+
+void loop(void) {
+  coldBrew.loop();
+}