Código de arduino

Código de arduino

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

--- arduino/Alarma/Alarma.ino
+++ arduino/Alarma/Alarma.ino
@@ -0,0 +1,247 @@
+/**
+   Aplicación para controlar una alarma hogareña controlada por puerto serie a través de una PC
+   UTN Facultad Regional Resistencia - 2015
+
+   @autor Motter Pemela
+   @autor Silva Beker Eliana
+   @autor Silva Omar
+   @autor Tato Rothamel Rodrigo
+*/
+//Estado de la alarma
+boolean alarmaOn = false;
+//Alarma disparada
+boolean alarmTriggered = false;
+
+//Sensores
+boolean bedroom3Window = false;
+boolean bedroom2Window = false;
+boolean hallWindow1 = false;
+boolean hallWindow2 = false;
+boolean frontDoor = false;
+boolean bedroom4Window = false;
+boolean hallMovement = false;
+
+
+const int BEDROOM_3_LIGHT = 2;
+const int BEDROOM_2_LIGHT = 3;
+const int BEDROOM_4_LIGHT = 6;
+const int HALL_LIGHT = 4;
+const int BATHROOM_3_LIGHT = 5;
+const int STAIRS_LIGHT = 7;
+
+const int BEDROOM_3_WINDOW_SENSOR = 8;
+const int BEDROOM_2_WINDOW_SENSOR = 9;
+const int HALL_WINDOW_1_SENSOR = 10;
+const int HALL_WINDOW_2_SENSOR = 11;
+const int BEDROOM_4_WINDOW_SENSOR = 12;
+const int MAIN_DOOR_SENSOR = A0;
+const int ALARM_LED = 13;
+const int HALL_MOVEMENT_SENSOR = A1;
+const int ALARM_TRIGGERED_CODE_EVENT = 22;//Código de disparo de alarma
+
+// the setup function runs once when you press reset or power the board
+
+void setup() {
+  // initialize digital pin 13 as an output.
+  pinMode(ALARM_LED, OUTPUT);
+  //Lights
+  pinMode(BEDROOM_3_LIGHT, OUTPUT);
+  pinMode(BEDROOM_2_LIGHT, OUTPUT);
+  pinMode(BEDROOM_4_LIGHT, OUTPUT);
+  pinMode(HALL_LIGHT, OUTPUT);
+  pinMode(BATHROOM_3_LIGHT, OUTPUT);
+  pinMode(STAIRS_LIGHT, OUTPUT);
+  //Sensors
+  pinMode(BEDROOM_3_WINDOW_SENSOR, INPUT);
+  pinMode(BEDROOM_2_WINDOW_SENSOR, INPUT);
+  pinMode(HALL_WINDOW_1_SENSOR, INPUT);
+  pinMode(HALL_WINDOW_2_SENSOR, INPUT);
+  pinMode(BEDROOM_4_WINDOW_SENSOR, INPUT);
+  pinMode(MAIN_DOOR_SENSOR, INPUT);
+  pinMode(HALL_MOVEMENT_SENSOR, INPUT);
+
+
+  digitalWrite(ALARM_LED, LOW);
+
+  Serial.begin(9600);
+}
+
+// the loop function runs over and over again forever
+void loop() {
+
+  int command = Serial.read();
+
+  if (command != -1) {
+    switchLights(command);
+    switchAlarm(command);
+  }
+  checkSensors();
+
+  delay(100);
+
+  // wait for a second
+}
+
+void switchLights(int light) {
+  if ((light >= 2 && light <= 7) || (light >= 248 && light <= 254)) {
+    //Serial.println(light);
+    if (light > 248) {
+      digitalWrite(abs(light - 256), LOW);
+    } else {
+      digitalWrite(abs(light), HIGH);
+    }
+  }
+}
+
+
+void switchAlarm(int light) {
+  //Verificar que ningun sensor este activado para poder activar alarma
+
+  if (light == 13 || light == 243) {
+    //Serial.println(light);
+    if (light == 243) {
+      digitalWrite(abs(light - 256), LOW);
+      alarmaOn = false;
+
+    } else {
+      if (!hallMovement && bedroom3Window && bedroom2Window && hallWindow1 && hallWindow2 && frontDoor
+          && bedroom4Window) {
+        digitalWrite(abs(light), HIGH);
+        alarmaOn = true;
+      }
+    }
+    alarmTriggered = false;//Vuelvo el estado de activación de alarma a su estado normal
+  }
+}
+
+void checkSensors() {
+
+
+  if (digitalRead(BEDROOM_3_WINDOW_SENSOR) == HIGH) {
+    if (bedroom3Window) {
+      bedroom3Window = false;
+      //Write event to console
+      Serial.println(-BEDROOM_3_WINDOW_SENSOR);
+      if (alarmaOn) {
+        alarmTriggered = true;
+      }
+    } else {
+      bedroom3Window = true;
+      Serial.println(BEDROOM_3_WINDOW_SENSOR);
+    }
+  }
+
+  if (digitalRead(BEDROOM_2_WINDOW_SENSOR) == HIGH) {
+    if (bedroom2Window) {
+      bedroom2Window = false;
+      //Write event to console
+      Serial.println(-BEDROOM_2_WINDOW_SENSOR);
+      if (alarmaOn) {
+        alarmTriggered = true;
+      }
+    } else {
+      bedroom2Window = true;
+      Serial.println(BEDROOM_2_WINDOW_SENSOR);
+    }
+  }
+
+  if (digitalRead(HALL_WINDOW_1_SENSOR) == HIGH) {
+    if (hallWindow1) {
+      hallWindow1 = false;
+      //Write event to console
+      Serial.println(-HALL_WINDOW_1_SENSOR);
+      if (alarmaOn) {
+        alarmTriggered = true;
+      }
+    } else {
+      hallWindow1 = true;
+      Serial.println(HALL_WINDOW_1_SENSOR);
+    }
+  }
+
+  if (digitalRead(HALL_WINDOW_2_SENSOR) == HIGH) {
+    if (hallWindow2) {
+      hallWindow2 = false;
+      //Write event to console
+      Serial.println(-HALL_WINDOW_2_SENSOR);
+      if (alarmaOn) {
+        alarmTriggered = true;
+      }
+    } else {
+      hallWindow2 = true;
+      Serial.println(HALL_WINDOW_2_SENSOR);
+    }
+  }
+
+  if (digitalRead(BEDROOM_4_WINDOW_SENSOR) == HIGH) {
+    if (bedroom4Window) {
+      bedroom4Window = false;
+      //Write event to console
+      Serial.println(-BEDROOM_4_WINDOW_SENSOR);
+      if (alarmaOn) {
+        alarmTriggered = true;
+      }
+    } else {
+      bedroom4Window = true;
+      Serial.println(BEDROOM_4_WINDOW_SENSOR);
+    }
+  }
+
+  if (digitalRead(MAIN_DOOR_SENSOR) == HIGH) {
+    if (frontDoor) {
+      frontDoor = false;
+      //Write event to console
+      Serial.println(-MAIN_DOOR_SENSOR);
+      if (alarmaOn) {
+        alarmTriggered = true;
+      }
+    } else {
+      frontDoor = true;
+      Serial.println(MAIN_DOOR_SENSOR);
+    }
+  }
+
+  //Valor menor al 10% del maximo de la entrada del potenciometro
+  //En este caso la lógica se invierte y se pasa como negativo para cuando
+  //no hay movimiento
+  if (analogRead(HALL_MOVEMENT_SENSOR) < 67) {
+    //Se detectan movimientos
+    if (!hallMovement) {
+      Serial.println(-HALL_MOVEMENT_SENSOR);
+      hallMovement = true;
+      if (alarmaOn) {
+        alarmTriggered = true;
+      }
+    }
+  } else {
+    //Ya no hay movimientos
+    if (hallMovement) {
+
+      Serial.println(HALL_MOVEMENT_SENSOR);
+      hallMovement = false;
+
+    }
+  }
+  if (alarmTriggered) {
+    Serial.println(ALARM_TRIGGERED_CODE_EVENT);
+    alarmTriggered = false;
+    alarm();
+  }
+}
+
+void alarm() {
+  long time = 0;
+  while (time < 120) {
+    for (int i = 2 ; i <= 7; i++) {
+      switchLights(i);
+    }
+    delay(250);
+    for (int j = 248 ; j <= 254; j++) {
+      switchLights(j);
+    }
+    delay(250);
+    time++;
+  }
+
+}
+


added first cut of how the pump will be activated

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/robreeves/robotany.git/'


Our First communication from Raspberry Pi to Arduino

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

--- CommToRPiTestI/CommToRPiTestI.ino
+++ CommToRPiTestI/CommToRPiTestI.ino
@@ -0,0 +1,23 @@
+#include <SoftwareSerial.h>
+#include <Wire.h>
+#include <Arduino.h>
+#include <Makeblock.h>
+
+void setup()
+{
+  // Open serial communications and wait for port to open:
+  Serial.begin(9600);
+  Serial1.begin(115200);
+  while (!Serial) {
+    ; // wait for serial port to connect. Needed for Leonardo only
+  }
+
+
+  Serial.println("Goodnight moon!");
+}
+
+void loop() // run over and over
+{
+  if (Serial1.available())
+    Serial.write(Serial1.read());
+}


v1.0 Initial release

v1.0 Initial release

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

--- GPSLCD.ino
+++ GPSLCD.ino
@@ -0,0 +1,622 @@
+/* GPS LCD
+
+    By GK Grotsky
+    8/30/16
+
+  This program communicate with the u-blox NEO-6M GPS module
+  through a software serial interface. It then displays certain GPS
+  parameters on a I2C 16x2 (or 20x4) character LCD display module. The
+  GPS messages are received by the on-board Arduino UART circuit using
+  the SoftwareSerial library. It then uses the TinyGPS++ library to
+  decode the GPS NMEA messages. The parameters are then displayed on a
+  16x4 (or 20x4) LCD using the LiquidCrystal_I2C library.
+
+  Note: Both the 16x2 and 20x4 LCDs are supported as these are the most popular
+        LCDs available.
+*/
+#include "GPSLCD.h"
+#include <TinyGPS++.h>
+#include <SoftwareSerial.h>
+#include <LiquidCrystal_I2C.h>
+
+TinyGPSPlus gps; // This is the GPS object that will pretty much do all the grunt work with the NMEA data
+SoftwareSerial GPSModule(10, 11); // RX, TX
+LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin); // Initializes class variables and defines the I2C address of the LCD
+bool dataValid; // Data is valid from the GPS module
+GPSStruct GPSData; // Holds the GPS data coming from the GPS module
+
+// The setup (runs once at start up)
+void setup()
+{
+  pinMode(BACKLIGHT_SW, INPUT);
+
+#ifdef _16x2
+  // Selects either speed or heading to be displayed
+  pinMode(SPEED_ALTITUDE_SW, INPUT);
+#else
+  // Selects either altitude or the date/time to be displayed
+  pinMode(ALTITUDE_DATE_TIME_SW, INPUT);
+#endif
+
+#ifdef DEBUG
+  Serial.begin(9600); // This opens up communications to the serial monitor in the Arduino IDE
+  Serial.flush();
+#endif
+  GPSModule.begin(9600); // This opens up communications to the software serial tx and rx lines
+  GPSModule.flush();
+
+  lcd.begin (COLUMN, ROW); // Defines LCD type
+  lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE); // Sets the pin to control the backlight
+  lcd.clear(); // Clear the LCD
+  lcd.home (); // Go to the home position on the LCD
+} // setup
+
+// The loop (runs forever and a day :-))
+void loop()
+{
+  static uint32_t pastSatellites = 0;
+  static byte initializingCounter = 0;
+  static unsigned long prevInitializationTime = INITIALIZATION_INTERVAL;
+  static unsigned long prevCreditTime = TOGGLETIME_INTERVAL;
+  static bool leftInitialization = false;
+  static bool creditToggle = true;
+#ifndef _16x2
+  static unsigned long prevDateTime = TOGGLETIME_INTERVAL;
+  static unsigned long prevHeadingTime = TOGGLETIME_INTERVAL;
+  static bool dateTimeToggle = true;
+  static bool headingToggle = true;
+#endif
+#ifdef DEBUG
+  static unsigned long prevDebugTime = 0;
+#endif
+#ifdef DATA_VALID_OVERRIDE
+  const bool dataValidOverride = true; // Set to true to override data valid for debugging
+#else
+  const bool dataValidOverride = false; // Set to false not to override data valid
+#endif
+#ifdef BACKLIGHT_OVERRIDE
+  // Override LCD backlight switch
+  lcd.setBacklight(BACKLIGHT_ONOFF);
+#else
+  // Force LCD backlight on/off
+  lcd.setBacklight(digitalRead(BACKLIGHT_SW));
+#endif
+  unsigned long now = millis();
+
+  while (GPSModule.available()) // While there are characters to come from the GPS
+  {
+    bool b = gps.encode(GPSModule.read()); // This feeds the serial NMEA data into the GPS library one char at a time
+  }
+
+  // Get the GPS data valid flags
+  dataValid =
+    gps.location.isValid()   &&
+    gps.speed.isValid()      &&
+    gps.altitude.isValid()   &&
+    gps.course.isValid()     &&
+    gps.date.isValid()       &&
+    gps.time.isValid()       &&
+    gps.satellites.isValid();
+
+  // Check if the GPS data is valid or data valid override is set (for debugging)
+  if (dataValid || dataValidOverride) {
+#ifndef DATA_VALID_OVERRIDE
+    // Store the real GPS data
+    GPSData.satellites = gps.satellites.value();
+    GPSData.lat        = gps.location.lat();
+    GPSData.lon        = gps.location.lng();
+    GPSData.speed      = gps.speed.mph();
+    GPSData.altitude   = gps.altitude.feet();
+#ifndef _16x2
+    GPSData.heading    = gps.course.deg();
+    GPSData.year       = gps.date.year();
+    GPSData.month      = gps.date.month();
+    GPSData.day        = gps.date.day();
+    GPSData.hour       = gps.time.hour();
+    GPSData.minute     = gps.time.minute();
+    GPSData.second     = gps.time.second();
+#endif // #ifndef _16x2
+#else // #ifndef DATA_VALID_OVERRIDE
+    // Store the fake GPS data (for debugging)
+    GPSData.satellites = 8;
+    GPSData.lat        = 39.16;
+    GPSData.lon        = -77.07;
+    GPSData.speed      = 55.0;
+    GPSData.altitude   = 555.0;
+#ifndef _16x2
+    GPSData.heading    = 90.0;
+    GPSData.year       = 2016;
+    GPSData.month      = 11; // Day before ST starts
+    GPSData.day        = 5;  //      "
+    GPSData.hour       = 23; // 7pm my local time
+    GPSData.minute     = 10;
+    GPSData.second     = 25;
+#endif // #ifndef _16x2
+#endif // #ifndef DATA_VALID_OVERRIDE
+    // Clear the screen once when leaving initialization
+    if (!leftInitialization) {
+      leftInitialization = true;
+      lcd.clear(); // Clear the LCD
+    }
+    // Display the latest info from the gps object which it derived from the data sent by the GPS unit
+    // Send data to the LCD
+#ifdef _16x2 //------------------------------------------------------
+    lcd.home (); // Go to 1st line
+    lcd.print("Lat: ");
+    lcd.print(GPSData.lat);
+    if (pastSatellites != GPSData.satellites) {
+      lcd.setCursor (11, 0);
+      lcd.print("SV:");
+      if (GPSData.satellites == 0) {
+        lcd.print("XX");
+      }
+      else if (GPSData.satellites <= 9) {
+        lcd.print(" "); // Blank leading char
+        lcd.print(GPSData.satellites);
+      }
+      else {
+        lcd.print(GPSData.satellites);
+      }
+      pastSatellites = GPSData.satellites;
+    }
+    lcd.setCursor (0, 1); // Go to 2nd line
+    lcd.print("Lon: ");
+    lcd.print(GPSData.lon);
+    if ((digitalRead(SPEED_ALTITUDE_SW))) {
+      lcd.setCursor (12, 1);
+      if (GPSData.speed < SPEED_CUTOUT) {
+        lcd.print("0  ");
+      }
+      else {
+        lcd.print((int)GPSData.speed);
+        lcd.print(" "); // Clear the extra char
+      }
+    }
+    else {
+      lcd.print("     "); // Clear the extra chars
+      if (GPSData.altitude <= 99.9) {
+        lcd.setCursor (14, 1);
+      }
+      else {
+        lcd.setCursor (13, 1);
+      }
+      lcd.print((int)GPSData.altitude); // Altitude
+      // Toggle credit every TOGGLETIME_INTERVAL seconds
+      if (now - prevCreditTime > (TOGGLETIME_INTERVAL / 2)) {
+        prevCreditTime = now;
+        if (creditToggle) { // Display credit
+          creditToggle = false;
+          lcd.print("     "); // Clear the extra chars
+          lcd.print(CREDIT); // Yours truly :-)
+        }
+        else {
+          creditToggle = true;
+          lcd.print("        "); // Clear the extra chars
+        }
+      } // if (now - prevCreditTime > TOGGLETIME_INTERVAL)
+    } // if ((digitalRead(SPEED_ALTITUDE_SW)))
+#else // 20x4 ----------------------------------------------------
+    lcd.home (); // Go to 1st line
+    lcd.print("Lat: ");
+    lcd.print(GPSData.lat);
+    if (pastSatellites != GPSData.satellites) {
+      lcd.setCursor (15, 0);
+      lcd.print("SV:");
+      if (GPSData.satellites == 0) {
+        lcd.print("XX");
+      }
+      else if (GPSData.satellites <= 9) {
+        lcd.print(" "); // Blank leading char
+        lcd.print(GPSData.satellites);
+      }
+      else {
+        lcd.print(GPSData.satellites);
+      }
+      pastSatellites = GPSData.satellites;
+    }
+    lcd.setCursor (0, 1); // Go to 2nd line
+    lcd.print("Lon: ");
+    lcd.print(GPSData.lon);
+#ifndef CONVERT_TO_LOCAL
+    // Only display if time/date is selected
+    if (!(digitalRead(ALTITUDE_DATE_TIME_SW))) {
+      lcd.print("      "); // Clear the extra chars
+      uint8_t DOW = dayOfWeek(GPSData.year, GPSData.month, GPSData.day);
+      if (IsDST(GPSData.day, GPSData.month, DOW)) {
+        lcd.print("DST");
+      }
+      else {
+        lcd.print(" ST");
+      }
+    }
+    else {
+      lcd.print("         "); // Clear the extra chars
+    }
+#endif // #ifndef CONVERT_TO_LOCAL
+    lcd.setCursor (0, 2); // Go to 3rd line
+    lcd.print("Spd: ");
+    if (GPSData.speed < SPEED_CUTOUT) {
+      lcd.print("0  ");
+    }
+    else {
+      lcd.print((int)GPSData.speed);
+      lcd.print(" "); // Clear the extra chars
+    }
+    lcd.setCursor (12, 2);
+    lcd.print("Hdg: ");
+    if (GPSData.speed < SPEED_CUTOUT) {
+      lcd.print("0  ");
+    }
+    else {
+      // Toggle heading every TOGGLETIME_INTERVAL seconds
+      if (now - prevHeadingTime > TOGGLETIME_INTERVAL) {
+        prevHeadingTime = now;
+        if (headingToggle) { // Display cardinal heading
+          headingToggle = false;
+          lcd.print(cardinal(GPSData.heading));
+        }
+        else { // Display degrees heading
+          headingToggle = true;
+          lcd.print((int)GPSData.heading);
+          if (GPSData.heading <= 99.9) lcd.print(" "); // Clear the extra char
+        } // if (headingToggle)
+      } // if (now - prevHeadingTime > TOGGLETIME_INTERVAL)
+    } // if (GPSData.speed < SPEED_CUTOUT)
+    lcd.setCursor (0, 3); // Go to 4th line
+    if ((digitalRead(ALTITUDE_DATE_TIME_SW))) {
+      lcd.print("Alt: ");
+      lcd.print((int)GPSData.altitude);
+      // Toggle credit every TOGGLETIME_INTERVAL seconds
+      if (now - prevCreditTime > (TOGGLETIME_INTERVAL / 2)) {
+        prevCreditTime = now;
+        if (creditToggle) { // Display credit
+          creditToggle = false;
+          lcd.print("         "); // Clear the extra chars
+          lcd.print(CREDIT); // Yours truly :-)
+        }
+        else {
+          creditToggle = true;
+          lcd.print("            "); // Clear the extra chars
+        }
+      } // if (now - prevCreditTime > TOGGLETIME_INTERVAL)
+      prevDateTime = TOGGLETIME_INTERVAL;
+      dateTimeToggle = true; // Default first to display date
+    } // if ((digitalRead(ALTITUDE_DATE_TIME_SW)))
+    else {
+      // Toggle date/time every TOGGLETIME_INTERVAL seconds
+      if (now - prevDateTime > TOGGLETIME_INTERVAL) {
+        prevDateTime = now;
+        if (dateTimeToggle) {
+          // Display date
+          dateTimeToggle = false;
+          lcd.print("Date: ");
+          uint8_t hour = GPSData.hour;
+          uint8_t day  = GPSData.day;
+          uint8_t month = GPSData.month;
+          uint16_t year = GPSData.year;
+#ifdef CONVERT_TO_LOCAL
+          // Convert UTC date to local date
+          bool DST = convertToLocal (&hour, &year, &month,
+                                     &day, GPSData.lon, true); // true means date conversion
+#endif // #ifdef CONVERT_TO_LOCAL
+          if (month < 10) lcd.print("0");
+          lcd.print(month);
+          lcd.print("/");
+          if (day < 10) lcd.print("0");
+          lcd.print(day);
+          lcd.print("/");
+          lcd.print(year);
+          printDay (dayOfWeek (year, month, day));
+        } // if (dateTimeToggle)
+        else {
+          // Display time
+          dateTimeToggle = true;
+          lcd.print("Time: ");
+          uint8_t hour = GPSData.hour;
+          uint8_t day  = GPSData.day;
+          uint8_t month = GPSData.month;
+          uint16_t year = GPSData.year;
+#ifdef CONVERT_TO_LOCAL
+          // Convert UTC time to local time (no need to convert the date)
+          bool DST = convertToLocal (&hour, &year, &month,
+                                     &day, GPSData.lon, false); // false means no date conversion
+#else // #ifdef CONVERT_TO_LOCAL
+#ifdef DISPLAY_12_HOUR
+          if (hour == 0) { // 12 hour clocks don't display 0
+            hour = 12;
+          }
+#endif // #ifdef DISPLAY_12_HOUR
+#endif // #ifdef CONVERT_TO_LOCAL
+#ifdef DISPLAY_12_HOUR
+          char AMPM[] = "am";
+          if (hour >= 12) { // Convert to 12 hour format
+            if (hour > 12) hour -= 12;
+            strcpy (AMPM, "pm");
+          }
+#endif
+          if (hour < 10) lcd.print("0");
+          lcd.print(hour);
+          lcd.print(":");
+          if (GPSData.minute < 10) lcd.print("0");
+          lcd.print(GPSData.minute);
+          lcd.print(":");
+          if (GPSData.second < 10) lcd.print("0");
+          lcd.print(GPSData.second);
+#ifdef DISPLAY_12_HOUR
+          lcd.print(AMPM);
+#endif // #ifdef DISPLAY_12_HOUR
+#ifdef CONVERT_TO_LOCAL
+#ifdef DISPLAY_12_HOUR
+          (DST) ? lcd.print(" DST") : lcd.print("  ST");
+#else // #ifdef DISPLAY_12_HOUR
+          (DST) ? lcd.print("   DST") : lcd.print("    ST");
+#endif // #ifdef DISPLAY_12_HOUR
+#endif // #ifndef CONVERT_TO_LOCAL
+#ifndef CONVERT_TO_LOCAL
+#ifdef DISPLAY_12_HOUR
+          lcd.print(" UTC");
+#else // #ifdef DISPLAY_12_HOUR
+          lcd.print("   UTC");
+#endif // #ifdef DISPLAY_12_HOUR
+#endif // #ifndef CONVERT_TO_LOCAL
+        } // if (dateTimeToggle)
+      } // if (now - prevDateTime > TOGGLETIME_INTERVAL)
+    } // if ((digitalRead(ALTITUDE_DATE_TIME_SW)))
+#endif //------------------------------------------------------------
+  } // if (dataValid)
+
+  // GPS data is not valid, so it must be initializing
+#ifdef _16x2 //------------------------------------------------------
+  else {
+    // Display initialization screen once every INITIALIZATION_INTERVAL
+    if (now - prevInitializationTime > INITIALIZATION_INTERVAL) {
+      prevInitializationTime = now;
+      lcd.setCursor (6, 0); // Go to 1st line
+      lcd.print("GPS");
+      lcd.setCursor (11, 0);
+      lcd.print("v");
+      lcd.print(VERSION);
+      lcd.setCursor (2, 1); // Go to 2nd line
+      lcd.print("Initializing");
+      lcd.setCursor (15, 1);
+      if (++initializingCounter > 9) initializingCounter = 1; // Limit 1 - 9
+      lcd.print(initializingCounter);
+      leftInitialization = false;
+    }
+  }
+#else // 20x4 -------------------------------------------------------
+  else {
+    // Display initialization screen once every INITIALIZATION_INTERVAL
+    if (now - prevInitializationTime > INITIALIZATION_INTERVAL) {
+      prevInitializationTime = now;
+      lcd.setCursor (8, 0); // Go to 1st line
+      lcd.print("GPS");
+      lcd.setCursor (14, 0);
+      lcd.print("v");
+      lcd.print(VERSION);
+      lcd.setCursor (4, 1); // Go to 2nd line
+      lcd.print("Initializing");
+      lcd.setCursor (6, 2); // Go to 3rd line
+      lcd.print("Data Not");
+      lcd.setCursor (7, 3); // Go to 4th line
+      lcd.print("Valid");
+      lcd.setCursor (19, 3);
+      if (++initializingCounter > 9) initializingCounter = 1; // Limit 1 - 9
+      lcd.print(initializingCounter);
+      leftInitialization = false;
+    }
+  }
+#endif //------------------------------------------------------------
+
+#ifdef DEBUG
+  // Display debug info to the serial monitor (if DEBUG is enabled)
+  // Display debug data once every DEBUG_INTERVAL
+  if (now - prevDebugTime > DEBUG_INTERVAL) {
+    prevDebugTime = now;
+    displayDebugData();
+  }
+#endif // #ifdef DEBUG
+
+} // loop
+
+#ifndef _16x2
+/* Helper functions start here
+
+  Ripped off from Electrical Engineering Stack Exchange
+  http://electronics.stackexchange.com/questions/66285/how-to-calculate-day-of-the-week-for-rtc
+  ------------------------------------------------------------
+   Returns the number of days to the start of the specified year, taking leap
+   years into account, but not the shift from the Julian calendar to the
+   Gregorian calendar. Instead, it is as though the Gregorian calendar is
+   extrapolated back in time to a hypothetical "year zero".
+*/
+uint16_t leap (uint16_t year)
+{
+  return year * 365 + (year / 4) - (year / 100) + (year / 400);
+}
+/* Returns a number representing the number of days since March 1 in the
+   hypothetical year 0, not counting the change from the Julian calendar
+   to the Gregorian calendar that occurred in the 16th century. This
+   algorithm is loosely based on a function known as "Zeller's Congruence".
+   This number MOD 7 gives the day of week, where 0 = Monday and 6 = Sunday.
+*/
+uint16_t zeller (uint16_t year, uint8_t month, uint8_t day)
+{
+  year += ((month + 9) / 12) - 1;
+  month = (month + 9) % 12;
+  return leap (year) + month * 30 + ((6 * month + 5) / 10) + day + 1;
+}
+
+// Returns the day of week for a given date.
+uint8_t dayOfWeek (uint16_t year, uint8_t month, uint8_t day)
+{
+  return (zeller (year, month, day) % 7) + 1;
+}
+//----------------------------------------------------------
+
+// Print the day of the week on the LCD
+void printDay(uint8_t day)
+{
+  if (day == 7) day = 0;
+  switch (day)
+  {
+    case 0:  lcd.print(" Mon"); break;
+    case 1:  lcd.print(" Tue"); break;
+    case 2:  lcd.print(" Wed"); break;
+    case 3:  lcd.print(" Thu"); break;
+    case 4:  lcd.print(" Fri"); break;
+    case 5:  lcd.print(" Sat"); break;
+    case 6:  lcd.print(" Sun"); break;
+    default: lcd.print(" Err");
+  }
+}
+
+// Compute the cardinal points of the compass
+const char* cardinal(double course)
+{
+#ifdef _16CARDINAL
+  const char* directions[] = {"N  ", "NNE", "NE ", "ENE", "E  ", "ESE", "SE ", "SSE",
+                              "S  ", "SSW", "SW ", "WSW", "W  ", "WNW", "NW ", "NNW"
+                             };
+#else
+  const char* directions[] = {"N  ", "N  ", "NE ", "NE ", "E  ", "E  ", "SE ", "SE ",
+                              "S  ", "S  ", "SW ", "SW ", "W  ", "W  ", "NW ", "NW "
+                             };
+#endif // #ifdef _16CARDINAL
+  uint8_t direction = (uint8_t)((course + 11.25d) / 22.5d);
+  return directions[direction % 16];
+}
+
+/* Ripped off from Stackoverflow
+  http://stackoverflow.com/questions/5590429/calculating-daylight-saving-time-from-only-date
+
+  Check to see if it's Daylight Savings Time (DST)
+*/
+bool IsDST(uint8_t day, uint8_t month , uint8_t DOW)
+{
+  // Make Day of Week (DOW) match with what Stackoverflow suggests
+  // for DOW (Sunday = 0 to Saturday = 6)
+  switch (DOW)
+  {
+    case 6:  DOW = 0; break; // Sun
+    case 7:  DOW = 1; break; // Mon
+    case 1:  DOW = 2; break; // Tue
+    case 2:  DOW = 3; break; // Wed
+    case 3:  DOW = 4; break; // Thu
+    case 4:  DOW = 5; break; // Fri
+    case 5:  DOW = 6; break; // Sat
+    default: break;
+  }
+  // January, February, and December are out
+  if (month < 3 || month > 11) {
+    return false;
+  }
+  // April to October are in
+  if (month > 3 && month < 11) {
+    return true;
+  }
+  int previousSunday = (int)(day - DOW);
+  // In march, we are DST if our previous Sunday was on or after the 8th
+  if (month == 3) {
+    return previousSunday >= 8;
+  }
+  // In November we must be before the first Sunday to be DST
+  // That means the previous Sunday must be before the 1st
+  return previousSunday <= 0;
+}
+
+#ifdef CONVERT_TO_LOCAL
+/* Convert UTC time and date to local time and date
+   Difference between UTC time/date (at Greenwich) and local time/date is 15 minutes
+   per 1 degree of longitude. See the following:
+   http://www.edaboard.com/thread101516.html
+*/
+bool convertToLocal (uint8_t* hour, uint16_t* year, uint8_t* month,
+                     uint8_t* day, const double lon, bool convertDate) {
+
+  uint8_t DaysAMonth [] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+
+  // Get Day of Week (DOW)
+  uint8_t DOW = dayOfWeek(*year, *month, *day);
+  // Get Daylight Saving Time (DST) or Standard Time (ST)
+  bool DST = IsDST(*day, *month, DOW);
+  // Compute local time (hours)
+  int UTCOffset = (int)(lon / 15.0d); // UTC offset
+  if (UTCOffset < 0) {
+    // West of Greenwich, subtract
+    UTCOffset = abs(UTCOffset); // Make offset positive
+    if (DST) --UTCOffset; // Compensate for DST
+    if (*hour <= UTCOffset) *hour += 24;
+    *hour = *hour - UTCOffset; // Subtract offset
+  }
+  else {
+    // East of Greenwich, add
+    if (DST) ++UTCOffset; // Compensate for DST
+    if (*hour <= UTCOffset) *hour += 24;
+    *hour = *hour + UTCOffset; // Add offset
+  }
+  // Convert date if convertDate flag is set
+  // Portions of the following code (with some modifications) ripped off from Instructables
+  // http://www.instructables.com/id/GPS-time-UTC-to-local-time-conversion-using-Arduin/?ALLSTEPS
+  if (convertDate) {
+    if ((24 - *hour) <= UTCOffset) { // A new UTC day started
+      if (*year % 4 == 0) DaysAMonth[1] = 29; //leap year check (the simple method)
+      if (*hour < 24) {
+        *day -= 1;
+        if (*day < 1) {
+          if (*month == 1) {
+            *month = 12;
+            *year -= 1;
+          } // if (*month == 1)
+          else {
+            *month -= 1;
+          }
+          *day = DaysAMonth[*month - 1];
+        } // if (*day < 1)
+      } // if (*hour < 24)
+      else if (*hour >= 24) {
+        day += 1;
+        if (*day > DaysAMonth[*month - 1]) {
+          *day = 1;
+          *month += 1;
+          if (*month > 12) *year += 1;
+        } // if (*day > DaysAMonth[*month - 1])
+      } // if (*hour >= 24)
+    } // if ((24 - *hour) <= UTCOffset)
+  } // if (convertDate)
+  return (DST);
+}
+#endif // #ifdef CONVERT_TO_LOCAL
+#endif // #ifndef _16x2
+
+#ifdef DEBUG
+// Displays debug data to the serial monitor
+void displayDebugData() {
+  Serial.print("Version: ");
+  Serial.println(VERSION);
+  Serial.print("Satellite Count: ");
+  Serial.println(GPSData.satellites);
+  Serial.print("Latitude: ");
+  Serial.println(GPSData.lat, 6);
+  Serial.print("Longitude: ");
+  Serial.println(GPSData.lon, 6);
+  Serial.print("Speed MPH: ");
+  Serial.println(GPSData.speed);
+  Serial.print("Altitude Feet: ");
+  Serial.println(GPSData.altitude);
+#ifdef _16x2
+  Serial.print("Alt/SPD: ");
+  Serial.println((digitalRead(SPEED_ALTITUDE_SW)) ? "Speed" : "Altitude");
+#else
+  Serial.print("Altitude/Date: ");
+  Serial.println(!(digitalRead(ALTITUDE_DATE_TIME_SW)) ? "Date/Time" : "Altitude");
+#endif
+  Serial.println((digitalRead(BACKLIGHT_SW)) ? "Backlight On" : "Backlight Off");
+  Serial.print("Data valid: ");
+  Serial.println(dataValid);
+  uint8_t DOW = dayOfWeek(GPSData.year, GPSData.month, GPSData.day);
+  Serial.print("DST = ");
+  Serial.println(IsDST(GPSData.day, GPSData.month, DOW));
+  Serial.println("");
+}
+#endif


Hardware verification code (step 1)

Hardware verification code (step 1)

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

--- Keyboard_Mouse/Keyboard_Mouse.ino
+++ Keyboard_Mouse/Keyboard_Mouse.ino
@@ -0,0 +1,40 @@
+const int TOGGLE_BTN = 2;
+const int LEFT_BTN = 12;
+const int RIGHT_BTN = 11;
+const int LED = 10;
+
+bool toggleOn = false;
+
+//this code runs once
+void setup() {
+  //create connection to Serial Monitor (Tools -> Serial Monitor or press Ctrl + Shift + M)
+  Serial.begin(9600);
+  //declare pins
+  pinMode(TOGGLE_BTN, INPUT);
+  pinMode(LEFT_BTN, INPUT);
+  pinMode(RIGHT_BTN, INPUT);
+  pinMode(LED, OUTPUT);
+}
+
+//this code runs continuously
+void loop() {
+
+  if (digitalRead(TOGGLE_BTN)){
+    toggleOn = !toggleOn;
+    if (toggleOn){
+      digitalWrite(LED, HIGH);
+    }
+    else{
+      digitalWrite(LED, LOW);
+    }
+  }
+
+  if (toggleOn) {
+    if (digitalRead(LEFT_BTN)){
+      Serial.println("Read left button");
+    }
+    else if (digitalRead(RIGHT_BTN)){
+      Serial.println("Read right button");
+    }
+  }
+}


start code to load animations.txt

start code to load animations.txt

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

--- RobotAnimations/RobotAnimations.ino
+++ RobotAnimations/RobotAnimations.ino
@@ -0,0 +1,56 @@
+#include <Wire.h>
+#include <Adafruit_PWMServoDriver.h>
+
+constexpr int kLightOnCountdownMsec = 500;
+constexpr int kLoopDelay = 50;
+constexpr int kOutputEnablePin = 9;
+
+auto _servoMux = Adafruit_PWMServoDriver();
+
+constexpr char* boneNames[] = {
+  "Torso",
+    "Clavicle.R",
+    "Shoulder.R",
+    "Upper.R",
+    "Lower.R",
+    "Clavicle.L",
+    "Shoulder.L",
+    "Upper.L",
+    "Lower.L"
+};
+
+struct Bone
+{
+  byte angle;
+};
+
+struct Frame
+{
+  Bone bones[];
+};
+
+struct Action
+{
+  Frame frames[];
+  int frameCount;
+};
+
+void setup()
+{
+  Serial.begin(115200);
+  Serial.setTimeout(1);
+
+  pinMode(LED_BUILTIN, OUTPUT);
+  pinMode(kOutputEnablePin, OUTPUT);
+
+  _servoMux.begin();
+  _servoMux.setPWMFreq(60);  // Analog servos run at ~60 Hz updates
+
+
+}
+
+void loop()
+{
+
+
+}


version string set

version string set

--- MewPro.ino
+++ MewPro.ino
@@ -50,7 +50,7 @@
 //   Copyright (c) 2014-2015 orangkucing
 //
 // MewPro firmware version string for maintenance
-#define MEWPRO_FIRMWARE_VERSION "2015051800"
+#define MEWPRO_FIRMWARE_VERSION "2015061900"

 //
 #include <Arduino.h>


add .ino code ton control arduino

add .ino code ton control arduino

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

--- arduino-orientation/arduino-orientation.ino
+++ arduino-orientation/arduino-orientation.ino
@@ -0,0 +1,43 @@
+#include <Servo.h>
+int servoPin = 3;
+unsigned long serialdata;
+int inbyte;
+Servo RealDevice;
+
+void setup() {
+  Serial.begin(9600);
+  RealDevice.attach(servoPin);
+  RealDevice.write(0);
+}
+
+void loop() {
+  if (Serial.available() > 0)  {
+    rotate(serial());
+  }
+}
+
+long serial() {
+  serialdata = 0;
+  // use newline char to break
+  while (true) {
+    inbyte = Serial.read();
+    if (inbyte >= 0 && inbyte != 10) {
+      serialdata = serialdata * 10 + inbyte - '0';
+    }
+    if(inbyte == 10) {
+      break;
+    }
+  }
+  inbyte = 0;
+  return serialdata;
+}
+
+void rotate(long a) {
+  if(a >= 0 && a <=180) {
+    RealDevice.write(a);
+    Serial.println(200);
+  }else{
+    Serial.println(-1);
+  }
+}
+


add wheel mode example

add wheel mode example

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

--- examples/wheel_mode/wheel_mode.ino
+++ examples/wheel_mode/wheel_mode.ino
@@ -0,0 +1,44 @@
+// Test motor wheel mode
+
+#include "DynamixelMotor.h"
+
+// id of the motor
+const uint8_t id=1;
+// speed, between -1023 and 1023
+int16_t speed=512;
+// communication baudrate
+const long unsigned int baudrate = 1000000;
+
+// hardware serial without tristate buffer
+// see blink_led example, and adapt to your configuration
+HardwareDynamixelInterface interface(Serial);
+
+DynamixelMotor motor(interface, id);
+
+void setup()
+{
+  interface.begin(baudrate);
+  delay(100);
+
+  // check if we can communicate with the motor
+  // if not, we turn the led on and stop here
+  uint8_t status=motor.init();
+  if(status!=DYN_STATUS_OK)
+  {
+    pinMode(LED_BUILTIN, OUTPUT);
+    digitalWrite(LED_BUILTIN, HIGH);
+    while(1);
+  }
+
+  motor.enableTorque();
+  motor.wheelMode();
+}
+
+//change motion direction every 5 seconds
+void loop()
+{
+  motor.speed(speed);
+  speed=-speed;
+  delay(5000);
+}
+


Add mqtt Led example

Add mqtt Led example

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

--- examples/mqtt/ethernet/Led/Led.ino
+++ examples/mqtt/ethernet/Led/Led.ino
@@ -0,0 +1,57 @@
+#include <SPI.h>
+#include <Ethernet.h>
+#include <PubSubClient.h>
+
+int const led = 2;
+
+#define TOKEN "your token here"
+
+uint8_t server[] = { 77, 73, 82, 243 };
+void callback(char *, byte *, unsigned int);
+EthernetClient ethClient;
+PubSubClient client(server, 1883, callback, ethClient);
+
+void setup() {
+    Serial.begin(9600);
+    pinMode(led, OUTPUT);
+
+    startEthernet();
+
+    while (!client.connect("arduinoclient")) {
+        Serial.println("Could not subscribe, retrying...");
+    }
+    Serial.println("Client connected to mqtt broker!");
+
+    String topic = "v2/things/" + String(TOKEN);
+    client.subscribe((char*)topic.c_str());
+
+}
+
+void loop() {
+    client.loop();
+}
+
+void callback(char* topic, byte* payload, unsigned int length) {
+    // handle message arrived
+    String text = "";
+    for (int i = 0; i < length; i++)
+        text.concat((char)payload[i]);
+    Serial.println(text);
+    text.replace(" ", "");
+    text.toUpperCase();
+    if (text.indexOf("{\"KEY\":\"LED\",\"VALUE\":\"ON\"}") >= 0) digitalWrite(led, HIGH);
+    else if (text.indexOf("{\"KEY\":\"LED\",\"VALUE\":\"OFF\"}") >= 0) digitalWrite(led, LOW);
+}
+
+
+void startEthernet() {
+    Serial.println("Connecting Arduino to network...");
+
+    // Local Network Settings
+    byte mac[] = { 0xD4, 0x28, 0xB2, 0xFF, 0xA0, 0xA1 }; // Must be unique on local network
+
+    // Connect to network amd obtain an IP address using DHCP
+    while (Ethernet.begin(mac) == 0)
+        Serial.println("DHCP Failed, retrying");
+    Serial.println("Arduino connected to network using DHCP");
+}


BLE_uart example

BLE_uart example

Combines the Notify and Write examples to create a basic UART example
that works with the Nordic nRF Android app and many others. Could use a
Print function and possibly read function, but basic RX/TX does work.

error: pathspec 'cpp_utils/tests/BLETests/Arduino/BLE_uart/BLE_uart.ino' did not match any file(s) known to git

--- cpp_utils/tests/BLETests/Arduino/BLE_uart/BLE_uart.ino
+++ cpp_utils/tests/BLETests/Arduino/BLE_uart/BLE_uart.ino
@@ -0,0 +1,111 @@
+/*
+    Video: https://www.youtube.com/watch?v=oCMOYS71NIU
+    Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleNotify.cpp
+    Ported to Arduino ESP32 by Evandro Copercini
+
+   Create a BLE server that, once we receive a connection, will send periodic notifications.
+   The service advertises itself as: 6E400001-B5A3-F393-E0A9-E50E24DCCA9E
+   Has a characteristic of: 6E400002-B5A3-F393-E0A9-E50E24DCCA9E - used for receiving data with "WRITE"
+   Has a characteristic of: 6E400003-B5A3-F393-E0A9-E50E24DCCA9E - used to send data with  "NOTIFY"
+
+   The design of creating the BLE server is:
+   1. Create a BLE Server
+   2. Create a BLE Service
+   3. Create a BLE Characteristic on the Service
+   4. Create a BLE Descriptor on the characteristic
+   5. Start the service.
+   6. Start advertising.
+
+   In this example rxValue is the data received (only accessible inside that function).
+   And txValue is the data to be sent, in this example just a byte incremented every second.
+*/
+#include <BLEDevice.h>
+#include <BLEServer.h>
+#include <BLEUtils.h>
+#include <BLE2902.h>
+
+BLECharacteristic *pCharacteristic;
+bool deviceConnected = false;
+uint8_t txValue = 0;
+
+// See the following for generating UUIDs:
+// https://www.uuidgenerator.net/
+
+#define SERVICE_UUID           "6E400001-B5A3-F393-E0A9-E50E24DCCA9E" // UART service UUID
+#define CHARACTERISTIC_UUID_RX "6E400002-B5A3-F393-E0A9-E50E24DCCA9E"
+#define CHARACTERISTIC_UUID_TX "6E400003-B5A3-F393-E0A9-E50E24DCCA9E"
+
+
+class MyServerCallbacks: public BLEServerCallbacks {
+    void onConnect(BLEServer* pServer) {
+      deviceConnected = true;
+    };
+
+    void onDisconnect(BLEServer* pServer) {
+      deviceConnected = false;
+    }
+};
+
+class MyCallbacks: public BLECharacteristicCallbacks {
+    void onWrite(BLECharacteristic *pCharacteristic) {
+      std::string rxValue = pCharacteristic->getValue();
+
+      if (rxValue.length() > 0) {
+        Serial.println("*********");
+        Serial.print("Received Value: ");
+        for (int i = 0; i < rxValue.length(); i++)
+          Serial.print(rxValue[i]);
+
+        Serial.println();
+        Serial.println("*********");
+      }
+    }
+};
+
+
+void setup() {
+  Serial.begin(115200);
+
+  // Create the BLE Device
+  BLEDevice::init("UART Service");
+
+  // Create the BLE Server
+  BLEServer *pServer = new BLEServer();
+  pServer->setCallbacks(new MyServerCallbacks());
+
+  // Create the BLE Service
+  BLEService *pService = pServer->createService(SERVICE_UUID);
+
+  // Create a BLE Characteristic
+  pCharacteristic = pService->createCharacteristic(
+                      CHARACTERISTIC_UUID_TX,
+                      BLECharacteristic::PROPERTY_NOTIFY
+                    );
+
+  pCharacteristic->addDescriptor(new BLE2902());
+
+  BLECharacteristic *pCharacteristic = pService->createCharacteristic(
+                                         CHARACTERISTIC_UUID_RX,
+                                         BLECharacteristic::PROPERTY_WRITE
+                                       );
+
+  pCharacteristic->setCallbacks(new MyCallbacks());
+
+  // Start the service
+  pService->start();
+
+  // Start advertising
+  pServer->getAdvertising()->start();
+  Serial.println("Waiting a client connection to notify...");
+}
+
+void loop() {
+
+  if (deviceConnected) {
+    Serial.printf("*** Sent Value: %d ***\n", txValue);
+    pCharacteristic->setValue(&txValue, 1);
+    pCharacteristic->notify();
+    txValue++;
+  }
+  delay(1000);
+}


Fresh Upload

Fresh Upload

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

--- OpenCTD_qDuino/OpenCTD_qDuino.ino
+++ OpenCTD_qDuino/OpenCTD_qDuino.ino
@@ -0,0 +1,125 @@
+//Wire and MS5803_I2C libraries for communicating with the pressure sensor.
+
+#include <Wire.h>
+#include <SparkFun_MS5803_I2C.h>
+
+//EC Circuit uses software serial
+#include <SoftwareSerial.h>     // For use by EC circuit.
+
+//OneWire is used to get data from both temperature and conductivity sensors
+#include <OneWire.h>
+
+//DallasTemperature is used to query the temeprature sensors
+#include <DallasTemperature.h>
+
+// For the SD card reader.
+#include <SPI.h>
+#include <SD.h>
+
+// Declare global variables.
+float tempA;
+float tempB;
+float tempC;
+
+float EC_float = 0;  // Electrical conductivity.
+
+char EC_data[48];    // A 48 byte character array to hold incoming data from the conductivity circuit.
+char *EC;            // Character pointer for string parsing.
+
+byte received_from_sensor = 0;  // How many characters have been received.
+byte string_received = 0;       // Whether it received a string from the EC circuit.
+
+SoftwareSerial ecSerial(8, 9);      // Define the SoftwareSerial port for conductivity.
+OneWire oneWire(6);        // Define the OneWire port for temperature.
+DallasTemperature sensors(&oneWire);  // Define DallasTemperature input based on OneWire.
+MS5803 sensor(ADDRESS_HIGH);          // Define pressure sensor.
+
+double pressure_abs; //define absolute pressure variable
+
+// Starts it up.
+//
+void setup(void) {
+
+  Serial.begin(9600);   // Set baud rate.
+  ecSerial.begin(9600); // Set baud rate for conductivty circuit.
+
+  pinMode(10, OUTPUT);  // Set data output pin for the SD card reader.
+
+  // Test to see if the SD card reader is functioning.
+  if (!SD.begin(4)) {
+    Serial.println("Card failed");  // Log to serial monitor if SD card doesn't work.
+    return;
+  }
+  delay(500);  // Wait half a second before continuing.
+
+  sensor.reset(); //reset pressure sensor
+  sensor.begin(); //initialize pressure sensor
+  sensors.begin();  // Intialize the temperature sensors.
+
+  delay(250);       // Wait a quarter second to continue.
+
+}
+
+void loop(void) {
+
+  // Read any pending data from the EC circuit.
+  if (ecSerial.available() > 0) {
+    received_from_sensor = ecSerial.readBytesUntil(13, EC_data, 48);
+
+    // Null terminate the data by setting the value after the final character to 0.
+    EC_data[received_from_sensor] = 0;
+  }
+
+  // Parse data, if EC_data begins with a digit, not a letter (testing ASCII values).
+  if ((EC_data[0] >= 48) && (EC_data[0] <=57)) {
+    parse_data();
+  }
+
+  delay(10);  // Wait 10 milliseconds.
+
+  // Read temperature sensors.
+  sensors.requestTemperatures();
+  tempA = sensors.getTempCByIndex(0);
+  tempB = sensors.getTempCByIndex(1);
+  tempC = sensors.getTempCByIndex(2);
+
+  // Log to the SD card...
+  File dataFile = SD.open("datalog.txt", FILE_WRITE);
+  if (dataFile) {
+    dataFile.print(sensor.getPressure(ADC_4096));
+    dataFile.print("  ");
+    dataFile.print(tempA);
+    dataFile.print("  ");
+    dataFile.print(tempB);
+    dataFile.print("  ");
+    dataFile.print(tempC);
+    dataFile.print("  ");
+    dataFile.println(EC);
+    dataFile.close();
+  }
+  else {
+
+  }
+
+  // Log to the serial monitor.
+  Serial.print(sensor.getPressure(ADC_4096));
+  Serial.print("  ");
+  Serial.print(tempA);
+  Serial.print("  ");
+  Serial.print(tempB);
+  Serial.print("  ");
+  Serial.print(tempC);
+  Serial.print("  ");
+  Serial.print(EC);
+  Serial.println("");
+
+  delay(50);  // Wait 50 milliseconds.
+}
+
+
+// Parses data from the EC Circuit.
+void parse_data() {
+
+  EC = strtok(EC_data, ",");
+
+}


First version of Roborover core

First version of Roborover core

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

--- Roborover_core/Roborover_core.ino
+++ Roborover_core/Roborover_core.ino
@@ -0,0 +1,78 @@
+//Roborover Core
+
+//add libraries
+#include <NewPing.h>
+#include <Servo.h>
+#include <L9110.h>
+
+L9110 L9110;
+
+// setup pin for LiPo Monitor
+int LiPoMonitor = 2;
+// setup servo and sonar module
+NewPing sonar(4,3);
+Servo sonarServo;
+
+void setup()
+{
+  pinMode(LiPoMonitor, INPUT);
+  sonarServo.attach(9);
+  Serial.begin(115200);
+}
+
+void loop()
+{
+  while(getFrontDistance() < 30)
+  {
+    L9110.fullStop();
+    if (getRightDistance() >= getLeftDistance())
+    {
+      L9110.right();
+      //delay(250);
+    }else{
+      L9110.left();
+      //delay(250);
+    }
+  }
+  L9110.forward();
+  delay(100);
+
+}
+
+// Get distance to the front of the robot
+float getFrontDistance()
+{
+  sonarServo.write(90);
+  delay(1500);
+  int frontDistance = sonar.ping_cm();
+  Serial.print("Ping front ");
+  Serial.print(frontDistance);
+  Serial.println(" cm");
+  return frontDistance;
+}
+
+// get distance to the left
+float getLeftDistance()
+{
+  sonarServo.write(180);
+  delay(1500);
+  int leftDistance = sonar.ping_cm();
+  Serial.print("Ping left ");
+  Serial.print(leftDistance);
+  Serial.println(" cm");
+  sonarServo.write(90);
+  return leftDistance;
+}
+
+// get distance to the right
+float getRightDistance()
+{
+  sonarServo.write(0);
+  delay(1500);
+  int rightDistance = sonar.ping_cm();
+  Serial.print("Ping right ");
+  Serial.print(rightDistance);
+  Serial.println(" cm");
+  sonarServo.write(90);
+  return rightDistance;
+}


add scales_kit example

add scales_kit example

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

--- examples/KIT/SCALES_KIT/SCALES_KIT.ino
+++ examples/KIT/SCALES_KIT/SCALES_KIT.ino
@@ -0,0 +1,114 @@
+/*
+*******************************************************************************
+* Copyright (c) 2022 by M5Stack
+*                  Equipped with M5Core sample source code
+*                          配套  M5Core 示例源代码
+* Visit the website for more information：https://docs.m5stack.com/en/app/scales_kit
+* 获取更多资料请访问：https://docs.m5stack.com/zh_CN/app/scales_kit
+*
+* describe: SCALES KIT WEIGHT UNIT EXAMPLE.
+* date：2022/02/23
+*******************************************************************************
+  Connect WEIGHT UNIT to port B (G26/36), calibration instructions: press button A to remove the tare weight when there is no load,
+  press button B, switch the standard weight value left and right and put down the corresponding weight, confirm for calibration.
+  将WEIGHT UNIT连接至端口B（G26/36）， 校准说明：无负重情况下按下按键A去处皮重， 按下按键B，左右切换标准重量值并放下对应重量砝码，comfirm进行校准。
+  Libraries:
+  - [HX711](https://github.com/bogde/HX711)
+
+*/
+
+#include <M5Stack.h>
+#include <M5GFX.h>
+#include "HX711.h"
+
+M5GFX display;
+M5Canvas canvas(&display);
+
+// HX711 related pin Settings.  HX711 相关引脚设置
+#define LOADCELL_DOUT_PIN 36
+#define LOADCELL_SCK_PIN 26
+
+HX711 scale;
+
+void setup() {
+  M5.begin(); //Init M5Stack.  初始化M5Stack
+  M5.Power.begin(); //Init power  初始化电源模块
+  display.begin();
+  canvas.setColorDepth(1); // mono color
+  canvas.createSprite(display.width(), display.height());
+  canvas.setTextDatum(MC_DATUM);
+  canvas.setPaletteColor(1, GREEN);
+
+  canvas.drawString("Calibration sensor....", 160, 80);
+  canvas.pushSprite(0, 0);
+  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
+
+
+  scale.set_gain();
+  //The scale value is the adc value corresponding to 1g
+  scale.set_scale(27.61f);  //set scale
+  scale.tare(); // auto set offset
+}
+
+char info[100];
+
+void loop() {
+  canvas.fillSprite(BLACK);
+  canvas.setTextSize(1);
+  canvas.drawString("Connect the Weight Unit to PortB(G26,G36)", 160, 40);
+  canvas.drawString("Click Btn A for Tare deduction", 160, 55);
+  canvas.drawString("Click Btn B Switch to Calibration mode", 160, 70);
+  float weight = scale.get_units(10)/1000.0;
+  // float weight = scale.get_units(10) / 1.0;
+  canvas.setTextSize(3);
+  if(weight >= 0) {
+    Serial.printf("Weight: %.2f", weight);
+    sprintf(info, "Weight: %.2f", weight);
+    canvas.drawString(String(info) + "kg", 160, 150);
+    // canvas.drawString(String(info) + "g", 160, 150);
+  }else{
+    canvas.drawString("Weight: 0kg", 160, 150);
+    // canvas.drawString("Weight: 0g", 160, 150);
+  }
+  M5.update();
+  if (M5.BtnA.wasPressed()) {
+    scale.tare();
+    canvas.drawString("0g Calibration!", 160, 180);
+  }
+  if (M5.BtnB.wasPressed()) {
+    long kg = 5;
+    while (1)
+    {
+      M5.update();
+      canvas.fillSprite(BLACK);
+      canvas.setTextSize(1);
+      canvas.drawString("Connect the Weight Unit to PortB(G26,G36)", 160, 40);
+      canvas.drawString("Click Btn A/C to change kg value", 160, 55);
+      canvas.drawString("Click Btn B Calibration Comfirm", 160, 70);
+      canvas.setTextSize(3);
+      canvas.drawString("Calibration:" + String(kg) + "kg", 160, 150);
+      canvas.drawString("comfirm", 160, 200);
+      canvas.fillTriangle(40, 200, 60, 220, 60, 180, 1);
+      canvas.fillTriangle(280, 200, 260, 220, 260, 180, 1);
+      canvas.pushSprite(0, 0);
+      if(M5.BtnA.isPressed()){
+        kg--;
+      }
+      if(M5.BtnC.isPressed()){
+        kg++;
+      }
+      if(M5.BtnB.wasPressed()){
+        break;
+      }
+      delay(10);
+    }
+    long kg_adc = scale.read_average(20);
+    kg_adc = kg_adc - scale.get_offset();
+    scale.set_scale( kg_adc / (kg * 1000.0));
+    // canvas.drawString(String(kg) + "kg Calibration: " + String(kg_adc / (kg * 1000.0)), 160, 180);
+    canvas.drawString("Set Scale: " + String(kg_adc / (kg * 1000.0)), 160, 180);
+    canvas.pushSprite(0, 0);
+    delay(1000);
+  }
+  canvas.pushSprite(0, 0);
+}


actually adding the file that had been moved for the previous commit...

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

--- Arduino/Bumblebee/Bumblebee.ino
+++ Arduino/Bumblebee/Bumblebee.ino
@@ -0,0 +1,139 @@
+#include <Wire.h>
+#include <Adafruit_MotorShield.h>
+#include "utility/Adafruit_MS_PWMServoDriver.h"
+
+Adafruit_MotorShield AFMS = Adafruit_MotorShield();
+
+Adafruit_DCMotor *motorLeft = AFMS.getMotor(1);
+Adafruit_DCMotor *motorRight = AFMS.getMotor(2);
+
+int sweeperPin = 5;
+int blowerPin = 6;
+
+int delayTime = 100;
+
+//  Note: Commented out as my motor controller is trashed
+//Adafruit_DCMotor *motorBrush = AFMS.getMotor(3);
+//Adafruit_DCMotor *motorSweeperBlower = AFMS.getMotor(4);
+
+void setup()
+{
+
+	//  Need to setup serial
+	Serial.begin(115200);
+
+	pinMode(sweeperPin, OUTPUT);
+	pinMode(blowerPin, OUTPUT);
+
+	while (!Serial) {
+		; //  Wait for serial to initialise
+
+	//  initialise things for the motor shield
+	//  do whatever else needs doing
+
+	}
+
+	Serial.println("Serial connected!");
+
+	AFMS.begin();
+}
+
+void loop()
+{
+	int leftMotorSpeed, rightMotorSpeed, sweeperSpeed, blowerSpeed;
+	leftMotorSpeed = rightMotorSpeed = sweeperSpeed = blowerSpeed = 0;
+
+	// listen for commands on the serial port
+	bool gotData = false;
+
+	while (Serial.available() > 0) {
+		// if command received, action it
+		// commands:
+		//	To set motors; L or R and +- 0..255.
+		//	W   s[W]eeper, 0..255
+		//	B	[B]lower, 0..255
+		//  S	get [S]ensor data, to be defined once sensors hooked up
+
+		char inc = Serial.read();
+		gotData = true;
+
+		switch (inc)
+		{
+		case 'L':
+			leftMotorSpeed = GetMotorValue();
+			break;
+		case 'R':
+			rightMotorSpeed = GetMotorValue();
+			break;
+		case 'W':
+			sweeperSpeed = GetMotorValue();
+			break;
+		case 'B':
+			blowerSpeed = GetMotorValue();
+			break;
+		case 'D':
+			delayTime = GetMotorValue();
+			break;
+		}
+	}
+
+	if (gotData)
+	{
+		String returnVal = "Left: " + String(leftMotorSpeed) +
+			", Right: " + String(rightMotorSpeed) +
+			", Sweeper: " + String(sweeperSpeed) +
+			", Blower: " + String(blowerSpeed);
+
+		Serial.println(returnVal);
+
+		SetMotorValue(motorLeft, leftMotorSpeed);
+		SetMotorValue(motorRight, rightMotorSpeed);
+
+		analogWrite(blowerPin, blowerSpeed);
+		analogWrite(sweeperPin, sweeperSpeed);
+
+		delay(delayTime);
+	}
+
+	motorLeft->run(RELEASE);
+	motorRight->run(RELEASE);
+
+	analogWrite(blowerPin, 0);
+	analogWrite(sweeperPin, 0);
+}
+
+int GetMotorValue() {
+	char inc = Serial.read();
+	bool isPositive = true;
+
+	if (inc == '-')
+	{
+		isPositive = false;
+	}
+
+	int val =
+		((Serial.read() - 48) * 100) +
+		((Serial.read() - 48) * 10) +
+		(Serial.read() - 48);
+
+	int retval = (isPositive ? val : val * -1);
+
+	//Serial.println("Retval: " + String(retval));
+
+	return retval;
+}
+
+void SetMotorValue(Adafruit_DCMotor* motor, int inputSpeed) {
+	uint8_t speed = inputSpeed >= 0 ? inputSpeed : inputSpeed * -1;
+	motor->setSpeed(speed);
+
+	//Serial.println(String(speed));
+
+	if (inputSpeed > 0) {
+		motor->run(FORWARD);
+	}
+	else
+	{
+		motor->run(BACKWARD);
+	}
+}


add firmware file

add firmware file

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

--- examples/new_firmware/new_firmware.ino
+++ examples/new_firmware/new_firmware.ino
@@ -0,0 +1,272 @@
+/*firmware of multichannel gas sensor v2.0*3
+  write by loovee
+  2016-11-6
+
+  Factory adc value of 3 channels:
+  NH3 = 860
+  CO  = 950
+  NO2 = 155
+
+  Default address is 0x04
+*/
+
+#include <Wire.h>
+#include <EEPROM.h>
+
+#define DEFAULT_I2C_ADDR 0x04
+#define DBG                     1
+// EEPROM ADDRESS
+#define ADDR_IS_SET             0           // if this is the first time to run, if 1126, set
+#define ADDR_FACTORY_ADC_NH3    2
+#define ADDR_FACTORY_ADC_CO     4
+#define ADDR_FACTORY_ADC_NO2    6
+
+#define ADDR_USER_ADC_HN3       8
+#define ADDR_USER_ADC_CO        10
+#define ADDR_USER_ADC_NO2       12
+#define ADDR_IF_CALI            14          // IF USER HAD CALI
+#define ADDR_I2C_ADDRESS        20
+// I2C COMMAND
+
+#define CMD_ADC_RES0            1           // NH3
+#define CMD_ADC_RES1            2           // CO
+#define CMD_ADC_RES2            3           // NO2
+#define CMD_ADC_RESALL          4           // ALL CHANNEL
+#define CMD_CHANGE_I2C          5           // CHANGE I2C
+#define CMD_READ_EEPROM         6           // READ EEPROM VALUE, RETURN UNSIGNED INT
+#define CMD_SET_R0_ADC          7           // SET R0 ADC VALUE
+#define CMD_GET_R0_ADC          8           // GET R0 ADC VALUE
+#define CMD_GET_R0_ADC_FACTORY  9           // GET FACTORY R0 ADC VALUE
+#define CMD_CONTROL_LED         10
+#define CMD_CONTROL_PWR         11
+
+// EEPROM READ AND WRITE - UNSIGNED INT
+void eeprom_write(int addr, unsigned int value)
+{
+    EEPROM.write(addr, value>>8);
+    EEPROM.write(addr+1, value&0xff);
+}
+
+unsigned int eeprom_read(int addr)
+{
+    unsigned int r = EEPROM.read(addr);
+    r <<= 8;
+    r+= EEPROM.read(addr+1);
+    return r;
+}
+
+const int pin_pwr = 8;
+const int pin_led = 9;
+
+const int pin_NH3   = A0;           // RES0
+const int pin_CO    = A1;           // RES1
+const int pin_NO2   = A2;           // RES2
+
+unsigned char i2c_address = 0;
+
+#define LED_ON()    digitalWrite(pin_led, LOW)
+#define LED_OFF()   digitalWrite(pin_led, HIGH)
+
+void factory_init()
+{
+#if DBG
+    Serial.print("FACTORY: ");
+#endif
+    if(1126 != eeprom_read(ADDR_IS_SET))            // IF FACTORY SET
+    {
+#if DBG
+        Serial.println("YES");
+#endif
+        eeprom_write(ADDR_IS_SET, 1126);
+        eeprom_write(ADDR_FACTORY_ADC_NH3, 860);
+        eeprom_write(ADDR_FACTORY_ADC_CO, 950);
+        eeprom_write(ADDR_FACTORY_ADC_NO2, 155);
+        eeprom_write(ADDR_USER_ADC_HN3, 860);
+        eeprom_write(ADDR_USER_ADC_CO, 950);
+        eeprom_write(ADDR_USER_ADC_NO2, 155);
+        eeprom_write(ADDR_IF_CALI, 0);
+        eeprom_write(ADDR_I2C_ADDRESS, DEFAULT_I2C_ADDR);
+    }
+#if DBG
+    else Serial.println("NO");
+#endif
+}
+
+int getAnalog(int pin)
+{
+    long sum = 0;
+    for(int i=0; i<64; i++)
+    {
+        sum += analogRead(pin);
+    }
+    return sum>>6;
+}
+
+unsigned int ADC_RES0 = 0;
+unsigned int ADC_RES1 = 0;
+unsigned int ADC_RES2 = 0;
+
+unsigned char raw_adc[6];
+
+void updateValue()
+{
+    static unsigned long timer_s = millis();
+    if(millis()-timer_s < 1000)return;
+    timer_s = millis();
+
+    ADC_RES0 = getAnalog(pin_NH3);
+    ADC_RES1 = getAnalog(pin_CO);
+    ADC_RES2 = getAnalog(pin_NO2);
+
+    raw_adc[0] = ADC_RES0>>8;
+    raw_adc[1] = ADC_RES0;
+    raw_adc[2] = ADC_RES1>>8;
+    raw_adc[3] = ADC_RES1;
+    raw_adc[4] = ADC_RES2>>8;
+    raw_adc[5] = ADC_RES2;
+}
+
+void setup()
+{
+#if DBG
+    Serial.begin(115200);
+#endif
+    pinMode(pin_pwr, OUTPUT);
+    digitalWrite(pin_pwr, HIGH);
+    pinMode(pin_led, OUTPUT);
+
+    factory_init();
+    i2c_address = eeprom_read(ADDR_I2C_ADDRESS);
+#if DBG
+    Serial.print("i2d address = 0x");
+    Serial.println(i2c_address, HEX);
+#endif
+    for(int i=0; i<5; i++)
+    {
+        digitalWrite(pin_led, LOW);
+        delay(100);
+        digitalWrite(pin_led, HIGH);
+        delay(100);
+    }
+
+    Wire.begin(i2c_address);           // join i2c bus with address
+    Wire.onReceive(receiveCallback);        // register receive callback
+    Wire.onRequest(requestCallback);        // register request callback
+}
+
+void loop()
+{
+    updateValue();
+}
+
+unsigned char recvCmd = 0;
+unsigned char recvDta = 0;
+unsigned char recvDtaStr[10];
+
+void receiveCallback(int dtaCount)
+{
+    if(dtaCount == 1)
+    {
+        recvCmd  = Wire.read();
+    }
+    else if(dtaCount == 2)     // set i2c address
+    {
+        recvCmd = Wire.read();
+        recvDta = Wire.read();
+
+        if(CMD_CHANGE_I2C == recvCmd)
+        {
+            i2c_address = recvDta;
+            eeprom_write(ADDR_I2C_ADDRESS, i2c_address);
+            Wire.begin(i2c_address);
+        }
+        else if(CMD_CONTROL_LED == recvCmd)
+        {
+            if(0 == recvDta)LED_OFF();
+            else if(1 == recvDta)LED_ON();
+        }
+        else if(CMD_CONTROL_PWR == recvCmd)
+        {
+            if(0 == recvDta)digitalWrite(pin_pwr, LOW);
+            else if(1 == recvDta)digitalWrite(pin_pwr, HIGH);
+        }
+    }
+    else if(dtaCount == 7)      // set ADC value
+    {
+        recvCmd = Wire.read();
+        unsigned int dta[3];
+
+        for(int i=0; i<3; i++)
+        {
+            dta[i] = Wire.read();
+            dta[i] <<= 8;
+            dta[i] += Wire.read();
+        }
+
+        if(recvCmd == CMD_SET_R0_ADC)
+        {
+            eeprom_write(ADDR_USER_ADC_HN3, dta[0]);
+            eeprom_write(ADDR_USER_ADC_CO, dta[1]);
+            eeprom_write(ADDR_USER_ADC_NO2, dta[2]);
+        }
+    }
+}
+
+unsigned char rcDta[10];
+void requestCallback()
+{
+    switch(recvCmd)
+    {
+        case CMD_ADC_RES0:                      // NH3
+        Wire.write(&raw_adc[0], 2);             // HIGH FIRST
+
+        break;
+
+        case CMD_ADC_RES1:                      // CO
+        Wire.write(&raw_adc[2], 2);             // HIGH FIRST
+        break;
+
+        case CMD_ADC_RES2:                      // NO2
+        Wire.write(&raw_adc[4], 2);             // HIGH FIRST
+        break;
+
+        case CMD_ADC_RESALL:
+        Wire.write(raw_adc, 6);
+        break;
+
+        case CMD_READ_EEPROM:
+        rcDta[0] = EEPROM.read(recvDta);
+        rcDta[1] = EEPROM.read(recvDta+1);
+        Wire.write(rcDta, 2);
+        break;
+
+        case CMD_GET_R0_ADC:
+
+        rcDta[0] = EEPROM.read(ADDR_USER_ADC_HN3);
+        rcDta[1] = EEPROM.read(ADDR_USER_ADC_HN3+1);
+        rcDta[2] = EEPROM.read(ADDR_USER_ADC_CO);
+        rcDta[3] = EEPROM.read(ADDR_USER_ADC_CO+1);
+        rcDta[4] = EEPROM.read(ADDR_USER_ADC_NO2);
+        rcDta[5] = EEPROM.read(ADDR_USER_ADC_NO2+1);
+
+        Wire.write(rcDta, 6);
+
+        break;
+
+        case CMD_GET_R0_ADC_FACTORY:
+
+        rcDta[0] = EEPROM.read(ADDR_FACTORY_ADC_NH3);
+        rcDta[1] = EEPROM.read(ADDR_FACTORY_ADC_NH3+1);
+        rcDta[2] = EEPROM.read(ADDR_FACTORY_ADC_CO);
+        rcDta[3] = EEPROM.read(ADDR_FACTORY_ADC_CO+1);
+        rcDta[4] = EEPROM.read(ADDR_FACTORY_ADC_NO2);
+        rcDta[5] = EEPROM.read(ADDR_FACTORY_ADC_NO2+1);
+
+        Wire.write(rcDta, 6);
+        break;
+
+        default:;
+    }
+}
+
+// END FILE


Create CAN_Trans_Sim.ino

Create CAN_Trans_Sim.ino

This simulates the format that the LV board should provide data in. I think its pretty much right, but I haven't been able to confirm that all data is correct on the receiver end.

The bit shifting is a pain to work out, but its taken from the packet description we got from Daniel.

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

--- CAN_Trans_Sim/CAN_Trans_Sim.ino
+++ CAN_Trans_Sim/CAN_Trans_Sim.ino
@@ -0,0 +1,91 @@
+//============================ CAN Transmitter Module ============================
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "Energia.h"
+#include "driverlib/pin_map.h"
+#include "driverlib/gpio.h"
+#include "driverlib/sysctl.h"
+#include "driverlib/can.h"
+#include "inc/hw_memmap.h"
+
+void setup()
+{
+  Serial.begin(115200);           // - Enable UART1 for debugging information
+
+  //-----------------------------CAN0 Configuration-------------------------------
+  Serial.println("Setting up CAN peripheral...");
+  SysCtlPeripheralEnable(SYSCTL_PERIPH_CAN0);          // - Enable clock for CAN0
+  SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);         // - Enable clock for GPIOE
+
+                                  // - Enable GPIOE Pins 4&5 for CAN
+  GPIOPinTypeCAN(GPIO_PORTE_BASE, GPIO_PIN_4 | GPIO_PIN_5);
+  GPIOPinConfigure(GPIO_PE4_CAN0RX);
+  GPIOPinConfigure(GPIO_PE5_CAN0TX);
+
+  CANInit(CAN0_BASE);            // - Initialize & Configure CAN peripheral
+  CANBitRateSet(CAN0_BASE, SysCtlClockGet(), 500000);
+  CANEnable(CAN0_BASE);
+
+  Serial.println("Configuration complete.\n");
+}
+
+int i=0;
+void loop()
+{
+  //---------------------------Assemble CAN Message------------------------------
+  uint16_t HV_Voltage = random(0, 500);
+  uint8_t HV_Amp = random(0, 200);
+  uint8_t inv_Faults = random(0, 15);
+  uint8_t throttle_Pos = random(0, 100);
+  uint8_t brake_Pos = random(0, 100);
+  uint8_t car_Faults = random(0, 15);
+  uint8_t LV_Battery_Voltage = random(0, 150);
+  uint16_t energy_Used = random(0, 800);
+
+  Serial.print("HV Voltage: ");            Serial.println(HV_Voltage);
+  Serial.print("HV Amp: ");                Serial.println(HV_Amp);
+  Serial.print("Inverter Faults: ");       Serial.println(inv_Faults);
+  Serial.print("Throttle Position: ");     Serial.println(throttle_Pos);
+  Serial.print("Brake Position: ");        Serial.println(brake_Pos);
+  Serial.print("Car Faults: ");            Serial.println(car_Faults);
+  Serial.print("LV Battery Voltage: ");    Serial.println(LV_Battery_Voltage);
+  Serial.print("Energy Used: ");           Serial.println(energy_Used);
+
+  uint8_t tx_Message[8];
+  tx_Message[0] = (HV_Voltage & 0x01FF) >> 1;
+  tx_Message[1] = ((HV_Voltage & 0x01FF) << 7) | ((HV_Amp & 0x00FF) >> 1);
+  tx_Message[2] = ((HV_Amp & 0x00FF) << 7) | ((inv_Faults & 0x000F) << 3) | ((throttle_Pos & 0x007F) >> 5);
+  tx_Message[3] = ((throttle_Pos & 0x007F) << 4) | ((brake_Pos & 0x007F) >> 3);
+  tx_Message[4] = ((brake_Pos & 0x007F) << 5) | ((car_Faults & 0x000F) << 1) | ((LV_Battery_Voltage & 0x00FF) >> 7);
+  tx_Message[5] = ((LV_Battery_Voltage & 0x00FF) << 1) | ((energy_Used & 0x1FFF) >> 12);
+  tx_Message[6] = ((energy_Used & 0x1FFF) >> 4);
+  tx_Message[7] = ((energy_Used & 0x1FFF) << 4);
+
+   Serial.println(tx_Message[0]);
+   Serial.println(tx_Message[1]);
+   Serial.println(tx_Message[2]);
+   Serial.println(tx_Message[3]);
+   Serial.println(tx_Message[4]);
+   Serial.println(tx_Message[5]);
+   Serial.println(tx_Message[6]);
+   Serial.println(tx_Message[7]);
+
+
+ //------------------------------Transmit Message---------------------------------
+ tCANMsgObject sMsgObjectTx;
+ sMsgObjectTx.ui32MsgID = 0x400;
+ sMsgObjectTx.ui32Flags = 0;
+ sMsgObjectTx.ui32MsgLen = 8;
+ sMsgObjectTx.pui8MsgData = tx_Message;
+ CANMessageSet(CAN0_BASE, 1, &sMsgObjectTx, MSG_OBJ_TYPE_TX);
+
+ Serial.println("Transmission pending...");
+ while(CANStatusGet(CAN0_BASE, CAN_STS_TXREQUEST) == 1);
+ Serial.println("Message transmitted");
+
+ while(1);
+ //delay(500);
+ i++;
+}


Include Arduino code

Include Arduino code

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

--- BLE_echo/BLE_echo.ino
+++ BLE_echo/BLE_echo.ino
@@ -0,0 +1,48 @@
+
+/*
+    BLE_echo
+
+    Test a serial connection to a HM-10
+    BLE module by reading incoming data
+    and writing it back out the serial
+    port.
+
+*/
+
+const int BUFF_LEN = 21;      // serial buffer length
+
+char sBuff[BUFF_LEN];         // serial buffer
+
+void setup()
+{
+  Serial.begin(9600);      // open serial port
+
+  Serial.setTimeout(20);  // timeout defaults to 1000 ms
+
+}
+
+void loop()
+{
+
+  // if bytes available
+  if( Serial.available() )
+  {
+    // read into buffer
+    int bytesRead = Serial.readBytes(sBuff, BUFF_LEN);
+
+    // echo read bytes to serial port
+    for(int i=0; i < bytesRead; i++) Serial.write(sBuff[i]);
+
+    // write newline
+    Serial.println();
+
+
+  } // if
+
+
+}
+
+
+
+
+


update SwitchLed

update SwitchLed

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

--- SwitchLed/SwitchLedDuration.ino
+++ SwitchLed/SwitchLedDuration.ino
@@ -0,0 +1,28 @@
+/* Use a switch to control a LED.
+  Details and schematic, please see http://yehnan.blogspot.com/2012/02/arduinoled.html
+*/
+#include <Bounce.h>
+
+Bounce bouncer = Bounce(2, 50);
+static int ledStatus = LOW;
+
+void setup(){
+  Serial.begin(115200);
+  pinMode(2, INPUT);
+  pinMode(13, OUTPUT);
+  digitalWrite(13, ledStatus);
+}
+
+void loop(){
+  bouncer.update();
+  if(bouncer.read() == HIGH) {
+    ledStatus = bouncer.duration() >= 5000 ? LOW : HIGH;
+  }
+  else{
+    ledStatus = LOW;
+  }
+
+  digitalWrite(13, ledStatus);
+}
+
+


Update src.ino

Update src.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/AJama50/CS207-Project.git/'


Initialize Arduino File

Initialize Arduino File

Added an outline for our project code

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

--- main.ino
+++ main.ino
@@ -0,0 +1,40 @@
+/*
+ * Get the input form the button board
+ * The input will be a int that represents 4 nibbles
+ *
+ * @return user input
+ */
+uint16_t getUserInput() {
+  return 0;
+}
+
+/*
+ * Encodes the message using a Caesar cipher
+ *
+ * @param message - the decoded message
+ * @return encoded message
+ */
+uint16_t encodeMessage(uint16_t message) {
+  return 0;
+}
+
+/*
+ * Decode the message based on the caesar cipher
+ *
+ * @param message - the encoded message
+ * @return decoded message
+ */
+uint16_t decodeMessage(uint16_t message) {
+  return 0;
+}
+
+
+void setup() {
+  // put your setup code here, to run once:
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+
+
+}


Create motor_2.ino

Create motor_2.ino

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

--- arduino/motor_2.ino
+++ arduino/motor_2.ino
@@ -0,0 +1,97 @@
+
+
+double potcurval;    // variable to read the value from the analog pin
+int angel; //Integer value of angle
+ double angle =0;
+
+ double curangle,kP=28.00,kI=42,kD=4,Last=0;
+ double P=0,I=0,D=0,Drive,Error=0,Integral=0;
+
+
+ void backward() {
+   digitalWrite(12,HIGH);
+   digitalWrite(9,LOW);
+ }
+  void forward()
+ {
+   digitalWrite(12,LOW);
+   digitalWrite(9,HIGH);
+ }
+ void halt()
+ {
+    digitalWrite(12,LOW);
+    digitalWrite(9,LOW);
+ }
+void setup()
+{
+  // myservo.attach(6);  // attaches the servo on pin 9 to the servo object
+  pinMode(9,OUTPUT);
+  pinMode(12,OUTPUT);
+  Serial.begin(9600);
+  pinMode(11,OUTPUT);
+  Serial.begin(9600);
+}
+ void Errorcalc()
+ {
+   potcurval=(double)analogRead(A0)+1;
+   potcurval=(potcurval/1024)*5;
+    curangle=(potcurval/5)*270;
+
+                Error = curangle-angle;
+ }
+void loop()
+{             if(Serial.available()>0)
+{
+   angle=(double)Serial.parseInt()+85;
+
+}
+
+
+                 Errorcalc();
+                if (abs(Error) <.8){ // prevent integral 'windup'
+                Integral = Integral + Error; // accumulate the error integral
+                }
+                else {
+                Integral=0; // zero it if out of bounds
+                }
+                P = Error*kP; // calc proportional term
+                I = Integral*kI; // integral term
+                D = (Last-curangle)*kD; // derivative term
+
+                Drive = P + I + D; // Total drive = P+I+D
+
+                //Drive = (Drive/550)*255; // scale Drive to be in the range 0-255
+
+
+                if (abs(Drive)>255) {
+                Drive=(Drive/abs(Drive)) *235;
+                }
+
+
+                Serial.println(Error);
+                if (Error < 0){ // Check which direction to go.
+                forward();
+
+                }
+                else if(Error >=0){ // depending on the sign of Error
+                 backward();
+
+                }
+
+                if(abs(Error)<2)
+                {
+                  halt();
+                }
+
+                analogWrite (11,abs(Drive)); // send PWM command to motor board
+                Last=curangle;
+   /*
+    Serial.println("P :");
+    Serial.println(P);
+    Serial.println("I :");
+    Serial.println(I);
+    Serial.println("D :");
+    Serial.println(D);
+    */
+
+}


added example

added example

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

--- examples/KitchenSink/KitchenSink.ino
+++ examples/KitchenSink/KitchenSink.ino
@@ -0,0 +1,71 @@
+#include <SPI.h>
+#include <KTask.h>
+#include <KWiFi.h>
+#include <KButton.h>
+#include <KDisplay.h>
+
+#define BUTTON_A 9
+#define BUTTON_B 6
+#define BUTTON_C 5
+
+KDisplay display;
+
+KWiFi wifi("abc", NULL);
+
+char *defaultText = "Press a button...";
+
+// handler for button A
+void press_a(KButton *button) {
+    Serial.println("Press: A");
+    display.set("A");
+}
+
+void release_a(KButton *button) {
+    Serial.println("Release: A");
+    display.set(defaultText);
+}
+
+KButton buttonA(BUTTON_A, press_a, release_a);
+
+// handler for button B
+void press_b(KButton *button) {
+    Serial.println("Press: B");
+    display.set("B");
+}
+
+void release_b(KButton *button) {
+    Serial.println("Release: B");
+    display.set(defaultText);
+}
+
+KButton buttonB(BUTTON_B, press_b, release_b);
+
+// handler for button C
+void press_c(KButton *button) {
+    Serial.println("Press: C");
+    display.set("C");
+}
+
+void release_c(KButton *button) {
+    Serial.println("Release: C");
+    display.set(defaultText);
+}
+
+KButton buttonC(BUTTON_C, press_c, release_c);
+
+void setup() {
+    // initialize serial
+    // while (!Serial);
+    Serial.begin(9600);
+    Serial.println("Press a button...");
+
+    // initialize tasks
+    KTask::setup();
+
+    // initialize display
+    display.set(defaultText);
+}
+
+void loop() {
+    KTask::loop();
+}


Create SimpleExample.ino

Create SimpleExample.ino

Added Simplified, basic example

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

--- firmware/examples/SimpleExample.ino
+++ firmware/examples/SimpleExample.ino
@@ -0,0 +1,109 @@
+/*
+DailyTimer.h Library
+BulldogLowell@gmail.com
+April, 2016
+** Library provides tools to set daily timers for control of devices such as lamps, appliances, etc. Developed primarilary for houshold presence simulation.
+** Allows for setting ON and OFF times, days of the week (i.e. weekends, weekdays, Fridays) and the use of random on/off times using this Constructor:
+   DailyTimer myTimer( START_HOUR, START_MINUTE, END_HOUR, END_MINUTE, DAYS_OF_WEEK, RANDOM or FIXED)
+
+** Timers may bridge midnight, simply enter times accordingly:
+   DailyTimer myTimer( 18, 30,  1, 45, WEEKENDS, FIXED);  // starts at 6:30pm Saturdays and Sundays and ends at 1:45am the next day.
+
+** Automatically sets correct timer state on powerup, using isActive() in loop(), see example below.
+** Random start and/or end times using this member function:
+   myTimer.setRandomOffset(30, RANDOM_START);  //  Can be RANDOM_START, RANDOM_END, or both (RANDOM)  default random offfset is 15min
+
+** Random days of week using this member function:
+   myTimer.setRandomDays(4); // will select four days of the week, randomly.  Useful to run this member function once a week, for example.
+
+** Select custom days of the week using this member function:
+   myTimer.setDaysActive(0b10101010);  // e.g.Sunday, Tuesday, Thursday and Saturday Note: Days in this order:  0bSMTWTFS0 <- LSB is zero
+
+** Set a timed event with just the start time as a trigger:
+   myTimer.startTrigger();  // will return true when Start Time is passed if today is an active day. use it in loop()
+
+** you can return the active days using this getter:
+   byte myByte = myTimer.getDays();  // returns a byte... Sunday is the MSB, Saturday is the LSB << 1
+
+** Dynamically set your start or end time (i.e. using some type of celestial function or web call to determine Sunrise or Sunset times)
+   myTimer.setStartTime(byte hour, byte minute);
+   myTimer.setEndTime(byte hour, byte minute);
+
+*/
+//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+//Program Start
+
+#include "DailyTimerSpark.h"
+
+
+DailyTimer timer1(18, 30,  1, 30, EVERY_DAY, RANDOM_END, customSeedGenerator);      // optional callback function for random number generation, see below example
+DailyTimer timer2(12,  0, 13,  0, SATURDAY, FIXED);                                 // default is FIXED, this will randomize the start time only
+DailyTimer timer3( 8, 30, 23, 30, WEEKENDS);                                        // creates with a default fixed start time and end time
+bool timer1_LastState = false;
+
+uint32_t lastUpdateTime = 0;
+
+void setup()
+{
+  timer3.begin(); // use this for syncing the state change tools startTrigger() and endTrigger() on startup
+  timer2.begin();
+  timer1.begin();
+  Serial.begin(9600);
+  pinMode(D7, OUTPUT);
+  timer1.setRandomOffset(15, RANDOM_END);
+  //timer1.setDaysActive(WEEKDAYS);             // Set the timer to be active on weekdays
+  //timer1.setDaysActive(B10101010);            // or define a custom day mask... SMTWTFS0  example: Sunday, Tuesday, Yhursday, Saturday
+  //timer1.setRandomDays(4);                    // or four random days per week
+  //timer3.setRandomOffset(5);                  // Change random start time, +/- 5 minutes... max 59 mins, default is 15mins
+  //Serial.println(timer1.getDays(), BIN);      // getDays() returns active days as a byte in the format above
+}
+
+void loop()
+{
+  bool timerState = timer1.isActive();  //State Change method this block
+  if(timerState != timer1_LastState)
+  {
+    if(timerState)
+    {
+      digitalWrite(D7, HIGH);
+      Serial.println("LED is ON");
+      Particle.publish("DailyTimer", "LED is ON", 60, PRIVATE);
+    }
+    else
+    {
+      digitalWrite(D7, LOW);
+      Serial.println("LED is OFF");
+      Particle.publish("DailyTimer", "LED is OFF", 60, PRIVATE);
+    }
+    timer1_LastState = timerState;
+  }
+
+  if(timer2.startTrigger())  // Boundary method following blocks
+  {
+    Serial.println("Timer 2 FIRED!");
+    Particle.publish("DailyTimer", "Timer2 Fired", 60, PRIVATE);
+  }
+  if(timer3.startTrigger())
+  {
+    Serial.println("Timer 3 FIRED!");
+    Particle.publish("DailyTimer", "Timer3 Fired", 60, PRIVATE);
+  }
+  if(timer3.endTrigger())
+  {
+    Serial.println("Timer 3 Expired!");
+    Particle.publish("DailyTimer", "Timer3 is Inactive", 60, PRIVATE);
+  }
+  if(millis() - lastUpdateTime > 1000UL)
+  {
+    char timeBuffer[32] = "";
+    Serial.println(Time.timeStr());
+    lastUpdateTime += 1000UL;
+  }
+}
+
+uint32_t customSeedGenerator()
+{
+  Serial.println("New Seed Created");
+  return  random(0xFFFFFFFF);
+}


AES decryption optimization

AES decryption optimization

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

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


added UI component

added UI component

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

--- brew_controller.ino
+++ brew_controller.ino
@@ -0,0 +1,543 @@
+
+#define sclk 13
+#define mosi 11
+#define cs   10
+#define dc   8
+#define rst  0  // you can also connect this to the Arduino reset
+
+#include <Adafruit_GFX.h>    // Core graphics library
+#include <Adafruit_ST7735.h> // Hardware-specific library
+#include <SPI.h>
+
+#if defined(__SAM3X8E__)
+    #undef __FlashStringHelper::F(string_literal)
+    #define F(string_literal) string_literal
+#endif
+
+// Color definitions
+#define BLACK    0x0000
+#define BLUE     0x001F
+#define RED      0xF800
+#define GREEN    0x07E0
+#define CYAN     0x07FF
+#define MAGENTA  0xF81F
+#define YELLOW   0xFFE0
+#define WHITE    0xFFFF
+
+Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);
+
+float p = 3.1415926;
+
+int currentCol = 0;
+int currentRow = 0;
+int prevCol = 0;
+int prevRow = 0;
+
+int setHLT = 160;
+int setRIMS = 160;
+int setBK = 100;
+
+int currHLT = 161;
+int currRIMS = 162;
+
+boolean paused = true;
+int mode = 0;
+int prevmode = 0;
+
+#define Neutral 0
+#define Press 1
+#define Up 2
+#define Down 3
+#define Right 4
+#define Left 5
+
+// Check the joystick position
+int CheckJoystick()
+{
+  int joystickState = analogRead(3);
+
+  if (joystickState < 50) return Left;
+  if (joystickState < 150) return Down;
+  if (joystickState < 250) return Press;
+  if (joystickState < 500) return Right;
+  if (joystickState < 650) return Up;
+  return Neutral;
+}
+
+//Draw dot when element is on
+void elementOn(int element)
+{
+  switch (element)
+  {
+    case 0:
+      tft.fillCircle(25, 8, 5, RED);
+      break;
+    case 1:
+      tft.fillCircle(75, 8, 5, RED);
+      break;
+    case 2:
+      tft.fillCircle(125, 8, 5, RED);
+      break;
+  }
+}
+
+//Erase dot when element turns off
+void elementOff(int element)
+{
+  switch (element)
+  {
+    case 0:
+      tft.fillCircle(25, 8, 5, BLACK);
+      break;
+    case 1:
+      tft.fillCircle(75, 8, 5, BLACK);
+      break;
+    case 2:
+      tft.fillCircle(125, 8, 5, BLACK);
+      break;
+  }
+}
+
+
+//Draw an empty arrow in defined position
+void clearArrow(int col, int row)
+{
+  switch (row)
+  {
+    case 0:
+      switch (col)
+      {
+        case 0:
+          tft.fillTriangle(25, 18, 20, 23, 30, 23, BLACK);
+          tft.drawTriangle(25, 18, 20, 23, 30, 23, WHITE);
+          break;
+        case 1:
+          tft.fillTriangle(75, 18, 70, 23, 80, 23, BLACK);
+          tft.drawTriangle(75, 18, 70, 23, 80, 23, WHITE);
+          break;
+        case 2:
+          tft.fillTriangle(125, 18, 120, 23, 130, 23, BLACK);
+          tft.drawTriangle(125, 18, 120, 23, 130, 23, WHITE);
+          break;
+      }
+      break;
+    case 1:
+      switch (col)
+      {
+        case 0:
+          tft.fillTriangle(25, 50, 20, 45, 30, 45, BLACK);
+          tft.drawTriangle(25, 50, 20, 45, 30, 45, WHITE);
+          break;
+        case 1:
+          tft.fillTriangle(75, 50, 70, 45, 80, 45, BLACK);
+          tft.drawTriangle(75, 50, 70, 45, 80, 45, WHITE);
+          break;
+        case 2:
+          tft.fillTriangle(125, 50, 120, 45, 130, 45, BLACK);
+          tft.drawTriangle(125, 50, 120, 45, 130, 45, WHITE);
+          break;
+      }
+      break;
+    case 2:
+      tft.drawRect(8, 78, 74, 18, BLACK);
+      break;
+    case 3:
+      switch (col)
+      {
+        case 0:
+          tft.drawRect(8, 103, 38, 18, BLACK);
+          break;
+        case 1:
+          tft.drawRect(58, 103, 50, 18, BLACK);
+          break;
+        case 2:
+          tft.drawRect(118, 103, 27, 18, BLACK);
+          break;
+      }
+  }
+}
+
+//Draw a filled arrow in defined position
+void setArrow(int col, int row)
+{
+  switch (row)
+  {
+    case 0:
+      switch (col)
+      {
+        case 0:
+          tft.fillTriangle(25, 18, 20, 23, 30, 23, WHITE);
+          break;
+        case 1:
+          tft.fillTriangle(75, 18, 70, 23, 80, 23, WHITE);
+          break;
+        case 2:
+          tft.fillTriangle(125, 18, 120, 23, 130, 23, WHITE);
+          break;
+      }
+      break;
+    case 1:
+      switch (col)
+      {
+        case 0:
+          tft.fillTriangle(25, 50, 20, 45, 30, 45, WHITE);
+          break;
+        case 1:
+          tft.fillTriangle(75, 50, 70, 45, 80, 45, WHITE);
+          break;
+        case 2:
+          tft.fillTriangle(125, 50, 120, 45, 130, 45, WHITE);
+          break;
+      }
+      break;
+    case 2:
+      tft.drawRect(8, 78, 74, 18, WHITE);
+      break;
+    case 3:
+      switch (col)
+      {
+        case 0:
+          tft.drawRect(8, 103, 38, 18, WHITE);
+          break;
+        case 1:
+          tft.drawRect(58, 103, 50, 18, WHITE);
+          break;
+        case 2:
+          tft.drawRect(118, 103, 27, 18, WHITE);
+          break;
+      }
+  }
+}
+
+//Print a temperature value indefined position
+void setValue(int col, int row, int value)
+{
+  switch (row)
+  {
+    case 0:
+      switch (col)
+      {
+        case 0:
+          tft.setCursor(10, 28);
+          tft.setTextColor(CYAN, BLACK);
+          tft.print(value);
+          break;
+        case 1:
+          tft.setCursor(60, 28);
+          tft.setTextColor(CYAN, BLACK);
+          tft.print(value);
+          break;
+        case 2:
+          tft.setCursor(110, 28);
+          tft.setTextColor(CYAN, BLACK);
+          tft.print(value);
+          if (value < 100)
+          {
+            tft.print("% ");
+          }
+          else
+          {
+            tft.print("%");
+          }
+          break;
+      }
+      break;
+    case 1:
+      switch (col)
+      {
+        case 0:
+          tft.setCursor(10, 55);
+          tft.setTextColor(YELLOW, BLACK);
+          tft.print(value);
+          break;
+        case 1:
+          tft.setCursor(60, 55);
+          tft.setTextColor(YELLOW,BLACK);
+          tft.print(value);
+          break;
+      }
+      break;
+  }
+}
+
+//Display paused state
+void setPaused(boolean value)
+{
+  if (value == true)
+  {
+    tft.setTextColor(RED, BLACK);
+    tft.setCursor(10, 80);
+    tft.print("PAUSED");
+  }
+  else
+  {
+    tft.setCursor(10, 80);
+    tft.setTextColor(WHITE, BLACK);
+    tft.print("PAUSE ");
+  }
+}
+
+//Subroutine to enable mode choices at the bottom
+void setMode(int modeToSet)
+{
+  tft.setCursor(10, 105);
+  if (modeToSet == 0)
+  {
+    tft.setTextColor(GREEN, BLACK);
+    //turn off RIMS and BK
+    elementOff(1);
+    elementOff(2);
+  }
+  else
+  {
+    tft.setTextColor(WHITE, BLACK);
+  }
+  tft.print("HLT");
+
+  tft.setCursor(60, 105);
+  if (modeToSet == 1)
+  {
+    tft.setTextColor(GREEN, BLACK);
+    //turn off BK
+    elementOff(2);
+  }
+  else
+  {
+    tft.setTextColor(WHITE, BLACK);
+  }
+  tft.print("RIMS");
+
+  tft.setCursor(120, 105);
+  if (modeToSet == 2)
+  {
+    tft.setTextColor(GREEN, BLACK);
+    //turn off HLT and RIMS
+    elementOff(0);
+    elementOff(1);
+  }
+  else
+  {
+    tft.setTextColor(WHITE, BLACK);
+  }
+  tft.print("BK");
+
+  tft.setTextColor(WHITE, BLACK);
+}
+
+
+
+
+void setup(void) {
+  Serial.begin(9600);
+  Serial.print("hello!");
+
+  tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab
+
+  Serial.println("init");
+
+  tft.setRotation(3);
+  tft.setTextColor(BLUE, BLACK);
+  tft.setTextSize(2);
+
+  uint16_t time = millis();
+  tft.fillScreen(ST7735_BLACK);
+
+  clearArrow(0,0);
+  clearArrow(1,0);
+  clearArrow(2,0);
+
+
+  clearArrow(0,1);
+  clearArrow(1,1);
+  clearArrow(2,1);
+
+  setValue(0, 0, setHLT);
+  setValue(1, 0, setRIMS);
+  setValue(2, 0, setBK);
+
+  setValue(0, 1, currHLT);
+  setValue(1, 1, currRIMS);
+
+  setPaused(paused);
+
+  setMode(mode);
+
+  setArrow(0, 0);
+
+}
+
+
+//Subroutine to handle Joystick
+void handleJoyStick(int stickData)
+{
+  switch (stickData)
+  {
+    case Left:
+      if (prevCol != 0)
+      {
+        currentCol = prevCol - 1;
+      }
+      break;
+    case Right:
+      if (prevCol != 2)
+      {
+        currentCol = prevCol + 1;
+      }
+      break;
+    case Up:
+      if (prevRow != 0)
+      {
+        currentRow = prevRow - 1;
+      }
+      break;
+    case Down:
+      if (prevRow != 3)
+      {
+        currentRow = prevRow + 1;
+      }
+      break;
+    case Press:
+      switch (currentRow)
+      {
+        case 0:
+          switch (currentCol)
+          {
+            case 0:
+              if (setHLT < 200)
+              {
+                setHLT += 1;
+                setValue(0, 0, setHLT);
+              }
+              break;
+            case 1:
+              if (setRIMS < 200)
+              {
+                setRIMS += 1;
+                setValue(1, 0, setRIMS);
+              }
+              break;
+            case 2:
+              if (setBK < 100)
+              {
+                setBK += 1;
+                setValue(2, 0, setBK);
+              }
+              break;
+          }
+          break;
+        case 1:
+          switch (currentCol)
+          {
+            case 0:
+              if (setHLT > 100)
+              {
+                setHLT -= 1;
+                setValue(0, 0, setHLT);
+              }
+              break;
+            case 1:
+              if (setRIMS > 100)
+              {
+                setRIMS -= 1;
+                setValue(1, 0, setRIMS);
+              }
+              break;
+            case 2:
+              if (setBK > 0)
+              {
+                setBK -= 1;
+                setValue(2, 0, setBK);
+              }
+              break;
+          }
+          break;
+        case 2:
+          paused = !paused;
+          setPaused(paused);
+          break;
+        case 3:
+          switch (currentCol)
+          {
+            case 0:
+              mode = 0;
+              setMode(mode);
+              break;
+            case 1:
+              mode = 1;
+              setMode(mode);
+              break;
+            case 2:
+              mode = 2;
+              setMode(mode);
+              break;
+          }
+          break;
+      }
+
+      break;
+  }
+}
+
+void loop() {
+  int joy = CheckJoystick();
+  handleJoyStick(joy);
+  if (prevRow != currentRow || prevCol != currentCol)
+  {
+    clearArrow(prevCol, prevRow);
+    setArrow(currentCol, currentRow);
+    prevRow = currentRow;
+    prevCol = currentCol;
+  }
+
+  //read in temps here and set value on screen if changed
+
+  //actual element control goes here
+  switch (mode)
+  {
+    case 0:
+      //firing the HLT only
+      if ((!paused) && (currHLT < setHLT))
+      {
+        elementOn(0);
+      }
+      else
+      {
+        elementOff(0);
+      }
+      break;
+    case 1:
+      //firing HLT and RIMS
+      if ((!paused) && (currRIMS < setRIMS))
+      {
+        //ensure HLT off
+        elementOff(0);
+        //now turn on RIMS
+        elementOn(1);
+      }
+      else
+      {
+        //turn off RIMS
+        elementOff(1);
+        //fire HLT?
+        if ((!paused) && (currHLT < setHLT))
+        {
+          elementOn(0);
+        }
+        else
+        {
+          elementOff(0);
+        }
+      }
+      break;
+    case 2:
+      //firing BK only
+      break;
+  }
+
+  //turn off elements regardless of mode
+
+  delay(100);
+}
+
+
+


Added Arduino code

Added Arduino code

error: pathspec 'glove-sensor/rock-paper-scissors.ino' did not match any file(s) known to git


Create pacman_barblink.ino

Create pacman_barblink.ino

error: pathspec 'CAA-NMC-2019/Code/pacman_barblink/pacman_barblink.ino' did not match any file(s) known to git

--- CAA-NMC-2019/Code/pacman_barblink/pacman_barblink.ino
+++ CAA-NMC-2019/Code/pacman_barblink/pacman_barblink.ino
@@ -0,0 +1,91 @@
+/*
+ * This is a modified version of the "strandtest" sketch from the Adafruit
+ * Neopixel library, for use in the BADGECULTURE project. To run this demo
+ * as intended, you need:
+ *  Arduino IDE (with neopixel library installed: https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library-installation)
+ *  Mini USB cable
+ *  USBTinyISP programmer
+ *  Reflowed BADGECULTURE board
+ *
+ * IDE settings:
+ *  Board:      ATTiny 25/45/85
+ *  Processor:  Attiny85
+ *  Clock:      8mhz
+ *  Programmer: USBTinyISP
+ *
+ * Make sure the USBTinyISP is set to power the target device.
+ * Before you can upload code, you must first burn the bootloader.
+ * Finally, with all programming settings the same, upload the code.
+ *
+ * See bit.ly/BADGECULTURE for more info.
+ */
+//
+
+#include <Adafruit_NeoPixel.h>
+#ifdef __AVR__
+  #include <avr/power.h>
+#endif
+
+#define NUMPIX 2    // verfiy the number of pixels on your board
+#define PIN 4       // verfiy the Attiny control pin
+Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIX, PIN, NEO_GRB + NEO_KHZ800);
+
+// I left the following in, though we haven't found the huge cap necessary with few pixels (so far)
+
+// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
+// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
+// and minimize distance between Arduino and first pixel.  Avoid connecting
+// on a live circuit...if you must, connect GND first.
+
+void setup() {
+  strip.begin();
+  strip.setBrightness(50);    // To save batteries and eyeballs
+  strip.show();               // Initialize all pixels to 'off'
+}
+
+void loop() {
+  for(int x=0;x<20;x++){
+    rainbow(1);
+
+  rainbowCycle(10);
+}
+
+void rainbow(uint8_t wait) {
+  uint16_t i, j;
+
+  for(j=0; j<256; j++) {
+    for(i=0; i<strip.numPixels(); i++) {
+      strip.setPixelColor(i, Wheel((i+j) & 255));
+    }
+    strip.show();
+    delay(wait);
+  }
+}
+
+// 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);
+  }
+}
+
+// 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);
+}