Create motordirection_calculation.ino

Create motordirection_calculation.ino

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

--- encoder/motordirection_calculation.ino
+++ encoder/motordirection_calculation.ino
@@ -0,0 +1,132 @@
+/*
+
+  Quadrature Encoder Direction Calculation (Robot Chemistry 4.IS8)
+
+  James H. Bannock and John C. de Mello
+
+  Department of Chemistry,
+  Imperial College London
+
+  Version 1.02
+
+  Created: Feb 2014
+  Updated: Nov 2016
+
+  ---
+
+  Requirements:
+
+  Stepper motor driven from an Easydriver.
+
+  Two channel quadrature encoder optical encoder coupled to motor shaft.
+
+  Refer to slide 66 in 2016 notes for formulation of matrix
+
+  ---
+
+  Outputs:
+  - Direction pin of Easydriver - PIN 2
+  - Step pin of Easydriver - PIN 3
+  - Channel A of encoder - PIN 5
+  - Channel B of encoder - PIN 6
+
+*/
+
+// macro definitions
+#define DIR_PIN 2
+#define STEP_PIN 3
+#define ENCODER_A 5
+#define ENCODER_B 6
+
+int eMatrix[4][4] =
+{
+  {0, -1, 1, 2},
+  {1, 0, 2, -1},
+  { -1, 2, 0, 1},
+  {2, 1, -1, 0}
+};
+
+int OldValue = -2;
+int CurrentValue = -1;
+int Direction;
+
+// set the motor direction here
+int dir = 1; // 1 for clockwise / -1 for anticlockwise
+
+void setup() {
+
+  // turn on serial communication
+  Serial.begin(9600);
+
+  // setup pins
+  pinMode(ENCODER_A, INPUT);
+  pinMode(ENCODER_B, INPUT);
+  pinMode(DIR_PIN, OUTPUT);
+  pinMode(STEP_PIN, OUTPUT);
+}
+
+void loop() {
+
+  OldValue = digitalRead(ENCODER_A) * 2 + digitalRead(ENCODER_B);
+
+  while (CurrentValue != OldValue) {
+
+    rotate(dir, 1000);
+
+    CurrentValue = digitalRead(ENCODER_A) * 2 + digitalRead(ENCODER_B);
+    Direction = eMatrix[OldValue][CurrentValue];
+
+    // switch-case to handle different outcomes (alternative is to use nested if-statments)
+    switch (Direction) {
+
+      case 2:
+        //Serial.println("Unknown");
+        break;
+
+      case 1:
+        Serial.println("Forward");
+        break;
+
+      case -1:
+        Serial.println("Reverse");
+        break;
+
+      case 0:
+        //Serial.print("No Movement");
+        break;
+
+      /*
+       * Notes:
+       *
+       * In the switch-case statement the use of 'break' causes the switch-case to finish at this point.
+       *
+       * Without a break, the code continues to test the argument (Direction) against the remaining cases.
+       *
+       */
+
+    }
+
+    OldValue = CurrentValue;
+
+  }
+
+  rotate(dir, 1000);
+
+}
+
+void rotate(int microsteps, float delay_) { // function to perform rotation
+
+  if (microsteps > 0) {
+    digitalWrite(DIR_PIN, HIGH); // if the number of steps is positive -> motor moves fowards
+  }
+  else {
+    digitalWrite(DIR_PIN, LOW); // if the number of steps is negative -> motor moves in reverse
+  }
+
+  for (int i = 0; i < abs(microsteps); i++) {
+    digitalWrite(STEP_PIN, HIGH);
+    delayMicroseconds(delay_); // wait for a defined time (see calc_delay())
+    digitalWrite(STEP_PIN, LOW);
+    delayMicroseconds(delay_); // wait for a defined time (see calc_delay())
+  }
+}


Create barometer skeleton sketch

Create barometer skeleton sketch

We're going to split off all of the sensors in the card and put them in separate files for easier debugging.

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

--- Calibration/barometer_skeleton/barometer_skeleton.ino
+++ Calibration/barometer_skeleton/barometer_skeleton.ino
@@ -0,0 +1,114 @@
+#include <Wire.h>
+#include <Adafruit_Sensor.h>
+#include <Adafruit_LSM303_U.h>
+#include <Adafruit_BMP085_U.h>
+#include <Adafruit_10DOF.h>
+
+/* Assign a unique ID to the sensors */
+Adafruit_10DOF                dof   = Adafruit_10DOF();
+Adafruit_LSM303_Accel_Unified accel = Adafruit_LSM303_Accel_Unified(30301);
+Adafruit_LSM303_Mag_Unified   mag   = Adafruit_LSM303_Mag_Unified(30302);
+Adafruit_BMP085_Unified       bmp   = Adafruit_BMP085_Unified(18001);
+
+/* Update this with the correct SLP for accurate altitude measurements */
+float seaLevelPressure = SENSORS_PRESSURE_SEALEVELHPA;
+
+/**************************************************************************/
+/*!
+    @brief  Initialises all the sensors used by this example
+*/
+/**************************************************************************/
+void initSensors()
+{
+  if(!accel.begin())
+  {
+    /* There was a problem detecting the LSM303 ... check your connections */
+    Serial.println(F("Ooops, no LSM303 detected ... Check your wiring!"));
+    while(1);
+  }
+  if(!mag.begin())
+  {
+    /* There was a problem detecting the LSM303 ... check your connections */
+    Serial.println("Ooops, no LSM303 detected ... Check your wiring!");
+    while(1);
+  }
+  if(!bmp.begin())
+  {
+    /* There was a problem detecting the BMP180 ... check your connections */
+    Serial.println("Ooops, no BMP180 detected ... Check your wiring!");
+    while(1);
+  }
+}
+
+/**************************************************************************/
+/*!
+
+*/
+/**************************************************************************/
+void setup(void)
+{
+  delay(1000);
+  Serial.begin(9600);
+  Serial.println(F("Adafruit 10 DOF Pitch/Roll/Heading Example")); Serial.println("");
+
+  /* Initialise the sensors */
+  initSensors();
+}
+
+/**************************************************************************/
+/*!
+    @brief  Constantly check the roll/pitch/heading/altitude/temperature
+*/
+/**************************************************************************/
+void loop(void)
+{
+  sensors_event_t accel_event;
+  sensors_event_t mag_event;
+  sensors_event_t bmp_event;
+  sensors_vec_t   orientation;
+
+  /* Calculate pitch and roll from the raw accelerometer data */
+  accel.getEvent(&accel_event);
+  if (dof.accelGetOrientation(&accel_event, &orientation))
+  {
+    /* 'orientation' should have valid .roll and .pitch fields */
+    Serial.print(F("Roll: "));
+    Serial.print(orientation.roll);
+    Serial.print(F("; "));
+    Serial.print(F("Pitch: "));
+    Serial.print(orientation.pitch);
+    Serial.print(F("; "));
+  }
+
+  /* Calculate the heading using the magnetometer */
+  mag.getEvent(&mag_event);
+  if (dof.magGetOrientation(SENSOR_AXIS_Z, &mag_event, &orientation))
+  {
+    /* 'orientation' should have valid .heading data now */
+    Serial.print(F("Heading: "));
+    Serial.print(orientation.heading);
+    Serial.print(F("; "));
+  }
+
+  /* Calculate the altitude using the barometric pressure sensor */
+  bmp.getEvent(&bmp_event);
+  if (bmp_event.pressure)
+  {
+    /* Get ambient temperature in C */
+    float temperature;
+    bmp.getTemperature(&temperature);
+    /* Convert atmospheric pressure, SLP and temp to altitude    */
+    Serial.print(F("Alt: "));
+    Serial.print(bmp.pressureToAltitude(seaLevelPressure,
+                                        bmp_event.pressure,
+                                        temperature));
+    Serial.print(F(" m; "));
+    /* Display the temperature */
+    Serial.print(F("Temp: "));
+    Serial.print(temperature);
+    Serial.print(F(" C"));
+  }
+
+  Serial.println(F(""));
+  delay(1000);
+}


add code

add code

--- strandtest.ino
+++ strandtest.ino
@@ -0,0 +1,133 @@
+#include <Adafruit_NeoPixel.h>
+
+#define PIN 6
+#define LEDS 60
+
+// Parameter 1 = number of pixels in strip
+// Parameter 2 = pin number (most are valid)
+// Parameter 3 = pixel type flags, add together as needed:
+//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
+//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
+//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
+//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
+Adafruit_NeoPixel strip = Adafruit_NeoPixel(LEDS, PIN, NEO_GRB + NEO_KHZ800);
+volatile int mode = 0;
+
+void nextMode() {
+  mode = (mode + 1) % 3;
+}
+
+int prevTime = 0;
+void setup() {
+  strip.begin();
+  strip.show(); // Initialize all pixels to 'off'
+  Serial.begin(9600);
+
+  pinMode(9, INPUT);
+  digitalWrite(9, HIGH);       // turn on pullup resistors
+  prevTime = millis();
+}
+
+
+unsigned int scale(unsigned int num, unsigned int natural_max, unsigned int target_max) {
+  unsigned long upper = (unsigned long)(num) * target_max;
+  return (unsigned int)(upper / natural_max);
+}
+
+uint8_t brightness = 0;
+
+void loop() {
+  static int lastPinPos = 1;
+  int currentPinPos = digitalRead(9);
+  if (currentPinPos == 1 && lastPinPos == 0) {
+    nextMode();
+  }
+  lastPinPos = currentPinPos;
+
+  switch(mode) {
+  case 0:
+    rainbow();
+    break;
+  case 1:
+    white_down();
+    break;
+  case 2:
+    white_down_and_back();
+  }
+
+  brightness = scale(analogRead(A0), 1024, 255);
+  strip.setBrightness(brightness);
+  strip.show();
+}
+
+
+void white_down_and_back() {
+  const int loop_length = 3000;
+
+  unsigned long pos = millis();
+  pos = 2*(pos % loop_length);
+
+  if (pos > loop_length ) {
+    pos = (loop_length - (pos - loop_length));
+  }
+
+  int target_index = scale(pos, loop_length, LEDS);
+
+  for(int i = 0; i < LEDS; ++i) {
+    if (target_index == i) {
+      strip.setPixelColor(i,  255, 255, 255);
+    } else {
+      strip.setPixelColor(i, 0);
+    }
+  }
+}
+
+void white_down() {
+  const int loop_length = 1000;
+
+  unsigned long pos = millis();
+  pos = pos % loop_length;
+
+  for(int i = 0; i < LEDS; ++i) {
+    if (scale(pos, loop_length, LEDS) == i)
+      strip.setPixelColor(i,  255, 255, 255);
+    else
+      strip.setPixelColor(i, 0);
+  }
+}
+
+
+void rainbow() {
+
+  const int loop_length = 10000;
+  unsigned long pos = millis();
+  pos = pos % loop_length;
+
+  rainbowCycle(scale(pos, loop_length, 255));
+}
+
+void rainbowCycle(uint8_t WheelPos) {
+  for(int i = 0; i < LEDS; ++i) {
+    strip.setPixelColor(i, Wheel(WheelPos + i));
+  }
+}
+
+
+// Input a value 0 to 255 to get a color value.
+// The colours are a transition r - g - b - back to r.
+uint32_t Wheel(byte WheelPos) {
+  if(WheelPos < 85) {
+    return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
+  }
+  else if(WheelPos < 170) {
+    WheelPos -= 85;
+    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
+  }
+  else {
+    WheelPos -= 170;
+    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
+  }
+}
+
+
+


SmartDisc's Brain

SmartDisc's Brain

Added first version of arduino code.

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

--- beta/beta.ino
+++ beta/beta.ino
@@ -0,0 +1,167 @@
+#include "TinyGPS.h"
+#include <SoftwareSerial.h>
+
+//gps serial port RX, TX
+SoftwareSerial gss(9, 10);
+SoftwareSerial device(11, 3);
+
+//keep track of how long push button was pressed
+int state = HIGH;
+int reading;
+int previous = LOW;
+long time = 0;
+int debounce = 200; //the debounce time, increase if the output flickers
+
+//flags
+boolean runGPS = false;
+
+TinyGPS gps;
+
+void createFile(char fname[40])
+{
+  int wait = 100; //delay to send commands to openlog
+  gss.write(26);
+  gss.write(26);
+  gss.write(26);
+
+
+  gss.print("new ");
+  gss.print(fname);
+  gss.print("/r");
+  delay(wait);
+  gss.print("append ");
+  gss.print(fname);
+  gss.print("/r");
+  delay(wait);
+}
+
+void setGPSBaud()
+{
+  device.write((byte)160); //A0
+  delay(50);
+  device.write((byte)161);  //A1
+  delay(50);
+  device.write((byte)0);    //00
+  delay(50);
+  device.write((byte)4);
+  delay(50);
+  device.write((byte)5);    //messageID
+  delay(50);
+  device.write((byte)0);    //COM PORT
+  delay(50);
+  device.write((byte)3);    //BAUD RATE: 38400
+  delay(50);
+  device.write((byte)0);
+  delay(50);
+  device.write((byte)5);
+  delay(50);
+  device.write((byte)13);
+  delay(50);
+  device.write((byte)10);
+  delay(50);
+}
+
+void setUpdateRate()
+{
+  device.write((byte)160); //A0
+  delay(50);
+  device.write((byte)161);  //A1
+  delay(50);
+  device.write((byte)0);    //00
+  delay(50);
+  device.write((byte)3);    //03
+  delay(50);
+  device.write((byte)14);   //0E
+  delay(50);
+  device.write((byte)10);   //10 10Hz
+  delay(50);
+  device.write((byte)0);
+  delay(50);
+  device.write((byte)15);
+  delay(50);
+  device.write((byte)13);
+  delay(50);
+  device.write((byte)10);
+  delay(50);
+}
+void setup()
+{
+  //delay(10000);
+  pinMode(2, INPUT);
+  pinMode(3, OUTPUT);
+  pinMode(13, OUTPUT);
+
+  Serial.begin(9600);
+  gss.begin(9600);
+
+  setGPSBaud();
+  delay(1000);
+  setUpdateRate();
+  delay(1000);
+
+  //attachInterrupt(2, pushButton, CHANGE);
+
+  createFile("test.log");
+}
+
+void pushButton()
+{
+  reading = digitalRead(2);
+
+  if (reading == HIGH && previous == LOW && millis() - time > debounce)
+  {
+    if (state == HIGH)
+    {
+      state = LOW;
+      digitalWrite(13, LOW);
+      runGPS = false;
+    }
+    else
+    {
+      state = HIGH;
+      digitalWrite(13, HIGH);
+      runGPS = true;
+    }
+  }
+
+  time = millis();
+
+}
+
+void getLocation()
+{
+  int c = gss.read();
+
+  if (gps.encode(c))
+  {
+
+    long lat, lon;
+    unsigned long fix_age, speeds;
+
+    gps.get_position(&lat, &lon, &fix_age);
+    speeds = gps.speed();
+
+    Serial.print("Lat: ");
+    Serial.print( lat );
+    gss.print("Lat: ");
+    gss.print( lat );
+
+    Serial.print(", Lon: ");
+    Serial.print( lon );
+    Serial.print(" -- speed: ");
+    Serial.println(speeds);
+    gss.print(", Lon: ");
+    gss.println( lon );
+    gss.print(" -- speed: ");
+    gss.println(speeds);
+
+  }
+}
+
+void loop()
+{
+    while (gss.available())
+    {
+       getLocation();
+    }
+}


Update RN_XV_WiFly.ino

Update RN_XV_WiFly.ino

--- examples/BoardsAndShields/RN_XV_WiFly/RN_XV_WiFly.ino
+++ examples/BoardsAndShields/RN_XV_WiFly/RN_XV_WiFly.ino
@@ -32,7 +32,7 @@
  *
  **************************************************************/

-#define BLYNK_DEBUG
+//#define BLYNK_DEBUG
 #define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
 #include <SPI.h>
 #include <WiFly.h>


Meir fjernkontrollert

Meir fjernkontrollert

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/Oegly/NotARobotCoup.git/'


initial BT serial test

initial BT serial test

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

--- utils/bt_serial/bt_serial.ino
+++ utils/bt_serial/bt_serial.ino
@@ -0,0 +1,41 @@
+/* Turn an LED on/off based on a command send via BlueTooth
+**
+** Credit: The following example was used as a reference
+** Rui Santos: http://randomnerdtutorials.wordpress.com
+*/
+
+int ledPin = 13;  // use the built in LED on pin 13 of the Uno
+int state = 0;
+int flag = 0;        // make sure that you return the state only once
+
+void setup() {
+    // sets the pins as outputs:
+    pinMode(ledPin, OUTPUT);
+    digitalWrite(ledPin, LOW);
+
+    Serial4.begin(9600); // Default connection rate for my BT module
+}
+
+void loop() {
+    //if some data is sent, read it and save it in the state variable
+    if(Serial4.available() > 0){
+      state = Serial4.read();
+      flag=0;
+    }
+    // if the state is 0 the led will turn off
+    if (state == '0') {
+        digitalWrite(ledPin, LOW);
+        if(flag == 0){
+          Serial4.println("LED: off");
+          flag = 1;
+        }
+    }
+    // if the state is 1 the led will turn on
+    else if (state == '1') {
+        digitalWrite(ledPin, HIGH);
+        if(flag == 0){
+          Serial4.println("LED: on");
+          flag = 1;
+        }
+    }
+}


Add PwmOut example.

Add PwmOut example.

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

--- examples/mbino-example-pwmout/mbino-example-pwmout.ino
+++ examples/mbino-example-pwmout/mbino-example-pwmout.ino
@@ -0,0 +1,20 @@
+#include "mbed.h"
+
+AnalogIn ain(A0);
+DigitalOut pwm(p3);
+
+void setup() {
+}
+
+void loop() {
+    pwm.write(ain.read());
+}
+
+#ifndef ARDUINO
+int main() {
+    setup();
+    for (;;) {
+        loop();
+    }
+}
+#endif


add node ID to code

add node ID to code

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/jeremywrnr/wampum.git/'


Added a watchdog timer for a teensy

Added a watchdog timer for a teensy

The watchdog can be used as a backup for ensuring J1939 messages are
present on the bus.

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/SynerconTechnologies/SmartSensorSimulator.git/'


Update Stepper1 for 200 SPM stepper.

Update Stepper1 for 200 SPM stepper.

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/JulianNicholls/Arduino.git/'


program to measure temperature

program to measure temperature

program to measure temperature and send the data via serially

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

--- temperature_measurement_rev1/temperature_measurement_rev1.ino
+++ temperature_measurement_rev1/temperature_measurement_rev1.ino
@@ -0,0 +1,27 @@
+/*
+Temperature Measurement
+=========== ===========
+rev v.1
+#measure the temperature using LM35
+#sends the data serially for verification
+*/
+
+
+//tm-temperature measurement
+
+#define tminput A0
+
+void setup()
+{
+  Serial.begin(9600);
+}
+
+float tm,tmvoltage;
+void loop()
+{
+  tm=analogRead(tminput);//read the temperature value
+  tmvoltage = tm * (5 / 1024);
+  Serial.print("The temperature is ");//diplay the temperature
+  Serial.println(tmvoltage);
+  delay(500);
+}


first commit

first commit

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/TEAMarg/ID-37-DICE.git/'


added New Arduino project

added New Arduino project

 for newer version led strip driver

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

--- Arduino/SCM_OWeek_LEDStrip2/SCM_OWeek_LEDStrip2.ino
+++ Arduino/SCM_OWeek_LEDStrip2/SCM_OWeek_LEDStrip2.ino
@@ -0,0 +1,129 @@
+/*
+  Serial RGB controller
+
+ Reads a serial input string looking for three comma-separated
+ integers with a newline at the end. Values should be between
+ 0 and 255. The sketch uses those values to set the color
+ of an RGB LED attached to pins 9 - 11.
+
+ The circuit:
+ * Common-anode RGB LED cathodes attached to pins 9 - 11
+ * LED anode connected to pin 13
+
+ To turn on any given channel, set the pin LOW.
+ To turn off, set the pin HIGH. The higher the analogWrite level,
+ the lower the brightness.
+
+ created 29 Nov 2010
+ by Tom Igoe
+
+ This example code is in the public domain.
+ */
+//https://github.com/iKenndac/Arduino-Dioder-Playground
+#include <Wire.h>
+#include <SoftwareSerial.h>
+#include "Suli.h"
+#include "LED_Strip_Arduino.h"
+
+#define CLK 2//pins definitions for the driver
+#define DIO 3
+led_strip Driver(CLK,DIO);
+// Protocol details (two header bytes, 12 value bytes, checksum)
+
+const int kProtocolHeaderFirstByte = 0xBA;
+const int kProtocolHeaderSecondByte = 0xBE;
+
+const int kProtocolHeaderLength = 2;
+const int kProtocolBodyLength = 12;
+const int kProtocolChecksumLength = 1;
+
+// Buffers and state
+
+bool appearToHaveValidMessage;
+byte receivedMessage[kProtocolBodyLength];
+
+void setup() {
+  // Open serial communications and wait for port to open:
+  Serial.begin(57600);
+  while (!Serial) {
+    ; // wait for serial port to connect. Needed for Leonardo only
+  }
+
+}
+
+void loop() {
+  int availableBytes = Serial.available();
+
+  if (!appearToHaveValidMessage) {
+
+    // If we haven't found a header yet, look for one.
+    if (availableBytes >= kProtocolHeaderLength) {
+
+      // Read then peek in case we're only one byte away from the header.
+      byte firstByte = Serial.read();
+      byte secondByte = Serial.peek();
+
+      if (firstByte == kProtocolHeaderFirstByte &&
+          secondByte == kProtocolHeaderSecondByte) {
+
+          // We have a valid header. We might have a valid message!
+          appearToHaveValidMessage = true;
+
+          // Read the second header byte out of the buffer and refresh the buffer count.
+          Serial.read();
+          availableBytes = Serial.available();
+      }
+    }
+    else
+    {
+       Serial.println("FAIL");
+    }
+  }
+
+  if (availableBytes >= (kProtocolBodyLength + kProtocolChecksumLength) && appearToHaveValidMessage) {
+
+    // Read in the body, calculating the checksum as we go.
+    byte calculatedChecksum = 0;
+
+    for (int i = 0; i < kProtocolBodyLength; i++) {
+      receivedMessage[i] = Serial.read();
+      calculatedChecksum ^= receivedMessage[i];
+    }
+
+    byte receivedChecksum = Serial.read();
+
+    if (receivedChecksum == calculatedChecksum) {
+      // Hooray! Push the values to the output pins.
+
+      Driver.begin();
+
+      for(int i = 0 ; i < 4 ; i++)
+      {
+        int index = i*3;
+        Driver.setColor(receivedMessage[index], receivedMessage[index+1] , receivedMessage[index+2]);
+      }
+      Driver.end();
+
+      Serial.println("OK");
+
+    } else {
+
+      Serial.println("FAIL");
+    }
+
+    appearToHaveValidMessage = false;
+  }
+
+}
+
+
+
+
+
+
+
+
+
+
+
+


Added Arduino sketch

Added Arduino sketch

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

--- Arduino/harry_potter_spells/harry_potter_spells.ino
+++ Arduino/harry_potter_spells/harry_potter_spells.ino
@@ -0,0 +1,73 @@
+/*
+  Harry Potter Interactive Wands
+
+  Made with Little Bits
+  Copied and only slightly modified from the Scent-imental Notification System
+  http://www.instructables.com/id/Scent-imental-Notification-System/
+
+  This example code is in the public domain.
+ */
+
+ int cloudValue = 0;
+
+//Give unique names to the 3 digital output pins of the Arduino
+int incendioPin  = 1;
+int locomotorPin = 5;
+int aguamentiPin = 9;
+
+// The setup routine sets up the Arduino and runs once
+void setup() {
+
+  // Initialize the digital pins as output pins.
+  pinMode(incendioPin,  OUTPUT);
+  pinMode(locomotorPin, OUTPUT);
+  pinMode(aguamentiPin, OUTPUT);
+
+  //uncomment the line below for debugging
+  //Serial.begin(9600);
+
+}
+
+// The loop routine runs over and over forever
+void loop() {
+
+  //Read the analog input from the Cloudbit
+  cloudValue = analogRead(A0);
+
+  //Convert the analog value of 0 to 1023 to a number between 0 and 100
+  cloudValue = map(cloudValue, 0, 1023, 0, 100);
+
+  //uncomment the line below for debugging
+  //Serial.println(cloudValue);
+
+  //Check for values from the Cloudbit
+
+  //If the number is 25, trigger incendio
+  if((cloudValue > 10) &&  (cloudValue < 33)){
+    digitalWrite(incendioPin,  HIGH);
+    digitalWrite(locomotorPin, LOW);
+    digitalWrite(aguamentiPin, LOW);
+  }
+
+  //If the number is 50, trigger locomotor
+  else if((cloudValue >= 33) && (cloudValue < 66)){
+    digitalWrite(incendioPin,  LOW);
+    digitalWrite(locomotorPin, HIGH);
+    digitalWrite(aguamentiPin, LOW);
+  }
+
+  //If the number is 75, trigger agumenti
+  else if((cloudValue >= 66) && (cloudValue < 100)){
+    digitalWrite(incendioPin,  LOW);
+    digitalWrite(locomotorPin, LOW);
+    digitalWrite(aguamentiPin, HIGH);
+  }
+
+  //If the number is 0, trigger nothing
+  else if(cloudValue <= 10){
+    digitalWrite(incendioPin,  LOW);
+    digitalWrite(locomotorPin, LOW);
+    digitalWrite(aguamentiPin, LOW);
+  }
+
+}


Add periodic temps when in heating, 1 second base cycle, input cycle mult.

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/FirstBuild/pizzaduino.git/'


Add Arduino formware

Add Arduino formware

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

--- arduino/gzconfetti/gzconfetti.ino
+++ arduino/gzconfetti/gzconfetti.ino
@@ -0,0 +1,82 @@
+/*
+  AnalogReadSerial
+  Reads an analog input on pin 0, prints the result to the serial monitor.
+  Graphical representation is available using serial plotter (Tools > Serial Plotter menu)
+  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
+
+  This example code is in the public domain.
+*/
+
+struct buf64 {
+    char str[64];
+    int nextChar;
+};
+buf64 cmdBuf;
+
+
+void exeCmds(char str[64]){  //Take a command string (whitespace stripped) and execute it.
+
+    if (str[0] == '1'){
+        digitalWrite(8, HIGH);
+    }
+    else if (str[0] == '0'){
+        digitalWrite(8, LOW);
+    }
+    else if (str[0] == 'M'){
+        digitalWrite(7, LOW);
+    }
+    else if (str[0] == 'N'){
+        digitalWrite(7, HIGH);
+    }
+}
+
+
+void sendReport(String report){
+
+    Serial.println(report);
+}
+
+
+void serialEvent(){  //Upon receiving new serial data, read it in (ignoring spaces) and execute the command if a newline character is detected
+
+    unsigned char ch;
+
+    while (Serial.available() > 0){
+
+        ch = Serial.read();
+
+        //Serial.print("I just read the character ");
+        //Serial.println(ch);
+
+        if (ch != '\n' && ch != ' '){
+            //Serial.println("ch wasn't a newline or space");
+            cmdBuf.str[cmdBuf.nextChar] = ch;
+            cmdBuf.nextChar++;
+        }
+        else if (ch == '\n'){
+            //Serial.print("ch was a newline, so I need to execute this string: ");
+            //Serial.println(cmdBuf.str);
+            cmdBuf.str[cmdBuf.nextChar] = ch;
+            cmdBuf.nextChar = 0;
+            exeCmds(cmdBuf.str);
+            cmdBuf.str[0] = '\0';
+            //Serial.print("I have reset the string to: ");
+            //Serial.println(cmdBuf.str);
+        }
+    }
+}
+
+
+void setup() {
+    Serial.begin(9600);
+    pinMode(4, OUTPUT);
+    digitalWrite(4, HIGH);
+    pinMode(7, OUTPUT);
+    digitalWrite(7, HIGH);
+    pinMode(8, OUTPUT);
+}
+
+void loop() {
+    ;  //Should prob put something here to save power, so as not to churn away doing nothing
+}
+


Add touch pin detection diagnostic sketch

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

--- examples/arduino/diag_ard_touch_detect/diag_ard_touch_detect.ino
+++ examples/arduino/diag_ard_touch_detect/diag_ard_touch_detect.ino
@@ -0,0 +1,201 @@
+//
+// GUIslice Library Examples
+// - Calvin Hass
+// - https://www.impulseadventure.com/elec/guislice-gui.html
+// - https://github.com/ImpulseAdventure/GUIslice
+// - TFT Diagnostic (Arduino): Test Touch Pin Detection
+//   - This sketch is intended to detect and report the set of pins
+//     currently wired to a 4-wire resistive touch display
+//   - This sketch is only intended to run in DRV_TOUCH_ADA_SIMPLE mode
+//   - The pin detection logic is not supported on ARM or ESP32 devices
+//   - Please refer to the touch configuration guide for details:
+//     https://github.com/ImpulseAdventure/GUIslice/wiki/Configure-Touch-Support
+//
+// ACKNOWLEDGEMENT:
+// - The pin detection logic was adapted from David Prentice's mcufriend_kbv library:
+//   https://github.com/prenticedavid/MCUFRIEND_kbv/blob/master/examples/diagnose_Touchpins/diagnose_Touchpins.ino
+//
+
+#include "GUIslice.h"
+#include "GUIslice_drv.h"
+
+// Ensure debug messaging is enabled
+#if (DEBUG_ERR != 1)
+#undef  DEBUG_ERR
+#define DEBUG_ERR 1
+#endif
+
+#if defined(DRV_TOUCH_NONE)
+#error "Touch pin detection requires a touch driver but DRV_TOUCH_NONE was set"
+#elif !defined(DRV_TOUCH_ADA_SIMPLE)
+#error "Only DRV_TOUCH_ADA_SIMPLE supports pin detection"
+#endif
+
+#if defined(__arm__) || defined(ESP32)
+#error "Pin detection not supported on ARM or ESP32 platforms"
+#endif
+
+
+#if defined(DRV_DISP_ADAGFX_MCUFRIEND)
+  // Import MCUFRIEND to support ID reporting
+#include <MCUFRIEND_kbv.h>
+extern MCUFRIEND_kbv m_disp;
+#endif
+
+#define MAX_STR             30
+
+// Defines for resources
+enum { E_FONT_TXT };
+
+// Instantiate the GUI
+#define MAX_FONT                1
+
+gslc_tsGui                  m_gui;
+gslc_tsDriver               m_drv;
+gslc_tsFont                 m_asFont[MAX_FONT];
+
+
+char m_acTxt[MAX_STR];
+gslc_tsRect m_rStatus = (gslc_tsRect) { 40, 60, 50, 10 };
+gslc_tsFont* m_pFont = NULL;
+
+#define MAX_FONT                1
+
+// Define debug message function
+static int16_t DebugOut(char ch) { Serial.write(ch); return 0; }
+
+void DrawBackground()
+{
+  // Background
+  gslc_tsRect rBack = (gslc_tsRect) { 0, 0, 0, 0 };
+  rBack.w = m_gui.nDispW;
+  rBack.h = m_gui.nDispH;
+  gslc_DrawFillRect(&m_gui, rBack, GSLC_COL_BLACK);
+
+  // Status
+  gslc_DrvDrawTxt(&m_gui, m_rStatus.x, m_rStatus.y, m_pFont, "Detecing Pins", GSLC_TXT_DEFAULT, GSLC_COL_YELLOW, GSLC_COL_BLACK);
+}
+
+bool DetectPins()
+{
+  int nPinXm = -1;
+  int nPinXp = -1;
+  int nPinYp = -1;
+  int nPinYm = -1;
+
+  int i, j, value, Apins[2], Dpins[2], Values[2], found = 0;
+
+  GSLC_DEBUG_PRINT("Making all control and bus pins INPUT_PULLUP\n", "");
+  GSLC_DEBUG_PRINT("Typical 30k Analog pullup with corresponding pin\n", "");
+  GSLC_DEBUG_PRINT("would read low when digital is written LOW\n", "");
+  GSLC_DEBUG_PRINT("e.g. reads ~25 for 300R X direction\n", "");
+  GSLC_DEBUG_PRINT("e.g. reads ~30 for 500R Y direction\n", "");
+  GSLC_DEBUG_PRINT("\n", "");
+  GSLC_DEBUG_PRINT("Starting detection:\n", "");
+
+  for (i = A0; i < A5; i++) pinMode(i, INPUT_PULLUP);
+  for (i = 2; i < 10; i++) pinMode(i, INPUT_PULLUP);
+  for (i = A0; i < A4; i++) {
+    for (j = 5; j < 10; j++) {
+      pinMode(j, OUTPUT);
+      digitalWrite(j, LOW);
+      value = analogRead(i);   // ignore first reading
+      value = analogRead(i);
+      if (value < 100) {
+        GSLC_DEBUG_PRINT(" Detected: (A%u, D%u) = %u\n", (i - A0), j, value);
+        if (found < 2) {
+          Apins[found] = i;
+          Dpins[found] = j;
+          Values[found] = value;
+          found++;
+        }
+      }
+      pinMode(j, INPUT_PULLUP);
+    }
+  }
+  if (found == 2) {
+    if (Values[0] < Values[1]) {
+      nPinXm = Apins[0];
+      nPinXp = Dpins[0];
+    }
+    else {
+      nPinYp = Apins[0];
+      nPinYm = Dpins[0];
+    }
+    if (Values[1] < Values[0]) {
+      nPinXm = Apins[1];
+      nPinXp = Dpins[1];
+    }
+    else {
+      nPinYp = Apins[1];
+      nPinYm = Dpins[1];
+    }
+    GSLC_DEBUG_PRINT("Final detection: YP=A%u XM=A%u YM=%u XP=%u\n", (nPinYp - A0), (nPinXm - A0), nPinYm, nPinXp);
+
+
+    GSLC_DEBUG_PRINT("-----------------------------------------------\n", "");
+    GSLC_DEBUG_PRINT("Recommended config settings:\n", "");
+    GSLC_DEBUG_PRINT("- Please copy these values over any existing ADATOUCH_PIN_* settings in your config.\n\n", "");
+
+    GSLC_DEBUG_PRINT("  // Pinout for DRV_TOUCH_SIMPLE 4-wire resistive touchscreen\n", "");
+    #if defined(DRV_DISP_ADAGFX_MCUFRIEND)
+      // For MCUFRIEND displays, report the ID
+      snprintf(m_acTxt, MAX_STR, "(MCUFRIEND ID=0x%04X)", m_disp.readID());
+      GSLC_DEBUG_PRINT("  // %s\n", m_acTxt);
+    #endif
+    GSLC_DEBUG_PRINT("  #define ADATOUCH_PIN_YP   A%d    // \"Y+\": Must be an analog pin\n", (nPinYp - A0));
+    GSLC_DEBUG_PRINT("  #define ADATOUCH_PIN_XM   A%d    // \"X-\": Must be an analog pin\n", (nPinXm - A0));
+    GSLC_DEBUG_PRINT("  #define ADATOUCH_PIN_YM   %d     // \"Y-\": Can be a digital pin\n", nPinYm);
+    GSLC_DEBUG_PRINT("  #define ADATOUCH_PIN_XP   %d     // \"X+\": Can be a digital pin\n", nPinXp);
+
+    GSLC_DEBUG_PRINT("-----------------------------------------------\n", "");
+    GSLC_DEBUG_PRINT("Current config settings:\n", "");
+    GSLC_DEBUG_PRINT("- YP=A%u XM=A%u YM=%u XP=%u\n",
+      (ADATOUCH_PIN_YP - A0), (ADATOUCH_PIN_XM - A0), ADATOUCH_PIN_YM, ADATOUCH_PIN_XP);
+    GSLC_DEBUG_PRINT("-----------------------------------------------\n", "");
+    GSLC_DEBUG_PRINT("Current config match recommendation?: ", "");
+    // Check pins for a match
+    if ((nPinXm != ADATOUCH_PIN_XM) || (nPinXp != ADATOUCH_PIN_XP) || \
+      (nPinYp != ADATOUCH_PIN_YP) || (nPinYm != ADATOUCH_PIN_YM))
+    {
+      GSLC_DEBUG_PRINT("MISMATCH - Please update config\n", "");
+      return false;
+    }
+    else {
+      GSLC_DEBUG_PRINT("OK - No need to update config\n", "");
+      return true;
+    }
+    GSLC_DEBUG_PRINT("-----------------------------------------------\n", "");
+
+  }
+  else {
+    return false;
+  }
+
+}
+
+
+void setup()
+{
+  // Initialize debug output
+  Serial.begin(9600);
+  gslc_InitDebug(&DebugOut);
+  //delay(1000);  // NOTE: Some devices require a delay after Serial.begin() before serial port can be used
+
+  // Initialize (with no support for GUI elements)
+  if (!gslc_Init(&m_gui, &m_drv, NULL, 0, m_asFont, MAX_FONT)) { return; }
+
+  // Use default font
+  if (!gslc_FontAdd(&m_gui, E_FONT_TXT, GSLC_FONTREF_PTR, NULL, 1)) { return; }
+
+  m_pFont = gslc_FontGet(&m_gui, E_FONT_TXT);
+
+  DrawBackground();
+
+  bool m_bDetectPinsOk = DetectPins();
+}
+
+void loop()
+{
+
+}


different debug config

different debug config

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


compiling code!

compiling code!


Cleaned Up Serial Code

Cleaned Up Serial Code

error: pathspec 'Data' did not match any file(s) known to git
error: pathspec 'Logging/Data-Logging-Main/Data-Logging-Main.ino' did not match any file(s) known to git


First commit of project test script.

First commit of project test script.

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

--- Project/robot_arm_test_script/robot_arm_test_script.ino
+++ Project/robot_arm_test_script/robot_arm_test_script.ino
@@ -0,0 +1,199 @@
+/**
+ *             robot_arm_test_script.ino
+ * Purpose:    Quick and dirty scripts to test parts of my project robot.
+ *
+ * @author:    Tyler Lucas
+ * Student ID: 3305203
+ * Date:       September 28, 2017
+ * Version     0.1
+ *
+ * References: N/A
+ *
+ */
+
+
+#include <Servo.h>  // servo library
+
+#define sonarTrigPin 13
+#define sonarEchoPin 12
+#define servo0PWMPin 11
+#define servo1PWMPin 9
+#define servo2PWMPin 8
+#define servo3PWMPin 6
+#define forceLVccPin 5
+#define forceRVccPin 4
+#define servo0PosPin A0
+#define servo1PosPin A1
+#define servo2PosPin A2
+#define servo3PosPin A3
+#define forceLPin A4
+#define forceRPin A5
+
+Servo servo[4];  // servo control objects
+int angles[4] = { 90, 65, 90, 60 };   // initial angles
+
+void setup()
+{
+  servo[0].attach( servo0PWMPin );   // swivel
+  servo[1].attach( servo1PWMPin );   // boom
+  servo[2].attach( servo2PWMPin );   // pincher
+  servo[3].attach( servo3PWMPin );   // main arm
+  for ( int n=0; n<4; n++ )
+    servo[n].write( angles[n] );
+
+  pinMode(sonarTrigPin, OUTPUT);
+  pinMode(sonarEchoPin, INPUT);
+
+  Serial.begin(9600);
+}
+
+void loop()
+{
+  Serial.println();
+
+  Serial.print("Servo #");
+  int servo_num = -1;
+  while ( servo_num < 0 || servo_num > 3 )
+  {
+    while ( Serial.available() == 0 ) { }
+    servo_num = Serial.parseInt();
+    if ( servo_num < 0 || servo_num > 3 )
+      Serial.print("\n Umm.. nope. Try again.\nServo #");
+  }
+  Serial.println( servo_num );
+
+  Serial.print("Angle: ");
+  while ( Serial.available() == 0 ) { }
+  int angle = Serial.parseInt();
+  Serial.println( angle );
+
+  angle = constrain_servo_angle(servo_num, angle);
+
+  Serial.print("Setting servo #");
+  Serial.print( servo_num );
+  Serial.print(" to ");
+  Serial.print( angle );
+  Serial.println(" degrees.");
+
+  go_to(servo_num, angle);
+
+  Serial.print("Servo #");
+  Serial.print( servo_num );
+  Serial.print(" set to ");
+  Serial.print( angles[servo_num] );
+  Serial.println(" degrees.");
+}
+
+int constrain_servo_angle(int servo_number, int input_angle)
+{
+  switch ( servo_number )
+  {
+  case 0: return constrain(input_angle, 0, 180);
+  case 1:
+    if (angles[3] < 60)
+      return constrain(input_angle, formulaZ(angles[3]), formulaA(angles[3]));
+    else if (angles[3] >= 60 && angles[3] < 70)
+      return constrain(input_angle, formulaY(angles[3]), formulaB(angles[3]));
+    else if (angles[3] >= 70 && angles[3] < 80)
+      return constrain(input_angle, formulaY(angles[3]), formulaC(angles[3]));
+    else if (angles[3] >= 80 && angles[3] < 100)
+      return constrain(input_angle, formulaX(angles[3]), formulaC(angles[3]));
+    else if (angles[3] >= 100 && angles[3] < 110)
+      return constrain(input_angle, formulaX(angles[3]), formulaD(angles[3]));
+    else if (angles[3] >= 110 && angles[3] < 120)
+      return constrain(input_angle, formulaW(angles[3]), formulaE(angles[3]));
+    else if (angles[3] >= 120 && angles[3] < 140)
+      return constrain(input_angle, formulaV(angles[3]), formulaE(angles[3]));
+    else if (angles[3] >= 140)
+      return constrain(input_angle, formulaU(angles[3]), formulaE(angles[3]));
+    else
+      return -1;
+  case 2: return constrain(input_angle, 65, 140);
+  case 3: return constrain(input_angle, 60, 140);
+  default: return -1;
+  }
+}
+
+int formulaA(int angle) { return 140; }
+int formulaB(int angle) { return 140 + (angle - 60) * (135-140)/(70-60); }
+int formulaC(int angle) { return 135; }
+int formulaD(int angle) { return 135 + (angle - 100) * (130-135)/(110-100); }
+int formulaE(int angle) { return 130; }
+int formulaZ(int angle) { return 65; }
+int formulaY(int angle) { return 65 + (angle - 60) * (54-65)/(80-60); }
+int formulaX(int angle) { return 54 + (angle - 80) * (20-54)/(110-80); }
+int formulaW(int angle) { return 20 + (angle - 110) * (25-20)/(120-110); }
+int formulaV(int angle) { return 25 + (angle - 120) * (18-25)/(140-120); }
+int formulaU(int angle) { return 18; }
+
+int constrain_servo_angle_conservatively(int servo_number, int input_angle)
+{
+  switch ( servo_number )
+  {
+  case 0: return constrain(input_angle, 15, 165);
+  case 1: return constrain(input_angle, 65, 130);
+  case 2: return constrain(input_angle, 65, 140);
+  case 3: return constrain(input_angle, 60, 140);
+  default: return -1;
+  }
+}
+
+/*
+ * Increments towards the intended angle, keeping other angles in valid ranges.
+ */
+void go_towards(int servo_number, int angle)
+{
+  angle = constrain_servo_angle(servo_number, angle);
+
+  int diff = angle - angles[servo_number];
+  int dir;
+  if (diff == 0)
+    dir = 0;
+  else
+    dir = diff / abs(diff);
+
+  angles[servo_number] += dir;
+  servo[servo_number].write( angles[servo_number] );
+
+  if ( servo_number == 3)
+  {
+    angles[(servo_number + 2) % 4] = constrain_servo_angle((servo_number + 2) % 4, angles[(servo_number + 2) % 4]);
+    servo[(servo_number + 2) % 4].write( angles[(servo_number + 2) % 4] );
+  }
+
+//  if ( angles[servo_number] % 15 == 0 )
+//    Serial.print(angles[servo_number]);
+}
+
+void go_to(int servo_number, int angle)
+{
+  int min_delay_time = 10, max_delay_time = 100, delay_time = max_delay_time;
+
+  int previous_angle;
+  do {
+    previous_angle = angles[servo_number];
+
+    delay(delay_time);
+
+    go_towards(servo_number, angle);
+
+    if ( abs(angle - angles[servo_number]) > 15 && delay_time > min_delay_time )
+      delay_time -= min_delay_time;
+    else if ( abs(angle - angles[servo_number]) <= 15 && delay_time < max_delay_time)
+      delay_time += min_delay_time;
+  } while ( previous_angle - angles[servo_number] != 0 );
+}
+
+double readSonar()
+{
+  long duration;
+
+  digitalWrite(sonarTrigPin, LOW);
+  delayMicroseconds(2);
+  digitalWrite(sonarTrigPin, HIGH);
+  delayMicroseconds(10);
+  digitalWrite(sonarTrigPin, LOW);
+
+  duration = pulseIn(sonarEchoPin, HIGH);
+  return 0.146 * duration - 23.843;  // returns in mm
+}


IR Sensor Arduino code. Publishes range data using ROS interface.

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

--- src/ir_sensors/irSensor.ino
+++ src/ir_sensors/irSensor.ino
@@ -0,0 +1,36 @@
+/*
+ * rosserial IR Ranger Example
+ *
+ */
+
+#include <ros.h>
+#include <std_msgs/Int32.h>
+
+ros::NodeHandle  nh;
+
+std_msgs::Int32 irReading;
+
+// topic name is range_data
+ros::Publisher irSensor( "range_data", &irReading);
+
+int pin = 0;
+int val = 0;
+
+void setup()
+{
+  //Serial.begin(9600);
+  nh.initNode();
+  nh.advertise(irSensor);
+}
+
+void loop()
+{
+  // publish the range value
+  val = analogRead(pin);
+  irReading.data = val;
+  irSensor.publish(&irReading);
+  //Serial.println(val);
+  nh.spinOnce();
+  delay(5000);
+}
+


Added Yun Example (With Static CIK)

Added Yun Example (With Static CIK)

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

--- examples/YunReadWriteString/YunReadWriteString.ino
+++ examples/YunReadWriteString/YunReadWriteString.ino
@@ -0,0 +1,78 @@
+//*****************************************************************************
+//
+// YunReadWriteString - A simple example showing how to use the Exosite
+//                      library on the Arduino Yún with a static CIK.
+//
+// Copyright (c) 2013 Exosite LLC.  All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+//  * Redistributions of source code must retain the above copyright notice,
+//    this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//  * Neither the name of Exosite LLC nor the names of its contributors may
+//    be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
+// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
+// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
+// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
+// DAMAGES, FOR ANY REASON WHATSOEVER.
+//
+//*****************************************************************************
+
+#include <Bridge.h>
+#include <YunClient.h>
+#include <Exosite.h>
+#include <EEPROM.h>
+
+/*==============================================================================
+* Configuration Variables
+*
+* Change these variables to your own settings.
+*=============================================================================*/
+String cikData = "0000000000000000000000000000000000000000";  // <-- Fill in your CIK here! (https://portals.exosite.com -> Add Device)
+
+// Use these variables to customize what datasources are read and written to.
+String readString = "command&uptime";
+String writeString = "uptime=";
+String returnString;
+
+/*==============================================================================
+* End of Configuration Variables
+*=============================================================================*/
+class YunClient client;
+Exosite exosite(cikData, &client);
+
+/*==============================================================================
+* setup
+*
+* Arduino setup function.
+*=============================================================================*/
+void setup(){
+  Bridge.begin();
+  Serial.begin(115200);
+  Serial.println("Boot");
+}
+
+/*==============================================================================
+* loop
+*
+* Arduino loop function.
+*=============================================================================*/
+void loop(){
+  //Write to "uptime" and read from "uptime" and "command" datasources.
+  if ( exosite.writeRead(writeString+String(millis()), readString, returnString)){
+    Serial.println("OK");
+    Serial.println(returnString);
+  }else{
+    Serial.println("Error");
+  }
+
+  delay(5000);
+}


PushbuttonExample

PushbuttonExample

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

--- Pushbutton/examples/PushbuttonExample/PushbuttonExample.ino
+++ Pushbutton/examples/PushbuttonExample/PushbuttonExample.ino
@@ -0,0 +1,85 @@
+#include <Pushbutton.h>
+
+/*
+ * This example uses the Pushbutton library to demonstrate three different
+ * methods for detecting a button press and release. It blinks the yellow
+ * user LED each time the Zumo user button is pressed and released. You can
+ * still use this demo without a Zumo Shield if you connect a normally-open
+ * momentary pushbutton between digital pin 12 and ground on your Arduino.
+ */
+
+#define LED_PIN 13
+
+/*
+ * Create a Pushbutton object for pin 12 (the Zumo user pushbutton pin)
+ * with default settings, which enables the internal pull-up on the pin
+ * and interprets a HIGH pin value as the default (unpressed) state of the
+ * button. (Optional arguments can be passed to the constructor to specify
+ * other button types and connection methods; see the documentation for
+ * details.)
+ */
+Pushbutton button(ZUMO_BUTTON);
+
+void setup()
+{
+  pinMode(LED_PIN, OUTPUT);
+}
+
+void loop()
+{
+  /*
+   * Method 1: Directly read the state of the button with the isPressed()
+   * function. You must debounce the button yourself with this method.
+   */
+  do
+  {
+    while (!button.isPressed());  // wait for button to be pressed
+    delay(10);                    // debounce the button press
+  }
+  while (!button.isPressed());    // if button isn't still pressed, loop
+
+  do
+  {
+    while (button.isPressed());   // wait for button to be released
+    delay(10);                    // debounce the button release
+  }
+  while (button.isPressed());     // if button isn't still released, loop
+
+  // blink LED
+  digitalWrite(LED_PIN, HIGH);
+  delay(200);
+  digitalWrite(LED_PIN, LOW);
+
+  /*
+   * Method 2: Use the waitForButton() function, which blocks and doesn't
+   * return until a button press and release are detected. This function
+   * takes care of button debouncing.
+   */
+  button.waitForButton();
+
+  // blink LED
+  digitalWrite(LED_PIN, HIGH);
+  delay(200);
+  digitalWrite(LED_PIN, LOW);
+
+  /*
+   * Method 3: Call the getSingleDebouncedRelease() function repeatedly
+   * in a loop, which returns true to report a single button release or false
+   * otherwise. This function takes care of button debouncing. If you have
+   * multiple buttons, you can call getSingleDebouncedRelease() or
+   * getSingleDebouncedPress() in a loop for all of them until one of them
+   * returns true.
+   */
+  while (1)
+  {
+    if (button.getSingleDebouncedRelease())
+    {
+      // blink LED
+      digitalWrite(LED_PIN, HIGH);
+      delay(200);
+      digitalWrite(LED_PIN, LOW);
+
+      break;
+    }
+  }
+}


you should write to the correct motors …


First commit. Basic rotary control.

First commit. Basic rotary control.

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

--- musicbox.ino
+++ musicbox.ino
@@ -0,0 +1,50 @@
+int encoderPin1 = 2;
+int encoderPin2 = 3;
+
+int enc1LastValue;
+int counter = 0;
+
+char* streams[] = {"primero", "segundo", "tercero",
+                    "cuarto", "quinto", "sexto",
+                    "septimo", "octavo", "noveno"};
+
+int streamsSize = sizeof(streams)/sizeof(char*);
+
+void setup() {
+
+  Serial.begin (9600);
+  Serial.println(streamsSize);
+
+  pinMode(encoderPin1, INPUT);
+  digitalWrite(encoderPin1, HIGH);
+  enc1LastValue = digitalRead(encoderPin1);
+
+  pinMode(encoderPin2, INPUT);
+  digitalWrite(encoderPin2, HIGH);
+
+}
+
+void loop() {
+
+  int enc1Value = digitalRead(encoderPin1);
+  int enc2Value = digitalRead(encoderPin2);
+
+  if (enc1Value != enc1LastValue) {
+    delay(1);
+    if (enc1Value == LOW) {
+      (enc2Value == enc1Value) ? counter++ : counter--;
+      if (counter<0) {
+        counter = 0;
+      }
+      if (counter>=streamsSize) {
+        counter = streamsSize-1;
+      }
+      Serial.print(counter);
+      Serial.print(": ");
+      Serial.println(streams[counter]);
+    }
+    enc1LastValue = enc1Value;
+  }
+}
+
+


Added TA project v2

Added TA project v2

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

--- BiotechHardware/dcs/dcs_ta2/dcs_ta2.ino
+++ BiotechHardware/dcs/dcs_ta2/dcs_ta2.ino
@@ -0,0 +1,189 @@
+#include <SPI.h>
+#include <Ethernet.h>
+#include <Keypad.h>
+#include <Wire.h>
+#include <LiquidCrystal_I2C.h>
+#include <Servo.h>
+
+const char server_addr[] = "192.168.2.4";
+byte mac[] = {
+  0x90, 0xA2, 0xDA, 0x0E, 0xF5, 0xF8};
+byte ip[] = {
+  192,168,1,73};
+
+EthernetServer server(80);
+boolean device_status = true;
+
+const byte ROWS = 4;
+const byte COLS = 3;
+char keys[ROWS][COLS] = {
+  {
+    '1','2','3'  }
+  ,
+  {
+    '4','5','6'  }
+  ,
+  {
+    '7','8','9'  }
+  ,
+  {
+    '*','0','#'  }
+};
+
+byte rowPins[ROWS] = {
+  2, 3, 4, 5};
+byte colPins[COLS] = {
+  6, 7, 8};
+
+Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS );
+LiquidCrystal_I2C lcd(0x27,20,4);
+Servo myservo;
+
+char pass[16];
+int attempt = 0;
+int count = 0;
+int max_attempt = 3;
+
+const int sensor = A2;
+const int push_btn = A3;
+const int servo = 9;
+
+void setup(){
+  Serial.begin(9600);
+  Ethernet.begin(mac, ip);
+  server.begin();
+  pinMode(sensor, INPUT);
+  digitalWrite(sensor, HIGH);
+  pinMode(push_btn, INPUT);
+  digitalWrite(push_btn, HIGH);
+  myservo.write(70);
+  Serial.println("ready");
+}
+
+void loop(){
+  EthernetClient client = server.available();
+  if(client){
+    while(client.connected()){
+      if(client.available()){
+        if(client.find("GET /")){
+          while(client.findUntil("command_", "\n\r")){
+            char type = client.read();
+            if(type == 'o') {
+              Serial.println("Open Command");
+              client.println("HTTP/1.1 200 OK");
+              client.println("Content-Type: application/json");
+              client.println();
+              client.print("{\"response\":\"open\"}");
+            }
+            else if(type == 's'){
+              int val = client.parseInt();
+              Serial.println("Status Command");
+              if(val == 2){
+                device_status = true;
+                Serial.println("Activate");
+                client.println("HTTP/1.1 200 OK");
+                client.println("Content-Type: application/json");
+                client.println();
+                client.print("{\"response\":\"activate\"}");
+              }
+              else if(val == 0){
+                device_status = false;
+                Serial.println("Deactivate");
+                client.println("HTTP/1.1 200 OK");
+                client.println("Content-Type: application/json");
+                client.println();
+                client.print("{\"response\":\"deactivate\"}");
+              }
+              else{
+                Serial.println("Unexpected command");
+                client.println("HTTP/1.1 200 OK");
+                client.println("Content-Type: application/json");
+                client.println();
+                client.print("{\"response\":\"invalid_status\"}");
+              }
+            }
+            else if(type == 'a') {
+              Serial.println("Pinging");
+              client.println("HTTP/1.1 200 OK");
+              client.println("Content-Type: application/json");
+              client.println();
+              client.print("{\"response\":\"online\"}");
+            }
+            else if(type == 'c') {
+              Serial.println("Check Status");
+              client.println("HTTP/1.1 200 OK");
+              client.println("Content-Type: application/json");
+              client.println();
+              if(device_status){
+                client.print("{\"response\":\"active\"}");
+              }
+              else{
+                client.print("{\"response\":\"non-active\"}");
+              }
+            }
+            else {
+              Serial.print("Unexpected type ");
+              Serial.print(type);
+              client.println("HTTP/1.1 200 OK");
+              client.println("Content-Type: application/json");
+              client.println();
+              client.print("{\"response\":\"invalid\"}");
+            }
+          }
+        }
+        break;
+      }
+    }
+    delay(10);
+    client.stop();
+  }
+  if(digitalRead(push_btn) == LOW){
+    auth_user("keluar");
+    open_door();
+  }
+
+  if(device_status){
+    char key = keypad.getKey();
+    if (key != NO_KEY && key != '*'){
+      pass[count] = key;
+      count++;
+    }
+    if(key == '*'){
+      attempt++;
+      auth_user(pass);
+      sys_init();
+    }
+    if(key == '#'){
+      sys_init();
+    }
+  }
+}
+
+void sys_init(){
+  memset(pass, 0, sizeof pass);
+  count = 0;
+}
+
+void auth_user(char user_input[]){
+  EthernetClient client;
+  Serial.println("Sending");
+  if (client.connect(server_addr,80))
+  {
+    client.print("GET /api/dcs/dcs_auth/");
+    client.print(user_input);
+    Serial.println(user_input);
+    client.print(" HTTP/1.1\n");
+    client.print("Host: 192.168.2.4\n");
+    client.print("Connection: close\n\n");
+    Serial.println("Sending success");
+  }
+  else{
+    Serial.println("Sending failed");
+  }
+}
+
+void open_door(){
+  Serial.println("Door open");
+  delay(1000);
+}
+


Three stack tower

Three stack tower

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

--- ThreeStack/ThreeStack.ino
+++ ThreeStack/ThreeStack.ino
@@ -0,0 +1,61 @@
+int dir1PinA = 13;
+int speedPinA = 11;
+int buze = 4;
+double AcX, AcY, AcZ;
+double error1;
+double e1 = 0;
+double e2 = 0;
+double e3 = 0;
+double error_average;
+int current_angle = 0;
+int target_angle = 0;
+int Kp = 3;
+
+void motorControl(int pwm1, int dir1){
+  int p1;
+  if (pwm1 >= 255) {p1 = 255;}
+  else {p1 = pwm1;}
+  if (dir1 == 1){
+    digitalWrite(dir1PinA, LOW);
+    analogWrite(speedPinA,p1);
+    }
+  if (dir1 == 2){
+    digitalWrite(dir1PinA, HIGH);
+    analogWrite(speedPinA, p1);
+    }
+}
+
+void setup() {
+
+  // put your setup code here, to run once:
+  Serial.begin(9600);
+  pinMode(dir1PinA, OUTPUT);
+  pinMode(speedPinA, OUTPUT);
+  pinMode(buze, OUTPUT);
+}
+
+void loop() {
+  AcX = (analogRead(A5)-342)/68.0;
+  AcZ = (analogRead(A3)-350)/70.0;
+  error1 = round(atan2(AcX, AcZ)/3.14*180);
+  e1 = e2;
+  e2 = e3;
+  e3 = error1;
+  error_average = (e1 + e2 + e3)/3;
+  current_angle = error_average;
+  int error = current_angle - target_angle;
+  if (error > 0) {
+    motorControl(Kp * error, 1);
+  } else {
+    motorControl(- Kp * error, 2);
+  }
+
+
+  Serial.print("  accel_X_reading is ");Serial.print(AcX);
+  Serial.print("  accel_Z_reading is ");Serial.print(AcZ);
+  Serial.print("error is");Serial.println(error_average);
+  digitalWrite(buze, LOW);
+  // put your main code here, to run repeatedly:
+  delay(20);
+
+}


Shorten lines so it doesn't wrap when copied to my MSWord doc. Replaced min speed hardcode in MotorGo with const int variable.

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


Sketches: Add sparkcore-glow-rgbled

Sketches: Add sparkcore-glow-rgbled

Fix https://github.com/gmacario/learning-arduino/issues/30

error: pathspec 'Sketches/sparkcore-glow-rgbled/sparkcore-glow-rgbled.ino' did not match any file(s) known to git

--- Sketches/sparkcore-glow-rgbled/sparkcore-glow-rgbled.ino
+++ Sketches/sparkcore-glow-rgbled/sparkcore-glow-rgbled.ino
@@ -0,0 +1,52 @@
+/*
+ * Glow a RGB LED on a Spark Core
+ * Adapted from https://learn.adafruit.com/rgb-led-strips/example-code
+ */
+
+int led_r = A4;
+int led_g = A5;
+int led_b = A6;
+
+int FADESPEED = 5;     // make this higher to slow down
+
+void setup() {
+    Serial.begin(9600);
+    pinMode(led_r, OUTPUT);
+    pinMode(led_g, OUTPUT);
+    pinMode(led_b, OUTPUT);
+}
+
+void loop() {
+  int r, g, b;
+
+  Serial.println("fade from blue to violet");
+  for (r = 0; r < 256; r++) {
+    analogWrite(led_r, r);
+    delay(FADESPEED);
+  }
+  Serial.println("fade from violet to red");
+  for (b = 255; b > 0; b--) {
+    analogWrite(led_b, b);
+    delay(FADESPEED);
+  }
+  Serial.println("fade from red to yellow");
+  for (g = 0; g < 256; g++) {
+    analogWrite(led_g, g);
+    delay(FADESPEED);
+  }
+  Serial.println("fade from yellow to green");
+  for (r = 255; r > 0; r--) {
+    analogWrite(led_r, r);
+    delay(FADESPEED);
+  }
+  Serial.println("fade from green to teal");
+  for (b = 0; b < 256; b++) {
+    analogWrite(led_b, b);
+    delay(FADESPEED);
+  }
+  Serial.println("fade from teal to blue");
+  for (g = 255; g > 0; g--) {
+    analogWrite(led_g, g);
+    delay(FADESPEED);
+  }
+}


POSTPIR_OK ULTRASON_OK LED_KO

POSTPIR_OK ULTRASON_OK LED_KO

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

--- electro/Exemple/WebClientRepeatingPOST/WebClientRepeatingPOST.ino
+++ electro/Exemple/WebClientRepeatingPOST/WebClientRepeatingPOST.ino
@@ -0,0 +1,109 @@
+/*
+  Repeating Web client
+
+ This sketch connects to a a web server and makes a request
+ using a Wiznet Ethernet shield. You can use the Arduino Ethernet shield, or
+ the Adafruit Ethernet shield, either one will work, as long as it's got
+ a Wiznet Ethernet module on board.
+
+ This example uses DNS, by assigning the Ethernet client with a MAC address,
+ IP address, and DNS address.
+
+ Circuit:
+ * Ethernet shield attached to pins 10, 11, 12, 13
+
+ created 19 Apr 2012
+ by Tom Igoe
+ modified 21 Jan 2014
+ by Federico Vanzati
+
+ http://www.arduino.cc/en/Tutorial/WebClientRepeating
+ This code is in the public domain.
+
+ */
+
+#include <SPI.h>
+#include <Ethernet.h>
+
+String data = "{\"name\":\"TESTPOSTMULTI\"}";
+
+// assign a MAC address for the ethernet controller.
+// fill in your address here:
+byte mac[] = {
+  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
+};
+// fill in an available IP address on your network here,
+// for manual configuration:
+IPAddress ip(192, 168, 1, 177);
+
+// initialize the library instance:
+EthernetClient client;
+
+//char server[] = "www.arduino.cc";
+IPAddress server(192,168,1,16);
+
+unsigned long lastConnectionTime = 0;             // last time you connected to the server, in milliseconds
+const unsigned long postingInterval = 10L * 1000L; // delay between updates, in milliseconds
+// the "L" is needed to use long type numbers
+
+void setup() {
+  // start serial port:
+  Serial.begin(9600);
+  while (!Serial) {
+    ; // wait for serial port to connect. Needed for native USB port only
+  }
+
+  // give the ethernet module time to boot up:
+  delay(1000);
+  // start the Ethernet connection using a fixed IP address and DNS server:
+  Ethernet.begin(mac, ip);
+  // print the Ethernet board/shield's IP address:
+  Serial.print("My IP address: ");
+  Serial.println(Ethernet.localIP());
+}
+
+void loop() {
+  // if there's incoming data from the net connection.
+  // send it out the serial port.  This is for debugging
+  // purposes only:
+  if (client.available()) {
+    char c = client.read();
+    Serial.write(c);
+  }
+
+  // if ten seconds have passed since your last connection,
+  // then connect again and send data:
+  if (millis() - lastConnectionTime > postingInterval) {
+    httpRequest();
+  }
+
+}
+
+// this method makes a HTTP connection to the server:
+void httpRequest() {
+  // close any connection before send a new request.
+  // This will free the socket on the WiFi shield
+  client.stop();
+
+  // if there's a successful connection:
+  if (client.connect(server, 8000)) {
+    Serial.println("connecting...");
+    // send the HTTP GET request:
+    client.println("POST /api/addsensor HTTP/1.1");
+      client.println("Host: 192.168.1.16");
+      client.println("Content-Type: application/x-www-form-urlencoded");
+      client.println("Connection: close");
+      client.println("User-Agent: Arduino/1.0");
+      client.print("Content-Length: ");
+      client.println(data.length());
+      client.println();
+      client.print(data);
+      client.println();
+
+    // note the time that the connection was made:
+    lastConnectionTime = millis();
+  } else {
+    // if you couldn't make a connection:
+    Serial.println("connection failed");
+  }
+}


added hardware tester for I2C messages

added hardware tester for I2C messages

error: pathspec 'hardware' did not match any file(s) known to git
error: pathspec 'testers/Oscillator/CheckIncomingI2Cmessages/CheckIncomingI2Cmessages.ino' did not match any file(s) known to git


added beacon encoder sketch

added beacon encoder sketch

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

--- course/beacon_ir_encoder_sketch/beacon_ir_encoder_sketch.ino
+++ course/beacon_ir_encoder_sketch/beacon_ir_encoder_sketch.ino
@@ -0,0 +1,42 @@
+#define CONTROL_PIN 6
+
+
+void transmit_encoded_signal(char encoded_signal){
+  //Send start signal (off for 100ms on for 500ms)
+  digitalWrite(CONTROL_PIN,LOW);
+  delay(100);
+  digitalWrite(CONTROL_PIN,HIGH);
+  delay(500);
+  digitalWrite(CONTROL_PIN,LOW);
+  delay(100);
+  //Write encoded signal, each bit is written for 100ms
+
+  //Most significant bit
+  digitalWrite(CONTROL_PIN,(encoded_signal&B10000000)==B10000000);
+  delay(100);
+  digitalWrite(CONTROL_PIN,(encoded_signal&B01000000)==B01000000);
+  delay(100);
+  digitalWrite(CONTROL_PIN,(encoded_signal&B00100000)==B00100000);
+  delay(100);
+  digitalWrite(CONTROL_PIN,(encoded_signal&B00010000)==B00010000);
+  delay(100);
+  digitalWrite(CONTROL_PIN,(encoded_signal&B00001000)==B00001000);
+  delay(100);
+  digitalWrite(CONTROL_PIN,(encoded_signal&B00000100)==B00000100);
+  delay(100);
+  digitalWrite(CONTROL_PIN,(encoded_signal&B00000010)==B00000010);
+  delay(100);
+  //Least significant bit
+  digitalWrite(CONTROL_PIN,(encoded_signal&B00000001)==B00000001);
+  delay(100);
+
+}
+void setup(){
+  Serial.begin(9600);
+  pinMode(CONTROL_PIN,OUTPUT);
+}
+
+void loop(){
+  transmit_encoded_signal(B11111111);
+  delay(2000);
+}


add RainbowCycle demo

add RainbowCycle demo

error: pathspec 'examples-ltc/4.RainbowTape/RainbowCycle/RainbowCycle.ino' did not match any file(s) known to git

--- examples-ltc/4.RainbowTape/RainbowCycle/RainbowCycle.ino
+++ examples-ltc/4.RainbowTape/RainbowCycle/RainbowCycle.ino
@@ -0,0 +1,45 @@
+#include "Adafruit_NeoPixel.h"
+
+#define pixelCount 5 // number of pixels in the chain; doesn't hurt to have less actual pixels in
+Adafruit_NeoPixel strip = Adafruit_NeoPixel(pixelCount, LED_BUILTIN_RGB,
+                                            NEO_GRB + NEO_KHZ800);
+
+
+// Input a value 0 to 255 to get a color value.
+// The colours are a transition r - g - b - back to r.
+uint32_t Wheel(byte WheelPos) {
+  WheelPos = 255 - WheelPos;
+  if(WheelPos < 85) {
+    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
+  }
+  if(WheelPos < 170) {
+    WheelPos -= 85;
+    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
+  }
+  WheelPos -= 170;
+  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
+}
+
+// Slightly different, this makes the rainbow equally distributed throughout
+void rainbowCycle(uint8_t wait) {
+  uint16_t i, j;
+
+  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
+    for(i=0; i< strip.numPixels(); i++) {
+      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
+    }
+    strip.show();
+    delay(wait);
+  }
+}
+
+void setup() {
+  strip.begin();
+  strip.show(); // Initialize all pixels to 'off'
+}
+
+void loop() {
+  rainbowCycle(20);
+}
+
+// Code based on Adafruit Neopixel examples


Colorful Light

Colorful Light

there were some noisy color changes when switching from one color to
another color, fixed that by making sure that the ranges are all
continues.

error: pathspec 'Action' did not match any file(s) known to git
error: pathspec 'Modules/RGB' did not match any file(s) known to git
error: pathspec 'LED/RGBLEDATtiny/RGBLEDATtiny.ino' did not match any file(s) known to git


Optimise data types

Optimise data types

fatal: remote error: upload-pack: not our ref c44d8166d2aa0ef8fa289faac54dcb9c4b17bc4f
fatal: the remote end hung up unexpectedly


Latest driver

Latest driver

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

--- arduino/arduino_md03_v_5_0/arduino_md03_v_5_0.ino
+++ arduino/arduino_md03_v_5_0/arduino_md03_v_5_0.ino
@@ -0,0 +1,166 @@
+/***************************************************
+           ArcEyes MD03 I2C sandbox
+             by David Wilman
+   MD03 over I2C code by By James Henderson 2012
+****************************************************/
+
+#include <Wire.h>
+#include <LCD.h>
+#include <LiquidCrystal_I2C.h>
+
+ //int LCD pins on I2C bus
+ #define I2C_ADDR 0x27
+ #define BACKLIGHT_PIN 3
+ #define En_pin  2
+ #define Rw_pin  1
+ #define Rs_pin  0
+ #define D4_pin  4
+ #define D5_pin  5
+ #define D6_pin  6
+ #define D7_pin  7
+ LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
+
+const int potPin1 = A0;
+const int potPin2 = A1;
+const int potPin3 = A2;
+const int rlyPin1 = 7; // Relay Pin for break
+const int rlyPin2 = 8; // Relay Pin for break
+const int rlyPin3 = 9; // Relay Pin for break
+const int motorPinSpeed1 = 3;
+const int motorPinSpeed2 = 10;
+const int motorPinSpeed3 = 11;
+const int motorPinDir1 = 2;
+const int motorPinDir2 = 4;
+const int motorPinDir3 = 5;
+boolean direct1 = LOW; // Stores what direction the motor should run in
+boolean direct2 = LOW; // Stores what direction the motor should run in
+boolean direct3 = LOW; // Stores what direction the motor should run in
+float speedControl1 = 0; //store the current speed
+float speedControl2 = 0; //store the current speed
+float speedControl3 = 0; //store the current speed
+long previousMillis = 0;  // store the time LCD was last updated
+long interval = 50; // time setween lcd updates
+
+
+//serial
+String inputString = "";         // a string to hold incoming data
+boolean stringComplete = false;  // whether the string is complete
+
+
+
+void setup(){
+  Wire.begin(); //start I2C bus
+  delay(100); //wait for bus to stabalise
+  pinMode(rlyPin1,OUTPUT); // Setup pins
+  pinMode(rlyPin2,OUTPUT); // Setup pins
+  pinMode(rlyPin3,OUTPUT); // Setup pins
+  pinMode(motorPinDir1,OUTPUT); // Setup pins
+  pinMode(motorPinDir2,OUTPUT); // Setup pins
+  pinMode(motorPinDir3,OUTPUT); // Setup pins
+  lcd.begin (16,2); // 2 rows x 16 char
+  // Switch on the backlight
+  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
+  lcd.setBacklight(HIGH);
+  lcd.clear();
+  lcd.setCursor(0,0);
+  lcd.print("ArcEyes MD03 I2C");
+  lcd.setCursor(0,1);
+  lcd.print("SandBox");
+  delay(30);
+  //lcd.clear();
+
+
+  //serial
+
+    Serial.begin(9600);
+  // reserve 200 bytes for the inputString:
+  inputString.reserve(200);
+}
+
+void loop(){
+  direct1 = manualSpeedControl(motorPinSpeed1, potPin1, rlyPin1, motorPinDir1, direct1, speedControl1);
+  direct2 = manualSpeedControl(motorPinSpeed2, potPin2, rlyPin2, motorPinDir2, direct2, speedControl2);
+  direct3 = manualSpeedControl(motorPinSpeed3, potPin3, rlyPin3, motorPinDir3, direct3, speedControl3);
+
+    // print the string when a newline arrives:
+  if (stringComplete) {
+    Serial.println(inputString);
+    // clear the string:
+    inputString = "";
+    stringComplete = false;
+  }
+
+
+}
+
+
+byte manualSpeedControl(int speedPin, byte potPin, int rlyPin, int dirPin, byte direct, int speedControl){
+    int potVal = analogRead(potPin);
+    if(potVal < 450){               //Sets reverse speed from Pot1
+      digitalWrite(rlyPin, LOW);
+      speedControl = map(potVal, 450, 0, 0, 250);
+      direct = LOW;
+    }
+    else if(potVal < 573){          // sets zero speed from Pot1
+      digitalWrite(rlyPin, HIGH);
+      speedControl = 0;
+    }
+    else if (potVal >= 574){        // sets forward speed from Pot1
+      digitalWrite(rlyPin, LOW);
+      speedControl = map(potVal, 574, 1023, 0, 250);
+      direct = HIGH;
+    }
+    analogWrite(speedPin, speedControl);
+    digitalWrite(dirPin, direct);
+
+    return direct;
+}
+/*
+byte getData(int address, byte reg){                   // function for getting data from MD03
+  Wire.beginTransmission(address);
+  Wire.write(reg);
+  Wire.endTransmission();
+
+  byte data = 0;
+  //for (int i; i<100; i++){
+    Wire.requestFrom(address, 1);         // Requests byte from MD03
+    while(Wire.available() < 1);          // Waits for byte to become availble
+    data = Wire.read();
+    //}
+
+  return(data);
+}
+
+void sendData(int address, byte reg, byte val){         // Function for sending data to MD03
+  Wire.beginTransmission(address);         // Send data to MD03
+    Wire.write(reg);
+    Wire.write(val);
+  Wire.endTransmission();
+}
+*/
+/*
+  SerialEvent occurs whenever a new data comes in the
+ hardware serial RX.  This routine is run between each
+ time loop() runs, so using delay inside loop can delay
+ response.  Multiple bytes of data may be available.
+ */
+void serialEvent() {
+  while (Serial.available()) {
+    // get the new byte:
+    char inChar = (char)Serial.read();
+    lcd.clear();
+    lcd.setCursor(0,0);
+    lcd.print(inChar);
+    // add it to the inputString:
+    inputString += inChar;
+    // if the incoming character is a newline, set a flag
+    // so the main loop can do something about it:
+    if (inChar == '\n') {
+      stringComplete = true;
+    }
+  }
+  lcd.clear();
+  lcd.setCursor(0,0);
+  lcd.print(inputString);
+
+}


REV14 hardware test

REV14 hardware test

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

--- Arduino/hardware/REV14/rn2483test/rn2483test.ino
+++ Arduino/hardware/REV14/rn2483test/rn2483test.ino
@@ -0,0 +1,56 @@
+uint8_t ch = 0;
+
+void setup() {
+  // put your setup code here, to run once:
+  Serial.begin(19200);
+  Serial.println("start");
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  uint8_t inBuf[64];
+  uint8_t outBuf[128];
+
+  for(uint8_t i = 0; i < sizeof(inBuf); i++) {
+    inBuf[i] = i + (ch * sizeof(inBuf));
+  }
+
+  Serial.print("ReturnVal: ");
+  Serial.println(getHex(inBuf, outBuf, sizeof(outBuf)));
+  for(uint8_t i = 0; i < sizeof(inBuf); i++) {
+    Serial.print(inBuf[i], HEX);
+  }
+  Serial.println();
+  Serial.write(outBuf, sizeof(outBuf));
+  Serial.println();
+  Serial.println();
+  ch++;
+  while (ch == 4) {}
+  delay(500);
+}
+
+bool getHex(const uint8_t *string, uint8_t *output, uint8_t outputLen)
+{
+  if((string || output) == NULL) return false; // check for null pointer
+    uint8_t counter = outputLen;
+    // convert to hex
+  while(counter) {
+    uint8_t highValue = *string >> 4;
+    uint8_t lowValue  = *string & 0x0f;
+    uint8_t temp;
+
+    temp = highValue;
+    if(temp <= 9) temp += '0';
+    else temp += ('A' - 10);
+    *output++ = temp;
+
+    temp = lowValue;
+    if(temp <= 9) temp += '0';
+    else temp += ('A'-10);
+    *output++ = temp;
+
+    string++;
+    counter -= 2;
+  }
+  return true;
+}


Connecting of computer mouse on SpikeRecorder with Arduino Due

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


Add plain hhi code

Add plain hhi code

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

--- HHI_switches_gripper/HHI_switches_gripper.ino
+++ HHI_switches_gripper/HHI_switches_gripper.ino
@@ -0,0 +1,112 @@
+/* Arduino Code for an EMG SpikerShield to control a TENS device, LED lights, and a gripper */
+
+#include <Servo.h>  //Includes the Gripper Servo Library
+Servo ServoGripper; //Declares the Name of the Servo to be ServoGripper -- this is all if you want to control a gripper hand as well
+
+#define NUM_LED 6  //sets the maximum numbers of LEDs
+#define MAX_Low 100   //for people with low EMG activity
+#define MAX_High 254//for people with high EMG activity
+#define Threshold 3 // this sets the light to activate TENS
+#define threshold_degrees 10 //Number of steps the Servo will have
+
+int reading[10];
+int finalReading;
+int StimPin = 3; // TENS Digital 3
+int SwitchPin = 4;   // pushbutton connected to digital pin 4 -  this will momentarily turn on TENS
+int SwitchThreshold = 7; //pushbutton connected to digital pin 7 - this will switch thresholds
+int GripPin = 2; //Digital Out that controls Servo Motor Gripper Hand
+int SwitchState = 0;
+int SwitchThresholdState = 0;
+int MAX = 0;
+byte litLeds = 0;
+byte multiplier = 1;
+byte leds[] = {8, 9, 10, 11, 12, 13};
+int aQ1 = 11;
+int aQ2 = 13;
+int aQ3 = 8;
+
+const int UpdateTime = 200; // (number of milliseconds between updating servo position -- if too low you will burn motor out)
+unsigned long OldTime = 0;
+int old_degrees = 0;
+int new_degrees = 0;
+
+void setup(){
+  Serial.begin(9600); //begin serial communications
+  ServoGripper.attach(GripPin); //Declare the Servo to be Connected to GripPin
+  pinMode(StimPin, OUTPUT); // Set TENS output to StimPin
+  pinMode(SwitchPin, INPUT);      // sets the digital pin 4 as the switch input
+  pinMode(SwitchThreshold, INPUT);      // sets the digital pin 7 as the threshold changer
+  for(int i = 0; i < NUM_LED; i++){ //initialize LEDs as outputs
+    pinMode(leds[i], OUTPUT);
+  pinMode(aQ1, OUTPUT);
+
+  }
+  MAX = MAX_High; //This sets the default to people with high EMG activity.
+
+
+}
+
+void loop(){
+
+    //note the serial print stuff is sjust debugging tools
+    SwitchThresholdState = digitalRead(SwitchThreshold);
+    if (SwitchThresholdState == HIGH){ // This will allow the switching between a low threshold and high threshold state on S2
+    if (MAX == MAX_High){ MAX = MAX_Low; digitalWrite(aQ3, HIGH);}
+    else{
+     MAX = MAX_High; digitalWrite(aQ2, HIGH); }
+    while (SwitchThresholdState == HIGH) { // This will pause the program while the person is touching the threshold button,
+    SwitchThresholdState = digitalRead(SwitchThreshold);
+    delay(10); }                         // so it doesn't flip back and forth while button is pushed
+    }
+
+    SwitchState = digitalRead(SwitchPin);
+    //Serial.println(SwitchState);
+    if (SwitchState == HIGH){ // This will activate the TENS if the PushButton is pressed on S1
+    digitalWrite(StimPin, HIGH), digitalWrite(aQ1, HIGH);
+    //Serial.println('Stim');
+     while (SwitchState == HIGH) { // This will pause the program while the person is touching TENS test button
+    SwitchState = digitalRead(SwitchPin);
+    delay(10); }
+    }
+
+  for(int i = 0; i < 10; i++){    //take ten readings in ~0.02 seconds
+    reading[i] = analogRead(A0) * multiplier;
+    delay(2);
+  }
+  for(int i = 0; i < 10; i++){   //average the ten readings
+    finalReading += reading[i];
+  }
+  finalReading /= 10;
+  for(int j = 0; j < NUM_LED; j++){  //write all LEDs low and stim pin low
+
+    digitalWrite(leds[j], LOW);
+    digitalWrite(StimPin, LOW);
+  }
+  Serial.println(finalReading);
+  //Serial.print("\t");
+  finalReading = constrain(finalReading, 0, MAX);
+  litLeds = map(finalReading, 0, MAX, 0, NUM_LED);
+  //Serial.println(litLeds);
+
+  for(int k = 0; k < litLeds; k++){
+    digitalWrite(leds[k], HIGH); // This turns on the LEDS
+    if (k >= Threshold){
+      digitalWrite(StimPin, HIGH); // This turns on the TENS as a function of which LED is lit
+    }
+  }
+
+  new_degrees = map(finalReading, 0 ,MAX, 165, 0); //Translate the analog reading to degrees for the servo (from 165° to 0°).
+
+if (millis() - OldTime > UpdateTime){
+  if(abs(new_degrees-old_degrees) > threshold_degrees){
+    ServoGripper.write(new_degrees); //Move the servo according to the degrees calculated
+  }
+  OldTime = millis();
+  old_degrees = new_degrees;
+}
+   //delay(10);
+  //for serial debugging, uncomment the next two lines.
+  //Serial.println(finalReading);
+  //delay(100);
+}
+


Create PotMeterRead.ino

Create PotMeterRead.ino

error: pathspec 'The' did not match any file(s) known to git
error: pathspec 'Things' did not match any file(s) known to git
error: pathspec 'Network/potmeter-workshop/PotMeterRead/PotMeterRead.ino' did not match any file(s) known to git


Added comments, cleaned code.

Added comments, cleaned code.

There was a fair amount of code that was still in place that was no longer needed. Removed that.

The comments were sparse, so I added a fair amount and tried to get them a bit more readable/understandable.

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/erikjlane/tracktimer.git/'


Add new revision of energino sketch, this version shall support both version of energino

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

--- sketches/Energino2/Energino2.ino
+++ sketches/Energino2/Energino2.ino
@@ -0,0 +1,544 @@
+/*
+ * Energino
+ *
+ * Energino is a energy consumption meter for DC loads
+ *
+ * This sketch connects an Arduino equipped with the Energino
+ * shield and with an Ethernet shield with a web service
+ * implementing the COSM (formely Pachube) REST API. It also
+ * implements a serial interface.
+ *
+ * Circuit:
+ *  Analog inputs attached to pins A0 (Current), A1 (Voltage)
+ *  Digital output attached to pin D3 (Relay)
+ *
+ * Supported commands from the serial:
+ *  #P<integer>, sets the period between two updates (in ms) [default is 2000]
+ *  #S<0/1>, sets the relay configuration, 0 load on, 1 load off [default is 0]
+ *  #A<integer>, sets the value in ohms of the R1 resistor [default is 100000]
+ *  #B<integer>, sets the value in ohms of the R2 resistor [default is 10000]
+ *  #C<integer>, sets the offset in mV of the current sensor [default is 2500]
+ *  #D<integer>, sets the sensitivity in mV of the current sensor [default is 185]
+ *  #R, resest the configuration to the defaults
+ *  #F<feed>, sets the feed id [default is 0]
+ *  #K<key>, sets the COSM authentication key [default is -]
+ *  #H, sets the remote host ip address [default is 216.52.233.121 (Cosm)]
+ *  #O, sets the remote host port [default is 80]
+ *
+ * No updates are sent over the Ethernet interface if the feed id is set to 0
+ *
+ * Serial putput:
+ *   #Energino,0,<voltage>,<current>,<power>,<relay>,<period>,<samples>,<ip>,<port>,<host>,<port>,<feed>,<key>
+ *
+ * RESTful interface:
+ *  This sketch accepts HTTP requests in the form GET /<cmd>/<param>/[value], where "cmd"
+ *  can be either "read" or "write", param is one of the following parameters:
+ *   datastreams [read]
+ *   switch [read|write]
+ *  Examples:
+ *   GET http://<ipaddress>/read/datastreams
+ *   GET http://<ipaddress>/read/switch
+ *   GET http://<ipaddress>/write/switch/0
+ *   GET http://<ipaddress>/write/switch/1
+ *
+ * created 31 October 2012
+ * by Roberto Riggio
+ *
+ * This code is released under the BSD Licence
+ *
+ */
+
+#include <SPI.h>
+#include <Ethernet.h>
+#include <EEPROM.h>
+#include <avr/eeprom.h>
+
+// comment/uncomment to disable/enable debug
+#define DEBUG
+
+#define RELAY_PIN 3
+#define STRING_BUFFER_SIZE 300
+
+#ifdef DEBUG
+#define DBG if(1)
+#else
+#define DBG if(0)
+#endif
+
+// Feed id
+const long FEED = 0;
+// Cosm key
+const char KEY[] = "-";
+
+// Cosm configuration
+IPAddress HOST(216,52,233,121);
+const long PORT = 80;
+
+// This configuration is used when DHCP fails
+IPAddress IP(172,25,18,219);
+IPAddress MASK(255,255,255,0);
+IPAddress GW(172,25,18,254);
+
+// Energino parameters
+int R1 = 100;
+int R2 = 10;
+int OFFSET = 2500;
+int SENSITIVITY = 850;
+int PERIOD = 2000;
+
+// Buffers used for parsing HTTP request lines
+char buffer[STRING_BUFFER_SIZE];
+char r[10];
+
+// Server configuration parameters, energino will listen for
+// incoming requests on this port
+const long SERVER_PORT = 8180;
+
+// Accumulators
+long VRaw;
+long IRaw;
+
+// Control loop paramters
+long sleep = 0;
+long delta = 0;
+
+// Last computed values
+float VFinal = 0.0;
+float IFinal = 0.0;
+
+// Not found page
+const char CONTENT_404[] = "HTTP/1.1 404 Not Found\n\n";
+
+// Not implemented page
+const char CONTENT_501[] = "HTTP/1.1 501 Not Implemented\n\n";
+
+// JSON response header and footer
+const char JSON_RESPONSE_BEGIN[] = "HTTP/1.1 200 OK\nContent-Type: application/json\n\n[";
+const char JSON_RESPONSE_END[] = "]\n";
+
+// magic string
+const char MAGIC[] = "Energino";
+const int REVISION = 0;
+
+// Minimum period for Ethernet updates
+const long MIN_ETHERNET_PERIOD = 2000;
+
+// Permanent configuration
+struct settings_t {
+  char magic[17];
+  byte mac[6];
+  char apikey[49];
+  long period;
+  int r1;
+  int r2;
+  int offset;
+  int sensitivity;
+  long feed;
+  IPAddress host;
+  long port;
+}
+settings;
+
+// working vars
+EthernetServer server(SERVER_PORT);
+
+void reset() {
+  DBG Serial.println("Writing defaults.");
+  strcpy (settings.magic,MAGIC);
+  settings.period = PERIOD;
+  settings.r1 = R1;
+  settings.r2 = R2;
+  settings.offset = OFFSET;
+  settings.sensitivity = SENSITIVITY;
+  settings.feed = FEED;
+  settings.host = HOST;
+  settings.port = PORT;
+  strcpy (settings.apikey,KEY);
+  randomSeed(analogRead(0));
+  settings.mac[0] = 0x90;
+  settings.mac[1] = 0xA2;
+  settings.mac[2] = 0xDA;
+  for (int i = 3; i < 6; i++) {
+    settings.mac[i] = random(0, 255);
+  }
+}
+
+void setup() {
+  // Default on
+  pinMode(RELAY_PIN,OUTPUT);
+  digitalWrite(RELAY_PIN, LOW);
+  pinMode(13,OUTPUT);
+  digitalWrite(13, LOW);
+  // configuring serial
+  Serial.begin(115200);
+  // Loading setting
+  eeprom_read_block((void*)&settings, (void*)0, sizeof(settings));
+  if (strcmp(settings.magic, MAGIC) != 0) {
+    reset();
+    eeprom_write_block((const void*)&settings, (void*)0, sizeof(settings));
+  }
+  // set sleep counter
+  resetSleep(settings.period);
+  // Print hw address
+  char macstr[18];
+  snprintf(macstr, 18, "%02x:%02x:%02x:%02x:%02x:%02x", settings.mac[0], settings.mac[1], settings.mac[2], settings.mac[3], settings.mac[4], settings.mac[5]);
+  DBG Serial.print("HWAddr: ");
+  DBG Serial.println(macstr);
+  // Try to configure the ethernet using DHCP
+  DBG Serial.println("Running DHCP...");
+  if (Ethernet.begin(settings.mac) == 0) {
+    DBG Serial.println("DHCP failed, using static IP.");
+    // Use static IP
+    Ethernet.begin(settings.mac, IP, MASK, GW);
+  }
+  // Give the Ethernet shield a second to initialize:
+  delay(1000);
+  // Start server
+  server.begin();
+}
+
+void loop() {
+
+  // Make sure that update period is not too high
+  if ((settings.feed != 0) && (settings.period < MIN_ETHERNET_PERIOD)) {
+    DBG Serial.println("Update period is too high, resetting.");
+    resetSleep(MIN_ETHERNET_PERIOD);
+  }
+
+  // Start profiling
+  long started = millis();
+
+  // Parse incoming commands
+  serParseCommand();
+
+  // Listen for incoming requests
+  handleRequests();
+
+  // Instant values are too floating,
+  // let's smooth them up
+  VRaw = 0;
+  IRaw = 0;
+
+  int skipCount = 0;
+
+  for(long i = 0; i < sleep; i++) {
+    VRaw += analogRead(A1);
+    IRaw += analogRead(A0);
+  }
+
+  // Conversion
+  VFinal = scaleVoltage((float)VRaw/sleep);
+  IFinal = scaleCurrent((float)IRaw/sleep);
+
+  // send data to remote host
+  sendData();
+
+  // Control loop
+  delta = abs(millis() - started);
+  sleep -= 5 * (delta - settings.period);
+  if (sleep < 5) {
+    sleep = 5;
+  }
+
+}
+
+void serParseCommand()
+{
+  char cmd = '\0';
+  int i, serAva;
+  char inputBytes[60] = {
+    '\0'       };
+  char * inputBytesPtr = &inputBytes[0];
+  if (Serial.available() > 0) {
+    delay(5);
+    serAva = Serial.available();
+    for (i=0; i<serAva; i++) {
+      char chr = Serial.read();
+      if (i == 0) {
+        if (chr != '#') {
+          return;
+        }
+        else {
+          continue;
+        }
+      }
+      else if (i == 1) {
+        cmd = chr;
+      }
+      else{
+        inputBytes[i-2] = chr;
+      }
+    }
+    inputBytes[i] = '\0';
+  }
+  if (cmd == 'F') {
+    long value = atol(inputBytesPtr);
+    if (value >= 0) {
+      settings.feed = value;
+    }
+  }
+  else if (cmd == 'P') {
+    int value = atoi(inputBytesPtr);
+    if (value > 0) {
+      resetSleep(value);
+    }
+  }
+  else if (cmd == 'A') {
+    int value = atoi(inputBytesPtr);
+    if (value >= 0) {
+      settings.r1 = value;
+    }
+  }
+  else if (cmd == 'B') {
+    int value = atoi(inputBytesPtr);
+    if (value >= 0) {
+      settings.r2 = value;
+    }
+  }
+  else if (cmd == 'C') {
+    int value = atoi(inputBytesPtr);
+    if (value >= 0) {
+      settings.offset = value;
+    }
+  }
+  else if (cmd == 'D') {
+    int value = atoi(inputBytesPtr);
+    if (value >= 0) {
+      settings.sensitivity = value;
+    }
+  }
+  else if (cmd == 'S') {
+    int value = atoi(inputBytesPtr);
+    if (value >= 0) {
+      digitalWrite(RELAY_PIN, HIGH);
+    }
+    else {
+      digitalWrite(RELAY_PIN, LOW);
+    }
+  }
+  else if (cmd == 'K') {
+    strncpy(settings.apikey, inputBytes,49);
+    settings.apikey[48] = '\0';
+  }
+  else if (cmd == 'H') {
+    byte host[4];
+    char *p = strtok(inputBytes, ".");
+    for (int i = 0; i < 4; i++) {
+      host[i] = atoi(p);
+      p = strtok(NULL, ".");
+    }
+    IPAddress hostIP = IPAddress(host);
+    DBG Serial.print("New host ip address: ");
+    DBG Serial.println(hostIP);
+    settings.host=IPAddress(host);
+  }
+  else if (cmd == 'O') {
+    long value = atol(inputBytesPtr);
+    if (value > 0) {
+      DBG Serial.print("New host port: ");
+      DBG Serial.println(value);
+      settings.port = value;
+    }
+  }
+  else if (cmd == 'R') {
+    reset();
+  }
+  eeprom_write_block((const void*)&settings, (void*)0, sizeof(settings));
+}
+
+// This method accepts HTTP requests in the form GET /<cmd>/<param>/[value]
+void handleRequests() {
+  EthernetClient request = server.available();
+  if (request) {
+    DBG Serial.println("Got request: ");
+    int idx = 0;
+    while (request.connected() && request.available()) {
+      // Read char by char HTTP request
+      char c = request.read();
+      DBG Serial.print(c);
+      // Store characters to string
+      if (idx < STRING_BUFFER_SIZE) {
+        buffer[idx] = c;
+      }
+      idx++;
+      // If you've gotten to the end of the line (received a newline
+      // character) the http request has ended, so you can send a reply
+      if (c == '\n' || idx >= STRING_BUFFER_SIZE) {
+        char method [5];
+        char url [20];
+        sscanf (buffer,"%s /%s/%s/%d",method,url);
+        if (strcmp(method, "GET") == 0) {
+          char * toks;
+          toks = strtok (url,"/");
+          if (strcmp(toks, "read") == 0) {
+            toks = strtok (NULL, "/");
+            if (strcmp(toks, "datastreams") == 0) {
+              DBG Serial.println("Sending full datastream");
+              sendContent(request,getDatastreams());
+              break;
+            }
+            else if (strcmp(toks, "switch") == 0) {
+              DBG Serial.println("Sending switch status");
+              sendContent(request, digitalRead(RELAY_PIN));
+              break;
+            }
+          }
+          else if (strcmp(toks, "write") == 0) {
+            toks = strtok (NULL, "/");
+            if (strcmp(toks, "switch") == 0) {
+              toks = strtok (NULL, "/");
+              if (atoi(toks) > 0) {
+                DBG Serial.println("Setting switch status to HIGH");
+                digitalWrite(RELAY_PIN, HIGH);
+              }
+              else {
+                DBG Serial.println("Setting switch status to LOW");
+                digitalWrite(RELAY_PIN, LOW);
+              }
+              sendContent(request, digitalRead(RELAY_PIN));
+              break;
+            }
+          }
+          // send a not found response header
+          request.println(CONTENT_404);
+          request.println();
+          break;
+        }
+        request.println(CONTENT_501);
+        request.println();
+        break;
+      }
+    }
+    // give the web browser time to receive the data
+    delay(10);
+    // close the connection:
+    request.stop();
+  }
+}
+
+void sendContent(EthernetClient &request, long value) {
+  request.println(JSON_RESPONSE_BEGIN);
+  request.print(value);
+  request.print(JSON_RESPONSE_END);
+}
+
+void sendContent(EthernetClient &request, char *value) {
+  request.println(JSON_RESPONSE_BEGIN);
+  request.print(value);
+  request.print(JSON_RESPONSE_END);
+}
+
+// this method makes a HTTP connection to the server
+void sendData() {
+  // poll energino
+  char *json = getDatastreams();
+  // check if the feed has been initialized
+  if (settings.feed == 0) {
+    return;
+  }
+  // try to connect
+  DBG Serial.println("Connecting.");
+  EthernetClient client;
+  if (client.connect(settings.host, settings.port)) {
+    DBG Serial.println("connected.");
+    DBG Serial.print("PUT /v2/feeds/");
+    DBG Serial.println(settings.feed);
+    // send the HTTP PUT request.
+    client.print("PUT /v2/feeds/");
+    client.print(settings.feed);
+    client.print(" HTTP/1.1\n");
+    client.print("X-PachubeApiKey: ");
+    client.println(settings.apikey);
+    client.print("User-Agent: ");
+    client.println(MAGIC);
+    client.print("Content-Length: ");
+    client.print(strlen(json));
+    client.print("\n");
+    client.print("Content-Type: application/json\n");
+    client.print("\n");
+    // here's the actual content of the PUT request:
+    client.print(json);
+    delay(1000);
+    // if there are incoming bytes available
+    // from the server, read them and print them:
+    while (client.available()) {
+      char c = client.read();
+      DBG Serial.print(c);
+    }
+    DBG Serial.print("\n");
+    client.stop();
+  }
+  else {
+    // if you couldn't make a connection:
+    DBG Serial.println("Unable to connect.");
+  }
+}
+
+char * getDatastreams() {
+  strcpy (buffer,"{\"version\":\"1.0.0\",");
+  strcat (buffer,"\"datastreams\":[");
+  strcat (buffer,"{\"id\":\"current\",\"current_value\":");
+  strcat (buffer,dtostrf (IFinal, 5, 3, r));
+  strcat (buffer,"},");
+  strcat (buffer,"{\"id\":\"voltage\",\"current_value\":");
+  strcat (buffer,dtostrf (VFinal, 5, 3, r));
+  strcat (buffer,"},");
+  strcat (buffer,"{\"id\":\"watts\",\"current_value\":");
+  strcat (buffer,dtostrf (VFinal * IFinal, 5, 3, r));
+  strcat (buffer,"},");
+  strcat (buffer,"{\"id\":\"switch\", \"current_value\":");
+  strcat (buffer,itoa(digitalRead(RELAY_PIN),r,10));
+  strcat (buffer,"}");
+  strcat (buffer,"]}");
+  // Print data also on the serial
+  Serial.print("#");
+  Serial.print(MAGIC);
+  Serial.print(",");
+  Serial.print(REVISION);
+  Serial.print(",");
+  Serial.print(VFinal,3);
+  Serial.print(",");
+  Serial.print(IFinal,3);
+  Serial.print(",");
+  Serial.print(VFinal * IFinal,3);
+  Serial.print(",");
+  Serial.print(digitalRead(RELAY_PIN));
+  Serial.print(",");
+  Serial.print(delta);
+  Serial.print(",");
+  Serial.print(sleep);
+  Serial.print(",");
+  Serial.print(Ethernet.localIP());
+  Serial.print(",");
+  Serial.print(SERVER_PORT);
+  Serial.print(",");
+  for (byte thisByte = 0; thisByte < 4; thisByte++) {
+    // print the value of each byte of the IP address:
+    Serial.print(settings.host[thisByte], DEC);
+    if (thisByte < 3) {
+      Serial.print(".");
+    }
+  }
+  Serial.print(",");
+  Serial.print(settings.port);
+  Serial.print(",");
+  Serial.print(settings.feed);
+  Serial.print(",");
+  Serial.print(settings.apikey);
+  Serial.print("\n");
+  return buffer;
+}
+
+float scaleVoltage(float VRaw) {
+  return ( VRaw * 5 * (settings.r1 + settings.r2)) / ( settings.r2 * 1024 );
+}
+
+float scaleCurrent(float IRaw) {
+  return ( IRaw * 5 / ( 1024 ) - settings.offset) / settings.sensitivity;
+}
+
+void resetSleep(long value) {
+  sleep = value / 1000 * 5000;
+  settings.period = value;
+}
+


making a tweak to the servo controller so it works well with the python code and fixing the \n naivety

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/VisIR/RoboCode.git/'


Added diagnostic packets for example Tzbii Tzl3B

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/upperman/Wireless-Led-Display.git/'