Added Arduino Firmware

Added Arduino Firmware

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

--- rcCarFirmware/rcCarFirmware.ino
+++ rcCarFirmware/rcCarFirmware.ino
@@ -0,0 +1,221 @@
+#include <CommandHandler.h>
+#include <Wire.h>
+#include <Adafruit_MotorShield.h>
+
+#define turnSpeed 150
+#define turnDelay 500
+#define stopDelay 500
+#define debug
+int currentSpeed = 0;
+#define maxSpeed 150
+#define FORWARDMOTOR 4
+#define TURNMOTOR 1
+
+// Create the motor shield object with the default I2C address
+Adafruit_MotorShield AFMS = Adafruit_MotorShield();
+// Or, create it with a different I2C address (say for stacking)
+// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);
+
+// Select which 'port' M1, M2, M3 or M4. In this case, M1
+Adafruit_DCMotor *myMotor = AFMS.getMotor(1);
+Adafruit_DCMotor *backMotor = AFMS.getMotor(4);
+// You can also make another motor on port M2
+//Adafruit_DCMotor *myOtherMotor = AFMS.getMotor(2);
+
+CommandHandler ch;
+
+
+void setup() {
+  Serial.begin(9600);
+  ch.begin();
+
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  //readCommand();
+  Serial.println("I am ready");
+  while(Serial.available()){
+    //parseCommand();
+    readCommand();
+  }
+
+}
+
+//--------------------------Turning Motor-------------------------------
+//Green left, blue right
+//Default for turning right
+
+void turn( char direct )
+{
+  if ( direct == 'r' )
+  {
+    myMotor->run(FORWARD);
+  }
+  else {
+    myMotor->run(BACKWARD);
+  }
+  myMotor->setSpeed(turnSpeed);
+}
+
+
+//Stop Turning
+void stopTurn() {
+  myMotor->run(RELEASE);
+  delay(stopDelay);
+}
+
+//----------------------Movement Motor---------------------------------
+
+//Move forward while ramping speed
+void moveForward( char direct ) {
+  if (direct == 'f')
+  {
+    backMotor->run(FORWARD);
+
+    for (currentSpeed = 0; currentSpeed < maxSpeed; currentSpeed++) {
+      backMotor->setSpeed(currentSpeed);
+    }
+  }
+  else
+  {
+    backMotor->run(BACKWARD);
+
+    for (currentSpeed = 0;  currentSpeed < maxSpeed; currentSpeed++) {
+      backMotor->setSpeed(currentSpeed);
+    }
+
+  }
+
+}
+
+
+//Stop moving the back motor
+void stopMovement( ) {
+
+  for ( currentSpeed = maxSpeed; currentSpeed > 0; currentSpeed--) {
+    backMotor->setSpeed(currentSpeed);
+  }
+
+  delay(stopDelay);
+
+}
+
+
+//---------------------------------Communicating with the Arduino using commands--------------------------------------
+//LEGACY CODE DONT TOUCH
+void readCommand( ) {
+
+  char command = Serial.read( );
+
+  switch (command) {
+    case 'f':
+      moveForward(command);
+      break;
+
+    case 'b':
+      //moveBackward(command);
+      break;
+
+    case 'r':
+      //turnRight();
+      break;
+
+    case 'l':
+      //turnLeft();
+      break;
+
+    case 's':
+      stopMovement();
+      break;
+
+    case 'i':
+      stopTurn();
+      break;
+  }
+
+}
+
+
+//------------------------FLOW---------------------------------
+/*
+  1. Read the Serial through parseCommand
+  2. Parse the motor, direction and delay
+  3. Send to commandHandler
+  4. commandHandler executes the program.
+
+
+*/
+
+//Parse the command sent in to the appropriate motor
+/*
+  Pattern:
+  "#/x/time."
+  # is for motor number (1 is turn, 4 is back)
+  x is for command: [f,b,r,l]
+  time is in milliseconds, 4 digits
+
+*/
+void parseCommand( )
+{
+  String command = Serial.readString();
+
+  if (command == NULL) {
+    return;
+  }
+
+  //String command = "1f1000";
+  //End of the char array is always the null character \0
+  char actualCommands[7];
+  command.toCharArray(actualCommands, 7);
+  int motor = actualCommands[0] - '0';
+  char direct = actualCommands[1];
+  String delayTime;
+
+  for (int i = 2; i < 7; i++)
+  {
+    delayTime.concat(actualCommands[i]);
+  }
+   int parsedTime = delayTime.toInt();
+  //commandHandler(motor, direct, delayTime.toInt());
+
+  #ifdef debug
+    Serial.print("Motor: ");
+    Serial.print(motor);
+    Serial.print(" Direction: ");
+    Serial.print(direct);
+    Serial.print(" Delay :");
+    Serial.println(parsedTime);
+  #endif
+
+  ch.sendCommand( motor, direct, parsedTime);
+}
+
+
+/* LEGACY CODE DO NOT TOUCH
+void commandHandler( int motor, char direct, int delayTime )
+{
+  if ( direct == 's' )
+  {
+    stopMovement();
+  }
+  else {
+    if (motor == FORWARDMOTOR)
+    {
+      moveForward(direct);
+      delay(delayTime);
+    }
+    else if (motor == TURNMOTOR)
+    {
+      turn(direct);
+      delay(delayTime);
+
+    }
+    else {
+      Serial.println("error in commandHandler");
+      return;
+    }
+  }
+
+}
+*/


Basic sanity check using the serial monitor

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

--- Python_To_Arduino_Communication/Sanity_Check/Sanity_Check.ino
+++ Python_To_Arduino_Communication/Sanity_Check/Sanity_Check.ino
@@ -0,0 +1,33 @@
+String inputString = "";
+bool recMessage = false;
+
+void setup() {
+  Serial.begin(9600);
+
+  //wait for some serial connection
+   while (!Serial);
+   Serial.println("--- Serial Connection Established ---");
+}
+
+void loop() {
+  //consume everything in the serial buffer
+  while (Serial.available())
+  {
+    char inChar = Serial.read();
+    if (inChar != '~'){
+        inputString += inChar;
+    }
+    else{
+        recMessage = true;
+    }
+  }
+
+  if (recMessage){
+      Serial.print("Arduino received: ");
+      Serial.println(inputString);
+      inputString = "";
+      recMessage = false;
+  }
+}
+
+


fix bugs

fix bugs

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


Add databaseAppendAllRecords()

Add databaseAppendAllRecords()

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/TheGum/Arduino-Elevator-Chip-System.git/'


Add the arduino file

Add the arduino file

Add the arduino file that supports fingerprint capture

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

--- without_sep_start_end_stream.ino
+++ without_sep_start_end_stream.ino
@@ -0,0 +1,434 @@
+const int lock=9;
+const int led =13;
+int id = 0;
+int button=4;
+boolean doorState=false;
+
+
+#include <Adafruit_Fingerprint.h>
+#include <SoftwareSerial.h>
+#include <EEPROM.h>
+
+//this is the program we shall be using
+//his too
+int getFingerprintIDez();
+
+// pin #2 is IN from sensor (GREEN wire)
+// pin #3 is OUT from arduino  (WHITE wire)
+SoftwareSerial mySerial(2, 3);
+
+
+Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
+
+void setup()
+{
+  pinMode(13, OUTPUT);
+  pinMode(button, OUTPUT);
+  pinMode(lock, OUTPUT);
+  Serial.begin(9600);
+  //Serial.println("fingertest");
+
+  // set the data rate for the sensor serial port
+  finger.begin(57600);
+
+  if (finger.verifyPassword()) {
+    //Serial.println("Found fingerprint sensor!");
+  } else {
+    //Serial.println("Did not find fingerprint sensor :(");
+    while (1);
+  }
+  //Serial.println("Waiting for valid finger...");
+}
+
+void loop()                     // run over and over again
+{
+ // Serial.println("Type in the ID # you want to save this finger as...");
+int condition=0;
+char c;
+      //you can replace with this later => condition=(digitalRead(button))
+
+      if(condition=(Serial.available()>0))
+      {
+      id=(EEPROM.read(1)+1);
+      getFingerprintEnroll(id);
+      Serial.end();
+      Serial.begin(9600);
+      }
+      else
+        {
+          getFingerprintID();
+          delay(50);            //don't ned to run this at full speed.
+        }
+}
+
+uint8_t getFingerprintID()
+{
+  uint8_t p = finger.getImage();
+  switch (p) {
+    case FINGERPRINT_OK:
+      //Serial.println("Image taken");
+      break;
+    case FINGERPRINT_NOFINGER:
+      //Serial.println("0");
+      return p;
+    case FINGERPRINT_PACKETRECIEVEERR:
+      Serial.println("Communication error");
+      return p;
+    case FINGERPRINT_IMAGEFAIL:
+      Serial.println("IE");//IE- IMAGING ERROR
+      return p;
+    default:
+
+      Serial.print("UE");
+
+      Serial.println("");
+      return p;
+
+  }
+
+  // OK success!
+
+  p = finger.image2Tz();
+  switch (p) {
+    case FINGERPRINT_OK:
+      //Serial.println("Image converted");
+      break;
+    case FINGERPRINT_IMAGEMESS:
+      Serial.println("Image too messy");
+      return p;
+    case FINGERPRINT_PACKETRECIEVEERR:
+      Serial.println("Communication error");
+      return p;
+    case FINGERPRINT_FEATUREFAIL:
+
+      Serial.print("Could not find fingerprint features");
+
+      Serial.println("");
+      return p;
+    case FINGERPRINT_INVALIDIMAGE:
+
+      Serial.print("Could not find fingerprint features");
+
+      Serial.println("");
+      return p;
+    default:
+      Serial.println("UE");//Unknown Error
+      return p;
+  }
+
+  // OK converted!
+  p = finger.fingerFastSearch();
+  if (p == FINGERPRINT_OK)
+  {
+    //To find a print match
+    //Serial.println("Found a print match!");
+    digitalWrite(13, HIGH);
+    delay(300);
+    digitalWrite(13, LOW);
+  }
+  else if (p == FINGERPRINT_PACKETRECIEVEERR)
+  {
+    Serial.println("Communication error");
+    return p;
+  }
+  else if (p == FINGERPRINT_NOTFOUND)
+  {
+    //no match found
+    Serial.print("");
+
+    Serial.print("NM");//NO MATCH
+
+    Serial.println("");
+
+    digitalWrite(13, HIGH);
+    delay(150);
+    digitalWrite(13, LOW);
+    delay(150);
+    digitalWrite(13, HIGH);
+    delay(150);
+    digitalWrite(13, LOW);
+    return p;
+
+  }
+  else
+  {
+    Serial.println("UE");
+    return p;
+  }
+
+  // found a match!
+  //Serial.println("Found ID #");
+  Serial.print("");
+
+  Serial.print(finger.fingerID);
+
+  Serial.println("");
+  //confidence
+  //Serial.println(finger.confidence);
+  doorLock();
+}
+
+// returns -1 if failed, otherwise returns ID #
+int getFingerprintIDez() {
+  uint8_t p = finger.getImage();
+  if (p != FINGERPRINT_OK)  return -1;
+
+  p = finger.image2Tz();
+  if (p != FINGERPRINT_OK)  return -1;
+
+  p = finger.fingerFastSearch();
+  if (p != FINGERPRINT_OK)  return -1;
+
+  // found a match!
+  Serial.print("Found ID #");
+  Serial.print(" "+finger.fingerID);
+  Serial.print(" with confidence of "); Serial.println(finger.confidence);
+  return finger.fingerID;
+
+}
+void doorLock(){
+  if(doorState==false){
+    digitalWrite(lock, HIGH);
+    doorState=true;
+  delay(2500);
+  digitalWrite(lock, LOW);
+  }
+}
+
+
+uint8_t getFingerprintEnroll(int id)
+{
+ Serial.print("");
+
+ Serial.print("NW");// NW-Expected id of next enrolling finger
+
+ Serial.println("");
+
+
+ Serial.print(id);
+
+  Serial.println("");
+
+  int p = -1;
+  //waiting to enroll finger
+   Serial.print(" ");
+
+  Serial.print("WF");//WF - waiting to enroll finger
+
+   Serial.println("");
+
+  while (p != FINGERPRINT_OK)
+  {
+    p = finger.getImage();
+    switch (p) {
+    case FINGERPRINT_OK:
+      //mike when image is taken
+      //Serial.println("Image taken");
+      break;
+    case FINGERPRINT_NOFINGER:
+     // Serial.println(".");
+      break;
+    case FINGERPRINT_PACKETRECIEVEERR:
+      Serial.println("Communication error");
+      break;
+    case FINGERPRINT_IMAGEFAIL:
+      Serial.println("IE");//Imaging error
+      break;
+    default:
+    //mike When error is unknown
+      //Serial.println("Unknown error");
+      break;
+
+    }
+  }
+  // OK success!
+
+  p = finger.image2Tz(1);
+  switch (p) {
+    case FINGERPRINT_OK:
+    //mike when image is converted
+    //  Serial.println("Image converted");
+      break;
+    case FINGERPRINT_IMAGEMESS:
+      Serial.println("Image too messy");
+      return p;
+    case FINGERPRINT_PACKETRECIEVEERR:
+      Serial.println("Communication error");
+      return p;
+    case FINGERPRINT_FEATUREFAIL:
+
+      Serial.print("Could not find fingerprint features");
+
+      Serial.println("");
+      return p;
+    case FINGERPRINT_INVALIDIMAGE:
+
+      Serial.print("Could not find fingerprint features");
+
+      Serial.println("");
+      return p;
+    default:
+      Serial.println("UE"); // Unknown Error
+      return p;
+  }
+  //mike remove finger
+   Serial.print("");
+
+  Serial.print("RF"); // RF - remove finger
+
+   Serial.println("");
+
+  delay(2000);
+  p = 0;
+  while (p != FINGERPRINT_NOFINGER) {
+    p = finger.getImage();
+  }
+
+  p = -1;
+  //mike place the same finger again
+   Serial.print("");
+
+  Serial.print("PF");//PF - place the same finger again
+
+  Serial.println("");
+
+  while (p != FINGERPRINT_OK) {
+    p = finger.getImage();
+    switch (p) {
+    case FINGERPRINT_OK:
+    //mike image taken
+     Serial.print("");
+
+      Serial.print("IT"); //IT - Image Taken
+
+      Serial.println("");
+      break;
+    case FINGERPRINT_NOFINGER:
+      //Serial.print(".");
+      break;
+    case FINGERPRINT_PACKETRECIEVEERR:
+      Serial.println("Communication error");
+      break;
+    case FINGERPRINT_IMAGEFAIL:
+      Serial.println("Imaging error");
+      break;
+    default:
+
+      Serial.print("UE");
+
+      Serial.println("");
+
+      break;
+    }
+  }
+
+  // OK success!
+
+  p = finger.image2Tz(2);
+  switch (p) {
+    case FINGERPRINT_OK:
+    //mike image converted
+      //Serial.println("Image converted");
+      break;
+    case FINGERPRINT_IMAGEMESS:
+      Serial.println("Image too messy");
+      return p;
+    case FINGERPRINT_PACKETRECIEVEERR:
+      Serial.println("Communication error");
+      return p;
+    case FINGERPRINT_FEATUREFAIL:
+
+      Serial.print("Could not find fingerprint features");
+
+      Serial.println("");
+      return p;
+    case FINGERPRINT_INVALIDIMAGE:
+
+      Serial.print("Could not find fingerprint features");
+
+      Serial.println("");
+      return p;
+    default:
+      Serial.println("UE");// UE - Unknown error
+      return p;
+  }
+
+
+  // OK converted!
+  p = finger.createModel();
+  if (p == FINGERPRINT_OK)
+  {
+    //mike when prints have matched during taking the finger print comparison
+     Serial.print("");
+
+    Serial.print("PM");//PM - Prints Matched
+
+    Serial.println("");
+    //return p;
+  }
+  else if (p == FINGERPRINT_PACKETRECIEVEERR)
+  {
+    Serial.println("Communication error");
+    return p;
+  }
+  else if (p == FINGERPRINT_ENROLLMISMATCH)
+  {
+    //this is to show finger prints did not match when comparing the two finger prints during registration
+    //mike Fingerprints did not match
+    Serial.println("FN");// FN -Finger prints did not match
+    return p;
+  }
+  else
+  {
+    Serial.println("UE");//Unknown error
+    return p;
+  }
+   Serial.print("");
+
+    //This is the id is ** part of the program
+  //Serial.print("ID");
+
+    //Serial.println("");
+
+  Serial.print("IS");
+    Serial.println("");
+
+  id=0;
+  id=EEPROM.read(1)+1;
+  Serial.print(" ");
+
+  Serial.print(id);
+
+  Serial.println("");
+
+  p = finger.storeModel(id);
+
+  if (p == FINGERPRINT_OK)
+  {
+    //This is to store the image, in my case it will show the id of the finger print
+    //Serial.println("Stored!");
+    EEPROM.write(1, id);
+  }
+  else if (p == FINGERPRINT_PACKETRECIEVEERR)
+  {
+    Serial.println("Communication error");
+    return p;
+  }
+  else if (p == FINGERPRINT_BADLOCATION)
+  {
+    Serial.println("Could not store in that location");
+    return p;
+  }
+  else if (p == FINGERPRINT_FLASHERR)
+  {
+    Serial.println("Error writing to flash");
+    return p;
+  } else
+  {
+
+    Serial.print("UE");
+
+    Serial.println("");
+    return p;
+  }
+}


preliminary version of arduino code

preliminary version of arduino code

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

--- Arduino/rccar/rccar.ino
+++ Arduino/rccar/rccar.ino
@@ -0,0 +1,59 @@
+#include "DualVNH5019MotorShield.h"
+
+DualVNH5019MotorShield md;
+
+void setup() {
+  Serial.begin(19200);
+  Serial.setTimeout(3000);
+  md.init();
+}
+
+void stopMotors() {
+  md.setSpeeds(0, 0);
+}
+
+void loop() {
+  int i;
+  int dataPos;
+  byte receivedData[12];
+
+  int bytesReceived = Serial.readBytes(receivedData, 8);
+  if (bytesReceived < 8) {
+    // Incomplete or missing communications.
+    // Stop motors and wait for valid message.
+    stopMotors();
+    return;
+  }
+
+  // Copy first 4 bytes to end of array, to make it easier
+  // to search for the sync bytes.
+  for (i = 0; i < 4; i++) {
+    receivedData[8 + i] = receivedData[i];
+  }
+
+  // Find sync bytes.
+  for (i = 0; i < 8; i++) {
+    if (receivedData[i] == 0x7f &&
+        receivedData[i+1] == 0x7f &&
+        receivedData[i+2] == 0x80 &&
+        receivedData[i+3] == 0x80) {
+      // Found sync bytes.
+      dataPos = (i+4)%8;
+      break;
+    }
+  }
+
+  if (i == 8) {
+    // Sync bytes not found. Wait for a valid message.
+    stopMotors();
+    return;
+  }
+
+  // Valid message found. Decode it and send to motor.
+  short leftPos = receivedData[dataPos] |
+      (((short)receivedData[dataPos+1]) << 8);
+  short rightPos = receivedData[dataPos+2] |
+      (((short)receivedData[dataPos+3]) << 8);
+  md.setSpeeds(rightPos, leftPos);
+}
+


Implmented TTA and refactored byte sending method

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

--- CSC_460_-_Jan_23.ino
+++ CSC_460_-_Jan_23.ino
@@ -0,0 +1,152 @@
+#include <scheduler.h>
+
+
+// constants won't change. They're used here to
+// set pin numbers:
+const int button_pin = 2;
+const int servo_x_pin = 0;
+const int servo_out_pin = 9;
+const int IR_pin = 13;
+
+volatile unsigned bit_seq = 0; // Byte we're trying to transmit
+volatile int bit_index = 0; // Index of byte b we're comparing against.
+
+void setupTimer3(){
+  //Clear timer config.
+  TCCR3A = 0;
+  TCCR3B = 0;
+  //Set to CTC (mode 4)
+  TCCR3B |= (1<<WGM32);
+
+  //Set prescaller to 1
+  TCCR3B |= (1<<CS30);
+
+  //Set TOP value (500 us seconds)
+   OCR3A = 8000;
+}
+
+void setupPWMTimer(){
+  //PWM
+  //Clear timer config
+  TCCR1A = 0;
+  TCCR1B = 0;
+  TIMSK1 &= ~(1<<OCIE1C);
+  //Set to Fast PWM (mode 15)
+  TCCR1A |= (1<<WGM10) | (1<<WGM11);
+  TCCR1B |= (1<<WGM12) | (1<<WGM13);
+
+  //Enable output C.
+  TCCR1A |= (1<<COM1C1);
+  //No prescaler
+  TCCR1B |= (1<<CS10);
+
+  OCR1A = 420;  //38KHz
+  OCR1C = 210;  //50% duty cycle
+  TCCR1A &= ~(1<<COM1C1); // have the IR transmitter off at first
+}
+
+void check_button(){
+  // read the state of the switch into a local variable:
+  int val = analogRead(button_pin);
+  if( val < 10 ){
+     transmit('D');
+  }
+}
+
+void handle_servo(){
+  int val = analogRead(servo_x_pin);            // reads the value of the potentiometer (value between 0 and 1023)
+  val = map(val, 0, 1023, 500, 2500);     // scale it to use it with the servo (value between 0 and 180)
+
+ //http://www.robotshop.com/blog/en/arduino-5-minute-tutorials-lesson-5-servo-motors-3636
+  digitalWrite(servo_out_pin,HIGH);
+  delayMicroseconds(val);
+  digitalWrite(servo_out_pin,LOW);
+}
+
+void transmit(byte _b) {
+  // debug
+  digitalWrite(10, HIGH);
+
+  // set global values for the interrupt handler
+  bit_seq = _b;
+
+  // set the byte sequence to send
+  // the 1,0 header bits
+  bit_seq <<= 2;
+  bit_seq += 1;
+
+  // start from lower order bit first
+  bit_index = 0;
+
+  cli();
+
+  //Enable interupt A for timer 3.
+  TIMSK3 |= (1<<OCIE3A);
+  // Clear interrupt;
+  TIFR3 |= (1<<OCF3A);
+  //Set timer to 0 (optional here).
+  TCNT3 = 0;
+
+  sei();
+}
+
+// interrupt handler for the IR transmitter
+ISR(TIMER3_COMPA_vect)
+{
+  if( bit_index < 10 ){
+    // we still have bits to send
+
+    if( (bit_seq & ( 1 << bit_index )) != 0){
+        // bit is set to one
+        // turn on the IRT
+        TCCR1A |= (1<<COM1C1);
+    }else {
+        // bit is set to zero
+        // turn off the IRT
+        TCCR1A &= ~(1<<COM1C1);
+    }
+
+    // increment the bit index
+    bit_index++;
+  }else{
+    // all of the bytes have been sent.
+    // turn off the IRT
+    TCCR1A &= ~(1<<COM1C1);
+
+    // disable this interrupt
+    TIMSK3 ^= (1<<OCIE3A);
+    TCNT3 = 0;
+
+    // debug
+    digitalWrite(10, LOW);
+  }
+}
+
+void setup() {
+  pinMode(button_pin, INPUT);
+  pinMode(servo_x_pin, INPUT);
+  pinMode(servo_out_pin, OUTPUT);
+  pinMode(IR_pin, OUTPUT);
+  Serial.begin(9600);
+
+  setupTimer3();
+  setupPWMTimer();
+
+  Scheduler_Init();
+  Scheduler_StartTask(0,20,check_button);
+  Scheduler_StartTask(5,20,handle_servo);
+
+  // debug pins
+  pinMode(10, OUTPUT);
+
+}
+void idle(uint32_t idle_period){
+  delay(idle_period);
+}
+
+void loop() {
+  uint32_t idle_period = Scheduler_Dispatch();
+  if( idle_period){
+     idle(idle_period);
+  }
+}


Issue #1 'Moisture Bad Reading' solved

Issue #1 'Moisture Bad Reading' solved

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/franciscoalario/GoldenAnt.git/'


Added boilerplate

Added boilerplate

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


Add project resources for Mote

Add project resources for Mote

Project resources ships external build files required (primarily
for testing)

error: pathspec 'projects/C7C.Atamo.Dusty.Mote_0_0_2/resources/Testing/TU_SH_DpUart_external_op.ino' did not match any file(s) known to git

--- projects/C7C.Atamo.Dusty.Mote_0_0_2/resources/Testing/TU_SH_DpUart_external_op.ino
+++ projects/C7C.Atamo.Dusty.Mote_0_0_2/resources/Testing/TU_SH_DpUart_external_op.ino
@@ -0,0 +1,37 @@
+#include <SoftwareSerial.h>
+
+// software serial #2: RX = digital pin 8, TX = digital pin 9
+// on the Mega, use other pins instead, since 8 and 9 don't work on the Mega
+SoftwareSerial portTwo(8, 9);
+
+void setup() {
+
+  pinMode(LED_BUILTIN, OUTPUT);
+
+  // Open serial communications and wait for port to open:
+  Serial.begin(9600);
+  while (!Serial) {
+    ; // wait for serial port to connect. Needed for native USB port only
+  }
+
+
+  // Start each software serial portm
+  portTwo.begin(9600);
+
+  digitalWrite(LED_BUILTIN, LOW);
+}
+
+void loop() {
+
+
+  // Now listen on the second port
+  portTwo.listen();
+  // while there is data coming in, read it
+  // and send to the hardware serial port:
+  Serial.println("Data from port two:");
+  while (portTwo.available() > 0) {
+    char inByte = portTwo.read();
+    delay(500);
+    Serial.write(inByte);
+  }
+}


Added new mqtt relay sketch

Added new mqtt relay sketch

error: pathspec 'Home' did not match any file(s) known to git
error: pathspec 'Automation/Sketches/RelayControl/RelayControl.ino' did not match any file(s) known to git


Bluetooth CAN message parsing

Bluetooth CAN message parsing

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

--- src/bluetooth_CAN/bluetooth_CAN.ino
+++ src/bluetooth_CAN/bluetooth_CAN.ino
@@ -0,0 +1,45 @@
+
+int  LED = 13;      // LED pin
+
+void setup() {
+  Serial.begin(9600); // initialization
+  pinMode(LED, OUTPUT);
+  Serial.println("Press 1 to LED ON or 0 to LED OFF...");
+}
+
+void loop() {
+  if (Serial.available() >= 3) {  // if the data came
+
+      char str_id[4];
+      Serial.readBytes(str_id, 4); // read id
+      Serial.print("ID: ");
+      for(int i = 0; i < 3; i++) Serial.print(str_id[i]);
+
+
+      char dlc_str[2];
+      Serial.readBytes(dlc_str, 2);
+      Serial.print("\ndlc: ");
+      Serial.print(dlc_str[0]);
+      Serial.println(dlc_str[1]);
+      int dlc = dlc_str[0] - '0';
+      dlc << 4;
+      dlc += dlc_str[1] - '0';
+      Serial.print("int dlc: ");
+      Serial.println(dlc);
+
+      char data[16];
+      Serial.readBytes(data, dlc*2); // read data
+      Serial.print("Data: ");
+      for(int i = 0; i < dlc*2; i+=2)
+      {
+        Serial.print("0x");
+        Serial.print(data[i]);
+        Serial.print(data[i+1]);
+        Serial.print(", ");
+      }
+
+      Serial.println("\n-----------------------\n");
+
+    delay(100);
+  }
+}


Added comments to the power supply program and took out some unused variables.

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


Added sensor board node firmware

Added sensor board node firmware

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

--- firmware/SensorBoard_node/SensorBoard_node.ino
+++ firmware/SensorBoard_node/SensorBoard_node.ino
@@ -0,0 +1,355 @@
+#include <RFM69.h>  // from lowpowerlab
+#include <SPI.h>
+#include <SPIFlash.h> //get it here: https://www.github.com/lowpowerlab/spiflash
+#include <Arduino.h>
+#include <Wire.h>
+#include "Adafruit_SHT31.h"
+#include "SparkFunMPL3115A2.h"
+#include <Adafruit_Sensor.h>  // from Adafruit's github
+#include <Adafruit_TSL2561_U.h>
+#include <avr/sleep.h>
+#include <avr/wdt.h>
+
+// define node parameters
+char node[] = "2";
+#define NODEID        2 // same sa above - must be unique for each node on same network (range up to 254, 255 is used for broadcast)
+#define GATEWAYID     1
+#define NETWORKID     101
+#define FREQUENCY     RF69_915MHZ //Match this with the version of your Moteino! (others: RF69_433MHZ, RF69_868MHZ)
+#define ENCRYPTKEY    "Tt-Mh=SQ#dn#JY3_" //has to be same 16 characters/bytes on all nodes, not more not less!
+#define IS_RFM69HW    //uncomment only for RFM69HW! Leave out if you have RFM69W!
+#define LED             9
+
+// define objects
+RFM69 radio;
+MPL3115A2 myPressure;
+Adafruit_SHT31 sht31 = Adafruit_SHT31();
+Adafruit_TSL2561_Unified tsl = Adafruit_TSL2561_Unified(TSL2561_ADDR_FLOAT, 12345);
+
+// define IAQ core global variables
+#define iaqaddress 0x5A
+uint16_t co2;
+uint8_t statu;
+int32_t resistance;
+uint16_t tvoc;
+
+// define MICS-4514 global variables
+#define PRE_PIN          8
+#define VNOX_PIN         A1
+#define VRED_PIN         A2
+#define PRE_HEAT_SECONDS 10
+int vnox_value = 0;
+int vred_value = 0;
+
+// define TSL2561 global variables
+long lux;
+float bar;
+int sound;
+float co;
+float no2;
+
+char dataPacket[150];
+
+ISR(WDT_vect)  // Interrupt service routine for WatchDog Timer
+{
+  wdt_disable();  // disable watchdog
+}
+
+void setup()
+{
+  pinMode(10, OUTPUT);
+  Serial.begin(115200);
+  Serial.println("Setup");
+
+  radio.initialize(FREQUENCY,NODEID,NETWORKID);
+#ifdef IS_RFM69HW
+  radio.setHighPower(); //uncomment only for RFM69HW!
+#endif
+  radio.encrypt(ENCRYPTKEY);
+
+  pinMode(9, OUTPUT);  // pin 9 controls LED
+  pinMode(5, OUTPUT);   // pin 5 controls power to all sensors
+  digitalWrite(5, HIGH);  // turn all sensors on
+  delay(10);
+
+  pinMode(PRE_PIN, OUTPUT);  // set preheater pin for mics4514 gas sensor
+  Serial.print("MICS-4514 Preheating...");
+  // Wait for preheating
+  digitalWrite(PRE_PIN, 1);
+  delay(PRE_HEAT_SECONDS * 1000);
+  digitalWrite(PRE_PIN, 0);
+  Serial.println("Done");
+}
+
+
+void sleep()
+{
+  //Serial.println("Going to Sleep");
+  Serial.flush(); // empty the send buffer, before continue with; going to sleep
+
+  digitalWrite(A1, LOW); // turn off UV sensor
+
+  radio.sleep();
+
+  cli();          // stop interrupts
+  MCUSR = 0;
+  WDTCSR  = (1<<WDCE | 1<<WDE);     // watchdog change enable
+  WDTCSR  = 1<<WDIE | (1<<WDP3) | (0<<WDP2) | (0<<WDP1) | (1<<WDP0); // set  prescaler to 8 second
+  sei();  // enable global interrupts
+
+  byte _ADCSRA = ADCSRA;  // save ADC state
+  ADCSRA &= ~(1 << ADEN);
+
+  asm("wdr");
+  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
+  cli();
+  //PORTD |= (1<<PORTD4); //Activate pullup on pin 4
+  //PCICR |= (1<<PCIE2);
+  //PCMSK2 |= (1<<PCINT20);
+  sleep_enable();
+  sleep_bod_disable();
+  sei();
+  sleep_cpu();
+
+  sleep_disable();
+  sei();
+
+  ADCSRA = _ADCSRA; // restore ADC state (enable ADC)
+  delay(1);
+
+  //ADCSRA &= (1 << ADEN);
+}
+
+
+void loop()
+{
+  sleep();
+
+  readSensors();
+
+  Serial.println(dataPacket);
+  Serial.println(strlen(dataPacket));
+  delay(50);
+
+  // send datapacket
+  radio.sendWithRetry(GATEWAYID, dataPacket, strlen(dataPacket), 5, 100);  // send data, retry 5 times with delay of 100ms between each retry
+  dataPacket[0] = (char)0; // clearing first byte of char array clears the array
+
+  /*
+  // blink LED after sending to give visual indication on the board
+  digitalWrite(9, HIGH);
+  delay(50);
+  digitalWrite(9, LOW);
+  */
+  fadeLED();
+}
+
+
+
+void readSensors()
+{
+
+   //T/RH
+  sht31.begin(0x44);
+  float temp = sht31.readTemperature();
+  float rh = sht31.readHumidity();
+
+
+  //light
+  tsl.begin();
+  tsl.enableAutoRange(true);
+  //tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_13MS);      /* fast but low resolution */
+  tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_101MS);  /* medium resolution and speed   */
+  // tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_402MS);  /* 16-bit data but slowest conversions */
+  sensors_event_t event;
+  tsl.getEvent(&event);
+  if (event.light)
+    lux = event.light;
+  else
+    lux = -1;
+
+
+  // IAQ core
+  Wire.requestFrom(iaqaddress, 9);
+  co2 = (Wire.read()<< 8 | Wire.read());
+  statu = Wire.read();
+  resistance = (Wire.read()& 0x00)| (Wire.read()<<16)| (Wire.read()<<8| Wire.read());
+  tvoc = (Wire.read()<<8 | Wire.read());
+
+
+
+  // ADMP401 mic for sound level
+  sound = analogRead(A0);  // read sound levels
+
+
+  // MPL3115A2 air pressure sensor
+  myPressure.begin(); // Get pressure sensor online
+  //Configure the sensor
+  //myPressure.setModeAltimeter(); // Measure altitude above sea level in meters
+  myPressure.setModeBarometer(); // Measure pressure in Pascals from 20 to 110 kPa
+
+  myPressure.setOversampleRate(7); // Set Oversample to the recommended 128
+  myPressure.enableEventFlags(); // Enable all three pressure and temp event flags
+  delay(10);
+
+  float pressure = myPressure.readPressure();
+  float temperature = myPressure.readTempF();
+
+  //const int station_elevation_ft = 5374; //Must be obtained with a GPS unit
+  //float station_elevation_m = station_elevation_ft * 0.3048; //I'm going to hard code this
+  const int station_elevation_m = 181; //Chicago
+  //1 pascal = 0.01 millibars
+  pressure /= 100; //pressure is now in millibars
+
+  float part1 = pressure - 0.3; //Part 1 of formula
+
+  const float part2 = 8.42288 / 100000.0;
+  float part3 = pow((pressure - 0.3), 0.190284);
+  float part4 = (float)station_elevation_m / part3;
+  float part5 = (1.0 + (part2 * part4));
+  float part6 = pow(part5, (1.0/0.190284));
+  float altimeter_setting_pressure_mb = part1 * part6; //Output is now in adjusted millibars
+  bar = altimeter_setting_pressure_mb * 0.02953;
+
+
+
+  // MICS 4514 CO/NO2 gas sensor
+  // Read analog values, print them out, and wait
+  vnox_value = analogRead(VNOX_PIN);
+  vred_value = analogRead(VRED_PIN);
+  co = readCO();
+  no2 = readNO2();
+
+
+
+
+  // define character arrays for all variables
+  //char _i[4];
+  char _t[7];
+  char _h[7];
+  char _c[7];
+  char _o[7];
+  char _g[7];
+  char _l[7];
+  char _n[7];
+  char _s[7];
+  char _v[7];
+
+
+  // convert all flaoting point and integer variables into character arrays
+  //dtostrf(nodeID, 2, 0, _i);
+  dtostrf(temp, 3, 1, _t);  // this function converts float into char array. 3 is minimum width, 2 is decimal precision
+  dtostrf(rh, 3, 1, _h);
+  dtostrf(co2, 3, 0, _c);
+  dtostrf(co, 1, 0, _o);
+  dtostrf(bar, 3, 2, _g);
+  dtostrf(lux, 1, 0, _l);
+  dtostrf(no2, 1, 0, _n);
+  dtostrf(sound, 1, 0, _s);
+  dtostrf(tvoc, 1, 0, _v);
+  delay(50);
+
+  dataPacket[0] = 0;  // first value of dataPacket should be a 0
+
+  // create datapacket by combining all character arrays into a large character array
+  strcat(dataPacket, "i:");
+  strcat(dataPacket, node);
+  strcat(dataPacket, ",t:");
+  strcat(dataPacket, _t);
+  strcat(dataPacket, ",h:");
+  strcat(dataPacket, _h);
+  strcat(dataPacket, ",c:");
+  strcat(dataPacket, _c);
+  strcat(dataPacket, ",o:");
+  strcat(dataPacket, _o);
+  strcat(dataPacket, ",g:");
+  strcat(dataPacket, _g);
+  strcat(dataPacket, ",l:");
+  strcat(dataPacket, _l);
+  strcat(dataPacket, ",n:");
+  strcat(dataPacket, _n);
+  strcat(dataPacket, ",s:");
+  strcat(dataPacket, _s);
+  strcat(dataPacket, ",v:");
+  strcat(dataPacket, _v);
+  delay(50);
+}
+
+
+
+
+float readCO()
+{
+  float adc = analogRead(VNOX_PIN);
+  float Rs = 47000.0/(1023.0/adc);
+  float R0 = 82000.0;
+  float ratio = Rs/R0;
+  float concentration = ((-181.4)*log(ratio))-97.469;
+  //Serial.println(adc);
+  //Serial.println(Rs);
+  //Serial.println(R0);
+  //Serial.println(ratio);
+  if(concentration>0)
+  {
+    return concentration;
+  }
+  else
+  {
+    return 0;
+  }
+}
+
+float readNO2()
+{
+  float adc = analogRead(VRED_PIN);
+  float Rs = 22000.0/(1023.0/adc);
+  float R0 = 350.0;
+  float ratio = Rs/R0;
+  float concentration = (124.28*log(ratio))-270.37;
+  //Serial.println(adc);
+  //Serial.println(Rs);
+  //Serial.println(R0);
+  //Serial.println(ratio);
+  if(concentration>0)
+  {
+    return concentration;
+  }
+  else
+  {
+    return 0;
+  }
+}
+
+
+
+// interpolate the UV intensity (from voltage vs intensity graph in datasheet)
+float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
+{
+  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
+}
+
+
+
+void fadeLED()
+{
+  int brightness = 0;
+  int fadeAmount = 5;
+  for(int i=0; i<510; i=i+5)  // 255 is max analog value, 255 * 2 = 510
+  {
+    analogWrite(9, brightness);  // pin 9 is LED
+
+    // change the brightness for next time through the loop:
+    brightness = brightness + fadeAmount;  // increment brightness level by 5 each time (0 is lowest, 255 is highest)
+
+    // reverse the direction of the fading at the ends of the fade:
+    if (brightness <= 0 || brightness >= 255)
+    {
+      fadeAmount = -fadeAmount;
+    }
+    // wait for 20-30 milliseconds to see the dimming effect
+    delay(20);
+  }
+  digitalWrite(9, LOW); // switch LED off at the end of fade
+}
+
+


Update PushNotification.ino

Update PushNotification.ino

--- examples/Widgets/PushNotification/PushNotification.ino
+++ examples/Widgets/PushNotification/PushNotification.ino
@@ -53,7 +53,7 @@
   // Setup notification button on pin 2
   pinMode(2, INPUT_PULLUP);
   // Attach pin 2 interrupt to our handler
-  attachInterrupt(0, notifyOnButtonPress, CHANGE);
+  attachInterrupt(digitalPinToInterrupt(2), notifyOnButtonPress, CHANGE);
 }

 void notifyUptime()


arduino test file

arduino test file

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

--- arduino/serialTest.ino
+++ arduino/serialTest.ino
@@ -0,0 +1,65 @@
+
+int pwmPin1 = 3;
+int pwmPin2 = 5;
+int pwmPin3 = 6;
+int pwmPin4 = 9;
+
+int irPin = 10;
+int incomingByte = 0;
+
+
+void setup() {
+
+  /* Initialize Serial at a 9600 baud rate */
+  Serial.begin(9600);
+
+  /* Configure PWM pins */
+  pinMode(pwmPin1, OUTPUT);
+  pinMode(pwmPin2, OUTPUT);
+  pinMode(pwmPin3, OUTPUT);
+  pinMode(pwmPin4, OUTPUT);
+
+  /* Configure IR range finders */
+  pinMode(irPin, INPUT);
+
+}
+
+void loop() {
+
+
+
+}
+
+/* Read IR value of specified pin */
+void readIR(int pin) {
+
+  int val = analogRead(pin);
+  getDistance(val);
+}
+
+/* 4 + 1023/Value */
+float getDistance(int val) {
+
+  float dist;
+  //dist = 4 + 5 * 1023.0/(float)val;
+  dist = 12343.85 * pow(val, -1.15);
+  Serial.println(dist);
+  return dist;
+}
+
+/* Handles receiving serial communication */
+void recvSerial() {
+
+    if (Serial.available() > 0) {
+        incomingByte = Serial.read();
+        Serial.print("received: ");
+        Serial.println(incomingByte, DEC);
+    }
+}
+
+/* Function to drive given PWM pin given value */
+void writePWM(int pin, float value) {
+
+  analogWrite(pin, value);
+}
+


commit

commit

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

--- projects/arduino/peopleinside.ino
+++ projects/arduino/peopleinside.ino
@@ -0,0 +1,1149 @@
+//#include <SPI.h>
+#include <QueueArray.h>
+//#include <Phpoc.h>
+
+#define DATA_SIZE 100
+#define TREE_SIZE 50
+//#define QN 6
+
+// 핀번호 설정
+int echo[4] = { 2, 8, 7, 5 };
+int trig[4] = { 3, 9, 6, 4 };
+
+// 거리
+float distance[4];
+
+// Bound, standard diviationl
+float lowerbound[4], upperbound[4];
+//PhpocClient client;
+// global avg (벽과의 거리)
+//float real_avg = 0;
+
+// initial times
+int times = 0;
+
+int cnt = 0;
+int data_cnt = 0;
+bool isNewLine = false;
+
+//QueueArray <float> Q[4];
+//QueueArray <float> D;
+float ar[16];
+int index = 0;
+//float Qsum[4] = {0,};
+//float Qavg[4] = {0,};
+bool first = false;
+bool last = false;
+bool sw = true;
+
+int seq = 1;
+
+int vote[TREE_SIZE];
+
+void setup() {
+  Serial.begin(250000);
+  //  while (!Serial)
+  //    ;
+  //  Serial.println("Sending GET request to web server");
+  //  Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
+  for (int i = 0; i < 4; i++) {
+    pinMode(trig[i], OUTPUT);
+    pinMode(echo[i], INPUT);
+  }
+  //    lowerbound[0] = 88 - 4;
+  //    lowerbound[1] = 88 - 4;
+  //    lowerbound[2] = 88 - 4;
+  //    lowerbound[3] = 88 - 4;
+  //    upperbound[0] = 88 + 4;
+  //    upperbound[1] = 88 + 4;
+  //    upperbound[2] = 88 + 4;
+  //    upperbound[3] = 88 + 4;
+  lowerbound[0] = 83.08;
+  lowerbound[1] = 83.35;
+  lowerbound[2] = 82.82;
+  lowerbound[3] = 83.34;
+  upperbound[0] = 91.39;
+  upperbound[1] = 91.66;
+  upperbound[2] = 91.13;
+  upperbound[3] = 91.65;
+}
+
+//void initialize(int init_time) {
+//  if (times < init_time) {
+//    for (int i = 0; i < 4; i++) {
+//      arr[i][times] = distance[i];
+//    }
+//  }
+//}
+
+//void calculate_bound(int init_time) {
+//  float sum[4] = {0,}, avg[4], stddv[4], sig = 0;
+//
+//  for (int i = 0; i < 4; i++) {
+//    for (int j = 10; j < init_time; j++) {
+//      sum[i] += arr[i][j];
+//    }
+//    avg[i] = sum[i] / (init_time - 10);
+//    sum[i] = 0;
+//  }
+//
+//  for (int i = 0; i < 4; i++) {
+//    for (int j = 10; j < init_time; j++) {
+//      sum[i] += pow(arr[i][j] - avg[i], 2);
+//    }
+//    stddv[i] = sqrt(sum[i] / (init_time - 10)) * 12;
+//  }
+//
+//  for (int i = 0; i < 4; i++) {
+//    if (stddv[i] > sig) sig = stddv[i];
+//  }
+//
+//  for (int i = 0; i < 4; i++) {
+//    lowerbound[i] = avg[i] - sig;
+//    upperbound[i] = avg[i] + sig;
+//  }
+//
+//  for (int i = 0; i < 4; i++) {
+//    real_avg += avg[i];
+//  }
+//  real_avg /= 4;
+//  lowerbound[0] = 83.08;
+//  lowerbound[1] = 83.35;
+//  lowerbound[2] = 82.82;
+//  lowerbound[3] = 83.34;
+//  upperbound[0] = 91.39;
+//  upperbound[1] = 91.66;
+//  upperbound[2] = 91.13;
+//  upperbound[3] = 91.65;
+//  //  for (int i = 0; i < 4; i++) {
+//  //    lowerbound[i] = real_avg - sig;
+//  //    upperbound[i] = real_avg + sig;
+//  //  }
+//}
+
+bool isInBound(int i) {
+  if (distance[i] > lowerbound[i] && distance[i] < upperbound[i]) return true;
+  else return false;
+}
+
+void process(int i) {
+  if (i==2 || i==5 || i==7 || i==8 || i==9 || i==10 || i==12 || i==17 || i==19 || i==26 || i==27 || i==29 || i==30 || i==41 || i==48){
+    i=-1;
+  }
+  if (i == 0) { // 보선
+    if (ar[3] < 62.25) {
+      vote[i] = -1;
+    } else {
+      if (ar[1] < 81.12) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    }
+  }
+  else if (i == 1) { // 채린
+    if (ar[2] < 83.495) {
+      vote[i] = 1;
+    } else {
+      if (ar[7] < 86.635) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    }
+  }
+    else if (i == 2) { // 조서
+      if (ar[6] < 79.23) {
+        vote[i] = 1;
+      } else {
+        if (ar[0] < 87.26) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      }
+    }
+    else if (i == 3) { // 두상
+      if (ar[11] < 48.25) {
+        if (ar[4] < 43) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      } else {
+        if (ar[2] < 87.105) {
+          vote[i] = 1;
+        } else {
+          if (ar[3] < 55.455) {
+            vote[i] = -1;
+          } else {
+            vote[i] = 1;
+          }
+        }
+      }
+    }
+  else if (i == 4) { // 기욱
+    if (ar[7] < 34) {
+      vote[i] = -1;
+    } else {
+      if (ar[3] < 61.65) {
+        vote[i] = -1;
+      } else {
+        if (ar[1] < 47.245) {
+          vote[i] = -1;
+        } else {
+          vote[i] = 1;
+        }
+      }
+    }
+  }
+    else if (i == 5) { // 형진
+      if (ar[1] < 77.63) {
+        if (ar[4] < 59.38) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      } else {
+        if (ar[13] < 89.58) {
+          if (ar[3] < 39.175) {
+            vote[i] = -1;
+          } else {
+            vote[i] = 1;
+          }
+        } else {
+          vote[i] = -1;
+        }
+      }
+    }
+  else if (i == 6) { // 종호
+    if (ar[2] < 63.795) {
+      vote[i] = 1;
+    } else {
+      if (ar[0] < 75.42) {
+        vote[i] = 1;
+      } else {
+        if (ar[4] < 67.845) {
+          vote[i] = 1;
+        } else {
+          if (ar[7] < 87.94) {
+            vote[i] = -1;
+          } else {
+            vote[i] = 1;
+          }
+        }
+      }
+    }
+  }
+  else if (i == 7) { // 지식
+    if (ar[1] < 81.185) {
+      vote[i] = -1;
+    } else {
+      if (ar[3] < 55.27) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    }
+  }
+    else if (i == 8) { // 지원
+      if (ar[7] < 45.3) {
+        if (ar[0] < 86.7) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      } else {
+        vote[i] = 1;
+      }
+    }
+    else if (i == 9) { // 광선
+      if (ar[2] < 86.925) {
+        vote[i] = 1;
+      } else {
+        if (ar[4] < 43.56) {
+          vote[i] = 1;
+        } else {
+          if (ar[8] < 87.645) {
+            vote[i] = -1;
+          } else {
+            vote[i] = 1;
+          }
+        }
+      }
+    }
+    else if (i == 10) { // 남진
+      if (ar[3] < 50.35) {
+        vote[i] = -1;
+      } else {
+        if (ar[1] < 32.015) {
+          vote[i] = -1;
+        } else {
+          if (ar[5] < 89.8) {
+            vote[i] = 1;
+          } else {
+            vote[i] = -1;
+          }
+        }
+      }
+    }
+  else if (i == 11) { // 소현
+    if (ar[3] < 75.715) {
+      vote[i] = -1;
+    } else {
+      if (ar[3] < 90.3) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    }
+  }
+  else if (i == 12) { // 성준
+    if (ar[7] < 48.025) {
+      vote[i] = -1;
+    } else {
+      if (ar[5] < 64.835) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    }
+  }
+    else if (i == 13) { // 성민
+      if (ar[7] < 49.08) {
+        if (ar[0] < 47.06) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      } else {
+        vote[i] = 1;
+      }
+    }
+  else if (i == 14) { // 상우
+    if (ar[1] < 81.21) {
+      if (ar[0] < 76.17) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    } else {
+      if (ar[3] < 81.225) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    }
+  }
+  else if (i == 15) { // 영준
+    if (ar[6] < 62.33) {
+      if (ar[1] < 88.91) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    } else {
+      if (ar[4] < 69.625) {
+        vote[i] = 1;
+      } else {
+        if (ar[0] < 78.07) {
+          vote[i] = 1;
+        } else {
+          if (ar[2] < 88.865) {
+            vote[i] = -1;
+          } else {
+            vote[i] = 1;
+          }
+        }
+      }
+    }
+  }
+  else if (i == 16) { // 영송
+    if (ar[3] < 75.25) {
+      vote[i] = -1;
+    } else {
+      if (ar[1] < 61.875) {
+        vote[i] = -1;
+      } else {
+        if (ar[1] < 89.465) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      }
+    }
+  }
+    else if (i == 17) { // 유성
+      if (ar[11] < 29.615) {
+        if (ar[0] < 87.48) {
+          vote[i] = -1;
+        } else {
+          vote[i] = 1;
+        }
+      } else {
+        if (ar[1] < 78.645) {
+          vote[i] = -1;
+        } else {
+          vote[i] = 1;
+        }
+      }
+    }
+  else if (i == 18) { // 승연
+    if (ar[2] < 51.29) {
+      if (ar[1] < 43.005) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    } else {
+      if (ar[2] < 88.565) {
+        if (ar[0] < 68.315) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      } else {
+        vote[i] = 1;
+      }
+    }
+  }
+    else if (i == 19) { // 용욱
+      if (ar[7] < 40.145) {
+        if (ar[6] < 42.94) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      } else {
+        if (ar[15] < 33.16) {
+          if (ar[5] < 86.505) {
+            vote[i] = 1;
+          } else {
+            vote[i] = -1;
+          }
+        } else {
+          vote[i] = 1;
+        }
+      }
+    }
+  else if (i == 20) { // 김현중
+    if (ar[3] < 86.605) {
+      if (ar[2] < 57.8) {
+        vote[i] = 1;
+      } else {
+        if (ar[6] < 40.42) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      }
+    } else {
+      if (ar[1] < 59.46) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    }
+  }
+  else if (i == 21) { // 장영준
+    if (ar[7] < 81.99) {
+      if (ar[14] < 43.185) {
+        vote[i] = 1;
+      } else {
+        if (ar[0] < 81.265) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      }
+    } else {
+      if (ar[1] < 90.145) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    }
+  }
+  else if (i == 22) { // 주병
+    if (ar[4] < 77.095) {
+      if (ar[1] < 94.82) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    } else {
+      if (ar[8] < 16.45) {
+        vote[i] = 1;
+      } else {
+        if (ar[2] < 65.125) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      }
+    }
+  }
+  else if (i == 23) { // 원균
+    if (ar[7] < 60.91) {
+      if (ar[0] < 51.18) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    } else {
+      if (ar[14] < 86.355) {
+        vote[i] = 1;
+      } else {
+        if (ar[5] < 86.23) {
+          vote[i] = -1;
+        } else {
+          vote[i] = 1;
+        }
+      }
+    }
+  }
+  else if (i == 24) { // 지영
+    if (ar[6] < 62.33) {
+      if (ar[1] < 88.91) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    } else {
+      if (ar[4] < 69.625) {
+        vote[i] = 1;
+      } else {
+        if (ar[0] < 78.07) {
+          vote[i] = 1;
+        } else {
+          if (ar[2] < 88.865) {
+            vote[i] = -1;
+          } else {
+            vote[i] = 1;
+          }
+        }
+      }
+    }
+  }
+  else if (i == 25) { // 규봉
+    if (ar[6] < 52.785) {
+      if (ar[13] < 26.455) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    } else {
+      if (ar[0] < 76.335) {
+        vote[i] = 1;
+      } else {
+        if (ar[8] < 89.33) {
+          vote[i] = -1;
+        } else {
+          vote[i] = 1;
+        }
+      }
+    }
+  }
+    else if (i == 26) { // 진용
+      if (ar[12] < 29.46) {
+        if (ar[3] < 38.565) {
+          vote[i] = -1;
+        } else {
+          vote[i] = 1;
+        }
+      } else {
+        if (ar[4] < 37.44) {
+          vote[i] = 1;
+        } else {
+          if (ar[8] < 29.02) {
+            vote[i] = 1;
+          } else {
+            vote[i] = -1;
+          }
+        }
+      }
+    }
+    else if (i == 27) { // 경나?
+      if (ar[7] < 40.44) {
+        vote[i] = -1;
+      } else {
+        if (ar[3] < 35.905) {
+          vote[i] = -1;
+        } else {
+          vote[i] = 1;
+        }
+      }
+    }
+  else if (i == 28) {
+    if (ar[3] < 81.64) {
+      if (ar[0] < 50.085) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    } else {
+      if (ar[1] < 80.765) {
+        vote[i] = -1;
+      } else {
+        if (ar[1] < 89.66) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      }
+    }
+  }
+  else if (i == 29) {
+    if (ar[7] < 41.715) {
+      vote[i] = -1;
+    } else {
+      if (ar[1] < 86.76) {
+        vote[i] = -1;
+      } else {
+        if (ar[3] < 64.51) {
+          vote[i] = -1;
+        } else {
+          vote[i] = 1;
+        }
+      }
+    }
+  }
+  else if (i == 30) {
+    if (ar[3] < 46.68) {
+      vote[i] = -1;
+    } else {
+      if (ar[2] < 86.555) {
+        vote[i] = 1;
+      } else {
+        if (ar[0] < 78.215) {
+          vote[i] = 1;
+        } else {
+          if (ar[3] < 65.625) {
+            vote[i] = 1;
+          } else {
+            vote[i] = -1;
+          }
+        }
+      }
+    }
+  }
+  else if (i == 31) {
+    if (ar[4] < 80.99) {
+      if (ar[3] < 45.485) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    } else {
+      if (ar[2] < 81.355) {
+        vote[i] = 1;
+      } else {
+        if (ar[0] < 64.835) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      }
+    }
+  }
+  else if (i == 32) {
+    if (ar[7] < 69.09) {
+      if (ar[2] < 74.935) {
+        if (ar[1] < 59.635) {
+          vote[i] = -1;
+        } else {
+          vote[i] = 1;
+        }
+      } else {
+        vote[i] = -1;
+      }
+    } else {
+      vote[i] = 1;
+    }
+  }
+  else if (i == 33) {
+    if (ar[6] < 79.955) {
+      if (ar[1] < 90.88) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    } else {
+      if (ar[4] < 56.625) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    }
+  }
+  else if (i == 34) {
+    if (ar[3] < 79.925) {
+      if (ar[4] < 75.775) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    } else {
+      if (ar[1] < 75.685) {
+        vote[i] = -1;
+      } else {
+        if (ar[2] < 87.795) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      }
+    }
+  }
+  else if (i == 35) {
+    if (ar[7] < 46.985) {
+      vote[i] = -1;
+    } else {
+      if (ar[0] < 86.755) {
+        vote[i] = 1;
+      } else {
+        if (ar[1] < 87.785) {
+          vote[i] = -1;
+        } else {
+          vote[i] = 1;
+        }
+      }
+    }
+  }
+  else if (i == 36) {
+    if (ar[4] < 86.545) {
+      vote[i] = 1;
+    } else {
+      if (ar[2] < 81.535) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    }
+  }
+  else if (i == 37) {
+    if (ar[2] < 86.51) {
+      if (ar[6] < 87.74) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    } else {
+      if (ar[0] < 82) {
+        vote[i] = 1;
+      } else {
+        if (ar[7] < 87.76) {
+          vote[i] = -1;
+        } else {
+          vote[i] = 1;
+        }
+      }
+    }
+  }
+  else if (i == 38) {
+    if (ar[4] < 79.465) {
+      if (ar[1] < 45.99) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    } else {
+      if (ar[6] < 75.765) {
+        vote[i] = 1;
+      } else {
+        if (ar[0] < 84.38) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      }
+    }
+  }
+  else if (i == 39) {
+    if (ar[4] < 71.125) {
+      if (ar[7] < 36.985) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    } else {
+      if (ar[0] < 75.86) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    }
+  }
+  else if (i == 40) {
+    if (ar[0] < 86.595) {
+      vote[i] = 1;
+    } else {
+      if (ar[2] < 75.555) {
+        vote[i] = 1;
+      } else {
+        if (ar[2] < 87.485) {
+          if (ar[6] < 55.33) {
+            vote[i] = 1;
+          } else {
+            vote[i] = -1;
+          }
+        } else {
+          vote[i] = 1;
+        }
+      }
+    }
+  }
+  else if (i == 41) {
+    if (ar[3] < 78.005) {
+      if (ar[0] < 57.29) {
+        vote[i] = 1;
+      } else {
+        if (ar[4] < 28.145) {
+          vote[i] = 1;
+        } else {
+          vote[i] = 1;
+        }
+      }
+    } else {
+      if (ar[6] < 87.055) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    }
+  }
+  else if (i == 42) {
+    if (ar[3] < 81.665) {
+      if (ar[2] < 86.285) {
+        vote[i] = 1;
+      } else {
+        if (ar[2] < 88.895) {
+          vote[i] = -1;
+        } else {
+          vote[i] = 1;
+        }
+      }
+    } else {
+      if (ar[5] < 71.495) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    }
+  }
+  else if (i == 43) {
+    if (ar[4] < 86.72) {
+      if (ar[5] < 54.95) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    } else {
+      if (ar[2] < 81.78) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    }
+  }
+  else if (i == 44) {
+    if (ar[6] < 86.28) {
+      if (ar[1] < 89.655) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    } else {
+      if (ar[0] < 86.59) {
+        vote[i] = 1;
+      } else {
+        if (ar[2] < 62.425) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      }
+    }
+  }
+  else if (i == 45) {
+    if (ar[6] < 86.295) {
+      if (ar[1] < 53.585) {
+        vote[i] = -1;
+      } else {
+        if (ar[1] < 89.69) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      }
+    } else {
+      if (ar[6] < 87.32) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    }
+  }
+  else if (i == 46) {
+    if (ar[6] < 79.27) {
+      if (ar[3] < 35.905) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    } else {
+      if (ar[2] < 70.465) {
+        vote[i] = 1;
+      } else {
+        if (ar[0] < 65.68) {
+          vote[i] = 1;
+        } else {
+          vote[i] = -1;
+        }
+      }
+    }
+  }
+  else if (i == 47) {
+    if (ar[2] < 84.245) {
+      vote[i] = 1;
+    } else {
+      if (ar[4] < 64.175) {
+        vote[i] = 1;
+      } else {
+        if (ar[2] < 88.625) {
+          vote[i] = -1;
+        } else {
+          vote[i] = 1;
+        }
+      }
+    }
+  }
+  else if (i == 48) {
+    if (ar[7] < 43.52) {
+      if (ar[2] < 60.06) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    } else {
+      if (ar[2] < 87.24) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    }
+  }
+  else if (i == 49) {
+    if (ar[7] < 59.045) {
+      if (ar[4] < 60.62) {
+        vote[i] = 1;
+      } else {
+        vote[i] = -1;
+      }
+    } else {
+      if (ar[5] < 65.57) {
+        vote[i] = -1;
+      } else {
+        vote[i] = 1;
+      }
+    }
+  }
+}
+
+void print_value() {
+  //  Serial.print(times);
+  //  Serial.print("\t");
+
+  //  if (times > 30 && (!isInBound(0) || !isInBound(1) || !isInBound(2) || !isInBound(3))) {
+  //    if (index < 40) {
+  //      //      ar[index++] = Qavg[0];
+  //      //      ar[index++] = Qavg[1];
+  //      //      ar[index++] = Qavg[2];
+  //      //      ar[index++] = Qavg[3];
+  //    }
+  //    isNewLine = false;
+  //    data_cnt += 4;
+  //  }
+
+  //  for (int i = 0; i < 4; i++) {
+  //    Q[i].push(distance[i]);
+  //    Qsum[i] += distance[i];
+  //  }
+  //
+  //  if (Q[0].count() == QN + 1) {
+  //    for (int i = 0; i < 4; i++) {
+  //      Qsum[i] -= Q[i].pop();
+  //    }
+  //  }
+  //
+  //  for (int i = 0; i < 4; i++)
+  //    Qavg[i] = Qsum[i] / Q[i].count();
+
+  if (isInBound(0) && isInBound(1) && isInBound(2) && isInBound(3) && !isNewLine) {
+    cnt++;
+  } else {
+    cnt = 0;
+  }
+
+  if (cnt == 3) {
+    cnt = 0;
+    if (ar[12] != 0 || ar[13] != 0 || ar[14] != 0 || ar[15] != 0) {
+      for (int i = 0; i < TREE_SIZE; i++) {
+        process(i);
+      }
+      int sum = 0;
+      int out = 0, in = 0;
+      for (int i = 0; i < TREE_SIZE; i++) {
+        Serial.print(vote[i]);
+        Serial.print("\t");
+        if (vote[i] == -1) out++;
+        else if (vote[i] == 1) in++;
+        sum += vote[i];
+        vote[i] = 0;
+      }
+      Serial.println("\t");
+      Serial.println("\t");
+      Serial.print("IN  :  ");
+      Serial.print(in);
+      Serial.print("\t");
+      Serial.print("OUT  :  ");
+      Serial.print(out);
+      Serial.print("\t");
+      Serial.print("RESULT  :  ");
+      Serial.print(sum);
+      Serial.println("\t");
+      Serial.println("\t");
+      in = 0; out = 0; sum = 0;
+    }
+    for (int i = 0; i < 16; i++) {
+      ar[i] = 0;
+    }
+
+    //    if (sw) {
+    //      for (int i = 0; i < DATA_SIZE - data_cnt; i++) {
+    //        Serial.print('0');
+    //        Serial.print("\t");
+    //      }
+    //      Serial.println();
+    //    }
+    data_cnt = 0;
+    isNewLine = true;
+    index = 0;
+  }
+
+  //  if (!isInBound(0) || !isInBound(1) || !isInBound(2) || !isInBound(3)) {
+  //    if (!first && D.count() < 12) {
+  //      D.push(Qavg[0]);
+  //      D.push(Qavg[1]);
+  //      D.push(Qavg[2]);
+  //      D.push(Qavg[3]);
+  //    }
+  //    if (!first && D.count() == 12) {
+  //      for (int i = 0; i < 12; i++) ar[i] = D.pop();
+  //      first = true;
+  //      //      Serial.println("First On!");
+  //    }
+  //    if (first && !last) {
+  //      D.push(Qavg[0]);
+  //      D.push(Qavg[1]);
+  //      D.push(Qavg[2]);
+  //      D.push(Qavg[3]);
+  //      if (D.count() > 12) for (int i = 0; i < 4; i++) D.pop();
+  //    }
+  //  }
+  //
+  //  if (first && !last && cnt == 2) {
+  //    for (int i = 12; i < 24; i++) ar[i] = D.pop();
+  //    last = true;
+  //  }
+  //  if (first && last) {
+  //    process();
+  //  }
+  //  if (cnt == 2) {
+  //    for (int i = 0; i < 24; i++) ar[i] = 0;
+  //    isNewLine = true;
+  //    cnt = 0;
+  //    first = false;
+  //    last = false;
+  //  }
+
+//  if (!isInBound(0) || !isInBound(1) || !isInBound(2) || !isInBound(3)) {
+//    if (index < 14) {
+//      for (int i = 0; i < 4; i++) {
+//        if (distance[i] == 120.0) {
+//          ar[index++] = 0;
+//        } else {
+//          ar[index++] = distance[i];
+//        }
+//      }
+//    }
+    for (int i = 0; i < 4; i++) {
+      //    if (!isInBound(i)) {
+            Serial.print(distance[i]);
+            Serial.print("\t");
+      //    }
+    }
+    data_cnt += 4;
+    isNewLine = false;
+    //    for (int i = 0; i < 4; i++) {
+    //      //    if (!isInBound(i)) {
+    //      Serial.print(lowerbound[i]);
+    //      Serial.print("\t");
+    //      //    }
+    //    }
+    //    for (int i = 0; i < 4; i++) {
+    //      //    if (!isInBound(i)) {
+    //      Serial.print(upperbound[i]);
+    //      Serial.print("\t");
+    //      //    }
+    //    }
+            Serial.println();
+//  }
+}
+
+float getDistance(int i) {
+  float result, du;
+  digitalWrite(trig[i], HIGH);
+  delay(5);
+  digitalWrite(trig[i], LOW);
+  du = pulseIn(echo[i], HIGH);
+  //  result = ((float)(340 * du) / 10000) / 2;
+  result = du / 58.2;
+  if (result > 120) result = 120; // 튀는 값 120으로 보정
+  return result;
+}
+
+//float getMedian(float a, float b, float c) {
+//  float A = a, B = b, C = c;
+//  if (b >= a && a >= c) return A;
+//  if (c >= a && a >= b) return A;
+//  if (a >= b && b >= c) return B;
+//  if (c >= b && b >= a) return B;
+//  if (a >= c && c >= b) return C;
+//  if (b >= c && c >= a) return C;
+//}
+
+void loop() {
+  int num = 1;
+
+  for (int i = 0; i < 4; i++) distance[i] = getDistance(i);
+
+
+
+  // 바운드 계산을 위한 초기값 (벽) 거리 측정
+  //  initialize(30);
+
+  // 바운드 계산
+  //  if (times == 30) calculate_bound(30);
+
+
+  // 출력
+  print_value();
+
+  if (Serial.available()) {
+    Serial.read();
+    sw = !sw;
+  }
+
+  times++;
+}


Circle version lamp

Circle version lamp

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

--- circle/circle.ino
+++ circle/circle.ino
@@ -0,0 +1,25 @@
+#import <FastLED.h>
+struct CRGB leds[N_LEDS];
+
+void setup() {
+  FastLED.addLeds<WS2812B, 7, GRB>(leds, 93);
+  FastLED.setMaxPowerInVoltsAndMilliamps(5,3000);
+}
+
+int rings[6] = { 32, 24, 16, 12, 8, 1 };
+int frame = 0;
+
+void loop() {
+  int offset = 0;
+  for(int ring = 0; ring < 6; ring++) {
+    int pixels = rings[ring];
+    // frame steps the ring around, ring * 3 off-sets each ring 3 pixels
+    uint8_t rainbowStart = frame + ring * 3;
+    int rainbowDelta = 255 / pixels;
+    fill_rainbow(&(leds[offset]), pixels, rainbowStart, rainbowDelta);
+    offset += pixels;
+  }
+  EVERY_N_MILLISECONDS(5) { frame++; }
+  FastLED.show();
+}
+


Revert to saved.

Revert to saved.

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

--- examples/Sandbox/CosaBitSet/CosaBitSet.ino
+++ examples/Sandbox/CosaBitSet/CosaBitSet.ino
@@ -0,0 +1,100 @@
+/**
+ * @file CosaBitSet.ino
+ * @version 1.0
+ *
+ * @section License
+ * Copyright (C) 2013, Mikael Patel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA  02111-1307  USA
+ *
+ * @section Description
+ * Demonstrate Cosa BitSet class.
+ *
+ * This file is part of the Arduino Che Cosa project.
+ */
+
+#include "Cosa/BitSet.hh"
+#include "Cosa/Watchdog.hh"
+#include "Cosa/Memory.h"
+#include "Cosa/Trace.hh"
+#include "Cosa/IOStream/Driver/UART.hh"
+
+enum {
+  RED,
+  GREEN,
+  BLUE,
+  YELLOW,
+  MAGENTA,
+  CYAN
+};
+
+void setup()
+{
+  BitSet<68> a, b;
+
+  uart.begin(9600);
+  trace.begin(&uart, PSTR("CosaBitSet: started"));
+  Watchdog::begin();
+
+  TRACE(free_memory());
+  TRACE(sizeof(a));
+
+  // Check that the bitset is empty
+  ASSERT(b.isempty());
+  ASSERT(a == b);
+
+  // Add and remove elements
+  ASSERT(!b[GREEN]);
+  b += GREEN;
+  ASSERT(b[GREEN]);
+  b -= GREEN;
+  ASSERT(!b[GREEN]);
+  b += RED;
+  b += CYAN;
+  ASSERT(b[RED] && b[CYAN]);
+  trace << PSTR("B0:") << b << endl;
+
+  // Assign and check that they are equal
+  a = b;
+  ASSERT(a == b);
+  trace << PSTR("A0:") << a << endl;
+
+  // Add element and another bitset
+  a += a.members() / 2;
+  trace << PSTR("A1:") << a << endl;
+
+  // Try adding element outside the bitset
+  b += 67;
+  b += 68;
+  b += 100;
+  trace << PSTR("B1:") << b << endl;
+  ASSERT(b[RED] && b[CYAN] && b[67]);
+  ASSERT(!b[68] && !b[100]);
+
+  // Remove bitset and the last element
+  b -= a;
+  b -= 67;
+  trace << PSTR("B2:") << b << endl;
+  ASSERT(b.isempty());
+  for (uint16_t i = 4; i < b.members(); i += 5)
+    b += i;
+  trace << PSTR("B3:") << b << endl;
+}
+
+void loop()
+{
+  ASSERT(true == false);
+}


Create testAllInputHandlers.ino

Create testAllInputHandlers.ino

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

--- examples/testAllInputHandlers/testAllInputHandlers.ino
+++ examples/testAllInputHandlers/testAllInputHandlers.ino
@@ -0,0 +1,43 @@
+/*
+
+This is a sketch testing all the different types of handlers
+The global input handler will always be triggered.
+Setting lightnode1/property1/ will trigger the node input handler.
+Setting lightnode2/property1/ will trigger the property input handler.
+
+*/
+
+#include <Arduino.h>
+#include <Homie.h>
+
+bool globalInputHandler(const HomieNode& node, const HomieRange& range, const String& property, const String& value) {
+  Homie.getLogger() << "Global input handler. Received on node " << node.getId() << ": " << property << " = " << value << endl;
+  return false;
+}
+
+bool nodeInputHandler(const HomieRange & range, const String & property, const String & value) {
+  Homie.getLogger() << "Node input handler. Received on property " << property << " value: " << value;
+  return true;
+}
+
+bool propertyInputHandler(const HomieRange& range, const String& value) {
+  Homie.getLogger() << "Property input handler. Receveived value: " << value;
+  return true;
+}
+
+HomieNode lightNode1("lightnode1", "Light Node One Name","switch", false, 0 , 0, &nodeInputHandler);
+HomieNode lightNode2("lightnode2", "Light Two One Name","switch");
+
+void setup() {
+  Serial.begin(115200);
+  Serial << endl << endl;
+  Homie_setFirmware("Test all input handlers", "0.0.1");
+  lightNode1.advertise("property1").setName("ln1 First property").setDatatype("boolean").settable();
+  lightNode2.advertise("property1").setName("ln2 First property").setDatatype("boolean").settable(propertyInputHandler);
+  Homie.setGlobalInputHandler(globalInputHandler);
+  Homie.setup();
+}
+
+void loop() {
+  Homie.loop();
+}


_05_kidSerie_sketch_03.Adafruit_Fisrt_feeds.ino 05_kidSerie

_05_kidSerie_sketch_03.Adafruit_Fisrt_feeds.ino 05_kidSerie

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

--- _05_kidSerie_sketch_03.Adafruit_Fisrt_feeds.ino
+++ _05_kidSerie_sketch_03.Adafruit_Fisrt_feeds.ino
@@ -0,0 +1,183 @@
+/*
+  Project name:
+     05 #kidSerie - Adafruit-IO Meets ESP8266, Arduino & MIT App Inventor 2
+     (Awesome Smart Phone App!)
+     Flavour III -
+     Hex File: _05_kidSerie_sketch_03.Adafruit_Fisrt_feeds.ino
+   Revision History:
+     20161029:
+       - from github adafruit/Adafruit_MQTT_Library
+  https://github.com/adafruit/Adafruit_MQTT_Library/blob/master/examples/mqtt_esp8266/mqtt_esp8266.ino
+  https://learn.adafruit.com/mqtt-adafruit-io-and-you/intro-to-adafruit-mqtt
+
+   Description:
+     Code sequence to get the final flavor V. Follow, please!
+     Simple code to intro Adafruit-io technology using MQTT broker, ESP8266, DHTXX sensor & arduino.
+     We will publish two topics: temp and humidity and subscribe them also.
+     We will access the our dashboard by phone using MIT App Inventor 2.
+     Awesome project!!!
+
+   MCU:                  Arduino 1.6.12 - @16MHz       http://www.arduino.cc/
+   ESP8266:              ESP-01                        https://goo.gl/E0Eq4l
+   DHT11:                PRODUCT ID: 386               https://www.adafruit.com/product/386
+
+   Connections:
+      See Official youtube channel vids:
+   Based on:   Tony DiCola for Adafruit Industries - see below!
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License v3 as published by
+   the Free Software Foundation
+*/
+/***************************************************
+  Adafruit MQTT Library ESP8266 Example
+  Must use ESP8266 Arduino from:
+    https://github.com/esp8266/Arduino
+  Works great with Adafruit's Huzzah ESP board & Feather
+  ----> https://www.adafruit.com/product/2471
+  ----> https://www.adafruit.com/products/2821
+  Adafruit invests time and resources providing this open source code,
+  please support Adafruit and open-source hardware by purchasing
+  products from Adafruit!
+  Written by Tony DiCola for Adafruit Industries.
+  MIT license, all text above must be included in any redistribution
+ ****************************************************/
+ /******************************* Adafruit MQTT *******************************/
+
+#include "Adafruit_MQTT.h"
+#include "Adafruit_MQTT_Client.h"
+
+/******************************* Esp8266**************************************/
+
+#include <ESP8266WiFi.h>
+
+/************************* WiFi Access Point *********************************/
+
+#define WLAN_SSID       "colibri" //"...your SSID..."
+#define WLAN_PASS       "jr10589238"//"...your password..."
+
+/************************* Adafruit.io Setup *********************************/
+
+#define AIO_SERVER      "io.adafruit.com"
+#define AIO_SERVERPORT  1883                   // use 8883 for SSL
+#define AIO_USERNAME    "giljr"// "...your AIO username (see https://accounts.adafruit.com)..."
+#define AIO_KEY         "6dfe661db07e4b3cbd109d064c778e55" // "...your AIO key..."
+
+/************ Global State (you don't need to change this!) ******************/
+
+// Create an ESP8266 WiFiClient class to connect to the MQTT server.
+WiFiClient client;
+// or... use WiFiFlientSecure for SSL
+//WiFiClientSecure client;
+
+// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
+Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);
+
+/****************************** Feeds ***************************************/
+/****************************** Topics ***************************************/
+// Setup a feed called 'photocell' for publishing.
+// Notice MQTT paths for AIO follow the form: <username>/feeds/<feedname>
+Adafruit_MQTT_Publish photocell = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/photocell");
+/****************************** Subscriptions*********************************/
+// Setup a feed called 'photocell' for subscribing to changes.
+Adafruit_MQTT_Subscribe photocell_subsc = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/photocell");
+
+/***************************  MQTT Conn   ************************************/
+
+// Bug workaround for Arduino 1.6.6, it seems to need a function declaration
+// for some reason (only affects ESP8266, likely an arduino-builder bug).
+void MQTT_connect();
+
+/****************************** Setup  ***************************************/
+void setup() {
+  Serial.begin(115200);
+  delay(10);
+
+  Serial.println(F("Adafruit MQTT demo"));
+
+  // Connect to WiFi access point.
+  Serial.println(); Serial.println();
+  Serial.print("Connecting to ");
+  Serial.println(WLAN_SSID);
+
+  WiFi.begin(WLAN_SSID, WLAN_PASS);
+  while (WiFi.status() != WL_CONNECTED) {
+    delay(500);
+    Serial.print(".");
+  }
+  Serial.println();
+
+  Serial.println("WiFi connected");
+  Serial.println("IP address: "); Serial.println(WiFi.localIP());
+
+  // Setup MQTT subscription for onoff feed.
+  mqtt.subscribe(&photocell_subsc);
+}
+
+uint32_t x=0;    // Mock data
+
+/****************************** Loop  ***************************************/
+void loop() {
+  // Ensure the connection to the MQTT server is alive (this will make the first
+  // connection and automatically reconnect when disconnected).  See the MQTT_connect
+  // function definition further below.
+  MQTT_connect();
+
+  // this is our 'wait for incoming subscription packets' busy subloop
+  // try to spend your time here
+
+ /****************************** Subscript  ***********************************/
+ Adafruit_MQTT_Subscribe *subscription;
+  while ((subscription = mqtt.readSubscription(5000))) {
+    if (subscription == &photocell_subsc) {
+      Serial.print(F("Got: "));
+      Serial.println((char *)photocell_subsc.lastread);
+    }
+  }
+ /****************************** Publish  **********************************/
+   // Now we can publish stuff!
+  Serial.print(F("\nSending photocell val "));
+  Serial.print(x);
+  Serial.print("...");
+  if (! photocell.publish(x++)) {
+    Serial.println(F("Failed"));
+  } else {
+    Serial.println(F("OK!"));
+  }
+/****************************** Ping  ***************************************/
+
+  // ping the server to keep the mqtt connection alive
+  // NOT required if you are publishing once every KEEPALIVE seconds
+  /*
+  if(! mqtt.ping()) {
+    mqtt.disconnect();
+  }
+  */
+}
+/********************************* MQTT Conn  ********************************/
+// Function to connect and reconnect as necessary to the MQTT server.
+// Should be called in the loop function and it will take care if connecting.
+void MQTT_connect() {
+  int8_t ret;
+
+  // Stop if already connected.
+  if (mqtt.connected()) {
+    return;
+  }
+
+  Serial.print("Connecting to MQTT... ");
+
+  uint8_t retries = 3;
+  while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected
+       Serial.println(mqtt.connectErrorString(ret));
+       Serial.println("Retrying MQTT connection in 5 seconds...");
+       mqtt.disconnect();
+       delay(5000);  // wait 5 seconds
+       retries--;
+       if (retries == 0) {
+         // basically die and wait for WDT to reset me
+         while (1);
+       }
+  }
+  Serial.println("MQTT Connected!");
+}


Updated arduino Drivetrain

Updated arduino Drivetrain

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

--- arduino/arduinoDriveTrain/arduinoDriveTrain.ino
+++ arduino/arduinoDriveTrain/arduinoDriveTrain.ino
@@ -0,0 +1,76 @@
+
+  // 3 controllers
+  //listed from front
+  //controller1
+  int controller1A1 = 13;
+  int controller1A2 = 12;
+
+  int controller1B1 = 11;
+  int controller1B2 = 10;
+
+  //controller2
+  int controller2A1 = 9;
+  int controller2A2 = 8;
+
+  int controller2B1 = 7;
+  int controller2B2 = 6;
+
+  //controller3
+  int controller3A1 = 5;
+  int controller3A2 = 4;
+
+  int controller3B1 = 3;
+  int controller3B2 = 2;
+
+  void setup(){
+  // set all the motor control pins to outputs
+  pinMode(controller1A1, OUTPUT);
+  pinMode(controller1A2, OUTPUT);
+  pinMode(controller1B1, OUTPUT);
+  pinMode(controller1B2, OUTPUT);
+
+  pinMode(controller2A1, OUTPUT);
+  pinMode(controller2A2, OUTPUT);
+  pinMode(controller2B1, OUTPUT);
+  pinMode(controller2B2, OUTPUT);
+
+  pinMode(controller3A1, OUTPUT);
+  pinMode(controller3A2, OUTPUT);
+  pinMode(controller3B1, OUTPUT);
+  pinMode(controller3B2, OUTPUT);
+
+  //NEED TO ASSIGN VALUES
+  int frontRightMotor = 0;
+  int frontLeftMotor = 0;
+  int backRightMotor = 0;
+  int backLeftMotor = 0;
+  int middleMotor = 0;
+  int pump = 0;
+
+}
+//
+//dir is direction, vel is velocity, duration
+//velocity is from 0 to 255
+//direciton is 1 or -1
+  void motorSpeed(int controller, int dir, int vel){
+
+    if( dir = 1){
+        analogWrite(controller, vel);
+        analogWrite(controller, 0);
+    }
+
+    else{
+        analogWrite(controller, 0);
+        analogWrite(controller, vel);
+    }
+
+  }
+
+void loop()
+{
+  //example code to make controller1A1 go forward at 200
+  motorSpeed(controller1A1, 1, 200);
+
+}
+
+


add servo test

add servo test

error: pathspec 'crypt-gears/servo_test/servo_test.ino' did not match any file(s) known to git

--- crypt-gears/servo_test/servo_test.ino
+++ crypt-gears/servo_test/servo_test.ino
@@ -0,0 +1,17 @@
+#include <Servo.h>
+
+Servo latch;
+int servopin = 8;
+
+void setup()
+{
+  latch.attach(servopin);
+}
+
+void loop()
+{
+  latch.write(0);
+  delay(10000);
+  latch.write(180);
+  delay(10000);
+}


Timer for color coded LEDs changed

Timer for color coded LEDs changed

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


Added DigitalInputPullup example by Scott Fitzgerald

error: pathspec 'build/shared/examples/2.Digital/DigitalIputPullup/DigitalIputPullup.ino' did not match any file(s) known to git

--- build/shared/examples/2.Digital/DigitalIputPullup/DigitalIputPullup.ino
+++ build/shared/examples/2.Digital/DigitalIputPullup/DigitalIputPullup.ino
@@ -0,0 +1,39 @@
+/*
+ Input Pullup Serial
+
+ This example demonstrates the use of pinMode(INPUT_PULLUP). It reads a
+ digital input on pin 2 and prints the results to the serial monitor.
+
+ The circuit:
+ * Momentary switch attached from pin 2 to ground
+
+ Unlike pinMode(INPUT), there is no pull-down resistor necessary. An internal
+ 20K-ohm resistor is pulled to 5V. This configuration causes the input to
+ read HIGH when the switch is open, and LOW when it is closed.
+
+ created 14 March 2012
+ by Scott Fitzgerald
+
+ This example code is in the public domain
+
+ */
+
+void setup(){
+  //start serial connection
+  Serial.begin(9600);
+  //configure pin2 as an input and enable the internal pull-up resistor
+  pinMode(2, INPUT_PULLUP);
+
+}
+
+void loop(){
+  //read the pushbutton value into a variable
+  int sensorVal = digitalRead(2);
+  //print out the value of the pushbutton
+  Serial.println(sensorVal);
+  //brief delay
+  delay(10);
+
+}
+
+


Adds first draft of Light Shield Arduino-side code.

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


Added Arduino code

Added Arduino code

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

--- arduino/Nerf_Target/Nerf_Target.ino
+++ arduino/Nerf_Target/Nerf_Target.ino
@@ -0,0 +1,23 @@
+const int knockSensor = A0;
+const int led = 13;
+const int threshold = 10;
+
+int sensorReading = 0;
+
+void setup() {
+  pinMode(led, OUTPUT);
+  digitalWrite(led, HIGH);
+  Serial.begin(9600);
+  Serial.println("Nerf Target v0.0.1, github.com/mcoms/nerf-target, 2014.");
+}
+
+void loop() {
+  sensorReading = analogRead(knockSensor);
+  if (sensorReading > threshold) {
+    String packet = String("NP,") + millis() + String(',') + sensorReading;
+    Serial.println(packet);
+    digitalWrite(led, LOW);
+  }
+  delay(100);
+  digitalWrite(led, HIGH);
+}


Added an example of using a thermistor to display temperature and activate two alarms: Hi and Low

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

--- examples/Touchscreen_GUI_Termometer/Touchscreen_GUI_Termometer.ino
+++ examples/Touchscreen_GUI_Termometer/Touchscreen_GUI_Termometer.ino
@@ -0,0 +1,213 @@
+/**************************************************************
+ *
+ *  Touchscreen_GUI_Template
+ *
+ *  Use this template as a starting point.
+ *  The required libraries "includes" and configuration
+ *  sample code is provided to help you quickly create
+ *  a working sketch.
+ *
+ *  This library was developed for Seeedstudio
+ *  TouchShield v2.0, based on their TFTv2 and SeeedTouchscreen
+ *  libraries. This library is intended to provide a minimal
+ *  but useful collection of reusable widgets that can be used
+ *  to create a Graphical User Interface (GUI) for any Arduino
+ *  project.
+ *
+ *  Comment out (or delete) lines that are not required for your project.
+ *
+ *  Author: Jose Rullan
+ *	Release Date: 03/28/2015  -- Arduino Day 2015!!!
+ *	Release Version: 0.1 beta
+ *
+ *	License: Whatever only requires to give credit to original
+ *	author (i.e. Jose Rullan)
+ *
+ *	Credits:
+ *
+ *
+ *************************************************************/
+
+// Required includes
+#include <SPI.h>
+#include <math.h>
+
+// TouchscreenGUI includes
+#include <Button.h>
+#include <Dial.h>
+#include <Display.h>
+#include <Gauge.h>
+#include <Numkey.h>
+
+// Create the objects
+//==========================================
+Canvas canvas = Canvas(); // Memory used: (storage/ram: 1,676/36)  3,372/228
+Button button = Button(); // Memory used: (storage/ram: 3,624/63)  6,996/291
+Dial dial = Dial();       // Memory used: (storage/ram: 4,760/64)  11756/355
+Display disp = Display(); // Memory used: (storage/ram: 484/37)    12,240/392
+Gauge gauge = Gauge();    // Memory used: (storage/ram: 1,470/52)  13710/444
+Numkey numkey = Numkey(); // Memory used: (storage/ram: 2,370/59)  16,080/503
+Button btnPlus = Button(20,GRAY1,BLACK,WHITE);	//Initialization version for round buttons
+Button btnMinus = Button(20,GRAY1,BLACK,WHITE); //Initialization version for round buttons
+
+// Global variables
+// If you need global variables in your program put them here,
+// before the setup() routine.
+#define LED1 10
+#define LED2 2
+
+#define TMP_PIN A4
+#define tempUpdate 5000
+
+float tempF;
+long lastUpdate;
+
+void setup() {
+  Serial.begin(9600);
+  pinMode(LED1, OUTPUT);
+  pinMode(LED2, OUTPUT);
+  pinMode(7,OUTPUT);
+  digitalWrite(7,HIGH);
+  canvas.init(TFT_LANDSCAPE);
+
+  //Configure the widgets
+  //=========================================
+    button.setSize(80,40);
+    button.setColors(GRAY1,BLACK,WHITE);
+    button.setText("Change");
+    button.setEventHandler(&buttonEventHandler);
+    button.init();
+    button.setDebounce(100);
+
+    btnPlus.setText("+");
+    btnPlus.setEventHandler(&btnPlusEventHandler);
+    btnPlus.init();
+    btnPlus.setDebounce(100);
+
+    btnMinus.setText("-");
+    btnMinus.setEventHandler(&btnMinusEventHandler);
+    btnMinus.init();
+    btnMinus.setDebounce(100);
+
+    dial.setSize(50);
+    dial.setColors(GRAY2,YELLOW,GRAY1);
+    dial.setLimits(60,80,100);
+    dial.init();
+    dial.setHiLimit(90,RED);
+    dial.setLowLimit(75,BLUE);
+
+    disp.setSize(80,40);
+    disp.setColors(BLACK,GREEN,GRAY2);
+    disp.setText("");
+    disp.init();
+
+    gauge.setSize(40,100);
+    gauge.setColors(GRAY2,YELLOW,WHITE);
+    gauge.setLimits(60,80,100);
+    gauge.init();
+    gauge.setHiLimit(90,RED);
+    gauge.setLowLimit(75,BLUE);
+
+    numkey.setSize(120,180);
+    numkey.setColors(GRAY1,BLACK,WHITE);
+    numkey.init();
+    numkey.setNumkeyEventHandler(&numkeyEventHandler);
+    numkey.setDebounce(100);
+
+  // Add widgets to canvas
+  // (Use layout template for coordinates)
+  //=========================================
+  canvas.add(&button,105,0);
+  canvas.add(&dial,55,110);
+  canvas.add(&disp,5,0);
+  canvas.add(&gauge,110,60);
+  canvas.add(&btnPlus,200,60);
+  canvas.add(&btnMinus,200,120);
+
+  //Numkey Notes:
+  //The numkey widget is meant to be a pop-up
+  //kind of widget. So it is added to the canvas
+  //when it is required. Upon pressing the = sign
+  //it will call it's event handler and after that
+  //it will automatically be removed from the canvas.
+  //To prevent this behavior then set
+  //	numkey.isPopUp = false; (By default = true)
+	//See buttonEventHandler below for an example.
+  tempF = getTempF(TMP_PIN);
+  dial.setCV((int) tempF);
+  gauge.setCV((int) tempF);
+  disp.setNum((int) tempF);
+}
+
+
+void loop() {
+  float lastTemp = tempF;
+  tempF = getTempF(TMP_PIN);
+  if(tempF != lastTemp){
+    if(millis()-lastUpdate > tempUpdate){
+      dial.setCV((int) tempF);
+      gauge.setCV((int) tempF);
+      disp.setNum((int) tempF);
+      if((unsigned int)tempF > dial.hiLimit){
+        digitalWrite(LED2,HIGH);
+      }else{
+        digitalWrite(LED2,LOW);
+      }
+      if((unsigned int)tempF < dial.lowLimit){
+        digitalWrite(LED1,HIGH);
+      }else{
+        digitalWrite(LED1,LOW);
+      }
+      lastUpdate = millis();
+    }
+  }
+  canvas.scan();
+}
+
+
+// Event Handler Functions for buttons
+//==========================================
+void buttonEventHandler(Button* btn){
+  // Example of a pop-up num keypad.
+  // When button is pressed, the numkey
+  // is added to the canvas, and it is rendered
+  // automatically.
+  canvas.add(&numkey,195,0);
+}
+
+void btnPlusEventHandler(Button* btn){
+	gauge.setCV(gauge.getCV()+5);
+	dial.setCV(gauge.getCV());
+	disp.setNum(gauge.getCV());
+}
+
+void btnMinusEventHandler(Button* btn){
+	if(gauge.getCV() < 5) return;
+	gauge.setCV(gauge.getCV()-5);
+	dial.setCV(gauge.getCV());
+	disp.setNum(gauge.getCV());
+}
+
+void numkeyEventHandler(Numkey* nk){
+	if(nk->getTextSize()>0){
+		disp.setNum(nk->getNum());
+		dial.setCV(nk->getNum());
+		gauge.setCV(nk->getNum());
+		nk->clear();
+  }
+}
+
+float getTempC(int PIN){
+  int a = analogRead(PIN);
+  float resistance;
+  int B = 3975; //thermistor constant
+
+  resistance = (float) (1023-a)*10000/a;
+
+  return 1/(log(resistance/10000)/B + 1/298.15) - 273.15;
+}
+
+float getTempF(int PIN){
+  return getTempC(PIN)*9.0/5.0+32.0;
+}
+


Adding a Cosa implementation of the NewLiquidCrystal library benchmarks.

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

--- examples/LCD/CosaLCDbench/CosaLCDbench.ino
+++ examples/LCD/CosaLCDbench/CosaLCDbench.ino
@@ -0,0 +1,135 @@
+/**
+ * @file CosaLCDbench.ino
+ * @version 1.0
+ *
+ * @section License
+ * Copyright (C) 2013, Mikael Patel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * @section Description
+ * Benchmarking the LCD device drivers towards New LiquidCrystal
+ * Library (https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/).
+ * This is a Cosa version of performanceLCD.pde.
+ *
+ * This file is part of the Arduino Che Cosa project.
+ */
+
+#include "Cosa/RTC.hh"
+#include "Cosa/Watchdog.hh"
+#include "Cosa/Trace.hh"
+#include "Cosa/LCD/Driver/HD44780.hh"
+
+// Select the LCD port for the benchmark
+// HD44780::Port port;
+// HD44780::SR3W port;
+HD44780::MJKDZ port;
+// HD44780::DFRobot port;
+HD44780 lcd(&port);
+
+// Benchmarks
+typedef void (*benchmark_t)(uint16_t);
+void benchmark1(uint16_t nr);
+void benchmark2(uint16_t nr);
+void benchmark3(uint16_t nr);
+void benchmark4(uint16_t nr);
+
+// Measurement support
+void measure(const char* name, benchmark_t fn, uint16_t nr, uint16_t bytes);
+#define MEASURE(fn,bytes)						\
+  do {									\
+    measure(PSTR(#fn),fn,10,bytes);					\
+    SLEEP(4);								\
+  } while (0)
+
+void setup()
+{
+  RTC::begin();
+  Watchdog::begin();
+  lcd.begin();
+  trace.begin(&lcd, PSTR("CosaLCDbench: "));
+  SLEEP(2);
+}
+
+// Display configuration
+const uint16_t WIDTH = 16;
+const uint16_t HEIGHT = 2;
+
+void loop()
+{
+  MEASURE(benchmark1, WIDTH * HEIGHT + 2);
+  MEASURE(benchmark2, WIDTH * HEIGHT * 6 * 2);
+  MEASURE(benchmark3, WIDTH * HEIGHT + 2);
+  MEASURE(benchmark4, WIDTH * HEIGHT + 2);
+}
+
+void benchmark1(uint16_t nr)
+{
+  while (nr--) {
+    char c = ' ' + (nr & 0x1f);
+    for (uint8_t height = 0; height < HEIGHT; height++) {
+      lcd.set_cursor(0, height);
+      for (uint8_t width = 0; width < WIDTH; width++)
+	lcd.putchar(c);
+    }
+  }
+}
+
+void benchmark2(uint16_t nr)
+{
+  while (nr--) {
+    for (uint8_t c = 'A'; c <= 'A' + 5; c++) {
+      for (uint8_t height = 0; height < HEIGHT; height++) {
+	for (uint8_t width = 0; width < WIDTH; width++) {
+	  lcd.set_cursor(width, height);
+	  lcd.putchar(c);
+	}
+      }
+    }
+  }
+}
+
+#define NUM_STR   "1234567890123456"
+#define ALPHA_STR "ABCDEFGHIJKLMNOP"
+
+void benchmark3(uint16_t nr)
+{
+  while (nr--) {
+    lcd.set_cursor(0, 1);
+    lcd.puts(NUM_STR);
+    lcd.set_cursor(0, 1);
+    lcd.puts(ALPHA_STR);
+  }
+}
+
+void benchmark4(uint16_t nr)
+{
+  while (nr--) {
+    lcd.set_cursor(0, 1);
+    lcd.puts_P(PSTR(NUM_STR));
+    lcd.set_cursor(0, 1);
+    lcd.puts_P(PSTR(ALPHA_STR));
+  }
+}
+
+void measure(const char* name, benchmark_t fn, uint16_t nr, uint16_t bytes)
+{
+  lcd.display_clear();
+  lcd.puts_P(name);
+  uint32_t start = RTC::micros();
+  {
+    fn(nr);
+  }
+  uint32_t us = (RTC::micros() - start) / nr;
+  trace << clear << name << endl;
+  trace << us << PSTR(" us (") << us / bytes << PSTR(")");
+}
+


added MidiDemoPlayer.ino

added MidiDemoPlayer.ino

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

--- examples/MidiDemoPlayer/MidiDemoPlayer.ino
+++ examples/MidiDemoPlayer/MidiDemoPlayer.ino
@@ -0,0 +1,15 @@
+#include <SD.h>
+#include <SPI.h>
+#include <arduino.h>
+#include <MusicPlayer.h>
+void setup() {
+  // put your setup code here, to run once:
+  Serial.begin(9600);
+  player.beginInMidiFmt();
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  player.midiDemoPlayer();
+  delay(500);
+}


code borked

code borked

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


arduino ds18b20 temp checker

arduino ds18b20 temp checker

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


Pince V3

Pince V3

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


Create sketch_onewire_DS18x20.ino

Create sketch_onewire_DS18x20.ino

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

--- OneWire/sketch_onewire_DS18x20.ino
+++ OneWire/sketch_onewire_DS18x20.ino
@@ -0,0 +1,155 @@
+/* One Wire - Example to Use
+
+   We made the experiments with a Seeed Studio SEN08011P Temp Sensor
+   the chip inside this sensor is the widely adopted DS18B20 product
+   by Maxim/Dallas!
+
+   Keep in Mind : The ds.search(addr) works like an iterator, if a
+       device is found the address is put in the byte addr[8] var
+       but the next time the method is call without the reset_search()
+       the ds.search(addr) search for next device!
+
+   See the README.md file for a brief reference to the functions of
+   the OneWire library.
+
+*/
+
+// -------------------------- Library ---------------------------
+// on pin 7 (a 4.7k resistor necessary if not Seeed Studio)
+#include <OneWire.h>
+
+// ---------------------------- Init ----------------------------
+byte addr[8];
+byte data[12];
+
+int type_s = 0;
+int i = 0;
+
+OneWire ds(7);
+
+// --------------------------- getChip --------------------------
+void getChip(byte a[8]){
+   // the first ROM byte indicates which chip
+  switch (a[0]) {
+    case 0x10:
+      Serial.println("Chip : DS18S20");  // or old DS1820
+      type_s = 1;
+      break;
+    case 0x28:
+      Serial.println("Chip : DS18B20");
+      type_s = 0;
+      break;
+    case 0x22:
+      Serial.println("Chip : DS1822");
+      type_s = 0;
+      break;
+    default:
+      Serial.println("Device is not a DS18x20 family device.");
+
+  }
+}
+
+// -------------------------- printAddr() ------------------------
+void printAddr(byte ad[8]){
+    Serial.print("Addr : ");
+    for(i = 0; i < 8; i++){
+
+        Serial.print(ad[i], HEX);
+        Serial.print(" ");
+    }
+    Serial.println("");
+}
+
+// -------------------------- readData() ------------------------
+void readData(){
+   // start conversion, with parasite power on at the end
+   ds.write(0x44, 1);
+   // maybe 750ms is enough, maybe not
+   delay(1000);
+
+   // reset the 1-wire bus. needed before communicating with any device
+   ds.reset();
+   // select a device based on its address. After a reset, this is needed
+   // to choose which device you will use, and then all communication will
+   // be with that device, until another reset
+   ds.select(addr);
+
+   // read the Scratchpad
+   ds.write(0xBE);
+
+   Serial.print("Data : ");
+   // read the 9 bytes of the Scratchpad (12 bytes with other models)
+   for ( i = 0; i < 9; i++) {           // we need 9 bytes
+      data[i] = ds.read();
+      Serial.print(data[i], HEX);
+      Serial.print(" ");
+  }
+  Serial.println("");
+
+}
+
+// ------------------------- printCRC() ------------------------
+void printCRC(byte dta[12]){
+    Serial.print("CRC  : ");
+    Serial.print(OneWire::crc8(data, 8), HEX);
+    Serial.println();
+}
+
+// -------------------------- getTemp() -------------------------
+// convert : 16bit signed integer -> should be stored in init16_t
+float getTemp(){
+    int16_t raw = (data[1] << 8) | data[0];
+  if (type_s) {
+    raw = raw << 3; // 9 bit resolution default
+    if (data[7] == 0x10) {
+      // "count remain" gives full 12 bit resolution
+      raw = (raw & 0xFFF0) + 12 - data[6];
+    }
+  } else {
+    byte cfg = (data[4] & 0x60);
+    // at lower res, the low bits are undefined, so let's zero them
+    if (cfg == 0x00) raw = raw & ~7;  // 9 bit resolution, 93.75 ms
+    else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms
+    else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms
+    //// default is 12 bit resolution, 750 ms conversion time
+  }
+   return (float)raw / 16.0;
+}
+
+// ------------------------- printTemp() ------------------------
+void printTemp(){
+    Serial.print("Temp : ");
+    Serial.println(getTemp());
+}
+
+// --------------------------- SetUp ----------------------------
+void setup() {
+  // start the serial comm
+  Serial.begin(9600);
+
+}
+
+// ---------------------------- Loop ----------------------------
+void loop(void) {
+
+  // Search next device, addr is an 8 byte array. device is found 1
+  if(!ds.search(addr)){
+      Serial.println("NO Address");
+      ds.reset_search();
+      delay(250);
+  }else{
+      Serial.println(" ");
+      // print the Chip type
+      getChip(addr);
+      printAddr(addr);
+      readData();
+      printCRC(data);
+      printTemp();
+
+      // reset the addr
+      ds.reset_search();
+      delay(250);
+  }
+
+  delay(5000);
+}


Create sensorflare-publish.ino

Create sensorflare-publish.ino

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

--- examples/sensorflare-publish.ino
+++ examples/sensorflare-publish.ino
@@ -0,0 +1,75 @@
+//Include the SensorFlare library
+#include "sensorflare.h"
+
+//Initialize objects from the library
+
+//One object of the class "PWMOut" is initialized for
+//every PWM output that will be remote control
+SensorFlare::PWMOut pwm(A0);
+
+//One object of the class "VarPublish" is initialized for every variable
+//that will be published in order to access remotly from the cloud
+//The argument that name the varible has a maximum of 12 characters
+//Both methods initialized the variable that will be published as PUBLIC
+SensorFlare::VarPublish varTem("temperature");
+SensorFlare::VarPublish varPir("pir","PUBLIC");
+//Initialized the variable that will be published as PRIVATE
+SensorFlare::VarPublish varLight("light","PRIVATE");
+
+// Initialize the different variables that will be used in the program
+int tem_pin=A3;
+int light_pin=A4;
+int pir_pin=D0;
+int status;
+int new_status;
+bool change;
+
+void setup() {
+
+// Call the begin() functions for every object of the classes "DigitalOut" and
+//"PWMout" to be wired up correct and available.
+
+    pwm.begin();
+
+//Set the extra pins that are used on the program, but are not controlled remotely
+    pinMode(pir_pin,INPUT);
+
+}
+
+void loop() {
+
+    // Temperature sensor
+    float tem= analogRead(tem_pin); // read value from the sensor
+    // The returned value from the Core is going to be in the range from 0 to 4095
+    // Calculate the voltage from the sensor reading
+    float voltage = (tem * 3.3) / 4095;
+    float deg =voltage* 100; // multiply by 100 to get degrees in K
+    float temperature = deg - 273.15; // subtract absolute zero to get degrees Celsius
+
+    //Luminosity
+    float photocell= analogRead(light_pin); // read value from the sensor
+    // The returned value from the Core is going to be in the range from 0 to 4095
+    // Calculate the voltage from the sensor reading
+    float Vphotocell = ((photocell * 3.3) / 4095);
+    float rl=(Vphotocell*10)/(3.3-Vphotocell);//Photoresistor value in KΩ
+    float value=500/rl;//luminosity
+    int light= (int) value;
+
+    //Find the change of state of the PIR sensor. Recognize move
+    new_status=digitalRead(pir_pin);
+    if (status!=new_status){
+        status=new_status;
+        change=TRUE;
+    }
+
+    //Publish every time that exist a change in the pin on which is connect the output of the PIR
+    if (change==TRUE) {
+        varPir.Publish(status,0);//Publish the variable at the called method time
+        change=FALSE;
+    }
+
+    //Publish the variables every 15 seconds.
+    varTem.Publish(temperature,15);
+    varLight.Publish(light,15);
+
+}


Add comment header.

Add comment header.

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


Needing to resolve memory issue

Needing to resolve memory issue

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/rniemand/ArduinoProjects.git/'


ThingSpeak IoT Weather Station

ThingSpeak IoT Weather Station

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/W4KRL/D1M-WX1-Weather-Station.git/'


Create mq2_arduino_to_serial.ino

Create mq2_arduino_to_serial.ino

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

--- raspberrypi/python/mq2_arduino_to_serial.ino
+++ raspberrypi/python/mq2_arduino_to_serial.ino
@@ -0,0 +1,30 @@
+const int gasPin = A0; //GAS sensor output pin to Arduino analog A0 pin
+unsigned long time;
+
+void setup()
+{
+	Serial.begin(9600); //Initialize serial port - 9600 bps
+ pinMode(7, OUTPUT);
+}
+
+void loop()
+{
+  int valorgas = analogRead(gasPin);
+
+	delay(1000); // Print value every 1 sec.
+
+if (valorgas > 200 )
+
+{digitalWrite(7, HIGH);}
+
+else
+{digitalWrite(7, LOW);}
+
+
+if (millis() > (time + 5000)) {
+       time = millis();
+Serial.println(valorgas);
+}
+else {}
+
+}