added MazeSolver example

added MazeSolver example

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

--- ZumoExamples/examples/MazeSolver/MazeSolver.ino
+++ ZumoExamples/examples/MazeSolver/MazeSolver.ino
@@ -0,0 +1,499 @@
+#include <QTRSensors.h>
+#include <ZumoReflectanceSensorArray.h>
+#include <ZumoMotors.h>
+#include <ZumoBuzzer.h>
+#include <Pushbutton.h>
+
+/* This example uses the Zumo Reflectance Sensor Array
+ * to navigate a black line maze with no loops. This program
+ * is based off the 3pi maze solving example which can be
+ * found here:
+ *
+ * http://www.pololu.com/docs/0J21/8.a
+ *
+ * The Zumo first calibrates the sensors to account
+ * for differences of the black line on white background.
+ * Calibration is accomplished in setup().
+ *
+ * In loop(), the function solveMaze() is called and navigates
+ * the Zumo until it finds the finish line which is defined as
+ * a large black area that is thick and wide enough to
+ * cover all six sensors at the same time.
+ *
+ * Once the Zumo reaches the finishing line, it will stop and
+ * wait for the user to place the Zumo back at the starting
+ * line. The Zumo can then follow the shortest path to the finish
+ * line.
+ *
+ * The macros SPEED, TURN_SPEED, ABOVE_LINE(), and LINE_THICKNESS
+ * might need to be adjusted on a case by case basis to give better
+ * line following results.
+ */
+
+// SENSOR_THRESHOLD is a value to compare reflectance sensor
+// readings to to decide if the sensor is over a black line
+#define SENSOR_THRESHOLD 300
+
+// ABOVE_LINE is a helper macro that takes returns
+// 1 if the sensor is over the line and 0 if otherwise
+#define ABOVE_LINE(sensor)((sensor) > SENSOR_THRESHOLD)
+
+// Motor speed when turning. TURN_SPEED should always
+// have a positive value, otherwise the Zumo will turn
+// in the wrong direction.
+#define TURN_SPEED 200
+
+// Motor speed when driving straight. SPEED should always
+// have a positive value, otherwise the Zumo will travel in the
+// wrong direction.
+#define SPEED 200
+
+// Thickness of your line in inches
+#define LINE_THICKNESS .75
+
+// When the motor speed of the zumo is set by
+// motors.setSpeeds(200,200), 200 is in ZUNITs/Second.
+// A ZUNIT is a fictitious measurement of distance
+// and only helps to approximate how far the Zumo has
+// traveled. Experimentally it was observed that for
+// every inch, there were approximately 17142 ZUNITs.
+// This value will differ depending on setup/battery
+// life and may be adjusted accordingly. This value
+// was found using a 75:1 HP Motors with batteries
+// partially discharged.
+#define INCHES_TO_ZUNITS 17142.0
+
+// When the Zumo reaches the end of a segment it needs
+// to find out three things: if it has reached the finish line,
+// if there is a straight segment ahead of it, and which
+// segment to take. OVERSHOOT tells the Zumo how far it needs
+// to overshoot the segment to find out any of these things.
+#define OVERSHOOT(line_thickness)(((INCHES_TO_ZUNITS * (line_thickness)) / SPEED))
+
+ZumoBuzzer buzzer;
+ZumoReflectanceSensorArray reflectanceSensors;
+ZumoMotors motors;
+Pushbutton button(ZUMO_BUTTON);
+
+// path[] keeps a log of all the turns made
+// since starting the maze
+char path[100] = "";
+unsigned char path_length = 0; // the length of the path
+
+void setup()
+{
+
+  unsigned int sensors[6];
+  unsigned short count = 0;
+  unsigned short last_status = 0;
+  int turn_direction = 1;
+
+  buzzer.play(">g32>>c32");
+
+  reflectanceSensors.init();
+
+  delay(500);
+  pinMode(13, OUTPUT);
+  digitalWrite(13, HIGH);        // turn on LED to indicate we are in calibration mode
+
+  button.waitForButton();
+
+  // Calibrate the Zumo by sweeping it from left to right
+  for(int i = 0; i < 4; i ++)
+  {
+    // Zumo will turn clockwise if turn_direction = 1.
+    // If turn_direction = -1 Zumo will turn counter-clockwise.
+    turn_direction *= -1;
+
+    // Turn direction.
+    motors.setSpeeds(turn_direction * TURN_SPEED, -1*turn_direction * TURN_SPEED);
+
+    // This while loop monitors line position
+    // until the turn is complete.
+    while(count < 2)
+    {
+      reflectanceSensors.calibrate();
+      reflectanceSensors.readLine(sensors);
+      if(turn_direction < 0)
+      {
+        // If the right  most sensor changes from (over white space -> over
+        // line or over line -> over white space) add 1 to count.
+        count += ABOVE_LINE(sensors[5]) ^ last_status;
+        last_status = ABOVE_LINE(sensors[5]);
+      }
+      else
+      {
+        // If the left most sensor changes from (over white space -> over
+        // line or over line -> over white space) add 1 to count.
+        count += ABOVE_LINE(sensors[0]) ^ last_status;
+        last_status = ABOVE_LINE(sensors[0]);
+      }
+    }
+
+    count = 0;
+    last_status = 0;
+  }
+
+  // Turn left.
+  turn('L');
+
+  motors.setSpeeds(0, 0);
+
+  // Sound off buzzer to denote Zumo is finished calibrating
+  buzzer.play("L16 cdegreg4");
+
+  // Turn off LED to indicate we are through with calibration
+  digitalWrite(13, LOW);
+}
+
+void loop()
+{
+
+  // solveMaze() explores every segment
+  // of the maze until it finds the finish
+  // line.
+  solveMaze();
+
+  // Sound off buzzer to denote Zumo has solved the maze
+  buzzer.play(">>a32");
+
+  // The maze has been solved. When the user
+  // places the Zumo at the starting line
+  // and pushes the Zumo button, the Zumo
+  // knows where the finish line is and
+  // will automatically navigate.
+  while(1)
+  {
+    button.waitForButton();
+    goToFinishLine();
+    // Sound off buzzer to denote Zumo is at the finish line.
+    buzzer.play(">>a32");
+  }
+}
+
+// Turns according to the parameter dir, which should be
+// 'L' (left), 'R' (right), 'S' (straight), or 'B' (back).
+void turn(char dir)
+{
+
+  // count and last_status help
+  // keep track of how much further
+  // the Zumo needs to turn.
+  unsigned short count = 0;
+  unsigned short last_status = 0;
+  unsigned int sensors[6];
+
+  // dir tests for which direction to turn
+  switch(dir)
+  {
+
+  // Since we're using the sensors to coordinate turns instead of timing them,
+  // we can treat a left turn the same as a direction reversal: they differ only
+  // in whether the zumo will turn 90 degrees or 180 degrees before seeing the
+  // line under the sensor. If 'B' is passed to the turn function when there is a
+  // left turn available, then the Zumo will turn onto the left segment.
+    case 'L':
+	case 'B':
+      // Turn left.
+      motors.setSpeeds(-TURN_SPEED, TURN_SPEED);
+
+      // This while loop monitors line position
+      // until the turn is complete.
+      while(count < 2)
+      {
+        reflectanceSensors.readLine(sensors);
+
+        // Increment count whenever the state of the sensor changes
+		// (white->black and black->white) since the sensor should
+		// pass over 1 line while the robot is turning, the final
+		// count should be 2
+        count += ABOVE_LINE(sensors[1]) ^ last_status;
+        last_status = ABOVE_LINE(sensors[1]);
+      }
+
+    break;
+
+    case 'R':
+      // Turn right.
+      motors.setSpeeds(TURN_SPEED, -TURN_SPEED);
+
+      // This while loop monitors line position
+      // until the turn is complete.
+      while(count < 2)
+      {
+        reflectanceSensors.readLine(sensors);
+        count += ABOVE_LINE(sensors[4]) ^ last_status;
+        last_status = ABOVE_LINE(sensors[4]);
+      }
+
+    break;
+
+    case 'S':
+    // Don't do anything!
+    break;
+  }
+}
+
+// This function decides which way to turn during the learning phase of
+// maze solving.  It uses the variables found_left, found_straight, and
+// found_right, which indicate whether there is an exit in each of the
+// three directions, applying the "left hand on the wall" strategy.
+char selectTurn(unsigned char found_left, unsigned char found_straight,
+  unsigned char found_right)
+{
+  // Make a decision about how to turn.  The following code
+  // implements a left-hand-on-the-wall strategy, where we always
+  // turn as far to the left as possible.
+  if(found_left)
+    return 'L';
+  else if(found_straight)
+    return 'S';
+  else if(found_right)
+    return 'R';
+  else
+    return 'B';
+}
+
+// The maze is broken down into segments. Once the Zumo decides
+// which segment to turn on, it will navigate until it finds another
+// intersection. followSegment() will then return after the
+// intersection is found.
+void followSegment()
+{
+  unsigned int position;
+  unsigned int sensors[6];
+  int offset_from_center;
+  int power_difference;
+
+  while(1)
+  {
+    // Get the position of the line.
+    position = reflectanceSensors.readLine(sensors);
+
+    // The offset_from_center should be 0 when we are on the line.
+    offset_from_center = ((int)position) - 2500;
+
+    // Compute the difference between the two motor power settings,
+    // m1 - m2.  If this is a positive number the robot will turn
+    // to the left.  If it is a negative number, the robot will
+    // turn to the right, and the magnitude of the number determines
+    // the sharpness of the turn.
+    power_difference = offset_from_center / 3;
+
+    // Compute the actual motor settings.  We never set either motor
+    // to a negative value.
+    if(power_difference > SPEED)
+      power_difference = SPEED;
+    if(power_difference < -SPEED)
+      power_difference = -SPEED;
+
+    if(power_difference < 0)
+      motors.setSpeeds(SPEED + power_difference, SPEED);
+    else
+      motors.setSpeeds(SPEED, SPEED - power_difference);
+
+    // We use the inner four sensors (1, 2, 3, and 4) for
+    // determining whether there is a line straight ahead, and the
+    // sensors 0 and 5 for detecting lines going to the left and
+    // right.
+
+    if(!ABOVE_LINE(sensors[0]) && !ABOVE_LINE(sensors[1]) && !ABOVE_LINE(sensors[2]) && !ABOVE_LINE(sensors[3]) && !ABOVE_LINE(sensors[4]) && !ABOVE_LINE(sensors[5]))
+    {
+      // There is no line visible ahead, and we didn't see any
+      // intersection.  Must be a dead end.
+      return;
+    }
+    else if(ABOVE_LINE(sensors[0]) || ABOVE_LINE(sensors[5]))
+    {
+      // Found an intersection.
+      return;
+    }
+
+  }
+}
+
+// The solveMaze() function works by applying a "left hand on the wall" strategy:
+// the robot follows a segment until it reaches an intersection, where it takes the
+// leftmost fork available to it. It records each turn it makes, and as long as the
+// maze has no loops, this strategy will eventually lead it to the finish. Afterwards,
+// the recorded path is simplified by removing dead ends. More information can be
+// found in the 3pi maze solving example.
+void solveMaze()
+{
+    while(1)
+    {
+        // Navigate current line segment
+        followSegment();
+
+        // These variables record whether the robot has seen a line to the
+        // left, straight ahead, and right, while examining the current
+        // intersection.
+        unsigned char found_left = 0;
+        unsigned char found_straight = 0;
+        unsigned char found_right = 0;
+
+        // Now read the sensors and check the intersection type.
+        unsigned int sensors[6];
+        reflectanceSensors.readLine(sensors);
+
+        // Check for left and right exits.
+        if(ABOVE_LINE(sensors[0]))
+            found_left = 1;
+        if(ABOVE_LINE(sensors[5]))
+            found_right = 1;
+
+        // Drive straight a bit more, until we are
+        // approximately in the middle of intersection.
+        // This should help us better detect if we
+        // have left or right segments.
+        motors.setSpeeds(SPEED, SPEED);
+        delay(OVERSHOOT(LINE_THICKNESS)/2);
+
+        reflectanceSensors.readLine(sensors);
+
+        // Check for left and right exits.
+        if(ABOVE_LINE(sensors[0]))
+            found_left = 1;
+        if(ABOVE_LINE(sensors[5]))
+            found_right = 1;
+
+        // After driving a little further, we
+        // should have passed the intersection
+        // and can check to see if we've hit the
+        // finish line or if there is a straight segment
+        // ahead.
+        delay(OVERSHOOT(LINE_THICKNESS)/2);
+
+        // Check for a straight exit.
+        reflectanceSensors.readLine(sensors);
+
+        // Check again to see if left or right segment has been found
+        if(ABOVE_LINE(sensors[0]))
+            found_left = 1;
+        if(ABOVE_LINE(sensors[5]))
+            found_right = 1;
+
+        if(ABOVE_LINE(sensors[1]) || ABOVE_LINE(sensors[2]) || ABOVE_LINE(sensors[3]) || ABOVE_LINE(sensors[4]))
+            found_straight = 1;
+
+        // Check for the ending spot.
+        // If all four middle sensors are on dark black, we have
+        // solved the maze.
+        if(ABOVE_LINE(sensors[1]) && ABOVE_LINE(sensors[2]) && ABOVE_LINE(sensors[3]) && ABOVE_LINE(sensors[4]))
+        {
+          motors.setSpeeds(0,0);
+          break;
+        }
+
+        // Intersection identification is complete.
+        unsigned char dir = selectTurn(found_left, found_straight, found_right);
+
+        // Make the turn indicated by the path.
+		turn(dir);
+
+        // Store the intersection in the path variable.
+        path[path_length] = dir;
+        path_length++;
+
+        // You should check to make sure that the path_length does not
+        // exceed the bounds of the array.  We'll ignore that in this
+        // example.
+
+        // Simplify the learned path.
+        simplifyPath();
+
+    }
+}
+
+// Now enter an infinite loop - we can re-run the maze as many
+// times as we want to.
+void goToFinishLine()
+{
+  unsigned int sensors[6];
+  int i = 0;
+
+  // Turn around if the Zumo is facing the wrong direction.
+  if(path[0] == 'B')
+  {
+    turn('B');
+    i++;
+  }
+
+  for(;i<path_length;i++)
+  {
+
+    followSegment();
+
+    // Drive through the intersection.
+    motors.setSpeeds(SPEED, SPEED);
+    delay(OVERSHOOT(LINE_THICKNESS));
+
+    // Make a turn according to the instruction stored in
+    // path[i].
+    turn(path[i]);
+  }
+
+  // Follow the last segment up to the finish.
+  followSegment();
+
+  // The finish line has been reached.
+  // Return and wait for another button push to
+  // restart the maze.
+  reflectanceSensors.readLine(sensors);
+  motors.setSpeeds(0,0);
+
+  return;
+}
+
+
+// simplifyPath analyzes the path[] array and reduces all the
+// turns. For example: Right turn + Right turn = (1) Back turn.
+void simplifyPath()
+{
+
+  // only simplify the path if the second-to-last turn was a 'B'
+  if(path_length < 3 || path[path_length - 2] != 'B')
+  return;
+
+  int total_angle = 0;
+  int i;
+
+  for(i = 1; i <= 3; i++)
+  {
+    switch(path[path_length - i])
+    {
+      case 'R':
+        total_angle += 90;
+        break;
+      case 'L':
+        total_angle += 270;
+        break;
+      case 'B':
+        total_angle += 180;
+        break;
+    }
+  }
+
+  // Get the angle as a number between 0 and 360 degrees.
+  total_angle = total_angle % 360;
+
+  // Replace all of those turns with a single one.
+  switch(total_angle)
+  {
+    case 0:
+      path[path_length - 3] = 'S';
+      break;
+    case 90:
+      path[path_length - 3] = 'R';
+      break;
+    case 180:
+      path[path_length - 3] = 'B';
+      break;
+    case 270:
+      path[path_length - 3] = 'L';
+      break;
+  }
+
+  // The path is now two steps shorter.
+  path_length -= 2;
+}


Added tx_test_4.

Added tx_test_4.

It works!

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

--- arduino/test/tx_test_4/tx_test_4.ino
+++ arduino/test/tx_test_4/tx_test_4.ino
@@ -0,0 +1,51 @@
+// One Arduino controling one transmitters, simulates four transmitters
+
+#define TX_PORT PORTD
+
+enum {
+  TX_PIN_1 = 2,
+  TX_PIN_2 = 3,
+  TX_PIN_1_MASK = 1u << (TX_PIN_1 % 8u),
+  TX_PIN_2_MASK = 1u << (TX_PIN_2 % 8u),
+  FREQ = 25000u,  // Hz
+  PERIOD = 1000000u / FREQ,  // μs
+  HALF_PERIOD = PERIOD / 2u,  // μs
+  NUM_TRANSMITTERS = 4u,
+  DURATION = 5000u,  // μs
+};
+
+unsigned const long SPACINGS[NUM_TRANSMITTERS] =
+    {117766u, 95420u, 77814u, 709001u};
+
+void setup() {
+  pinMode(TX_PIN_1, OUTPUT);
+  pinMode(TX_PIN_2, OUTPUT);
+}
+
+void loop() {
+  static unsigned i = 0;
+  unsigned long beginning = micros();
+
+  // Send out ping from transmitter
+  unsigned long time = micros() - beginning;
+  unsigned long next = time;
+  while (time < DURATION) {
+    // Turn off TX_PIN_2 and turn on TX_PIN_1
+    TX_PORT = TX_PORT & (~TX_PIN_2_MASK) | TX_PIN_1_MASK;
+    next += HALF_PERIOD;
+    while (micros() - beginning < next)
+      ;
+
+    // Turn off TX_PIN_1 and turn on TX_PIN_2
+    TX_PORT = TX_PORT & (~TX_PIN_1_MASK) | TX_PIN_2_MASK;
+    next += HALF_PERIOD;
+    while ((time = micros() - beginning) < next)
+      ;
+  }
+
+  // wait until time for next ping
+  unsigned long spacing = SPACINGS[i];
+  i = (i + 1) % NUM_TRANSMITTERS;
+  while (micros() - beginning < spacing)
+    ;
+}


Added RC522 reader Modbus device

Added RC522 reader Modbus device

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

--- sketches/RFIDReaderModbus/RFIDReaderModbus.ino
+++ sketches/RFIDReaderModbus/RFIDReaderModbus.ino
@@ -0,0 +1,82 @@
+#include <SPI.h>
+#include <MFRC522.h>
+#include <ModbusRtu.h>
+#define ID   3
+Modbus slave(ID, 0, 10);
+
+#define num_readers 3
+
+
+MFRC522 *readers[num_readers];
+
+//Array with configs for each reader.
+//Structure: {RST_PIN, SS_PIN, MODBUS_REG }
+int reader_settings[num_readers][3] = {{9, 10, 3},
+                                       {2, 3, 4},
+                                       {4, 5, 5}};
+
+//Modbus register array.
+uint16_t au16data[9] =
+{0, //Left untouched
+0, //Left untouched
+0, //Reader diagnostics
+0, //First reader
+0, //Second reader
+0, //Third reader
+0, //Diagnostics - packets sent
+0, //Diagnostics - packets received
+0};//Diagnostics - error count
+
+
+void setup() {		// Initialize serial communications with the PC
+  SPI.begin();			// Init SPI bus
+	setup_readers();
+  slave.begin(115200);
+}
+
+void setup_readers()
+{
+  for(int x = 0; x < num_readers; x++)
+  {                            //{RST_PIN, SS_PIN, MODBUS_REG }
+    //Creating a reader instance
+    readers[x] = new MFRC522(reader_settings[x][1], reader_settings[x][0]);
+
+    //Init the reader
+    readers[x] -> PCD_Init();
+
+    //Test the reader
+    byte reader_version;
+    reader_version = readers[x] -> PCD_ReadRegister(readers[x] -> VersionReg);
+    if ((reader_version == 0x00) || (reader_version == 0xFF)) { bitWrite(au16data[2], x, 1); } //Incorrect version - probably hardware fault, put that in the register
+  }
+}
+
+void record_uid(MFRC522::Uid *uid, int reader_num) {au16data[reader_settings[reader_num][2]] = (uint16_t) uid;} //Recording uid to its register in au16_data
+
+void reset_uid(int reader_num) { au16data[reader_settings[reader_num][2]] = 0;} //Resetting the UID since no card is found on the reader
+
+void loop() {
+  slave.poll( au16data, 9 );
+  au16data[0] = 0;
+  au16data[1] = 0;
+  for(int x = 0; x < num_readers; x++)
+  {
+    readers[x] -> PICC_ReadCardSerial(); //Seems like we need two Select's in a row to detect card's presence.
+    readers[x] -> PICC_IsNewCardPresent();
+    if (! readers[x] -> PICC_ReadCardSerial()) //See, this does the same PICC_Select, but this one fails if there is no card on the reader, while the first doesn't. Funny.
+    {
+      //Card not present
+      reset_uid(x);
+    }
+    else
+    {
+      //Card present
+      record_uid(&(readers[x] -> uid), x);
+    }
+  }
+  au16data[6] = slave.getInCnt();
+  au16data[7] = slave.getOutCnt();
+  au16data[8] = slave.getErrCnt();
+}
+
+


- initial physical web example

- initial physical web example

http://google.github.io/physical-web/

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

--- examples/physical_web_beacon/physical_web_beacon.ino
+++ examples/physical_web_beacon/physical_web_beacon.ino
@@ -0,0 +1,74 @@
+// Import libraries (BLEPeripheral depends on SPI)
+#include <SPI.h>
+#include <BLEPeripheral.h>
+
+// define pins (varies per shield/board)
+#define BLE_REQ   10
+#define BLE_RDY   2
+#define BLE_RST   9
+
+// create peripheral instance, see pinouts above
+BLEPeripheral blePeripheral = BLEPeripheral(BLE_REQ, BLE_RDY, BLE_RST);
+
+// create service
+BLEService physicalWebService = BLEService("fed8");
+
+// create characteristic
+BLECCharacteristic physicalWebCharacterisitc = BLECharCharacteristic("fed9", BLERead | BLEBroadcast, 15);
+
+void setup() {
+  Serial.begin(9600);
+#if defined (__AVR_ATmega32U4__)
+  //Wait until the serial port is available (useful only for the Leonardo)
+  //As the Leonardo board is not reseted every time you open the Serial Monitor
+  while(!Serial) {}
+  delay(5000);  //5 seconds delay for enabling to see the start up comments on the serial board
+#endif
+
+  blePeripheral.setLocalName("physical-web");
+  blePeripheral.setAdvertisedServiceUuid(service.uuid());
+
+  // add attributes to peripheral
+  blePeripheral.addAttribute(physicalWebService);
+  blePeripheral.addAttribute(characteristic);
+
+  // set value
+  unsigned char physicalWebData[15]; // only 15 bytes (instead of 18), because flags (3 bytes) are in advertisement data
+  unsigned char i = 0;
+
+  physicalWebData[i++] = 0x00; // flags
+  physicalWebData[i++] = 0x20; // power
+  physicalWebData[i++] = 0x00; // http://www.
+
+  physicalWebData[i++] = 'A';
+  physicalWebData[i++] = 'B';
+  physicalWebData[i++] = 'C';
+
+  physicalWebData[i++] = 0x07; // .com
+
+  physicalWebCharacterisitc.setValue(physicalWebData, i);
+
+  // begin initialization
+  blePeripheral.begin();
+
+  // broadcast the characteristic
+  physicalWebCharacterisitc.broadcast();
+}
+
+void loop() {
+  BLECentral central = blePeripheral.central();
+
+  if (central) {
+    // central connected to peripheral
+    Serial.print(F("Connected to central: "));
+    Serial.println(central.address());
+
+    while (central.connected()) {
+      central.disconnect(); // disconnect central ASAP
+    }
+
+    // central disconnected
+    Serial.print(F("Disconnected from central: "));
+    Serial.println(central.address());
+  }
+}


Added HMTL Module RS485 Receive test

Added HMTL Module RS485 Receive test

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

--- HMTL_Modules/HMTL_Recv_Test/HMTL_Recv_Test.ino
+++ HMTL_Modules/HMTL_Recv_Test/HMTL_Recv_Test.ino
@@ -0,0 +1,85 @@
+/*
+ * Basic RS485 socket receive test, triggers LEDs on receive
+ */
+#include "EEPROM.h"
+#include <RS485_non_blocking.h>
+#include <SoftwareSerial.h>
+#include "SPI.h"
+#include "Adafruit_WS2801.h"
+#include "Wire.h"
+
+#define DEBUG_LEVEL DEBUG_HIGH
+#include "Debug.h"
+
+#include "GeneralUtils.h"
+#include "EEPromUtils.h"
+#include "HMTLTypes.h"
+#include "PixelUtil.h"
+#include "RS485Utils.h"
+#include "MPR121.h"
+
+#define PIN_RS485_1  2 // 4 on board v2
+#define PIN_RS485_2  7
+#define PIN_RS485_3  4 // 5 on board v2
+
+#define RED_LED      9 // 10 on board v2
+#define GREEN_LED   10 // 11 on board v2
+#define BLUE_LED    11 // 13 on board v2
+
+#define RCV_LED     13
+
+#define MY_ADDR   0x01 // Socket receive address
+
+
+RS485Socket rs485(PIN_RS485_1, PIN_RS485_2, PIN_RS485_3, (DEBUG_LEVEL != 0));
+
+void setup() {
+  Serial.begin(9600);
+
+  pinMode(RED_LED, OUTPUT);
+  pinMode(GREEN_LED, OUTPUT);
+  pinMode(BLUE_LED, OUTPUT);
+  pinMode(RCV_LED, OUTPUT);
+
+  /* Setup the RS485 connection */
+  rs485.setup();
+
+  DEBUG_PRINTLN(DEBUG_LOW, "RS485 socket initialized");
+}
+
+void loop() {
+  unsigned int msglen;
+
+  const byte *data = rs485.getMsg(MY_ADDR, &msglen);
+  if (data != NULL) {
+    int value = (data[0] << 8) || data[1];
+    DEBUG_VALUELN(0, "value=", value);
+    digitalWrite(RCV_LED, HIGH);
+    if (value == 0) {
+      digitalWrite(RED_LED, LOW);
+      digitalWrite(GREEN_LED, LOW);
+      digitalWrite(BLUE_LED, LOW);
+    } else {
+      switch (value % 3) {
+      case 0:
+	digitalWrite(RED_LED, HIGH);
+	digitalWrite(GREEN_LED, LOW);
+	digitalWrite(BLUE_LED, LOW);
+	break;
+      case 1:
+	digitalWrite(RED_LED, LOW);
+	digitalWrite(GREEN_LED, HIGH);
+	digitalWrite(BLUE_LED, LOW);
+	break;
+      case 2:
+	digitalWrite(RED_LED, LOW);
+	digitalWrite(GREEN_LED, LOW);
+	digitalWrite(BLUE_LED, HIGH);
+	break;
+      }
+    }
+  } else {
+    delay(20);
+    digitalWrite(RCV_LED, LOW);
+  }
+}


Added unified sensor sketch

Added unified sensor sketch

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

--- DHT_Unified_Sensor_dcg/DHT_Unified_Sensor_dcg.ino
+++ DHT_Unified_Sensor_dcg/DHT_Unified_Sensor_dcg.ino
@@ -0,0 +1,84 @@
+// DHT Temperature & Humidity Sensor
+// Unified Sensor Library Example
+// Written by Tony DiCola for Adafruit Industries
+// Released under an MIT license.
+
+// Depends on the following Arduino libraries:
+// - Adafruit Unified Sensor Library: https://github.com/adafruit/Adafruit_Sensor
+// - DHT Sensor Library: https://github.com/adafruit/DHT-sensor-library
+
+#include <Adafruit_Sensor.h>
+#include <DHT.h>
+#include <DHT_U.h>
+
+#define DHTPIN            13         // Pin which is connected to the DHT sensor.
+
+// Uncomment the type of sensor in use:
+#define DHTTYPE           DHT11     // DHT 11
+//#define DHTTYPE           DHT22     // DHT 22 (AM2302)
+//#define DHTTYPE           DHT21     // DHT 21 (AM2301)
+
+// See guide for details on sensor wiring and usage:
+//   https://learn.adafruit.com/dht/overview
+
+DHT_Unified dht(DHTPIN, DHTTYPE);
+
+uint32_t delayMS;
+
+void setup() {
+  Serial.begin(9600);
+  // Initialize device.
+  dht.begin();
+  Serial.println("DHTxx Unified Sensor Example");
+  // Print temperature sensor details.
+  sensor_t sensor;
+  dht.temperature().getSensor(&sensor);
+  Serial.println("------------------------------------");
+  Serial.println("Temperature");
+  Serial.print  ("Sensor:       "); Serial.println(sensor.name);
+  Serial.print  ("Driver Ver:   "); Serial.println(sensor.version);
+  Serial.print  ("Unique ID:    "); Serial.println(sensor.sensor_id);
+  Serial.print  ("Max Value:    "); Serial.print(sensor.max_value); Serial.println(" *C");
+  Serial.print  ("Min Value:    "); Serial.print(sensor.min_value); Serial.println(" *C");
+  Serial.print  ("Resolution:   "); Serial.print(sensor.resolution); Serial.println(" *C");
+  Serial.println("------------------------------------");
+  // Print humidity sensor details.
+  dht.humidity().getSensor(&sensor);
+  Serial.println("------------------------------------");
+  Serial.println("Humidity");
+  Serial.print  ("Sensor:       "); Serial.println(sensor.name);
+  Serial.print  ("Driver Ver:   "); Serial.println(sensor.version);
+  Serial.print  ("Unique ID:    "); Serial.println(sensor.sensor_id);
+  Serial.print  ("Max Value:    "); Serial.print(sensor.max_value); Serial.println("%");
+  Serial.print  ("Min Value:    "); Serial.print(sensor.min_value); Serial.println("%");
+  Serial.print  ("Resolution:   "); Serial.print(sensor.resolution); Serial.println("%");
+  Serial.println("------------------------------------");
+  // Set delay between sensor readings based on sensor details.
+  delayMS = sensor.min_delay / 1000;
+}
+
+void loop() {
+  // Delay between measurements.
+  delay(delayMS);
+  // Get temperature event and print its value.
+  sensors_event_t event;
+  dht.temperature().getEvent(&event);
+  if (isnan(event.temperature)) {
+    Serial.println("Error reading temperature!");
+  }
+  else {
+    Serial.print("Temperature: ");
+    Serial.print(event.temperature);
+    Serial.println(" *C");
+  }
+  // Get humidity event and print its value.
+  dht.humidity().getEvent(&event);
+  if (isnan(event.relative_humidity)) {
+    Serial.println("Error reading humidity!");
+  }
+  else {
+    Serial.print("Humidity: ");
+    Serial.print(event.relative_humidity);
+    Serial.println("%");
+  }
+}


adds week 5 file

adds week 5 file

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

--- week5/TemperatureSwitch/TemperatureSwitch.ino
+++ week5/TemperatureSwitch/TemperatureSwitch.ino
@@ -0,0 +1,48 @@
+#define aref_voltage 3.3
+
+//TMP36 Pin Variables
+int tempPin = 1;
+int tempRead;
+
+int hotLed = 13;
+int coolLed = 5;
+
+void setup(void) {
+  // We'll send debugging information via the Serial monitor
+  Serial.begin(9600);
+
+  pinMode(hotLed, OUTPUT);
+  pinMode (coolLed, OUTPUT);
+}
+
+
+void loop(void) {
+
+  tempRead = analogRead(tempPin);
+
+  float voltage = tempRead * aref_voltage;
+  voltage /= 1024.0;
+
+  float temperatureC = (voltage - 0.5) * 100 ;
+
+  float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
+  Serial.print(temperatureF); Serial.println(" degrees F");
+
+  if(temperatureF < 117){
+    digitalWrite(coolLed, HIGH);
+    digitalWrite(hotLed, LOW);
+    Serial.print("cool temp is: ");
+    } else{
+    digitalWrite(hotLed, HIGH);
+    digitalWrite(coolLed, LOW);
+    Serial.print("hot temp is: ");
+  }
+
+  delay(1000);
+
+}
+
+/* link to video is:https://vimeo.com/185075359 */
+
+/* http://www.ladyada.net/make/logshield/lighttemp.html */
+


janky motor shield

janky motor shield

error: pathspec 'Shields/Motor_Shield/MotorShield_Arduino/MotorShield_Arduino_Janky.ino' did not match any file(s) known to git

--- Shields/Motor_Shield/MotorShield_Arduino/MotorShield_Arduino_Janky.ino
+++ Shields/Motor_Shield/MotorShield_Arduino/MotorShield_Arduino_Janky.ino
@@ -0,0 +1,202 @@
+const int encoderRightData1 = 3;
+const int encoderRightData2 = 5;
+const int encoderLeftData1 = 2;
+const int encoderLeftData2 = 4;
+// left
+const int rightDir = 7;
+const int rightSpeed = 6;
+const int rightDisable = 8;
+
+// right
+const int leftDir = 9;
+const int leftSpeed = 10;
+const int leftDisable = 11;
+
+volatile int tickDataRight = 0;
+volatile int tickDataLeft = 0;
+
+const float ticksPerRev = 6000.0;
+const float wheelCir = 1.092; // Meters
+const float metersPerTick = wheelCir / ticksPerRev;
+const float DEADBAND = 2;
+
+float desiredSpeedR = 0; // m/s
+float desiredSpeedL = 0; // m/s
+float actualSpeedR;
+float actualSpeedL;
+
+float lastErrorL;
+float lastErrorR;
+
+float P = 20;
+float D = 10;
+
+int PWM_L = 0;
+int PWM_R = 0;
+
+long lastLoopTime;
+float dT_sec;
+
+// Serial comm vars
+#define uchar unsigned char
+uchar cmd[4] = {
+  0,0,0,0};
+int numBytesIn = 0;
+boolean cmdHasStarted = false;
+long lastCmdTime;
+
+/* TODO
+ * 1 - fix deadband (maybe bigger?)
+ * 2 - push command speed
+ * 3 - fix timeout
+ */
+
+
+void setup()
+{
+  Serial.begin(9600);
+
+  pinMode(encoderRightData1, INPUT);
+  pinMode(encoderRightData2, INPUT);
+  pinMode(encoderLeftData1,  INPUT);
+  pinMode(encoderLeftData2,  INPUT);
+
+  digitalWrite(encoderRightData1, HIGH);
+  digitalWrite(encoderRightData2, HIGH);
+  digitalWrite(encoderLeftData1,  HIGH);
+  digitalWrite(encoderLeftData2,  HIGH);
+
+  pinMode(rightDir, OUTPUT);
+  pinMode(rightSpeed, OUTPUT);
+  pinMode(rightDisable, OUTPUT);
+  pinMode(leftDir, OUTPUT);
+  pinMode(leftSpeed, OUTPUT);
+  pinMode(leftDisable, OUTPUT);
+  attachInterrupt(1, tickRight, CHANGE);
+  attachInterrupt(0, tickLeft, CHANGE);
+
+  delay(1000);
+
+  lastCmdTime = millis();
+  lastLoopTime = millis();
+  dT_sec = millis();
+
+  Serial.println();
+  Serial.flush();
+  Serial.println("Ready");
+}
+
+boolean gotCommand = false;
+
+void loop()
+{
+  gotCommand = false;
+  while(Serial.available())
+  {
+    if(Serial.read() == '$')
+    {
+      desiredSpeedL = -1*Serial.parseFloat();
+      desiredSpeedR = -1*Serial.parseFloat();
+      lastCmdTime = millis();
+      gotCommand = true;
+    }
+  }
+  if(gotCommand)
+  {
+    Serial.print('$');
+    Serial.print(actualSpeedL);
+    Serial.print(',');
+    Serial.print(actualSpeedR);
+    Serial.print(',');
+    Serial.print(dT_sec);
+    Serial.print('\n');
+  }
+  //Serial.println(tickDataLeft);
+  if( millis() - lastCmdTime > 500)
+  {
+    Serial.println("TIMEOUT");
+    desiredSpeedL = 0;
+    desiredSpeedR = 0;
+    PWM_L = 0;
+    PWM_R = 0;
+  }
+
+  dT_sec = (float)( millis() - lastLoopTime ) / 1000.0;
+  lastLoopTime = millis();
+  actualSpeedL = ( metersPerTick * tickDataLeft ) / dT_sec;
+  actualSpeedR = ( metersPerTick * tickDataRight ) / dT_sec;
+
+  tickDataLeft = 0;
+  tickDataRight = 0;
+
+  //Serial.print(tickDataLeft);
+  //Serial.print('\t');
+  //Serial.println(tickDataRight);
+
+  delay(50);
+
+  float ErrorL = desiredSpeedL - actualSpeedL;
+  float ErrorR = desiredSpeedR - actualSpeedR;
+
+  float dErrorL = ErrorL - lastErrorL;
+  float dErrorR = ErrorR - lastErrorR;
+
+  int dPWM_L = (int)( P * ErrorL + D * dErrorL );
+  int dPWM_R = (int)( P * ErrorR + D * dErrorR );
+
+  PWM_L += dPWM_L;
+  PWM_R += dPWM_R;
+
+  PWM_L = min(255, max(-255, PWM_L) );
+  PWM_R = min(255, max(-255, PWM_R) );
+
+  // Deadband
+  if( abs(PWM_L) < DEADBAND )
+    PWM_L = 0;
+  if( abs(PWM_R) < DEADBAND )
+    PWM_R = 0;
+
+  int dirL = PWM_L < 0;
+  int dirR = PWM_R > 0;
+
+  int powerL = dirL ? 255 + PWM_L : PWM_L;
+  int powerR = dirR ? 255 - PWM_R : -PWM_R;
+
+  if(desiredSpeedL == 0)
+    PWM_L = 0;
+  if(desiredSpeedR == 0)
+    PWM_R = 0;
+
+  digitalWrite(rightDir, HIGH);
+  digitalWrite(leftDir, HIGH);
+  analogWrite(rightSpeed, powerR);
+  analogWrite(leftSpeed, powerL);
+
+  lastErrorL = ErrorL;
+  lastErrorR = ErrorR;
+}
+
+void tickRight()
+{
+  if (digitalRead(encoderRightData1) == digitalRead(encoderRightData2))
+  {
+    tickDataRight++;
+  }
+  else
+  {
+    tickDataRight--;
+  }
+}
+
+void tickLeft()
+{
+  if (digitalRead(encoderLeftData1) == digitalRead(encoderLeftData2))
+  {
+    tickDataLeft++;
+  }
+  else
+  {
+    tickDataLeft--;
+  }
+}
+


initial commit of android-arduino USB test code

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

--- arduinoTest/USB_to_Android/USB_to_Android.ino
+++ arduinoTest/USB_to_Android/USB_to_Android.ino
@@ -0,0 +1,61 @@
+//Zachary Nelson
+//znelson1@ford.com
+//This program uses a 74hc595 shift register and a
+//7-sement display to display the numbers 0 - 9. It
+//is used to test future implementations of the
+//display control.
+
+//Pin connected to ST_CP of 74HC595
+int latchPin = 8;
+//Pin connected to SH_CP of 74HC595
+int clockPin = 12;
+////Pin connected to DS of 74HC595
+int dataPin = 11;
+
+String inputString = "";
+boolean stringComplete = false;
+int i = 0;
+
+void setup() {
+  //set pins to output so you can control the shift register
+  pinMode(latchPin, OUTPUT);
+  pinMode(clockPin, OUTPUT);
+  pinMode(dataPin, OUTPUT);
+
+  Serial.begin(115200);
+}
+
+void loop() {
+  if (stringComplete) {
+    // do something...
+    sendDigit(i);
+    i+=1;
+    inputString = "";
+    stringComplete = false;
+  }
+}
+
+void sendDigit(int x){
+  // take the latchPin low so
+  // the LEDs don't change while you're sending in bits:
+  digitalWrite(latchPin, LOW);
+  // shift out the bits:
+  shiftOut(dataPin, clockPin, LSBFIRST, x);
+
+  //take the latch pin high so the LEDs will light up:
+  digitalWrite(latchPin, HIGH);
+}
+
+void serialEvent() {
+
+  while (Serial.available()) {
+    char inChar = (char)Serial.read();
+    inputString += inChar;
+    if (inChar == 'E') {
+      stringComplete = true;
+    }
+  }
+}
+
+
+


Create DigoleSerialDisp_GeoDemo.ino

Create DigoleSerialDisp_GeoDemo.ino

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


Added MIDI examples

Added MIDI examples

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

--- libraries/CurieBLE/examples/MIDIBLE/MIDIBLE.ino
+++ libraries/CurieBLE/examples/MIDIBLE/MIDIBLE.ino
@@ -0,0 +1,158 @@
+/* Written by Oren Levy (auxren.com; @auxren) while competing on
+   America's Greatest Makers with help from Intel.
+   MIDI over BLE info from: https://developer.apple.com/bluetooth/Apple-Bluetooth-Low-Energy-MIDI-Specification.pdf
+
+  This sketch plays a random MIDI note (between 0 and 127) every 400ms.
+  For a 'smarter' sketch, check out my Airpeggiator example.
+  The Airpeggiator uses the Curie's IMU to allow you to play
+  an imaginary harp in the air. I included a quantizer so you can
+  select a key and scale so you can jam along with friends.
+  https://github.com/auxren/MIDIBLE101/tree/master/Airpeggiator
+
+  I have only tested MIDI over BLE using Apple devices. Android doesn't
+  support native MIDI over BLE yet and I haven't had much of a chance
+  to test with Windows machines.
+
+  To connect on a Mac, search for Audio MIDI Setup.
+  Click 'Window' on the top menu and choose 'Show MIDI Studio'.
+  Double click 'Bluetooth' and the bluetooth configuration window
+  will pop up. After loading the MIDIBLE sketch on your Arduino 101
+  you should see it advertising as Auxren. Click connect and the device
+  will be available as MIDI device in all your audio software like Garageband.
+
+  There are a few ways to connect using an iOS device. One way to to open
+  up Garageband. Click on the wrench icon in the upper right and choose 'Advanced'
+  Towards the bottom of advanced, you will see 'Bluetooth MIDI devices'.
+  You should see your Arduino 101 advertising in the list. Connect to
+  your device and it should be available to all other iOS MIDI apps you have.
+
+  To send data, you use the following line: char.setValue(d, n); where char is
+  the BLE characteristic (in our case, midiCha), d is the data, and n is the
+  number of bytes of data.
+  The first 2 bytes of data are the header byte and timestamp byte. If you want,
+  you can figure out the timestamping scheme, but I just left it with a generic value
+  since I haven't worked on anything timeing sensitive yet (like a sequencer).
+  The third, fourth, and fifth bytes are standard MIDI bytes. You can send more bytes
+  if you would like as long as it is complies to the standard MIDI spec.
+
+  The MIT License (MIT)
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy
+  of this software and associated documentation files (the "Software"), to deal
+  in the Software without restriction, including without limitation the rights
+  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+  copies of the Software, and to permit persons to whom the Software is
+  furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in all
+  copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+  SOFTWARE.
+
+*/
+#include <CurieBLE.h>
+
+#define TXRX_BUF_LEN              20 //max number of bytes
+#define RX_BUF_LEN                20 //max number of bytes
+uint8_t rx_buf[RX_BUF_LEN];
+int rx_buf_num, rx_state = 0;
+uint8_t rx_temp_buf[20];
+uint8_t outBufMidi[128];
+
+//Buffer to hold 5 bytes of MIDI data. Note the timestamp is forced
+uint8_t midiData[] = {0x80, 0x80, 0x00, 0x00, 0x00};
+
+//Loads up buffer with values for note On
+void noteOn(char chan, char note, char vel) //channel 1
+{
+  midiData[2] = 0x90 + chan;
+  midiData[3] = note;
+  midiData[4] = vel;
+}
+
+//Loads up buffer with values for note Off
+void noteOff(char chan, char note) //channel 1
+{
+  midiData[2] = 0x80 + chan;
+  midiData[3] = note;
+  midiData[4] = 0;
+}
+
+BLEPeripheral midiDevice; // create peripheral instance
+
+BLEService midiSvc("03B80E5A-EDE8-4B33-A751-6CE34EC4C700"); // create service
+
+// create switch characteristic and allow remote device to read and write
+BLECharacteristic midiChar("7772E5DB-3868-4112-A1A9-F2669D106BF3", BLEWrite | BLEWriteWithoutResponse | BLENotify | BLERead, 5);
+
+void setup() {
+  Serial.begin(9600);
+
+  BLESetup();
+  Serial.println(("Bluetooth device active, waiting for connections..."));
+}
+
+void BLESetup()
+{
+  // set the local name peripheral advertises
+  midiDevice.setLocalName("Auxren");
+  midiDevice.setDeviceName("Auxren");
+
+  // set the UUID for the service this peripheral advertises
+  midiDevice.setAdvertisedServiceUuid(midiSvc.uuid());
+
+  // add service and characteristic
+  midiDevice.addAttribute(midiSvc);
+  midiDevice.addAttribute(midiChar);
+
+  // assign event handlers for connected, disconnected to peripheral
+  midiDevice.setEventHandler(BLEConnected, midiDeviceConnectHandler);
+  midiDevice.setEventHandler(BLEDisconnected, midiDeviceDisconnectHandler);
+
+  // assign event handlers for characteristic
+  midiChar.setEventHandler(BLEWritten, midiCharacteristicWritten);
+  // set an initial value for the characteristic
+  midiChar.setValue(midiData, 5);
+
+  // advertise the service
+  midiDevice.begin();
+}
+
+void loop() {
+
+  /*Simple randome note player to test MIDI output
+     Plays random note every 400ms
+  */
+  int note = random(0, 127);
+  //readMIDI();
+  noteOn(0, note, 127); //loads up midiData buffer
+  midiChar.setValue(midiData, 5);//midiData); //posts 5 bytes
+  delay(200);
+  noteOff(0, note);
+  midiChar.setValue(midiData, 5);//midiData); //posts 5 bytes
+  delay(200);
+}
+
+
+void midiDeviceConnectHandler(BLECentral& central) {
+  // central connected event handler
+  Serial.print("Connected event, central: ");
+  Serial.println(central.address());
+}
+
+void midiDeviceDisconnectHandler(BLECentral& central) {
+  // central disconnected event handler
+  Serial.print("Disconnected event, central: ");
+  Serial.println(central.address());
+}
+
+void midiCharacteristicWritten(BLECentral& central, BLECharacteristic& characteristic) {
+  // central wrote new value to characteristic, update LED
+  Serial.print("Characteristic event, written: ");
+}


Create ADXL362_SimpleRead.ino

Create ADXL362_SimpleRead.ino

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

--- firmware/examples/ADXL362_SimpleRead/ADXL362_SimpleRead.ino
+++ firmware/examples/ADXL362_SimpleRead/ADXL362_SimpleRead.ino
@@ -0,0 +1,53 @@
+/*
+ ADXL362_SimpleRead.ino -  Simple XYZ axis reading example
+ for Analog Devices ADXL362 - Micropower 3-axis accelerometer
+ go to http://www.analog.com/ADXL362 for datasheet
+
+
+ License: CC BY-SA 3.0: Creative Commons Share-alike 3.0. Feel free
+ to use and abuse this code however you'd like. If you find it useful
+ please attribute, and SHARE-ALIKE!
+
+ Created June 2012
+ by Anne Mahaffey - hosted on http://annem.github.com/ADXL362
+
+ Modified May 2013
+ by Jonathan Ruiz de Garibay
+
+Connect SCLK, MISO, MOSI, and CSB of ADXL362 to
+SCLK, MISO, MOSI, and DP 10 of Arduino
+(check http://arduino.cc/en/Reference/SPI for details)
+
+*/
+
+#include <SPI.h>
+#include <ADXL362.h>
+
+ADXL362 xl;
+
+int16_t temp;
+int16_t XValue, YValue, ZValue, Temperature;
+
+void setup(){
+
+  Serial.begin(9600);
+  xl.begin(10);                   // Setup SPI protocol, issue device soft reset
+  xl.beginMeasure();              // Switch ADXL362 to measure mode
+
+  Serial.println("Start Demo: Simple Read");
+}
+
+void loop(){
+
+  // read all three axis in burst to ensure all measurements correspond to same sample time
+  xl.readXYZTData(XValue, YValue, ZValue, Temperature);
+  Serial.print("XVALUE=");
+  Serial.print(XValue);
+  Serial.print("\tYVALUE=");
+  Serial.print(YValue);
+  Serial.print("\tZVALUE=");
+  Serial.print(ZValue);
+  Serial.print("\tTEMPERATURE=");
+  Serial.println(Temperature);
+  delay(100);                // Arbitrary delay to make serial monitor easier to observe
+}


Fixed paul test

Fixed paul test

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/tylergrreid/Arduino_Flight_Computer.git/'


Arduino Source Code

Arduino Source Code

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

--- oledPong/oledPong.ino
+++ oledPong/oledPong.ino
@@ -0,0 +1,197 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2015 Martin Hudoba
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#include "U8glib.h"
+
+U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0 | U8G_I2C_OPT_NO_ACK | U8G_I2C_OPT_FAST);	// Fast I2C / TWI
+
+#define START 1
+#define UP_RIGHT 2
+#define UP_LEFT 3
+#define DOWN_RIGHT 4
+#define DOWN_LEFT 5
+#define UP_RIGHTS 6
+#define UP_LEFTS 7
+#define DOWN_RIGHTS 8
+#define DOWN_LEFTS 9
+
+#define RIGHT_WALL 1
+#define LEFT_WALL 2
+#define UPPER_WALL 3
+#define BOTTOM_WALL 4
+#define PADDLE_REND 5
+#define PADDLE_RMID 6
+#define PADDLE_LEND 7
+#define PADDLE_LMID 8
+
+#define SPD0 0
+#define SPD1 48
+
+#define PADDLE_XL 0
+#define PADDLE_XR 126
+
+#define JOYPIN_L 2
+#define JOYPIN_R 0
+
+int16_t joyYL;
+int16_t joyYR;
+int16_t paddleL;
+int16_t paddleR;
+uint8_t movementVal;
+uint16_t scoreR;
+uint16_t scoreL;
+uint8_t bodX;
+uint8_t bodY;
+uint8_t lastBodX = 64;
+uint8_t lastBodY = 32;
+uint8_t direct = START;
+uint8_t lastDirection;
+uint8_t rndDirection;
+
+void assignDirection(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e, uint8_t f, uint8_t g, uint8_t h) {
+  movementVal = 0;
+  lastDirection = direct;
+  lastBodX = bodX;
+  lastBodY = bodY;
+   if (lastDirection == a) {direct = b;}
+  else if (lastDirection == c) {direct = d;}
+  else if (lastDirection == e) {direct = f;}
+  else if (lastDirection == g) {direct = h;}
+
+  if (direct == START) {
+    if (rndDirection == UP_RIGHT) {direct = DOWN_RIGHT;}
+    else if (rndDirection == UP_LEFT) {direct = DOWN_LEFT;}
+    else if (rndDirection == DOWN_RIGHT) {direct = UP_RIGHT;}
+    else if (rndDirection == DOWN_LEFT) {direct = UP_LEFT;}
+  }
+}
+
+void movement(uint8_t i, uint8_t num) {
+  if (direct == START) {
+    lastBodX = 64;
+    lastBodY = 32;
+  }
+  if (i == UP_RIGHT) {
+    bodX = lastBodX + map(movementVal, SPD0, SPD1, 0, 128);
+    bodY = lastBodY - map(movementVal, SPD0, SPD1, 0, num);
+  } else if (i == UP_LEFT) {
+    bodX = lastBodX - map(movementVal, SPD0, SPD1, 0, 128);
+    bodY = lastBodY - map(movementVal, SPD0, SPD1, 0, num);
+  } else if (i == DOWN_RIGHT) {
+    bodX = lastBodX + map(movementVal, SPD0, SPD1, 0, 128);
+    bodY = lastBodY + map(movementVal, SPD0, SPD1, 0, num);
+  } else if (i == DOWN_LEFT) {
+    bodX = lastBodX - map(movementVal, SPD0, SPD1, 0, 128);
+    bodY = lastBodY + map(movementVal, SPD0, SPD1, 0, num);
+  }
+  u8g.drawPixel(bodX, bodY);
+  checkCollision();
+}
+
+void checkCollision() {
+  if ( ((bodY >= paddleR) && (bodY <= paddleR + 2)) && (bodX >= PADDLE_XR)) { //Right Paddle TOP
+    assignDirection(UP_RIGHT, UP_LEFT, UP_RIGHTS, UP_LEFT, DOWN_RIGHT, DOWN_LEFT, DOWN_RIGHTS, DOWN_LEFT);
+  } else if ( ((bodY >= paddleR + 3) && (bodY <= paddleR + 3)) && (bodX >= PADDLE_XR)) { //Right Paddle TOP-MIDDLE
+    assignDirection(UP_RIGHT, UP_LEFTS, UP_RIGHTS, UP_LEFTS, DOWN_RIGHT, DOWN_LEFTS, DOWN_RIGHTS, DOWN_LEFTS);
+  } else if ( ((bodY >= paddleR + 4) && (bodY <= paddleR + 5)) && (bodX >= PADDLE_XR)) { //Right Paddle BOTTOM
+    assignDirection(UP_RIGHT, UP_LEFT, UP_RIGHTS, UP_LEFT, DOWN_RIGHT, DOWN_LEFT, DOWN_RIGHTS, DOWN_LEFT);
+  } else if ( ((bodY >= paddleL) && (bodY <= paddleL + 2)) && ((bodX >= PADDLE_XL + 1) && (bodX <= PADDLE_XL + 3)) ) { //Left Paddle TOP
+    assignDirection(UP_LEFT, UP_RIGHT, UP_LEFTS, UP_RIGHT, DOWN_LEFT, DOWN_RIGHT, DOWN_LEFTS, DOWN_RIGHT);
+  } else if ( ((bodY >= paddleL + 3) && (bodY <= paddleL + 3)) && ((bodX >= PADDLE_XL + 1) && (bodX <= PADDLE_XL + 3)) ) { //Left Paddle TOP-MIDDLE
+    assignDirection(UP_LEFT, UP_RIGHTS, UP_LEFTS, UP_RIGHTS, DOWN_LEFT, DOWN_RIGHTS, DOWN_LEFTS, DOWN_RIGHTS);
+  } else if ( ((bodY >= paddleL + 4) && (bodY <= paddleL + 5)) && ((bodX >= PADDLE_XL + 1) && (bodX <= PADDLE_XL + 3)) ) { //Left Paddle BOTTOM
+    assignDirection(UP_LEFT, UP_RIGHT, UP_LEFTS, UP_RIGHT, DOWN_LEFT, DOWN_RIGHT, DOWN_LEFTS, DOWN_RIGHT);
+  } else if (bodX >= 128) { //Right wall
+    rndDirection = random(2, 6);
+    direct = START;
+    movementVal = 0;
+    lastBodX = bodX;
+    lastBodY = bodY;
+    scoreL++;
+  } else if (bodX <= 0) { //Left wall
+    rndDirection = random(2, 6);
+    direct = START;
+    movementVal = 0;
+    lastBodX = bodX;
+    lastBodY = bodY;
+    scoreR++;
+  } else if (bodY <= 0) { //Upper wall
+    bodY = 0;
+    assignDirection(UP_RIGHT, DOWN_RIGHT, UP_LEFT, DOWN_LEFT, UP_RIGHTS, DOWN_RIGHTS, UP_LEFTS, DOWN_LEFTS);
+  } else if (bodY >= 64) { //Bottom wall
+    bodY = 64;
+    assignDirection(DOWN_RIGHT, UP_RIGHT, DOWN_LEFT, UP_LEFT, DOWN_RIGHTS, UP_RIGHTS, DOWN_LEFTS, UP_LEFTS);
+  }
+}
+
+void draw(void) {
+  if (direct == START) {
+      if (rndDirection == UP_RIGHT) {movement(UP_RIGHT, 128);}
+      else if (rndDirection == UP_LEFT) {movement(UP_LEFT, 128);}
+      else if (rndDirection == DOWN_RIGHT) {movement(DOWN_RIGHT, 128);}
+      else if (rndDirection == DOWN_LEFT) {movement(DOWN_LEFT, 128);
+      }
+  } else if (direct == UP_RIGHT) {movement(UP_RIGHT, 64);}
+    else if (direct == UP_LEFT) {movement(UP_LEFT, 64);}
+    else if (direct == DOWN_RIGHT) {movement(DOWN_RIGHT, 64);}
+    else if (direct == DOWN_LEFT) {movement(DOWN_LEFT, 64);}
+    else if (direct == UP_RIGHTS) {movement(UP_RIGHT, 16);}
+    else if (direct == UP_LEFTS) {movement(UP_LEFT, 16);}
+    else if (direct == DOWN_RIGHTS) {movement(DOWN_RIGHT, 16);}
+    else if (direct == DOWN_LEFTS) {movement(DOWN_LEFT, 16);
+  }
+
+  checkCollision();
+  u8g.setFont(u8g_font_helvB08);
+  /*u8g.setPrintPos(27, 35);
+  u8g.print(direct);*/
+
+  u8g.setPrintPos(32, 15);
+  u8g.print(scoreL);
+  u8g.setPrintPos(80, 15);
+  u8g.print(scoreR);
+
+  u8g.drawPixel(bodX, bodY);
+  u8g.drawBox(64, 0, 1, 64);
+  u8g.drawBox(PADDLE_XL, paddleL, 2, 5);
+  u8g.drawBox(PADDLE_XR, paddleR, 2, 5);
+}
+
+void setup() {
+  randomSeed(analogRead(3));
+}
+
+void loop() {
+  int16_t joyL = analogRead(JOYPIN_L);
+  int16_t joyR = analogRead(JOYPIN_R);
+  paddleL = map(joyL, 0, 1023, 0, 59);
+  paddleR = map(joyR, 0, 1023, 0, 59);
+
+  u8g.firstPage();
+  do {
+    draw();
+  } while ( u8g.nextPage() );
+
+  movementVal++;
+}


make flow simpler

make flow simpler

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


added simple auto connect example

added simple auto connect example

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/javl/WiFiManager.git/'


tracking network nodes

tracking network nodes

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

--- Arduino/2d_array3/2d_array3.ino
+++ Arduino/2d_array3/2d_array3.ino
@@ -0,0 +1,118 @@
+// Notes:
+// draft code for storing mesh node data in a 2D array
+// code currently functioning with a demo string
+// needs to be integrated into the mesh code
+// only one NodeMCU needed, no OLED required/used
+
+// Behavior:
+// Establish 2D node with 6x6 entries
+// Fill first row with local node data
+// Parse sample string, check to make sure it's not already recorded in the array
+// Add the parsed data to the first available row
+// If data sits in array for X time without an update, delete from array
+
+// node ID, when added (millis), name, tag1, tag2, tag3
+String testString = "123456789,0,Nick,Kiwis,Grapes,Apples";
+String nodeNum = String(ESP.getChipId());
+String tempData[] = {"","","","",""};
+
+// first bracket left empty intentionally
+// is there a more elegant way to declare this array?
+String nodeData[][6] = {
+  // first one is me
+  {nodeNum,"0","Taylor","Apples","Oranges","Bananas"},
+  {"","","","","",""},
+  {"","","","","",""},
+  {"","","","","",""},
+  {"","","","","",""},
+  {"","","","","",""}
+  };
+
+void setup() {
+  // don't show initial serial garbage
+  delay(100);
+
+  Serial.begin(115200);
+
+  // parse incoming data string into a temporary array
+  parseData();
+
+  // see if the node number already exists in the array
+  checkExisting();
+}
+
+void loop() {
+
+
+  // see if a recorded node hasn't reported for a while
+  // fyi, millis don't seem to start right at zero (20k is more like a 12 sec delay)
+  garbageCollection(20000);
+
+  delay(1000);
+
+  Serial.println("");
+  for(int k = 0; k < 6; k++){
+    Serial.print(nodeData[1][k] + ", ");
+  }
+}
+
+void garbageCollection(int x){
+  for(int i = 0; i < 6; i++){
+    if((nodeData[i][1].toInt() + x) < millis()){
+      for(int j = 0; j < 6; j++){
+        nodeData[i][j] = "";
+      }
+    }
+  }
+}
+
+void checkExisting(){
+
+  boolean alreadyRecorded = false;
+  for(int i = 0; i < 6; i++){
+    if(tempData[0] == nodeData[i][0]){
+      alreadyRecorded = true;
+      nodeData[i][1] = String(millis());
+      Serial.println("");
+      for(int k = 0; k < 6; k++){
+        Serial.print(nodeData[i][k] + ", ");
+      }
+    }
+  }
+
+  while (alreadyRecorded == false){
+    for(int i = 0; i < 6; i++){
+      if(nodeData[i][0] == ""){
+        for(int x = 0; x < 6; x++){
+          nodeData[i][x] = tempData[x];
+        }
+        // serial debug
+        Serial.println("");
+        for(int k = 0; k < 6; k++){
+          Serial.print(nodeData[i][k] + ", ");
+        }
+        alreadyRecorded = true;
+        break;
+      }
+    }
+  }
+}
+
+void parseData(){
+
+  int delim1 = testString.indexOf(',');
+  tempData[0] = testString.substring(0,delim1);
+  int delim2 = testString.indexOf(',',delim1+1);
+  tempData[1] = testString.substring(delim1+1,delim2);
+  int delim3 = testString.indexOf(',',delim2+1);
+  tempData[2] = testString.substring(delim2+1,delim3);
+  int delim4 = testString.indexOf(',',delim3+1);
+  tempData[3] = testString.substring(delim3+1,delim4);
+  int delim5 = testString.indexOf(',',delim4+1);
+  tempData[4] = testString.substring(delim4+1,delim5);
+  int delim6 = testString.indexOf(',',delim5+1);
+  tempData[5] = testString.substring(delim5+1,delim6);
+
+}
+
+


Create ESP_master.ino

Create ESP_master.ino

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

--- Modules/i2c_test/ESP_master.ino
+++ Modules/i2c_test/ESP_master.ino
@@ -0,0 +1,40 @@
+/*
+ * For ESP32-WROOM board (OLED, battery, full pin breakout)
+ *
+ * Board:   Wemos Wifi&Bluetooth Battery
+ * Flash:   80Mhz
+ * Upload:  921600
+ * Port:    cu.SLAB_USBtoUART
+ * Prog:    AVRISPmkII
+ *
+ * ESP 21   >>  Attiny SDA
+ * ESP 22   >>  Attiny SCL
+ * ESP VCC  >>  Attiny VCC
+ * ESP GND  >>  Attiny GND
+ *
+ */
+
+#include <Wire.h>
+
+void setup()
+{
+ Wire.begin();            // join i2c bus (address optional for master)
+ Serial.begin(9600);      // start serial for output
+}
+
+void loop()
+{
+ Wire.requestFrom(4, 1);  // request 1 byte from slave device address 4
+
+while(Wire.available())   // slave may send less than requested
+ {
+ int i = Wire.read();     // receive a byte as character
+ Serial.println(i);       // print the character
+ }
+
+delay(500);
+
+// debug, should work even if the tiny is not sending
+// Serial.println("testing...");
+
+}


Update Fan Testing.ino

Update Fan Testing.ino

DEFUNCT AS OF 10/18/16

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


pad example

pad example

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

--- Pad/pad/pad.ino
+++ Pad/pad/pad.ino
@@ -0,0 +1,90 @@
+/*  Pads - Girls code it better 2017/18
+    DaveCalaway
+*/
+
+#include "Keyboard.h"
+#include "Mouse.h"
+
+// buttons
+const int upButton = 2;
+const int downButton = 3;
+const int leftButton = 4;
+const int rightButton = 5;
+// mouse
+const int mouseLeft = 6;
+const int upMouse = 7;
+const int downMouse = 8;
+const int leftMouse = 9;
+const int rightMouse = 10;
+const int jumpButton = 14;
+
+const int responseDelay = 50;
+
+byte Button[6] = {upButton, downButton, leftButton, rightButton, mouseLeft, jumpButton};
+byte mouse[4] = {upMouse, downMouse, leftMouse, rightMouse};
+
+byte mouse_read = 1;
+byte button_read = 1;
+
+void setup() {
+  for ( byte i = 0; i < 6; i++) {
+    pinMode(Button[i], INPUT_PULLUP);
+  }
+  for ( byte i = 0; i < 4; i++) {
+    pinMode(mouse[i], INPUT_PULLUP);
+  }
+
+  Serial.begin(9600);
+  // initialize mouse control:
+  Mouse.begin();
+  Keyboard.begin();
+}
+
+void loop() {
+
+  for ( byte i = 0; i < 6; i++) {
+    button_read = digitalRead(Button[i]);
+    if (button_read == LOW) {
+      Serial.println("ok");
+      delay(responseDelay);
+      button_(i);
+    }
+  }
+
+  for ( byte i = 0; i < 4; i++) {
+    mouse_read = digitalRead(mouse[i]);
+    if (mouse_read == LOW) {
+      //Serial.println("ok");
+      delay(responseDelay);
+      mouse_(i);
+    }
+  }
+
+}
+
+void mouse_(byte i) {
+  if (i == 0) // up
+    Mouse.move(0, -40);
+  if (i == 1) // down
+    Mouse.move(0, 40);
+  if (i == 2) // left
+    Mouse.move(-40, 0);
+  if (i == 3) // right
+    Mouse.move(40, 0);
+}
+
+void button_(byte i) {
+  if (i == 0) // up
+    Keyboard.write('w');
+  if (i == 1) // down
+    Keyboard.write('s');
+  if (i == 2) // left
+    Keyboard.write('a');
+  if (i == 3) // right
+    Keyboard.write('d');
+  if (i == 4) // mouseLeft
+    Mouse.click(MOUSE_LEFT);
+  if (i == 5) // jumpButton
+    Keyboard.write(' ');
+}
+


Testing Arduino WiFi with web app

Testing Arduino WiFi with web app

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


fixes index bug

fixes index bug

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/kdomen/Morse-Code.git/'


DS18B20 version complete (sensor is too slow to continue using)

/bin/sh: 1: Syntax error: Unterminated quoted string


Change to 2x2 blocks with no margin

Change to 2x2 blocks with no margin

Gives a 64x32 grid.

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/'


daisy chain of 4 shifts

daisy chain of 4 shifts

error: pathspec 'shift-register-daisy-chain-serial-controll.ino' did not match any file(s) known to git

--- shift-register-daisy-chain-serial-controll.ino
+++ shift-register-daisy-chain-serial-controll.ino
@@ -0,0 +1,968 @@
+int SER_Pin = 11;   //pin 14 on the 75HC595
+int RCLK_Pin = 8;  //pin 12 on the 75HC595
+int SRCLK_Pin = 12; //pin 11 on the 75HC595
+
+//How many of the shift registers - change this
+#define number_of_74hc595s 6
+
+//register pins
+#define numOfRegisterPins number_of_74hc595s * 8
+
+boolean registers[numOfRegisterPins];
+
+
+int dev1=0;
+int dev2=1;
+int dev3=2;
+int dev4=3;
+int dev5=4;
+int dev6=5;
+int dev7=6;
+int dev8=7;
+int dev9=8;
+int dev10=9;
+int dev11=10;
+int dev12=11;
+int dev13=12;
+int dev14=13;
+int dev15=14;
+int dev16=15;
+int dev17=16;
+int dev18=17;
+int dev19=18;
+int dev20=19;
+int dev21=20;
+int dev22=21;
+int dev23=22;
+int dev24=23;
+int dev25=24;
+int dev26=25;
+int dev27=26;
+int dev28=27;
+int dev29=28;
+int dev30=29;
+int dev31=30;
+int dev32=31;
+int dev33=32;
+int dev34=33;
+int dev35=34;
+int dev36=35;
+int dev37=36;
+int dev38=37;
+int dev39=38;
+int dev40=39;
+int dev41=40;
+int dev42=41;
+int dev43=42;
+int dev44=43;
+int dev45=44;
+int dev46=45;
+int dev47=46;
+int dev48=47;
+
+
+
+
+void setup(){
+  pinMode(SER_Pin, OUTPUT);
+  pinMode(RCLK_Pin, OUTPUT);
+  pinMode(SRCLK_Pin, OUTPUT);
+  Serial.begin(9600); // baud rate
+  Serial.flush();
+
+
+  //reset all register pins
+  clearRegisters();
+  writeRegisters();
+}
+
+
+/*
+PROBLEM. to be fixed:
+Random shift register's output states at power up
+maybe solution:
+OE / MR pins
+pullup resistors
+*/
+
+//set all register pins to LOW
+void clearRegisters(){
+  for(int i = numOfRegisterPins - 1; i >=  0; i--){
+     registers[i] = LOW;
+  }
+  writeRegisters();
+}
+
+
+//Set and display registers
+//Only call AFTER all values are set how you would like (slow otherwise)
+void writeRegisters(){
+
+  digitalWrite(RCLK_Pin, LOW);
+
+  for(int i = numOfRegisterPins - 1; i >=  0; i--){
+    digitalWrite(SRCLK_Pin, LOW);
+
+    int val = registers[i];
+
+    digitalWrite(SER_Pin, val);
+    digitalWrite(SRCLK_Pin, HIGH);
+
+  }
+  digitalWrite(RCLK_Pin, HIGH);
+
+}
+
+//set an individual pin HIGH or LOW
+void setRegisterPin(int index, int value){
+  registers[index] = value;
+}
+
+
+
+void loop(){
+
+  relaycontroll();
+
+
+}
+
+
+
+void relaycontroll()
+{
+
+
+  int delayTime=200;
+  String input = "";
+
+     // Read any serial input
+     while (Serial.available() > 0)
+     {
+         input += (char) Serial.read(); // Read in one char at a time
+         delay(5); // Delay for 5 ms so the next char has time to be received
+     }
+
+
+
+/////////////////////////// Relay 1
+     if (input == "dev1_on")
+     {
+      setRegisterPin(dev1, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev1_off")
+{
+      setRegisterPin(dev1, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 1
+/////////////////////////// Relay 2
+     if (input == "dev2_on")
+     {
+      setRegisterPin(dev2, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev2_off")
+{
+      setRegisterPin(dev2, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 2
+/////////////////////////// Relay 3
+     if (input == "dev3_on")
+     {
+      setRegisterPin(dev3, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev3_off")
+{
+      setRegisterPin(dev3, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 3
+/////////////////////////// Relay 4
+     if (input == "dev4_on")
+     {
+      setRegisterPin(dev4, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev4_off")
+{
+      setRegisterPin(dev4, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 4
+/////////////////////////// Relay 5
+     if (input == "dev5_on")
+     {
+      setRegisterPin(dev5, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev5_off")
+{
+      setRegisterPin(dev5, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 5
+/////////////////////////// Relay 6
+     if (input == "dev6_on")
+     {
+      setRegisterPin(dev6, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev6_off")
+{
+      setRegisterPin(dev6, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 6
+/////////////////////////// Relay 7
+     if (input == "dev7_on")
+     {
+      setRegisterPin(dev7, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev7_off")
+{
+      setRegisterPin(dev7, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 7
+/////////////////////////// Relay 8
+     if (input == "dev8_on")
+     {
+      setRegisterPin(dev8, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev8_off")
+{
+      setRegisterPin(dev8, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 8
+/////////////////////////// Relay 9
+     if (input == "dev9_on")
+     {
+      setRegisterPin(dev9, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev9_off")
+{
+      setRegisterPin(dev9, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 9
+/////////////////////////// Relay 10
+     if (input == "dev10_on")
+     {
+      setRegisterPin(dev10, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev10_off")
+{
+      setRegisterPin(dev10, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 10
+/////////////////////////// Relay 11
+     if (input == "dev11_on")
+     {
+      setRegisterPin(dev11, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev11_off")
+{
+      setRegisterPin(dev11, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 11
+/////////////////////////// Relay 12
+     if (input == "dev12_on")
+     {
+      setRegisterPin(dev12, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev12_off")
+{
+      setRegisterPin(dev12, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 12
+/////////////////////////// Relay 13
+     if (input == "dev13_on")
+     {
+      setRegisterPin(dev13, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev13_off")
+{
+      setRegisterPin(dev13, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 13
+/////////////////////////// Relay 14
+     if (input == "dev14_on")
+     {
+      setRegisterPin(dev14, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev14_off")
+{
+      setRegisterPin(dev14, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 14
+/////////////////////////// Relay 15
+     if (input == "dev15_on")
+     {
+      setRegisterPin(dev15, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev15_off")
+{
+      setRegisterPin(dev15, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 15
+/////////////////////////// Relay 16
+     if (input == "dev16_on")
+     {
+      setRegisterPin(dev16, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev16_off")
+{
+      setRegisterPin(dev16, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 16
+/////////////////////////// Relay 17
+     if (input == "dev17_on")
+     {
+      setRegisterPin(dev17, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev17_off")
+{
+      setRegisterPin(dev17, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 17
+/////////////////////////// Relay 18
+     if (input == "dev18_on")
+     {
+      setRegisterPin(dev18, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev18_off")
+{
+      setRegisterPin(dev18, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 18
+/////////////////////////// Relay 19
+     if (input == "dev19_on")
+     {
+      setRegisterPin(dev19, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev19_off")
+{
+      setRegisterPin(dev19, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 19
+/////////////////////////// Relay 20
+     if (input == "dev20_on")
+     {
+      setRegisterPin(dev20, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev20_off")
+{
+      setRegisterPin(dev20, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 20
+/////////////////////////// Relay 21
+     if (input == "dev21_on")
+     {
+      setRegisterPin(dev21, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev21_off")
+{
+      setRegisterPin(dev21, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 21
+/////////////////////////// Relay 22
+     if (input == "dev22_on")
+     {
+      setRegisterPin(dev22, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev22_off")
+{
+      setRegisterPin(dev22, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 22
+/////////////////////////// Relay 23
+     if (input == "dev23_on")
+     {
+      setRegisterPin(dev23, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev23_off")
+{
+      setRegisterPin(dev23, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 23
+/////////////////////////// Relay 24
+     if (input == "dev24_on")
+     {
+      setRegisterPin(dev24, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev24_off")
+{
+      setRegisterPin(dev24, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 24
+/////////////////////////// Relay 25
+     if (input == "dev25_on")
+     {
+      setRegisterPin(dev25, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev25_off")
+{
+      setRegisterPin(dev25, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 25
+/////////////////////////// Relay 26
+     if (input == "dev26_on")
+     {
+      setRegisterPin(dev26, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev26_off")
+{
+      setRegisterPin(dev26, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 26
+/////////////////////////// Relay 27
+     if (input == "dev27_on")
+     {
+      setRegisterPin(dev27, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev27_off")
+{
+      setRegisterPin(dev27, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 27
+/////////////////////////// Relay 28
+     if (input == "dev28_on")
+     {
+      setRegisterPin(dev28, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev28_off")
+{
+      setRegisterPin(dev28, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 28
+/////////////////////////// Relay 29
+     if (input == "dev29_on")
+     {
+      setRegisterPin(dev29, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev29_off")
+{
+      setRegisterPin(dev29, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 29
+/////////////////////////// Relay 30
+     if (input == "dev30_on")
+     {
+      setRegisterPin(dev30, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev30_off")
+{
+      setRegisterPin(dev30, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 30
+/////////////////////////// Relay 31
+     if (input == "dev31_on")
+     {
+      setRegisterPin(dev31, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev31_off")
+{
+      setRegisterPin(dev31, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 31
+/////////////////////////// Relay 32
+     if (input == "dev32_on")
+     {
+      setRegisterPin(dev32, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev32_off")
+{
+      setRegisterPin(dev32, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 32
+/////////////////////////// Relay 33
+     if (input == "dev33_on")
+     {
+      setRegisterPin(dev33, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev33_off")
+{
+      setRegisterPin(dev33, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 33
+/////////////////////////// Relay 34
+     if (input == "dev34_on")
+     {
+      setRegisterPin(dev34, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev34_off")
+{
+      setRegisterPin(dev34, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 34
+/////////////////////////// Relay 35
+     if (input == "dev35_on")
+     {
+      setRegisterPin(dev35, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev35_off")
+{
+      setRegisterPin(dev35, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 35
+/////////////////////////// Relay 36
+     if (input == "dev36_on")
+     {
+      setRegisterPin(dev36, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev36_off")
+{
+      setRegisterPin(dev36, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 36
+/////////////////////////// Relay 37
+     if (input == "dev37_on")
+     {
+      setRegisterPin(dev37, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev37_off")
+{
+      setRegisterPin(dev37, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 37
+/////////////////////////// Relay 38
+     if (input == "dev38_on")
+     {
+      setRegisterPin(dev38, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev38_off")
+{
+      setRegisterPin(dev38, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 38
+/////////////////////////// Relay 39
+     if (input == "dev39_on")
+     {
+      setRegisterPin(dev39, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev39_off")
+{
+      setRegisterPin(dev39, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 39
+/////////////////////////// Relay 40
+     if (input == "dev40_on")
+     {
+      setRegisterPin(dev40, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev40_off")
+{
+      setRegisterPin(dev40, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 40
+/////////////////////////// Relay 41
+     if (input == "dev41_on")
+     {
+      setRegisterPin(dev41, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev41_off")
+{
+      setRegisterPin(dev41, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 41
+/////////////////////////// Relay 42
+     if (input == "dev42_on")
+     {
+      setRegisterPin(dev42, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev42_off")
+{
+      setRegisterPin(dev42, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 42
+/////////////////////////// Relay 43
+     if (input == "dev43_on")
+     {
+      setRegisterPin(dev43, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev43_off")
+{
+      setRegisterPin(dev43, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 43
+/////////////////////////// Relay 44
+     if (input == "dev44_on")
+     {
+      setRegisterPin(dev44, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev44_off")
+{
+      setRegisterPin(dev44, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 44
+/////////////////////////// Relay 45
+     if (input == "dev45_on")
+     {
+      setRegisterPin(dev45, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev45_off")
+{
+      setRegisterPin(dev45, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 45
+/////////////////////////// Relay 46
+     if (input == "dev46_on")
+     {
+      setRegisterPin(dev46, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev46_off")
+{
+      setRegisterPin(dev46, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 46
+/////////////////////////// Relay 47
+     if (input == "dev47_on")
+     {
+      setRegisterPin(dev47, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev47_off")
+{
+      setRegisterPin(dev47, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 47
+/////////////////////////// Relay 48
+     if (input == "dev48_on")
+     {
+      setRegisterPin(dev48, HIGH);
+      writeRegisters();
+      delay(delayTime);
+   //   clearRegisters();
+     }
+     else if(input == "dev48_off")
+{
+      setRegisterPin(dev48, LOW);
+      writeRegisters();
+      delay(delayTime);
+  //    clearRegisters();
+
+}
+////////////////////////// end Relay 48
+
+
+
+
+}


euler angles

euler angles

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/ocean-x/erikson-1.git/'


commiting Blink2

commiting Blink2

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

--- Blink2/Blink2.ino
+++ Blink2/Blink2.ino
@@ -0,0 +1,23 @@
+/*
+  Blink
+  Turns on an LED on for one second, then off for one second, repeatedly.
+
+  This example code is in the public domain.
+ */
+
+// Pin 13 has an LED connected on most Arduino boards.
+// give it a name:
+int led = 13;
+
+// the setup routine runs once when you press reset:
+void setup() {
+  // initialize the digital pin as an output.
+  pinMode(led, OUTPUT);
+}
+
+// the loop routine runs over and over again forever:
+void loop() {
+  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
+  delay(200);               // wait for a second
+  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
+  delay(1000);               // wait for a second


Create modbus_slave_rs485_gyroMPU6050.ino

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

--- modbus_slave_rs485_gyroMPU6050.ino
+++ modbus_slave_rs485_gyroMPU6050.ino
@@ -0,0 +1,138 @@
+#include <SimpleModbusSlave.h>
+
+#include <Wire.h>
+#include "rgb_lcd.h"
+
+
+#define baud 38400
+#define timeout 1000
+#define polling 200 // the scan rate
+#define retry_count 10
+
+
+int Distance = 0;
+
+rgb_lcd lcd;
+
+const int colorR = 255;
+const int colorG = 0;
+const int colorB = 0;
+
+#define TxEnablePin 2
+#define  LED 10
+
+enum
+{
+  // just add or remove registers and your good to go...
+  // The first register starts at address 0
+  ADC_VAL,
+  PWM_VAL,
+  HOLDING_REGS_SIZE // leave this one
+  // total number of registers for function 3 and 16 share the same register array
+  // i.e. the same address space
+};
+
+unsigned int holdingRegs[HOLDING_REGS_SIZE]; // function 3 and 16 register array
+
+
+void setup()
+{Serial.begin(38400);
+
+
+
+  modbus_configure(&Serial, 115200, SERIAL_8N2, 1, 2, HOLDING_REGS_SIZE, holdingRegs);
+
+  // modbus_update_comms(baud, byteFormat, id) is not needed but allows for easy update of the
+  // port variables and slave id dynamically in any function.
+  modbus_update_comms(9600, SERIAL_8N2, 1);
+
+
+pinMode(8, OUTPUT); //dir
+pinMode(9, OUTPUT); //pul
+pinMode(7, OUTPUT); //pul
+digitalWrite(8, LOW);
+digitalWrite(9, LOW);
+//digitalWrite(7, HIGH);
+digitalWrite(7, LOW);
+
+
+ lcd.begin(16, 2);
+
+    lcd.setRGB(colorR, colorG, colorB);
+
+    // Print a message to the LCD.
+   lcd.print("XYZ");
+}
+
+void loop()
+{
+modbus_update();
+lcd.setCursor(5, 0);
+
+if (holdingRegs[0] > 100)
+
+{int data1 = (holdingRegs[0]/100)*-1;
+
+lcd.print(data1);
+
+}
+
+else
+{lcd.print(holdingRegs[0]);}
+
+
+
+lcd.setCursor(5, 1);
+if (holdingRegs[1] > 100)
+
+{int data2 = (holdingRegs[1]/10)*-1;
+
+lcd.print(data2);
+
+}
+
+else
+
+{
+lcd.print(holdingRegs[1]);
+}
+
+
+
+
+int vueltas1 = holdingRegs[0]*20;
+int vueltas = holdingRegs[0]*10;
+
+
+
+digitalWrite(9, HIGH);
+delayMicroseconds(2500); // change value for speed fast 33 to 10000 slow
+digitalWrite(9, LOW);
+delayMicroseconds(2500); // change value for speed fast 33 to 10000 slow
+
+//if (Distance >= vueltas || Distance >= (vueltas - 10))
+
+//{digitalWrite(7, HIGH);
+//Distance = vueltas;
+//}
+
+if
+(holdingRegs[0] < 25)
+
+{digitalWrite(7, HIGH);
+digitalWrite(8, HIGH);
+}
+
+else if (holdingRegs[0] > 80)
+
+{digitalWrite(7, HIGH);
+digitalWrite(8, LOW);
+}
+
+else
+
+{digitalWrite(7, LOW);
+Distance = Distance + 1;
+}
+
+}


Polar plot example

Polar plot example

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

--- contrib/polar.ino
+++ contrib/polar.ino
@@ -0,0 +1,48 @@
+#include <EEPROM.h>
+#include <SPI.h>
+#include <GD2.h>
+
+void setup()
+{
+  GD.begin();
+}
+
+void loop()
+{
+  int i;
+
+  GD.VertexFormat(2);   // 2 bits of subpixel precision
+
+  GD.VertexTranslateX(PIXELS(GD.w / 2));
+  GD.VertexTranslateY(PIXELS(GD.h / 2));
+  GD.Clear();
+
+  int R = GD.h / 2 - 1;     // outside radius
+
+  // Draw radial rings
+  GD.Begin(POINTS);
+  for (i = 0; i < 10; i++) {
+    int r = map(i, 0, 9, PIXELS(R), PIXELS(30));
+
+    GD.ColorRGB(255, 255, 255);
+    GD.PointSize(r);
+    GD.Vertex2f(0, 0);
+
+    GD.ColorRGB(0, 0, 0);
+    GD.PointSize(r - PIXELS(1));
+    GD.Vertex2f(0, 0);
+  }
+
+  // Draw rays
+  GD.ColorRGB(255, 255, 255);
+  GD.Begin(LINES);
+  for (i = 0; i < 8; i++) {
+    int x, y;
+    int theta = map(i, 0, 8, 0, 65536L);    // angle in Furmans
+
+    GD.polar(x, y, 4 * R, theta);
+    GD.Vertex2f(0, 0);
+    GD.Vertex2f(x, y);
+  }
+  GD.swap();
+}


Example sketch to demonstrate how to use native ESP8266 SDK functionality

error: pathspec 'hardware/esp8266com/esp8266/libraries/esp8266/examples/NativeSdk/NativeSdk.ino' did not match any file(s) known to git

--- hardware/esp8266com/esp8266/libraries/esp8266/examples/NativeSdk/NativeSdk.ino
+++ hardware/esp8266com/esp8266/libraries/esp8266/examples/NativeSdk/NativeSdk.ino
@@ -0,0 +1,33 @@
+
+/*
+ * NativeSdk by Simon Peter
+ * Access functionality from the ESP8266 SDK
+ * This example code is in the public domain
+ *
+ * This is for advanced users.
+ * Note that this makes your code dependent on the ESP8266, which is generally
+ * a bad idea. So you should try to use esp8266/Arduino functionality
+ * where possible instead, in order to abstract away the hardware dependency.
+ */
+
+// Expose Expressif SDK functionality - wrapped in ifdef so that it still
+// compiles on other platforms
+#ifdef ESP8266
+extern "C" {
+#include "user_interface.h"
+}
+#endif
+
+void setup() {
+  Serial.begin(115200);
+}
+
+void loop() {
+  // Call Expressif SDK functionality - wrapped in ifdef so that it still
+  // compiles on other platforms
+#ifdef ESP8266
+  Serial.print("wifi_station_get_hostname: ");
+  Serial.println(wifi_station_get_hostname());
+#endif
+  delay(1000);
+}


Update MIDI_to_BLE-MIDI_nRF51822.ino

Update MIDI_to_BLE-MIDI_nRF51822.ino

error: pathspec 'MIDI_to_BLE-MIDI_bridge' did not match any file(s) known to git
error: pathspec 'nRF51822/MIDI_to_BLE-MIDI_nRF51822.ino' did not match any file(s) known to git


Create example.ino

Create example.ino

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

--- example.ino
+++ example.ino
@@ -0,0 +1,27 @@
+#include <SPI.h>
+#include <DRW_SSD1306_SPI_char.h>
+
+const uint8_t cs_pin = 2;
+const uint8_t dc_pin = 1;
+
+DRW_SSD1306_SPI_char oled;
+
+void setup() {
+  Serial.begin();
+  SPI.begin();
+  SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0)); // 4MHz clock
+  oled.begin(dc_pin, cs_pin);
+  oled.write("Hello, world!\r\n");
+}
+
+void loop() {
+  static uint8_t x = 0;
+  static uint8_t y = 0;
+  static uint8_t n = 0;
+  x = random(0, 21);
+  y = random(0, 8);
+  n = random(0, 9);
+
+  oled.set_char_cursor(x, y);
+  oled.print(n);
+}


Disconnected Sensor Feedback for FW Pitch/Roll

As per title. Reason being that the imu would stall the servo at
extreme angles

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/lowjunen/THOR.git/'


Delete BB-UNIT FIRMWARE BALL V0-4.ino

Delete BB-UNIT FIRMWARE BALL V0-4.ino

error: pathspec 'Firmware/BB-UNIT/BB-UNIT' did not match any file(s) known to git
error: pathspec 'FIRMWARE' did not match any file(s) known to git
error: pathspec 'BALL' did not match any file(s) known to git
error: pathspec 'V0-4.ino' did not match any file(s) known to git