Nightlight (LED and photoresistor)

Nightlight (LED and photoresistor)

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

--- src/analog_nightlight/analog_nightlight.ino
+++ src/analog_nightlight/analog_nightlight.ino
@@ -0,0 +1,20 @@
+const int sensorPin = 0;
+const int ledPin = 9;
+
+int value = 0;
+
+void setup()
+{
+  analogReference(DEFAULT); // not necessary
+  pinMode(ledPin, OUTPUT);
+  Serial.begin(9600);
+}
+
+void loop()
+{
+  value = analogRead(sensorPin);
+  Serial.println(value);
+  if (value > 900) digitalWrite(ledPin, HIGH);
+  else digitalWrite(ledPin, LOW);
+}
+


Add a simple GPS emulator

Add a simple GPS emulator

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

--- software/SimpleGPSEmu/SimpleGPSEmu.ino
+++ software/SimpleGPSEmu/SimpleGPSEmu.ino
@@ -0,0 +1,298 @@
+/*
+ * SimpleGPSEmu - GPS NMEA source emulator produces GGA and RMC
+ * sentences.
+ */
+
+ /*
+  * Syncing to the PC only works if Teensy is programmed. If it is
+  * powered down it will come back up at approximately the time it
+  * was powered down.
+  *
+  */
+
+#include <MsTimer2.h>
+#include <TimeLib.h>
+/*
+ * $GPGGA,105506.00,4104.90288,N,08753.60184,W,1,5,03,1154.3,M,0.0,M,0.0,0000*45
+ * $GPGGA,hhmmss.ss,llll.lllll,a,nnnnn.nnnnn,b,t,uu,v.v,w.w,M,x.x,M,y.y,zzzz*hh <CR><LF>
+ * $GPRMC,105506.00,A,4104.90288,N,08753.60184,W,58.32,105.0,141017,0.0,E,A*22
+ * $GPRMC,hhmmss.ss,A,llll.lllll,a,yyyyy.yyyyy,a,x.x,x.x,xxxxxx,x.x,a,i*hh<CR><LF>
+ */
+
+// Koerner Aviation coordinates:
+const float startLat = 41.09; // degrees
+const float startLon = -87.9167100; // degrees
+const float startAlt = 434.3; // m
+
+const float vAscent = 6; // m/sec
+const float vDescent = -10; // m/sec
+const float altBurst = 3e4; // m
+const int tUpdate = 10; // seconds
+const int speedup = 1;
+
+const float earth_radius = 6.7E6; // m
+const float latScale = 1.124E5; // m/deg
+const float knots2mps = 0.51444444444;
+const float ft2m = 0.3048;
+const float deg2rad = 3.1415927 / 180.0;
+
+boolean isBurst;
+byte inByte;
+char inChar;
+boolean timesUp;
+float vWind = 30; // m/sec
+float vWindAngle = 105; // 0-360 deg east of north => tan( vx/vy )
+float vx, vy, vz; // x=>lon, y=>lat, z=>alt
+float position1[3] = {startLon, startLat, startAlt};
+float position2[3] = {startLon, startLat, startAlt};
+String inStr;
+unsigned long timeNow, timeLast;
+
+void setup() {
+  MsTimer2::set( round( 1000.0 * tUpdate / ( 1.0 * speedup) ), sendString );
+  // set the Time library to use Teensy 3.0's RTC to keep time
+  setSyncProvider( getTeensy3Time );
+  Serial1.begin(4800);
+  Serial.begin(9600);
+  delay( 100 );
+
+  // Sync to PC time
+  if (Serial.available()) {
+    time_t t = processSyncMessage();
+    if (t != 0) {
+      Teensy3Clock.set(t); // set the RTC
+      setTime(t);
+    }
+  }
+  timeLast = millis();
+  vx = vWind * sin( vWindAngle * deg2rad );
+  vy = vWind * cos( vWindAngle * deg2rad );
+  vz = vAscent;
+  Serial.println( nmeaGgaString() );
+  Serial.println( nmeaRmcString() );
+  timesUp = false;
+  isBurst = false;
+  MsTimer2::start();
+}
+
+void loop() {
+
+  if ( Serial.available() > 0 ) {
+
+    inChar = (char)Serial.read();
+
+    // Check for a CTRL-<x> and loop back something readable
+    // unless it's a CR BS or LF.
+    // If CR add a LF in case the terminal isn't sending them.
+    // If LF (^J), put it through.
+    // If BS, erase the character
+
+    if (inChar == '\r') { //Terminal sent a CR, add LF
+
+      Serial.write( '\n' );Serial.write( inChar );
+      inStr = "";
+
+     } else if ( inChar == '\n' ) { //Line Feed only, send it.
+
+      Serial.write( inChar );
+      inStr += inChar;
+
+    } else if ( (byte)inChar == (char)0x08 ) { // BS, erase the char.
+
+      Serial.write( inChar );Serial.write( '\x20' );Serial.write( inChar );
+      inStr = inStr.substring( 0, inStr.length() - 1 );
+
+    } else if ( (byte)inChar < 0x20 ) {
+
+      inChar = (char)((byte)inChar + 0x40);
+      Serial.write( '^' );Serial.write( inChar );
+      inStr += '^';inStr += inChar;
+
+    } else {
+
+      Serial.write( inChar );
+      inStr += inChar;
+
+    }
+
+    Serial.flush();
+
+  }
+
+  if ( timesUp ) {
+    updatePosition();
+    Serial.println( nmeaGgaString() );
+    Serial1.println( nmeaGgaString() );
+    Serial.println( nmeaRmcString() );
+    Serial1.println( nmeaRmcString() );
+    timesUp = false;
+  }
+
+  if ( !isBurst && position1[2] > altBurst ) {
+    vz = vDescent;
+    isBurst = true;
+  }
+
+  if ( isBurst && position1[2] < startAlt ) {
+    vx = 0.0;
+    vy = 0.0;
+    vz = 0.0;
+  }
+
+}
+
+time_t getTeensy3Time()
+{
+  return Teensy3Clock.get();
+}
+
+String nmeaGgaString() {
+  String tmpStr = "GPGGA," +
+                  timeToNmeaString( now() ) + "," +
+                  latToNmeaString( position1[1] ) + "," +
+                  lonToNmeaString( position1[0] ) + "," + "1,5,03," +
+                  altToNmeaString( position1[2] ) + ",M,0.0,M,0.0,0000";
+
+  return  '$' + tmpStr + '*' + checkStr( tmpStr );
+}
+
+String nmeaRmcString() {
+
+  String tmpStr = "GPRMC," +
+                  timeToNmeaString( now() ) + ",A," +
+                  latToNmeaString( position1[1] ) + ',' +
+                  lonToNmeaString( position1[0] ) + ',' +
+                  gndSpeedToNmeaString( vx, vy ) + ',' +
+                  headingToNmeaString( vx, vy ) + ',' +
+                  dateToNmeaString( now() ) + ",0.0,E,A";
+
+  return  '$' + tmpStr + '*' + checkStr( tmpStr );
+}
+
+String timeToNmeaString( time_t t ) {
+  String tmpStr = "";
+  int hr = hour(t);
+  if ( hr < 10 ) tmpStr += '0';
+  tmpStr += String( hr );
+  int min = minute(t);
+  if ( min < 10 ) tmpStr += '0';
+  tmpStr += String( min );
+  float sec = (float)( second(t) * 100 ) / 100.0;
+  if ( sec < 10 ) tmpStr += "0";
+  tmpStr += String( sec );
+  return tmpStr;
+}
+
+String dateToNmeaString( time_t t ) {
+  return zeroPad( String( day(t) ), 2 ) +
+         zeroPad( String( month(t) ), 2 ) +
+         String( year(t) ).substring( 2 );
+}
+
+String latToNmeaString( float lat ) {
+  char dir = 'N';
+  if ( lat < 0.0 ) {
+    dir = 'S';
+    lat *= -1.0;
+  }
+  float mins = 60.0 * ( lat - floor( lat ) );
+  int deg = floor( lat );
+  return  zeroPad( String( deg ), 2 ) +
+          zeroPad( String( (int)floor( mins ) ), 2 ) +
+          zeroFill( String( mins - floor( mins ), 5 ).substring( 1 ), 6 ) +
+          ',' + dir;
+}
+
+String lonToNmeaString( float lon ) {
+  char dir = 'E';
+  if ( lon < 0.0 ) {
+    dir = 'W';
+    lon *= -1.0;
+  }
+  float mins = 60.0 * ( lon - floor( lon ) );
+  int deg = floor( lon );
+  return  zeroPad( String( deg ), 3 ) +
+          zeroPad( String( (int)floor( mins ) ), 2 ) +
+          zeroFill( String( mins - floor( mins ), 5 ).substring( 1 ), 6 ) +
+          ',' + dir;
+}
+
+String altToNmeaString( float alt ) {
+  return String( round( 10 * alt ) / 10.0, 1 );
+}
+
+String gndSpeedToNmeaString( float velx, float vely ) {
+  return String( sqrt( velx*velx + vely*vely ) / knots2mps, 1 );
+}
+
+String headingToNmeaString( float velx, float vely ) {
+  float angle = ( atan2( velx, vely ) ) / deg2rad;
+  if ( angle < 0 ) angle += 180.0;
+  return String( angle, 1 );
+}
+
+void updatePosition( ) {
+  timeNow = millis();
+  float deltaT = speedup * ( timeNow - timeLast ) / 1000.0;
+  timeLast = timeNow;
+  addToLatLonAlt( deltaT * vy, deltaT * vx, deltaT * vz );
+}
+
+void addToLatLonAlt( float dy, float dx, float dz ) {
+  position1[0] += dx * cos( position1[1] * deg2rad ) / latScale;
+  position1[1] += dy / latScale;
+  position1[2] += dz;
+}
+
+String zeroPad( String str, int strLen ) {
+  int len = str.length();
+  for ( int i = 0 ; i < strLen - len ; i++ ) {
+    str = '0' + str;
+  }
+  return str;
+}
+
+String zeroFill( String str, int strLen ) {
+  int len = str.length();
+  for ( int i = 0 ; i < strLen - len ; i++ ) {
+    str = str + '0';
+  }
+  return str;
+}
+void sendString() {
+  timesUp = true;
+}
+
+String checkStr( String str ) {
+
+  char buf[80]; // Max length of NMEA excl. '$',CR,LF = 79, + null
+  str.toCharArray(buf, 80);
+  byte check = 0x00;
+  for ( int i = 0 ; i < str.length() ; i++ ) {
+    check ^= (byte)buf[i];
+  }
+  String chkStr = String( check, HEX );
+  if ( check < 0x10 ) {
+    chkStr = '0' + chkStr;
+  }
+  chkStr.toUpperCase();
+  return chkStr;
+}
+
+/*  code to process time sync messages from the serial port   */
+#define TIME_HEADER  "T"   // Header tag for serial time sync message
+
+unsigned long processSyncMessage() {
+  unsigned long pctime = 0L;
+  const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013
+
+  if(Serial.find(TIME_HEADER)) {
+     pctime = Serial.parseInt();
+     return pctime;
+     if( pctime < DEFAULT_TIME) { // check the value is a valid time (greater than Jan 1 2013)
+       pctime = 0L; // return 0 to indicate that the time is not valid
+     }
+  }
+  return pctime;
+}
+


Enhanced SoftAP with channel and hide parameters

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/ArtursGailis1995/esp8266_deauther.git/'


working on bond keypad code

working on bond keypad code

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

--- arduino-keypad/ak/ak.ino
+++ arduino-keypad/ak/ak.ino
@@ -0,0 +1,174 @@
+#define MODECOMBO 0
+#define MODESTART 1
+
+
+#define number_of_74hc595s 2 //How many of the shift registers - change this
+#define numOfRegisterPins number_of_74hc595s * 8
+int SER_PIN = 8;   //pin 14 on the 75HC595
+int RCLK_PIN = 9;  //pin 12 on the 75HC595
+int SRCLK_PIN = 10; //pin 11 on the 75HC595
+boolean registers[numOfRegisterPins];
+
+unsigned long lastBounceTime = 0;
+unsigned long lastPressTime = 0;
+unsigned long lastTransitionTime = 0;
+
+const long debounceInterval = 10;
+const long timeoutInterval = 3000;
+const long transitionInterval = 5000;
+
+#define NUMBUTTONS 3
+int buttons[NUMBUTTONS] = {2, 3, 4};
+int lastStates[NUMBUTTONS];
+
+#define COMBOLENGTH 4
+int comboPos = 0;
+int comboBuffer[COMBOLENGTH];
+static int goodCombo[COMBOLENGTH] = {1, 2, 1, 0};
+
+int state;
+
+void setup() {
+
+  Serial.begin(9600);
+
+  pinMode(SER_PIN, OUTPUT);
+  pinMode(RCLK_PIN, OUTPUT);
+  pinMode(SRCLK_PIN, OUTPUT);
+
+  for (int i; i < NUMBUTTONS; i++) {
+    pinMode(buttons[i], INPUT);
+    lastStates[i] = 0;
+  }
+
+  pinMode(SER_PIN, OUTPUT);
+  pinMode(RCLK_PIN, OUTPUT);
+  pinMode(SRCLK_PIN, OUTPUT);
+
+  //reset all register pins
+  clearRegisters();
+  writeRegisters();
+
+  state = 0;
+
+}
+
+void loop() {
+
+  unsigned long currentMillis = millis();
+
+  switch (state) {
+
+    case MODECOMBO:
+      Serial.println("State 0");
+      setRegisterPin(9, LOW);
+      setRegisterPin(10, LOW);
+      setRegisterPin(11, HIGH);
+      writeRegisters();
+
+      if (currentMillis - lastBounceTime >= debounceInterval) {
+
+        lastBounceTime = currentMillis;
+
+        for (int buttonNumber; buttonNumber < NUMBUTTONS; buttonNumber++) {
+
+          int buttonState = digitalRead(buttons[buttonNumber]);
+
+          // this ensures that the button is released before registering new presses
+          if ((buttonState != lastStates[buttonNumber]) && (buttonState)) {
+            lastPressTime = currentMillis;
+            if (addPress(buttonNumber)) {
+              state = MODESTART;
+              lastTransitionTime = currentMillis;
+            }
+          }
+          lastStates[buttonNumber] = buttonState;
+        }
+      }
+
+      if ((currentMillis - lastPressTime >= timeoutInterval) &&  (comboPos > 0)){
+        Serial.println("timeout!");
+        restartCombo();
+      }
+
+      break;
+
+    case MODESTART:
+      Serial.println("State 1");
+      setRegisterPin(9, LOW);
+      setRegisterPin(10, HIGH);
+      setRegisterPin(11, LOW);
+      writeRegisters();
+
+      // the machine will transition back into
+      if (currentMillis - lastTransitionTime >= transitionInterval) {
+        state = 0;
+      }
+
+      break;
+  }
+}
+
+void restartCombo(void) {
+  comboPos = 0;
+  for (int i; i < NUMBUTTONS; i++) {
+    setRegisterPin(i, LOW);
+  }
+  writeRegisters();
+}
+
+bool addPress(int buttonNumber) {
+
+  setAndWrite(buttonNumber, HIGH);
+
+  comboBuffer[comboPos] = buttonNumber;
+  comboPos++;
+
+  if (comboPos == COMBOLENGTH) {
+
+    for (int i; i < COMBOLENGTH; i++) {
+
+      bool correct = comboBuffer[i] == goodCombo[i];
+
+      if (!correct) {
+        restartCombo();
+        return false;
+      }
+    }
+    return true;
+  }
+  return false;
+}
+
+void setAndWrite(int index, int value) {
+  setRegisterPin(index, value);
+  writeRegisters();
+}
+
+void clearRegisters(){
+  for(int i = numOfRegisterPins - 1; i >=  0; i--){
+     registers[i] = LOW;
+  }
+}
+
+void writeRegisters() {
+
+  digitalWrite(RCLK_PIN, LOW);
+
+  for (int i = numOfRegisterPins - 1; i >=  0; i--){
+
+    digitalWrite(SRCLK_PIN, LOW);
+
+    int val = registers[i];
+
+    digitalWrite(SER_PIN, val);
+    digitalWrite(SRCLK_PIN, HIGH);
+  }
+  digitalWrite(RCLK_PIN, HIGH);
+}
+
+//set an individual pin HIGH or LOW
+void setRegisterPin(int index, int value){
+  registers[index] = value;
+}
+


another example

another example

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

--- Examples/kultpfunzel_pot/kultpfunzel_pot.ino
+++ Examples/kultpfunzel_pot/kultpfunzel_pot.ino
@@ -0,0 +1,22 @@
+/*
+  Read analog values from a potentiometer
+*/
+
+int ledPin = 10; // And a led between ground and this pin
+int potiPin = A3;
+
+unsigned int analogValue;
+
+void setup ()
+{
+  pinMode (ledPin, OUTPUT);
+  Serial.begin(9600);
+}
+
+void loop () {
+  analogValue = analogRead(potiPin); // This is in the range 0 - 1023
+  analogValue = map(analogValue, 0, 1023, 0, 255); // mapped to 0 - 255
+
+  Serial.println(analogValue);
+  analogWrite (ledPin, analogValue);
+}


added first test code

added first test code

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

--- test/Pan_Tilt_Servo_Movement_Test_Code.ino
+++ test/Pan_Tilt_Servo_Movement_Test_Code.ino
@@ -0,0 +1,24 @@
+//This is the Pan Tilt Servo Movement code
+//By pyrito
+
+#include <Servo.h>
+
+ Servo yawServo;
+ Servo pitchServo;
+
+void setup()
+{
+  yawServo.attach(3);
+  pitchServo.attach(2);
+  SetPanTiltConfiguration(0,0,13,10);
+}
+
+void loop()
+{
+}
+
+void SetPanTiltConfiguration(float yaw, float pitch, float yawOffset, float pitchOffset)
+{
+  yawServo.write(yaw + yawOffset);
+  pitchServo.write(pitch + pitchOffset);
+}


Added multi pin port manipulation

Added multi pin port manipulation

Port mappings for Arduino Mega 2560 need to be sorted out

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

--- flea3_multi_pin_trigger/flea3_multi_pin_trigger.ino
+++ flea3_multi_pin_trigger/flea3_multi_pin_trigger.ino
@@ -0,0 +1,12 @@
+void setup()
+{
+  DDRB = B11111111;
+}
+
+void loop()
+{
+  PORTB = B11100000;
+  delayMicroseconds(3333);
+  PORTB = B00000000;
+  delayMicroseconds(3333);
+}


Ball drop bug fixed

Ball drop bug fixed

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


Create PC_v099b0306.ino

Create PC_v099b0306.ino

error: pathspec 'Particle' did not match any file(s) known to git
error: pathspec 'Photon' did not match any file(s) known to git
error: pathspec 'based/code/PC_v099b0306.ino' did not match any file(s) known to git


Adds example for Arduino DUE.

Adds example for Arduino DUE.

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

--- examples/readerDUE/readerDUE.ino
+++ examples/readerDUE/readerDUE.ino
@@ -0,0 +1,86 @@
+#include "Arduino.h"
+#include "OBD9141.h"
+
+/*
+  On the Arduino DUE (version 1.6.8) using the Serial port pins as digital IO
+  pins is problematic. In particular, it seems you cannot use the port as a
+  serial port after using pinMode() on the pins.
+
+  We fix this by using an extra pin; we use this extra pin to create the slow
+  5 baud init pattern while the Serial pins remain in use for the serial port.
+
+  So connect any digital pin to the Tx pin of the serial port and update the
+  number accordingly.
+*/
+
+// In this example, Serial port 'Serial1' is used. The native USB port is used
+// to provide information.
+
+// The real Rx pin of the serial port, such that we can enable the pullup:
+#define RX_PIN 19
+
+// An extra pin connected to the Tx pin of the Serial port used.
+#define TX_PIN 5
+// So this pin has a direct connection to pin 18 (TX1)
+
+// The ENable pin for my SN65HVDA195 breakout is connected to pin 2.
+#define EN_PIN 2
+
+
+OBD9141 obd;
+
+
+void setup(){
+    SerialUSB.begin(9600);
+    delay(2000);
+
+    pinMode(EN_PIN, OUTPUT);
+    digitalWrite(EN_PIN, HIGH);
+
+    obd.begin(Serial1, RX_PIN, TX_PIN);
+}
+
+void loop(){
+    SerialUSB.println("Looping");
+
+    bool init_success =  obd.init();
+    SerialUSB.print("init_success:");
+    SerialUSB.println(init_success);
+
+    // init_success = true;
+    // Uncomment this line if you use the simulator to force the init to be
+    // interpreted as successful. With an actual ECU; be sure that the init is
+    // succesful before trying to request PID's.
+
+    if (init_success){
+        bool res;
+        while(1){
+            res = obd.getCurrentPID(0x11, 1);
+            if (res){
+                SerialUSB.print("Result 0x11 (throttle): ");
+                SerialUSB.println(obd.readUint8());
+            }
+
+            res = obd.getCurrentPID(0x0C, 2);
+            if (res){
+                SerialUSB.print("Result 0x0C (RPM): ");
+                SerialUSB.println(obd.readUint16()/4);
+            }
+
+
+            res = obd.getCurrentPID(0x0D, 1);
+            if (res){
+                SerialUSB.print("Result 0x0D (speed): ");
+                SerialUSB.println(obd.readUint8());
+            }
+            SerialUSB.println();
+
+            delay(200);
+        }
+    }
+    delay(3000);
+}
+
+
+
+


Switched Data ouput order to place RTC Unix time in front

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


Yet another blink example sketch; classical variant with a twist - random delay time.

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

--- examples/Blink/CosaBlinkRandom/CosaBlinkRandom.ino
+++ examples/Blink/CosaBlinkRandom/CosaBlinkRandom.ino
@@ -0,0 +1,54 @@
+/**
+ * @file CosaBlinkRandom.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.
+ *
+ * @section Description
+ * Cosa LED blink demonstration with a twist. The classical Arduino
+ * LED blink program written in Cosa using the Arduino built-in LED
+ * with a random delay. No setup is necessary as mode is handled by
+ * the OutputPin class. The delay is busy-wait (not low power mode).
+ *
+ * @section Circuit
+ * Uses built-in LED (D13/Arduino).
+ *
+ * This file is part of the Arduino Che Cosa project.
+ */
+
+#include "Cosa/OutputPin.hh"
+
+OutputPin ledPin(Board::LED);
+
+int32_t
+random(int32_t range)
+{
+  if (range == 0) return 0;
+  return (random() % range);
+}
+
+int32_t
+random(int32_t low, int32_t high)
+{
+  if (low >= high) return (low);
+  return (random(high - low) + low);
+}
+
+void loop()
+{
+  ledPin.high();
+  delay(random(100, 500));
+  ledPin.low();
+  delay(random(100, 500));
+}


Fixed the smoothing/average value (error was in float arithmetic).

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

--- InfraredThermometer/InfraredThermometer.ino
+++ InfraredThermometer/InfraredThermometer.ino
@@ -0,0 +1,256 @@
+#include <Adafruit_GFX.h>
+#include <Adafruit_SSD1306.h>
+#include <IRTemp.h>
+#include <SPI.h>
+#include <Wire.h>
+
+
+/*
+ ===============================================================================
+
+ Infrared Thermometer
+ Version:  0.5
+ Build:    20151103
+
+ Darian Cabot
+ http://dariancabot.com/category/projects/infrared-thermometer/
+
+ -------------------------------------------------------------------------------
+
+ Hardware modules used:
+
+ Freetronics IRTemp
+ http://www.freetronics.com.au/products/irtemp-ir-temperature-sensor-module
+
+ Adafruit SSD1306 OLED
+ https://github.com/adafruit/Adafruit_SSD1306
+
+ ===============================================================================
+ */
+
+
+// IRTemp configuration...
+static const byte PIN_DATA    = 2;
+static const byte PIN_CLOCK   = 3; // Must be either pin 2 or pin 3
+static const byte PIN_ACQUIRE = 4;
+static const TempUnit SCALE=CELSIUS; // Options are CELSIUS, FAHRENHEIT
+
+IRTemp irTemp(PIN_ACQUIRE, PIN_CLOCK, PIN_DATA);
+
+
+// OLED configuration...
+// If using software SPI (the default case):
+#define OLED_MOSI   9
+#define OLED_CLK   10
+#define OLED_DC    11
+#define OLED_CS    12
+#define OLED_RESET 13
+
+Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
+
+#if (SSD1306_LCDHEIGHT != 64)
+#error("Height incorrect, please fix Adafruit_SSD1306.h!");
+#endif
+
+
+// Temperature variables...
+int tMin;
+int tMax;
+int tSmooth;
+float ftMin;
+float ftMax;
+float ftSmooth;
+int count = 0;
+int smoothCount = 0;
+
+// Graph variables...
+int gWidth = 128;
+int gHeight = 39;
+int gLeft = 30;
+int gTop = 25;
+int gXStep = gWidth / 64;
+float gYMin = 0;
+float gYMax = 100;
+float oldGYMin = 0;
+float oldGYMax = 100;
+int oldX = gLeft;
+int oldY;
+int gRescale;
+
+
+void setup()
+{
+  Serial.begin(19200);
+  Serial.println("IR Temperature v0.5");
+  Serial.println();
+
+  display.begin(SSD1306_SWITCHCAPVCC); // Generate the high voltage from the 3.3v line internally.
+  display.clearDisplay(); // clears the screen and buffer
+
+  ftMin = irTemp.getIRTemperature(SCALE);
+  ftMax = ftMin;
+  ftSmooth = ftMin;
+
+  tMin = round(ftMin * 100);
+  tMax = tMin;
+  tSmooth = tMin;
+
+  oldY = gTop + gHeight / 2;
+
+  count = gLeft;
+}
+
+
+void loop()
+{
+
+  display.fillRect(0, 0, display.width(), gTop - 1, BLACK);  // Clear big number.
+  display.fillRect(0, gTop, gLeft - 1, gHeight, BLACK);  // Clear graph min/max.
+  display.drawLine(0, gTop - 1, display.width(), gTop - 1, WHITE); // Draw graph top line.
+
+  float ftIr = irTemp.getIRTemperature(SCALE);
+  int tIr = round(ftIr * 100.0f);
+
+  Serial.println(ftIr);
+
+  display.setTextSize(3);
+  display.setTextColor(WHITE);
+  display.setCursor(20,0);
+  display.print(ftIr, 2);
+
+  boolean isMin = 0;
+  boolean isMax = 0;
+  boolean isSmooth = 0;
+
+  if (!isnan(ftIr))
+  {
+    if (ftIr <= ftMin)
+    {
+      ftMin = ftIr;
+      tMin = tIr;
+      isMin = 1;
+    }
+
+    if (ftIr >= ftMax)
+    {
+      ftMax = ftIr;
+      tMax = tIr;
+      isMax = 1;
+    }
+
+    int tSmoothOld = tSmooth;
+    ftSmooth = (tSmooth * 19.0f + tIr) / 20.0f; // Math needs to be done on float, otherwise it's too coarse.
+    tSmooth = round(ftSmooth);
+
+    // Do comparison at only 1 decimal place (same as display)
+    if ((tSmoothOld / 10) == (tSmooth / 10))
+    {
+      smoothCount ++;
+    }
+    else
+    {
+      smoothCount = 0;
+    }
+  }
+
+  // Print stats...
+
+  display.setTextSize(1);
+  display.setCursor(1, gTop + 2);
+
+  if (isMax)
+  {
+    display.setTextColor(BLACK, WHITE); // 'inverted' text
+    display.fillRect(0, gTop + 1, 25, 9, WHITE);
+    display.print(tMax / 100.0f, 1);
+    display.setTextColor(WHITE, BLACK);
+  }
+  else
+  {
+    display.print(tMax / 100.0f, 1);
+  }
+
+
+  display.setCursor(1, gTop + gHeight / 2 - 3);
+
+  if (smoothCount > 19)
+  {
+    display.setTextColor(BLACK, WHITE); // 'inverted' text
+    display.fillRect(0, gTop + gHeight / 2 - 4, 25, 9, WHITE);
+    display.print(tSmooth / 100.0f, 1);
+    display.setTextColor(WHITE, BLACK);
+  }
+  else
+  {
+    display.print(tSmooth / 100.0f, 1);
+  }
+
+
+  display.setCursor(1, gTop + gHeight - 8);
+
+  if (isMin)
+  {
+    display.setTextColor(BLACK, WHITE); // 'inverted' text
+    display.fillRect(0, gTop + gHeight - 9, 25, 9, WHITE);
+    display.print(tMin / 100.0f, 1);
+    display.setTextColor(WHITE, BLACK);
+  }
+  else
+  {
+    display.print(tMin / 100.0f, 1);
+  }
+
+
+  oldGYMin = gYMin;
+  oldGYMax = gYMax;
+
+  // GRAPH: Update graph axis...
+  gYMin = ftMin;
+  gYMax = ftMax;
+
+
+  if (gRescale < 3)
+  {
+    display.fillRect(gLeft, gTop, gWidth, gHeight, BLACK);
+    display.setCursor(gLeft + 8, gTop + gHeight / 2 - 4);
+    display.print("Rescaling...");
+    gRescale ++;
+    count = 1000; // force restart.
+  }
+  else if (gRescale == 3)
+  {
+    // Blank graph to remove 'rescaling' text, ready for drawing...
+    display.fillRect(gLeft, gTop, gWidth, gHeight, BLACK);
+    gRescale ++;
+  }
+  else
+  {
+    // GRAPH: Calculate X and Y values...
+    oldX = count;
+    count = count + gXStep;
+    int gYVal = round(gTop + gHeight - 1 - (ftIr - gYMin) * ((gHeight - 1)  / (gYMax - gYMin)));
+
+    // GRAPH: Draw...
+    display.fillRect(oldX + 1, gTop, 7, gHeight, BLACK);
+    display.drawLine(oldX, oldY, count, gYVal, WHITE);
+
+    oldY = gYVal;
+
+    // Mark span changes...
+    if ((gYMax - gYMin) > (oldGYMax - oldGYMin))
+    {
+      gRescale = 0;
+    }
+
+    // Check if edge of screen reached, and wrap if required...
+    if (count >= gWidth)
+    {
+      count = gLeft;
+      oldX = gLeft;
+      display.fillRect(gLeft, gTop, (gXStep * 4), gHeight, BLACK);
+    }
+  }
+
+  display.display();
+}
+


Create 2nd.ino

Create 2nd.ino

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

--- 2nd.ino
+++ 2nd.ino
@@ -0,0 +1,49 @@
+#define LED_PIN 13
+#define BUT_SLW 2
+#define BUT_PIN 4
+
+bool state = 1;
+long tBtP, tBtS;
+unsigned long t, old;
+
+inline void initPins() {
+  pinMode(LED_PIN, OUTPUT);
+  pinMode(BUT_SLW, INPUT);
+  pinMode(BUT_PIN, INPUT);
+
+}
+
+void setup() {
+  tBtP = -10000;
+  tBtS = -20000;
+  t = 1000;
+
+  old = millis();
+  digitalWrite(LED_PIN, state);
+}
+
+void loop() {
+  //saving time from now
+  unsigned long now = millis();
+
+  // case time enough has passed, then:
+  if (now >= old + t) {
+    old = now;
+    state = !state;
+    digitalWrite(LED_PIN, state);
+  }
+
+  if (digitalRead(BUT_PIN)) {
+    t *= 2;
+    tBtP = now;
+  }
+
+  if (digitalRead(BUT_SLW)) {
+    t /= 2;
+    tBtS = now;
+  }
+
+  if (500 > abs(tBtP - tBtS)) {
+    while (1);
+  }
+}


Update - bug fixes

Update - bug fixes

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/Blade2021/roots.git/'


Ant specific arduino trigger

Ant specific arduino trigger

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

--- ant_trigger/ant_trigger/ant_trigger.ino
+++ ant_trigger/ant_trigger/ant_trigger.ino
@@ -0,0 +1,159 @@
+/*  quick_release
+    Control a quick release data acquisition run
+    communicate over serial to start a run, taking as inputs
+     - pre-delay (time to wait before changing length)
+     - step-to-exposure delay
+     - exposure duration
+     - post-exposure time before length is reset
+    Created by CDW on 2014.12.02
+*/
+
+
+// Timing variables
+const int PREDELAY  = 10;      // in ms, before stim goes on
+const int ANTDELAY = 250;      // in ms, between whap start and shutter
+const int SHUTTERDELAY = 1;    // in ms, between shutter and camera
+const int EXPOSUREDUR = 1;     // in ms, camera image duration  TODO: SEND THIS ONE OVER SERIAL TOO
+const int POSTEXPOSURE = 1000; // in ms, before returning to length
+
+// Non-global variable declaration
+int antdelay = ANTDELAY;
+bool run_now = false;
+
+// ArduTimer Hardware configuration
+#define SIG1 2;
+#define LED1 3;
+#define SIG2 4;
+#define LED2 5;
+#define SIG3 6;
+#define LED3 7;
+#define SIG4 8;
+#define LED4 9;
+#define SIG5 10;
+#define LED5 11;
+#define SIG6 12;
+#define LED6 13;
+
+
+// Pin configuration
+int ANT_OUT    = SIG2; // to ant whapper
+int ANT_LED    = LED2;
+int SHUT_OUT   = SIG4; // to quick shutter
+int SHUT_LED   = LED4;
+int EXPOSE_OUT = SIG5; // to exposure trigger
+int EXPOSE_LED = LED5;
+
+
+// Begin setup of board
+void setup()
+{
+    // Initialize serial interface
+    Serial.begin(115200); // Start serial connection
+    while (!Serial) {
+        ; // wait for serial (for Leonardo only)
+    }
+    Serial.println("Hi"); // Demonstrate serial connection
+    // Set pin modes
+    pinMode(ANT_OUT, OUTPUT);
+    pinMode(ANT_LED, OUTPUT);
+    pinMode(SHUT_OUT, OUTPUT);
+    pinMode(SHUT_LED, OUTPUT);
+    pinMode(EXPOSE_OUT, OUTPUT);
+    pinMode(EXPOSE_LED, OUTPUT);
+    // Initial pin states
+    turn_ant(false);
+    turn_shutter(false);
+    turn_exposure(false);
+    // Close out setup
+    Serial.println("Setup complete");
+}
+
+// Loop through
+void loop()
+{
+    check_serial(); // read input if it exists
+    if (run_now) {
+        run(PREDELAY, antdelay, SHUTTERDELAY, EXPOSUREDUR, POSTEXPOSURE);
+        Serial.println("Run complete"); // tag that we've done a run
+        run_now = false; // reset the run flag
+    }
+}
+
+// Read data from serial, just the step-to-exposure delay
+void check_serial()
+{
+    if(Serial.available() >= 2) {      // only when something is available
+        antdelay = Serial.parseInt(); // first int is delay
+        Serial.println(antdelay);     // echo back as sanity check
+        char ending = (char)Serial.read();
+        if (ending == '\n') {          // ignore out-of-format commands
+            run_now = true;
+        }
+        else {
+            Serial.println("Command ignored: didn't end in newline");
+        }
+    }
+}
+
+// Control a run
+void run(int predelay, int antdelay, int shutterdelay, int exposuredur, int postexposure)
+{
+    delay(predelay);      // just to let things settle
+    //turn_ant(true);       // whap the ant
+    //delay(antdelay);      // wait for motor movement
+    turn_shutter(true);   // tell the shutter to open
+    delay(shutterdelay);  // let the shutter physically respond
+    turn_exposure(true);  // tell the camera to take a pic
+    delay(exposuredur);    // let the camera take a pic
+    turn_shutter(false);  // tell the shutter to close
+    delay(postexposure);  // let the muscle rest
+    turn_exposure(false); // reset cam trigger
+    //turn_ant(false);      // reset whap
+}
+
+// Series of control functions
+/* Each takes a state, true for on and false for off. On and off values for
+   each connection are set here. This is complicated since some need to be
+   high when on while others need to be high when off. To double complicate
+   things, I think that the transistor control shield on the ardutimer inverts
+   the signal.
+
+   NOTE: THESE SHOULD BE DOUBLED CHECKED DURING SET UP.
+*/
+
+// Ant control
+void turn_ant(boolean state){
+    if(state == true){
+        digitalWrite(ANT_OUT, HIGH);
+        digitalWrite(ANT_LED, HIGH);
+    }
+    else{
+        digitalWrite(ANT_OUT, LOW);
+        digitalWrite(ANT_LED, LOW);
+    }
+}
+
+// Shutter control
+void turn_shutter(boolean state){
+    if(state == true){
+        digitalWrite(SHUT_OUT, LOW);
+        digitalWrite(SHUT_LED, HIGH);
+    }
+    else{
+        digitalWrite(SHUT_OUT, HIGH);
+        digitalWrite(SHUT_LED, LOW);
+    }
+}
+
+//Exposure control
+void turn_exposure(boolean state){
+    if(state == true){
+        digitalWrite(EXPOSE_OUT, LOW);
+        digitalWrite(EXPOSE_LED, HIGH);
+    }
+    else{
+        digitalWrite(EXPOSE_OUT, HIGH);
+        digitalWrite(EXPOSE_LED, LOW);
+    }
+}
+


adding test ino

adding test ino

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

--- ESPSerialWiFiManager.ino
+++ ESPSerialWiFiManager.ino
@@ -0,0 +1,17 @@
+#include <ESP8266WiFi.h>
+#include "ESPSerialWiFiManager.h"
+
+ESPSerialWiFiManager eswp = ESPSerialWiFiManager();
+
+void setup(){
+    Serial.begin(115200);
+
+    // eswp.set_init_ap("SSID", "Password");
+    eswp.begin();
+}
+
+void loop(){
+    eswp.run_menu();
+    Serial.println("Loop...");
+    delay(1000);
+}


Added setup placeholders. Added some functions such as usb_mode and support_function.

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/sagriff/uav_project.git/'


Added zaxis to joypad sketch

Added zaxis to joypad sketch

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/manashmndl/bluebrain.git/'


Example SD card mode for UNO

Example SD card mode for UNO

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

--- SDModule/BatDetector.ino
+++ SDModule/BatDetector.ino
@@ -0,0 +1,142 @@
+#include <SD.h>
+#include <SPI.h>
+//----------------------SPI SPEED SETTINGS----------------------
+SPISettings settingsA(2000000, MSBFIRST, SPI_MODE0); // 2 MHz clock, MSB first, mode 0
+SPISettings settingsB(4000000, MSBFIRST, SPI_MODE0); // 4 MHz clock, MSB first, mode 0
+SPISettings settingsC(8000000, MSBFIRST, SPI_MODE0); // 8 MHz clock, MSB first, mode 0
+SPISettings settingsD(16000000, MSBFIRST, SPI_MODE0); // 16 MHz clock, MSB first, mode 0
+SPISettings settingsE(20000000, MSBFIRST, SPI_MODE0); // 20 MHz clock, MSB first, mode 0 (SD!)
+//FILE
+File myFile;
+//----------------------BUFFERs FOR ANALOG DATA----------------------
+byte buf00[256]; // buffer array 1
+byte buf01[256]; // buffer array 2
+byte controlbuf0x = 0; // control byte to send certain buffer data
+//---------------------TEST COMMAND----------------------------------
+byte Test = 0b00000001;
+//----------------------PROTOTYPES----------------------
+void dataSend(void); //to send the data
+void SerialPrepare(void);
+void BDTest(byte);
+void testLoadBuffer(void);
+void SDPrepare(void);
+
+void setup()
+{
+  //----------------------USE LED AS AN ERROR INFORMER----------------------
+  pinMode(13, OUTPUT);
+  SerialPrepare();
+  SDPrepare();
+
+
+
+
+}
+
+void loop()
+{
+  SPI.beginTransaction (settingsB);  // 20 MHz clock, MSB first, mode 0
+  BDTest(Test);
+  dataSend(controlbuf0x);
+  ReadData();
+  myFile.close();
+  Serial.println("Finished");
+  while(1); //stop here
+}
+
+void SerialPrepare(void){
+  Serial.begin(9600);
+  while (!Serial) {
+    ; // wait for serial port to connect. Needed for native USB port only
+  }
+}
+
+void SDPrepare(void){
+  Serial.print("Initializing SD card..."); //Initialization message
+  if (!SD.begin(4)) { //IF ERROR IS ENCOUNTERED
+    digitalWrite(13, HIGH); //LED GO ON
+    Serial.println("Card failed, or not present"); //UNSUCCESSFUL MESSAGE
+    return;
+  }
+  Serial.println("Card initialized.");//SUCCESSFUL MESSAGE
+  if (SD.exists("example.txt")) {
+    Serial.println("example.txt exists."); //CHECK IF FILE EXISTS
+    }
+  else {
+    Serial.println("example.txt doesn't exist.");
+  }
+  //----------------------CREATE AND OPEN A FILE ON SD CARD----------------------
+  myFile = SD.open("example.txt", FILE_WRITE);
+  //myFile.close(); //USE THIS TO CHECK IF EMPTY FILE CREATED
+}
+
+void dataSend(byte controlbuf0x){
+  Serial.println("Saving to SD...");
+  if (myFile) {
+    switch(controlbuf0x){
+      case 0:
+      Serial.println("Saving buff00");
+        myFile.write(buf00,0b11111111);
+        break;
+      case 1:
+      Serial.println("Saving buff01");
+        myFile.write(buf01,0b11111111);
+        break;
+      default:
+      digitalWrite(13, HIGH);
+      break;
+      }
+    //myFile.close();
+    // print to the serial port too:
+  }
+  else{
+    digitalWrite(13, HIGH);
+    Serial.println("error opening example.txt");
+  }
+}
+
+void BDTest(byte Test){
+  if((Test && 0b00000001)==1){
+    Serial.println("Starting to generate data");
+    testLoadBuffer();
+    Serial.println("Finished generating");
+  }
+  /*if((Test && 0b00000010)==1){
+  }
+  if((Test && 0b00000100)==1){
+  }
+  if((Test && 0b00001000)==1){
+  }
+  if((Test && 0b00010000)==1){
+  }
+  if((Test && 0b00100000)==1){
+  }
+  if((Test && 0b01000000)==1){
+  }
+  if((Test && 0b10000000)==1){
+  }*/
+}
+
+void testLoadBuffer(void){
+  byte i;
+  for(i=0b00000000; i<0b11111111; i++){
+    buf00[i]=i;
+    Serial.print(i);
+    Serial.println("");
+    }
+}
+
+void ReadData(void){
+if (myFile) {
+    Serial.println("example.txt:");
+
+    // read from the file until there's nothing else in it:
+    while (myFile.available()) {
+      Serial.write(myFile.read());
+    }
+    // close the file:
+  } else {
+    // if the file didn't open, print an error:
+    Serial.println("error opening test.txt");
+  }
+}


Changed LEDs

Changed LEDs

Changed LEDs from STATUS to SETUP_SUCCESS

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


upload arduino sketch

upload arduino sketch

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

--- evos_arduino_button/evos_arduino_button.ino
+++ evos_arduino_button/evos_arduino_button.ino
@@ -0,0 +1,382 @@
+
+#include <RBD_Timer.h>
+
+#include <PinChangeInterrupt.h>
+#include <PinChangeInterruptBoards.h>
+#include <PinChangeInterruptPins.h>
+#include <PinChangeInterruptSettings.h>
+
+#include <Adafruit_NeoPixel.h>
+
+// Timer for indicator scroll
+RBD::Timer timer;
+
+// Steering wheel pins
+const int leftSignalPin = 13;
+const int rightSignalPin = 2;
+const int hornPin = 0;
+const int lapCounterPin = 3;
+const int PTTPin = 4;
+
+// Button cluster pins
+const int hazardPin = 5;
+const int wiperPin = 7;
+const int headlightPin = 6;
+const int ignitionPin = 8;
+
+// Limit switch pins
+const int brakeLimitPin = A3;
+const int clutchLimitPin = A4;
+
+// LED strip control pins
+const int leftFrontLEDPin = 9;
+const int rightFrontLEDPin = 10;
+const int rearLEDPin = 11;
+const int starterLEDPin = 12;
+
+// Relay control pins
+const int ignitionRelayPin = 14;
+const int hornRelayPin = 15;
+const int wiperRelayPin = 16;
+
+//LED Settings
+#define LED_BRIGHTNESS 128
+#define NUM_LEDS_FRONT 31
+#define NUM_LEDS_FRONT_TOP 15
+#define NUM_LEDS_REAR 132
+#define NUM_LEDS_REAR_TOP 66
+#define NUM_LEDS_REAR_TOP_SIDE 15
+#define NUM_LEDS_STARTER 36
+
+const int rearLeftTopLEDs[]={50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65};
+const int rearLeftBottomLEDs[]={81,80,79,78,77,76,75,74,73,72,71,70,69,68,67,66};
+const int rearRightTopLEDs[]={15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
+const int rearRightBottomLEDs[]={116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131};
+
+const int frontTopRow = 15;
+const int rearTopRow = 100;
+
+Adafruit_NeoPixel stripStarter = Adafruit_NeoPixel(NUM_LEDS_STARTER, starterLEDPin, NEO_GRB + NEO_KHZ800);
+Adafruit_NeoPixel stripFrontLeft = Adafruit_NeoPixel(NUM_LEDS_FRONT, leftFrontLEDPin, NEO_GRB + NEO_KHZ800);
+Adafruit_NeoPixel stripFrontRight = Adafruit_NeoPixel(NUM_LEDS_FRONT, rightFrontLEDPin, NEO_GRB + NEO_KHZ800);
+Adafruit_NeoPixel stripRear = Adafruit_NeoPixel(NUM_LEDS_REAR, rearLEDPin, NEO_GRB + NEO_KHZ800);
+
+uint32_t amber = stripRear.Color(255, 51, 0);
+uint32_t halfred = stripRear.Color(50, 0, 0);
+uint32_t fullred = stripRear.Color(255, 0, 0);
+uint32_t fullwhite = stripRear.Color(255,255,255);
+uint32_t halfwhite = stripRear.Color(127,127,127);
+
+// DEVICE STATES
+bool wiperState = false;
+bool hornState = false;
+bool ignitionState = false;
+bool clutchState = false;
+
+// LED STATES
+const int BLANK = 0;
+const int HAZARD = 1;
+const int LEFT = 2;
+const int RIGHT = 3;
+const int HL = 4;
+const int HL_HAZARD = 5;
+const int HL_LEFT = 6;
+const int HL_RIGHT = 7;
+
+bool hazardState = false;
+bool headlightState = false;
+bool brakeState = true;
+bool leftState = false;
+bool rightState = false;
+bool stateChanged = false;
+int ledState = 0;
+int amberCount = 0;
+
+void setup() {
+  Serial.begin(9600);
+
+  // STEERING WHEEL PINS
+  pinMode(leftSignalPin, INPUT_PULLUP);
+  digitalWrite(leftSignalPin, HIGH);
+  attachPinChangeInterrupt(digitalPinToPCINT(leftSignalPin), leftSignalTrigger, FALLING);
+  pinMode(rightSignalPin, INPUT_PULLUP);
+  attachPinChangeInterrupt(digitalPinToPCINT(rightSignalPin), rightSignalTrigger, FALLING);
+  pinMode(hornPin, INPUT_PULLUP);
+  attachPinChangeInterrupt(digitalPinToPCINT(hornPin), hornTrigger, CHANGE);
+//  attachPinChangeInterrupt(digitalPinToPCINT(hornPin), hornReleaseTrigger, RISING);
+  pinMode(lapCounterPin, INPUT_PULLUP);
+  attachPinChangeInterrupt(digitalPinToPCINT(lapCounterPin), lapCounterTrigger, FALLING);
+  pinMode(PTTPin, INPUT_PULLUP);
+  attachPinChangeInterrupt(digitalPinToPCINT(PTTPin), PTTTrigger, FALLING);
+
+  // BUTTON CLUSTER PINS
+  pinMode(ignitionPin, INPUT_PULLUP);
+  attachPinChangeInterrupt(digitalPinToPCINT(ignitionPin), ignitionTrigger, CHANGE);
+//  attachPinChangeInterrupt(digitalPinToPCINT(ignitionPin), ignitionReleaseTrigger, RISING);
+  pinMode(hazardPin, INPUT_PULLUP);
+  attachPinChangeInterrupt(digitalPinToPCINT(hazardPin), hazardTrigger, FALLING);
+  pinMode(wiperPin, INPUT_PULLUP);
+  attachPinChangeInterrupt(digitalPinToPCINT(wiperPin), wiperTrigger, FALLING);
+  pinMode(headlightPin, INPUT_PULLUP);
+  attachPinChangeInterrupt(digitalPinToPCINT(headlightPin), headlightTrigger, FALLING);
+
+  // LIMIT SWITCH PINS
+  pinMode(brakeLimitPin, INPUT_PULLUP);
+  attachPinChangeInterrupt(digitalPinToPCINT(brakeLimitPin), brakeTrigger, CHANGE);
+  pinMode(clutchLimitPin, INPUT_PULLUP);
+  attachPinChangeInterrupt(digitalPinToPCINT(clutchLimitPin), clutchTrigger, CHANGE);
+
+  // RELAY CONTROL PINS
+  pinMode(ignitionRelayPin, OUTPUT);
+  digitalWrite(ignitionRelayPin, HIGH);
+  pinMode(hornRelayPin, OUTPUT);
+  digitalWrite(hornRelayPin, HIGH);
+  pinMode(wiperRelayPin, OUTPUT);
+  digitalWrite(wiperRelayPin, HIGH);
+
+  // LED STRIP PREP
+  stripStarter.begin();
+  stripStarter.show();
+  stripFrontLeft.begin();
+  stripFrontLeft.show();
+  stripFrontRight.begin();
+  stripFrontRight.show();
+  stripRear.begin();
+  stripRear.show();
+
+  // INDICATOR SCROLL TIMING
+  timer.setHertz(32);
+}
+
+void loop() {
+  if(timer.onRestart()) {
+    updateAmbers();
+  }
+  if(stateChanged){
+    stateChanged = false;
+    parseLEDState();
+    updateLEDs();
+  }
+}
+
+
+void updateAmbers() {
+  if(amberCount == NUM_LEDS_FRONT_TOP+1){
+    amberCount = 0;
+  }
+  amberCount++;
+  stateChanged = true;
+}
+
+
+void updateLEDs() {
+  stripStarter.clear();
+  stripFrontLeft.clear();
+  stripFrontRight.clear();
+  stripRear.clear();
+
+  switch(ledState) {
+    case BLANK:
+      // do nothing
+      break;
+
+    case HAZARD:
+      for (int i = 0; i < amberCount; i++){
+        stripFrontLeft.setPixelColor(NUM_LEDS_FRONT_TOP-i, amber);
+        stripFrontRight.setPixelColor(NUM_LEDS_FRONT_TOP-i, amber);
+      }
+      for (int i = 0; i < amberCount; i++){
+        stripRear.setPixelColor(rearLeftTopLEDs[i], amber);
+        stripRear.setPixelColor(rearLeftBottomLEDs[i], amber);
+        stripRear.setPixelColor(rearRightTopLEDs[i], amber);
+        stripRear.setPixelColor(rearRightBottomLEDs[i], amber);
+      }
+      break;
+
+    case LEFT:
+      for (int i = 0; i < amberCount; i++){
+        stripFrontLeft.setPixelColor(NUM_LEDS_FRONT_TOP-i, amber);
+      }
+      for (int i = 0; i < amberCount; i++){
+        stripRear.setPixelColor(rearLeftTopLEDs[i], amber);
+        stripRear.setPixelColor(rearLeftBottomLEDs[i], amber);
+      }
+      break;
+
+    case RIGHT:
+      for (int i = 0; i < amberCount; i++){
+        stripFrontRight.setPixelColor(NUM_LEDS_FRONT_TOP-i, amber);
+      }
+      for (int i = 0; i < amberCount; i++){
+        stripRear.setPixelColor(rearRightTopLEDs[i], amber);
+        stripRear.setPixelColor(rearRightBottomLEDs[i], amber);
+      }
+      break;
+
+    case HL:
+      for (int i = 0; i < NUM_LEDS_FRONT; i++){
+        stripFrontRight.setPixelColor(i, fullwhite);
+        stripFrontLeft.setPixelColor(i, fullwhite);
+      }
+      for (int i = 0; i < NUM_LEDS_REAR; i++){
+        stripRear.setPixelColor(i, halfred);
+      }
+      break;
+
+    case HL_HAZARD:
+      for (int i = 0; i < NUM_LEDS_FRONT; i++){
+        stripFrontRight.setPixelColor(i, fullwhite);
+        stripFrontLeft.setPixelColor(i, fullwhite);
+      }
+      for (int i = 0; i < NUM_LEDS_REAR; i++){
+        stripRear.setPixelColor(i, halfred);
+      }
+      for (int i = 0; i < amberCount; i++){
+        stripFrontLeft.setPixelColor(NUM_LEDS_FRONT_TOP-i, amber);
+        stripFrontRight.setPixelColor(NUM_LEDS_FRONT_TOP-i, amber);
+      }
+      for (int i = 0; i < amberCount; i++){
+        stripRear.setPixelColor(rearLeftTopLEDs[i], amber);
+        stripRear.setPixelColor(rearLeftBottomLEDs[i], amber);
+        stripRear.setPixelColor(rearRightTopLEDs[i], amber);
+        stripRear.setPixelColor(rearRightBottomLEDs[i], amber);
+      }
+      break;
+
+    case HL_LEFT:
+      for (int i = 0; i < NUM_LEDS_FRONT; i++){
+        stripFrontRight.setPixelColor(i, fullwhite);
+        stripFrontLeft.setPixelColor(i, fullwhite);
+      }
+      for (int i = 0; i < NUM_LEDS_REAR; i++){
+        stripRear.setPixelColor(i, halfred);
+      }
+      for (int i = 0; i < amberCount; i++){
+        stripFrontLeft.setPixelColor(NUM_LEDS_FRONT_TOP-i, amber);
+      }
+      for (int i = 0; i < amberCount; i++){
+        stripRear.setPixelColor(rearLeftTopLEDs[i], amber);
+        stripRear.setPixelColor(rearLeftBottomLEDs[i], amber);
+      }
+    case HL_RIGHT:
+      for (int i = 0; i < NUM_LEDS_FRONT; i++){
+        stripFrontRight.setPixelColor(i, fullwhite);
+        stripFrontLeft.setPixelColor(i, fullwhite);
+      }
+      for (int i = 0; i < NUM_LEDS_REAR; i++){
+        stripRear.setPixelColor(i, halfred);
+      }
+      for (int i = 0; i < amberCount; i++){
+        stripFrontRight.setPixelColor(NUM_LEDS_FRONT_TOP-i, amber);
+      }
+      for (int i = 0; i < amberCount; i++){
+        stripRear.setPixelColor(rearRightTopLEDs[i], amber);
+        stripRear.setPixelColor(rearRightBottomLEDs[i], amber);
+      }
+  }
+
+  if (brakeState) {
+    for (int i = 0; i < NUM_LEDS_REAR; i++){
+        stripRear.setPixelColor(i, fullred);
+      }
+  }
+  stripStarter.show();
+  stripFrontLeft.show();
+  stripFrontRight.show();
+  stripRear.show();
+}
+
+void parseLEDState() {
+  if(!headlightState) {  // headlights off
+      if(hazardState) {
+        ledState = HAZARD;
+      } else if (leftState) {
+        ledState = LEFT;
+      } else if (rightState) {
+        ledState = RIGHT;
+      } else {
+        ledState = BLANK;
+      }
+    } else {  // headlights on
+      if(hazardState) {
+        ledState = HL_HAZARD;
+      } else if (leftState) {
+        ledState = HL_LEFT;
+      } else if (rightState) {
+        ledState = HL_RIGHT;
+      } else {
+        ledState = HL;
+      }
+    }
+}
+
+// STEERING WHEEL TRIGGERS
+void leftSignalTrigger() {
+  Serial.println("Left signal pressed");
+  leftState = !leftState;
+  stateChanged = true;
+}
+
+void rightSignalTrigger() {
+  Serial.println("Right signal pressed");
+  rightState = !rightState;
+  stateChanged = true;
+}
+
+void hornTrigger() {
+  Serial.println("Horn pressed");
+  hornState = !hornState;
+  digitalWrite(hornRelayPin, !hornState);
+}
+
+void PTTTrigger() {
+  Serial.println("PTT pressed");
+}
+
+void lapCounterTrigger() {
+  Serial.println("Lap counter pressed");
+}
+
+
+// BUTTON CLUSTER TRIGGERS
+void ignitionTrigger(){
+  Serial.println("Ignition pressed");
+  ignitionState = !ignitionState;
+  digitalWrite(ignitionRelayPin, !ignitionState);
+}
+
+void ignitionReleaseTrigger() {
+  Serial.println("Ignition released");
+  digitalWrite(hornRelayPin, HIGH);
+}
+
+void hazardTrigger() {
+  Serial.println("Hazard pressed");
+  hazardState = !hazardState;
+  stateChanged = true;
+}
+
+void wiperTrigger() {
+  Serial.println("Wiper pressed");
+  wiperState = !wiperState;
+  digitalWrite(wiperRelayPin, !wiperState);
+}
+
+void headlightTrigger() {
+  Serial.println("Headlight pressed");
+  headlightState = !headlightState;
+  stateChanged = true;
+}
+
+
+// LIMIT SWITCHES
+void brakeTrigger() {
+  Serial.println("Brake pressed");
+  brakeState = !brakeState;
+  stateChanged = true;
+}
+
+void clutchTrigger() {
+  Serial.println("Clutch pressed");
+  clutchState = !clutchState;
+}


Added TestMotors example

Added TestMotors example

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

--- examples/TestMotors/TestMotors.ino
+++ examples/TestMotors/TestMotors.ino
@@ -0,0 +1,209 @@
+/*
+TestMotors.ino
+Source: https://github.com/DrGFreeman/RasPiBot202.V2
+
+MIT License
+
+Copyright (c) 2017 Julien de la Bruere-Terreault <drgfreeman@tuta.io>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+/*
+Test motors
+*/
+
+#include <AStar32U4.h>
+#include <AStarEncoders.h>
+#include <Odometer.h>
+#include <TimedPID.h>
+
+// Define robot geometrical properties
+// Distance travelled per encoder tick
+const float tickDist = .152505;
+// Width between the two wheels
+const float track = 142.5;
+
+// Define motor PID gains
+const float Kp = 1.0; // 2.0
+const float Ki = 6.0; // 5.0
+const float Kd = 0.01;
+
+// Define motors max command
+const float motorsMaxCommand = 400;
+
+// Define motor trims in 1/40
+const int leftTrim = 30;
+const int rightTrim = 40;
+
+// Define speed variables for acceleration control
+int lastSpeedCmdLeft = 0;
+int lastSpeedCmdRight = 0;
+
+// Define maximum speed command change per time step
+const int accelMax = 20;
+
+// Define different objects from RasPiBot202V2 library
+AStarEncoders encoders;
+Odometer odometer(tickDist, track);
+TimedPID PIDLeft(Kp, Ki, Kd);
+TimedPID PIDRight(Kp, Ki, Kd);
+
+// Define objects from AStar32U4 library
+AStar32U4Motors motors;
+AStar32U4ButtonA btnA;
+AStar32U4ButtonB btnB;
+AStar32U4ButtonC btnC;
+
+// Define variables used for target speed generation and time step calculation
+unsigned long initialTime;
+unsigned long lastTime;
+
+void setup() {
+  Serial.begin(9600);
+
+  // Set encoders directions
+  encoders.flipDirection(false, true);
+
+  // Set PID controllers command range
+  PIDLeft.setCmdRange(-motorsMaxCommand, motorsMaxCommand);
+  PIDRight.setCmdRange(-motorsMaxCommand, motorsMaxCommand);
+
+  // Initialize time variables
+  initialTime = micros();
+  lastTime = initialTime;
+  delay(10);
+}
+
+void loop() {
+
+  // Calculate the time step between passes of the main loop
+  // Get current time
+  unsigned long currentTime = micros();
+  // Calculate time step in seconds (micro seconds / 1 000 000)
+  float timeStep = float(currentTime - lastTime) / 1E6;
+  // Store current time as last time for next pass of the loop
+  lastTime = currentTime;
+
+  // Define the target speed as function of time
+  float targetSpeed = 0;
+  if (currentTime - initialTime > 8E6){
+    // Reset initial time
+    initialTime = currentTime;
+  }
+  else if (currentTime - initialTime > 7E6)
+  {
+    targetSpeed = 250;
+  }
+    else if (currentTime - initialTime > 5E6)
+  {
+    targetSpeed = 200;
+  }
+  else if (currentTime - initialTime > 3E6) {
+    targetSpeed = 250;
+  }
+  // Add continuous variation of the target speed
+  targetSpeed += 25 * sin(micros() / 2.5E5);
+
+  // Print actual motor speeds from odometer
+  Serial.print(odometer.getSpeedRight());
+  Serial.print("\t");
+  Serial.print(odometer.getSpeedLeft());
+
+  // Press button A to control motors with a variable target speed
+  if (btnA.isPressed())
+  {
+    setMotorSpeeds(targetSpeed, targetSpeed);
+    Serial.print("\t");
+    Serial.println(targetSpeed);
+  }
+  // Press button B to control motors with a fixed target speed
+  else if (btnB.isPressed())
+  {
+    setMotorSpeeds(300, 300);
+    Serial.print("\t");
+    Serial.println(300);
+  }
+  else
+  {
+    setMotorSpeeds(0, 0);
+    Serial.print("\t");
+    Serial.println(0);
+  }
+
+  // Ensure a constant time step of the main loop (10 milliseconds)
+  while (micros() - currentTime < 10000)
+  {
+    // Wait until time step is reached
+  }
+}
+
+// Sets the motor speeds using PID controllers
+void setMotorSpeeds(int speedLeft, int speedRight)
+{
+  // Read odometer counts
+  int countsLeft = encoders.getCountsLeft();
+  int countsRight = encoders.getCountsRight();
+
+  // Update odometer
+  odometer.update(countsLeft, countsRight);
+
+  // get speed command from PID controllers
+  int speedCmdLeft = PIDLeft.getCmdAutoStep(speedLeft, odometer.getSpeedLeft());
+  int speedCmdRight = PIDRight.getCmdAutoStep(speedRight, odometer.getSpeedRight());
+
+  // Handle speed commands
+
+  // Control maximum acceleration
+  if (speedCmdLeft - lastSpeedCmdLeft > accelMax)
+  {
+    speedCmdLeft = lastSpeedCmdLeft + accelMax;
+  }
+  if (speedCmdLeft - lastSpeedCmdLeft < -accelMax)
+  {
+    speedCmdLeft = lastSpeedCmdLeft - accelMax;
+  }
+  if (speedCmdRight - lastSpeedCmdRight > accelMax)
+  {
+    speedCmdRight = lastSpeedCmdRight + accelMax;
+  }
+  if (speedCmdRight - lastSpeedCmdRight < -accelMax)
+  {
+    speedCmdRight = lastSpeedCmdRight - accelMax;
+  }
+
+  // Stop immediately if target speed is zero
+  if (speedLeft == 0)
+  {
+    speedCmdLeft = 0;
+    PIDLeft.reset();
+  }
+  if (speedRight == 0)
+  {
+    speedCmdRight = 0;
+    PIDRight.reset();
+  }
+
+  // Set motor speeds
+  motors.setSpeeds(speedCmdLeft * leftTrim / 40, speedCmdRight * rightTrim / 40);
+
+  lastSpeedCmdLeft = speedCmdLeft;
+  lastSpeedCmdRight = speedCmdRight;
+}
+


Add Paperweight LEDs

Add Paperweight LEDs

Add Paperweight LEDs with a shift register. Serial messages to come.

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

--- paperweight/Paperweight/Paperweight.ino
+++ paperweight/Paperweight/Paperweight.ino
@@ -0,0 +1,30 @@
+const int PIN_DATA = 4;
+const int PIN_LATCH = 3;
+const int PIN_CLOCK = 2;
+
+byte arrivalStatus = 1;
+
+void setup() {
+    pinMode(PIN_DATA, OUTPUT);
+    pinMode(PIN_CLOCK, OUTPUT);
+    pinMode(PIN_LATCH, OUTPUT);
+}
+
+void loop() {
+    digitalWrite(PIN_LATCH, LOW);
+    shiftOut(PIN_DATA, PIN_CLOCK, MSBFIRST, arrivalStatus);
+    digitalWrite(PIN_LATCH, HIGH);
+    simulate_motion();
+}
+
+/**
+ * Pretend Update arrivalStatus as if this
+ * was a bus that is getting closer to the
+ * desired stop
+ */
+void simulate_motion() {
+    arrivalStatus <<= 1;
+    if (!arrivalStatus)
+        arrivalStatus = 1;
+    delay(1000);
+}


Added a fade example

Added a fade example

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

--- firmware/examples/fade_example.ino
+++ firmware/examples/fade_example.ino
@@ -0,0 +1,11 @@
+#include "rgb-controls/rgb-controls.h"
+
+using namespace RGBControls;
+
+Led led(D0, D1, D2);
+Color red(255, 0, 0);
+Color blue(255, 0, 0);
+
+void loop() {
+  led.fade(red, blue);
+}


Added EchoString.ino firmata firmware for testing

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

--- EchoString/EchoString.ino
+++ EchoString/EchoString.ino
@@ -0,0 +1,42 @@
+/*
+ * Firmata is a generic protocol for communicating with microcontrollers
+ * from software on a host computer. It is intended to work with
+ * any host computer software package.
+ *
+ * To download a host software package, please clink on the following link
+ * to open the download page in your default browser.
+ *
+ * http://firmata.org/wiki/Download
+ */
+
+/* This sketch accepts strings and raw sysex messages and echos them back.
+ *
+ * This example code is in the public domain.
+ */
+#include <Firmata.h>
+
+void stringCallback(char *myString)
+{
+    Firmata.sendString(myString);
+}
+
+
+void sysexCallback(byte command, byte argc, byte*argv)
+{
+    Firmata.sendSysex(command, argc, argv);
+}
+
+void setup()
+{
+    Firmata.setFirmwareVersion(FIRMATA_MAJOR_VERSION, FIRMATA_MINOR_VERSION);
+    Firmata.attach(STRING_DATA, stringCallback);
+    Firmata.attach(START_SYSEX, sysexCallback);
+    Firmata.begin(57600);
+}
+
+void loop()
+{
+    while(Firmata.available()) {
+        Firmata.processInput();
+    }
+}


DEFUNCT AS OF 10/18/16

DEFUNCT AS OF 10/18/16

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


MCodez

MCodez

Dummy Serial Code

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

--- dummyserial.ino
+++ dummyserial.ino
@@ -0,0 +1,33 @@
+  /*
+   *  Demo Code for sending 5 sensors readings..
+  */
+  float a=10;
+  float b=12;
+  float c=15;
+  float d=16;
+  float e=20;
+void setup() {
+Serial.begin(115200);
+}
+
+void loop() {
+a=a+1;
+b=b+1;
+c=c+1;
+d=d+1;
+e=e+1;
+
+Serial.print(a);
+Serial.print("  ");
+Serial.print(b);
+Serial.print("  ");
+Serial.print(c);
+Serial.print("  ");
+Serial.print(d);
+Serial.print("  ");
+Serial.print(e);
+Serial.print("  ");
+Serial.println();
+delay(500);
+
+}


update

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/ada/ws.git/'


Editing sonar Arduino code

Editing sonar Arduino code

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


added sensitivity switch

added sensitivity switch

:)

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


Changed 'evapFanPin' to 'evapFanPinState' for shutterOperation();

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/fbatta/wbox-nodejs.git/'


Programmerings opgave 1 leksion 1

Programmerings opgave 1 leksion 1

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


added test files for arduino

added test files for arduino

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

--- test_comm/test_comm.ino
+++ test_comm/test_comm.ino
@@ -0,0 +1,49 @@
+#include <RelayDevice.h>
+
+
+bool START_FLAG = false;
+RelayDevice *relay;
+
+void setup() {
+  // put your setup code here, to run once:
+  relay = new RelayDevice();
+  Serial.begin(9600);
+  Serial.flush();
+  Serial1.flush();
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  Serial.println(START_FLAG);
+  String command = relay->cmd();
+  if (command != "NONE"){
+    //Serial.println(command);
+  }
+  START_FLAG = aamsCommandHandler(START_FLAG, command);
+  delay(50);
+}
+
+
+bool aamsCommandHandler(bool START_FLAG, String command){
+  if (command != "NONE"){
+    Serial.print("ARDUINO_DOES: ");
+    Serial.println(command);
+  }
+  if (command.startsWith("CONNECT")){
+    relay->sendCmd("connect");
+    Serial.println("ARDUINO SEND: CONNECT");
+  } else if (command.startsWith("READY")){
+    relay->sendCmd("start");
+    Serial.println("ARDUINO SEND: START");
+  } else if (command.startsWith("START")){
+    Serial.println("ARDUINO SET: START_FLAG - TRUE");
+    START_FLAG = true;
+  } else if (command.startsWith("STOP")){
+    Serial.println("ARDUINO SET: START_FLAG - FALSE");
+    START_FLAG = false;
+  } else if (command.startsWith("DISCONNECT")){
+    Serial.println("ARDUINO SET: START_FLAG - FALSE, DISCONNECT");
+    START_FLAG = false;
+  }
+  return START_FLAG;
+}


Added Arduino code
Communication and motor controller.

Signed-off-by: Guadalupe Bernal <3ba124e7807a1b32b6dab461294c1db5393e5b0d@gmail.com>

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

--- software/arduino/motorController/motorController.ino
+++ software/arduino/motorController/motorController.ino
@@ -0,0 +1,193 @@
+#define BRAKEVCC 0
+#define CW   1
+#define CCW  2
+#define BRAKEGND 3
+#define CS_THRESHOLD 100
+
+/*  VNH2SP30 pin definitions
+ xxx[0] controls '1' outputs
+ xxx[1] controls '2' outputs */
+int inApin[2] = {7, 4};  // INA: Clockwise input
+int inBpin[2] = {8, 9}; // INB: Counter-clockwise input
+int pwmpin[2] = {5, 6}; // PWM input
+int cspin[2] = {2, 3}; // CS: Current sense ANALOG input
+int enpin[2] = {0, 1}; // EN: Status of switches output (Analog pin)
+int statpin = 13;
+
+
+void setup()
+{
+  pinMode(statpin, OUTPUT);
+  // Initialize digital pins as outputs
+  for (int i=0; i<2; i++)
+  {
+    pinMode(inApin[i], OUTPUT);
+    pinMode(inBpin[i], OUTPUT);
+    pinMode(pwmpin[i], OUTPUT);
+  }
+  // Initialize braked
+  for (int i=0; i<2; i++)
+  {
+    digitalWrite(inApin[i], LOW);
+    digitalWrite(inBpin[i], LOW);
+  }
+  digitalWrite(statpin, HIGH);
+  Serial.begin(57600);      //the connection to the computer via USB
+  Serial1.begin(57600);     //serial is the bluetooth from the controller
+}
+
+
+long t0 = 0;
+bool motoroff = true;
+bool modeGamepad = false;
+
+void loop() {
+  long t1 = millis();
+  int n = Serial1.available();
+  if (n >= 4) {
+    int16_t v[2] = {0}; //-128..127
+    Serial1.readBytes((char*)v, 4);
+
+    if (v[0] == 1024){
+      modeGamepad =! modeGamepad;
+      return;
+    }
+    if (modeGamepad){
+      setThrottle(v[0], v[1]);
+      t1 = millis();
+      t0 = t1;
+      motoroff=false;
+    }
+  }
+  if (!modeGamepad){
+    int n = Serial.available();
+    if (n >= 4) {
+      int16_t v[2] = {0}; //-128..127
+      Serial.readBytes((char*)v, 4);
+      setThrottle(v[0], v[1]);
+      t1 = millis();
+      t0 = t1;
+      motoroff=false;
+    }
+  }
+
+  if (t1 - t0 > 100 && !motoroff) {
+    int16_t v[2] = {0}; //-128..127
+    n = Serial1.available();
+    if (n > 0) Serial1.readBytes((char*)v, n);
+    n = Serial.available();
+    if (n > 0) Serial.readBytes((char*)v, n);
+    setThrottle(0, 0);
+    motoroff = true;
+  }
+  delay(5);
+}
+
+
+void motorOff(int motor)
+{
+  // Initialize braked
+  for (int i=0; i<2; i++)
+  {
+    digitalWrite(inApin[i], LOW);
+    digitalWrite(inBpin[i], LOW);
+  }
+  analogWrite(pwmpin[motor], 0);
+}
+
+/* motorGo() will set a motor going in a specific direction
+ the motor will continue going in that direction, at that speed
+ until told to do otherwise.
+
+ motor: this should be either 0 or 1, will selet which of the two
+ motors to be controlled
+
+ direct: Should be between 0 and 3, with the following result
+ 0: Brake to VCC
+ 1: Clockwise
+ 2: CounterClockwise
+ 3: Brake to GND
+
+ pwm: should be a value between ? and 1023, higher the number, the faster
+ it'll go
+ */
+ void setThrottle(float TL, float TR) {
+  if (TL >= 0) {
+    digitalWrite(inApin[0], HIGH);
+    digitalWrite(inBpin[0], LOW);
+  } else {
+    digitalWrite(inApin[0], LOW);
+    digitalWrite(inBpin[0], HIGH);
+  }
+
+  if (TR >= 0) {
+    digitalWrite(inApin[1], HIGH);
+    digitalWrite(inBpin[1], LOW);
+  }
+  else {
+    digitalWrite(inApin[1], LOW);
+    digitalWrite(inBpin[1], HIGH);
+  }
+  analogWrite(pwmpin[0], abs(TL));
+  analogWrite(pwmpin[1], abs(TR));
+}
+
+
+void motorGo(uint8_t motor, uint8_t direct, uint8_t pwm)
+{
+  if (motor <= 1)
+  {
+    if (direct <=4)
+    {
+      // Set inA[motor]
+      if (direct <=1)
+        digitalWrite(inApin[motor], HIGH);
+      else
+        digitalWrite(inApin[motor], LOW);
+
+      // Set inB[motor]
+      if ((direct==0)||(direct==2))
+        digitalWrite(inBpin[motor], HIGH);
+      else
+        digitalWrite(inBpin[motor], LOW);
+
+      analogWrite(pwmpin[motor], pwm);
+    }
+  }
+}
+
+
+
+
+
+//  if (n >= 4) {
+//    int16_t v[2] = {0}; //-128..127
+//    Serial.readBytes((char*)v, 4);
+//    setThrottle(v[0], v[1]);
+//    //t1 = millis();
+//    t0 = t1;
+//
+//    Serial1.print(v[0]);
+//    Serial1.print(" ");
+//    Serial1.print(v[1]);
+//    Serial1.print(" ");
+//    Serial1.print(n);
+//    Serial1.println(" <<<<<<<<<<<<<<<<<<<<");
+//
+//    motoroff=false;
+//  }
+//
+//  //if (ix % 100 == 0)  Serial.println(ix);
+//  if (t1 - t0 > 100 && !motoroff) {
+//    int16_t v[2] = {0}; //-128..127
+//    n = Serial.available();
+//    if (n > 0) Serial.readBytes((char*)v, n);
+//     n = Serial.available();
+//    setThrottle(0, 0);
+//    Serial1.print(n);
+//    Serial1.println(" >>>>>>>>>>>>>>>>>>>");
+//
+//    motoroff = true;
+//  }
+//  delay(5);
+


Create bt_terminal.ino

Create bt_terminal.ino

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

--- bt_terminal.ino
+++ bt_terminal.ino
@@ -0,0 +1,224 @@
+#include <SoftwareSerial.h>
+#include <Servo.h>
+
+String chars[] = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
+                  "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
+                 };
+
+String alphabet[] = {
+  "  .-",
+  "-...",
+  "-.-.",
+  " -..",
+  "   .",
+  "..-.",
+  " --.",
+  "....",
+  "  ..",
+  ".---",
+  " -.-",
+  ".-..",
+  "  --",
+  "  -.",
+  " ---",
+  ".--.",
+  "--.-",
+  " .-.",
+  " ...",
+  "   -",
+  " ..-",
+  "...-",
+  " .--",
+  "-..-",
+  "-.--",
+  "--.."
+};
+
+typedef void (*func) (String cmd);
+
+SoftwareSerial bt(9, 10); // (tx,rx)
+
+// key value struct
+struct key_func {
+  String key;
+  func fn;
+};
+
+// function declerations
+int getIntParam(String, String, int);
+boolean isExistParam(String, String);
+void blink(String);
+void servo(String);
+void laser(String);
+void listenBluetooth();
+void listenSerial();
+
+// commands array
+key_func func_map[3];
+
+void setup() {
+  bt.begin(9600);
+  bt.println("AT+NAMEGox");
+  Serial.begin(19200);
+
+  // key and function name must be same
+  func_map[0].key = "blink"; // command name
+  func_map[0].fn = blink;    // command function
+
+  func_map[1].key = "servo";
+  func_map[1].fn = servo;
+
+  func_map[2].key = "laser";
+  func_map[2].fn = laser;
+
+}
+
+String bluetoothData = "";
+String serialData = "";
+
+void loop() {
+  // blink -t 20 -i 100 -a
+  listenBluetooth();
+  // blink -t 20 -i 100 -a
+  listenSerial();
+}
+
+
+void listenBluetooth() {
+  while (bt.available() > 0) {
+    char chr = bt.read();
+    if (chr != '\n') bluetoothData.concat(chr);
+    if (chr == '\n') {
+      for (int i = 0; i < sizeof func_map / sizeof func_map[0]; i++) {
+        if (bluetoothData.startsWith(func_map[i].key)) {
+          func_map[i].fn(bluetoothData);
+        }
+      }
+      bluetoothData = "";
+    }
+  }
+}
+
+void listenSerial() {
+  while (Serial.available() > 0) {
+    char chr = Serial.read();
+    if (chr != '\n') serialData.concat(chr);
+    if (chr == '\n') {
+      for (int i = 0; i < sizeof func_map / sizeof func_map[0]; i++) {
+        if (serialData.startsWith(func_map[i].key)) {
+          func_map[i].fn(serialData);
+        }
+      }
+      serialData = "";
+    }
+  }
+}
+
+void servo(String cmd) {
+  String paramsStr = cmd.substring(sizeof __func__ / sizeof __func__[0]);
+
+  Serial.println("servo");
+
+  int pin = getIntParam("-p", paramsStr, 3);
+  int degree = getIntParam("-d", paramsStr, 0);
+
+  Servo srv;
+  srv.attach(pin);
+  srv.write(map(degree, 0, 1023, 0, 180));
+
+}
+
+void blink(String cmd) {
+  String paramsStr = cmd.substring(sizeof __func__ / sizeof __func__[0]);
+
+  int pin = getIntParam("-p", paramsStr, 10);
+  int times = getIntParam("-t", paramsStr, 10);
+  int interval = getIntParam("-i", paramsStr, 250);
+
+  pinMode(pin, OUTPUT);
+
+  for (int i = 0; i < times ; i++) {
+    digitalWrite(pin, HIGH);
+    delay(interval);
+    digitalWrite(pin, LOW);
+    delay(interval);
+  }
+
+  if (isExistParam("-a", paramsStr)) {
+    digitalWrite(pin, HIGH);
+  } else {
+    digitalWrite(pin, LOW);
+  }
+
+}
+
+
+
+void laser(String cmd) {
+  String paramsStr = cmd.substring(sizeof __func__ / sizeof __func__[0]);
+
+  int pin = getIntParam("-p", paramsStr, 12);
+  String msg = getStringParam("-m", paramsStr, " ");
+
+  Serial.println(msg);
+
+  pinMode(pin, OUTPUT);
+  // delays are optional
+  digitalWrite(pin, HIGH);
+  delay(1000);
+  digitalWrite(pin, LOW);
+  delay(50);
+
+  for (int i = 0; i < msg.length(); i++ ) {
+    for (int j = 0; j < 4; j++) {
+      Serial.println(alphabet[findCharIndex(msg.charAt(i))].charAt(j));
+      if (alphabet[findCharIndex(msg.charAt(i))].charAt(j) == ' ') {
+        digitalWrite(pin, HIGH);
+        delay(100);
+        digitalWrite(pin, LOW);
+        delay(50);
+      } else if (alphabet[findCharIndex(msg.charAt(i))].charAt(j) == '.') {
+        digitalWrite(pin, HIGH);
+        delay(300);
+        digitalWrite(pin, LOW);
+        delay(50);
+      } else if (alphabet[findCharIndex(msg.charAt(i))].charAt(j) == '-') {
+        digitalWrite(pin, HIGH);
+        delay(500);
+        digitalWrite(pin, LOW);
+        delay(50);
+      }
+    }
+  }
+}
+
+int findCharIndex(char chr){
+  for(int i=0; i<(sizeof(chars) / sizeof(String)); i++ ){
+    if(chars[i].startsWith(String(chr))){
+      return i;
+    }
+  }
+  return 0;
+}
+
+int getIntParam(String param_name, String params, int default_value) {
+  int position = params.indexOf(param_name);
+
+  if (position > -1) {
+    return params.substring(position + param_name.length() + 1, params.indexOf(' ', position + param_name.length() + 1)).toInt();
+  }
+  return default_value;
+}
+
+String getStringParam(String param_name, String params, String default_value) {
+  int position = params.indexOf(param_name);
+
+  if (position > -1) {
+    return params.substring(position + param_name.length() + 1, params.indexOf(' ', position + param_name.length() + 1));
+  }
+  return default_value;
+}
+
+boolean isExistParam(String param_name, String params) {
+  return params.indexOf(param_name) > -1;
+}


Initial DoorAndTempSensor

Initial DoorAndTempSensor

- This sensor combines an open/close door sensor with
  a DS18B20 temperature sensor
- It uses one Device2272 and one ArduinoDS18B20Sensor
- The door state (open/close) and the temperature is sent
  once every 2 minutes of when the state of the door changes

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

--- DoorAndTempSensor.ino
+++ DoorAndTempSensor.ino
@@ -0,0 +1,56 @@
+// Copyright 2015-2016 the project authors as listed in the AUTHORS file.
+// All rights reserved. Use of this source code is governed by the
+// license that can be found in the LICENSE file.
+
+#include "Device2272.h"
+#include "ArduinoDS18B20Sensor.h"
+
+// define the arduino pins used to connect to door sensor
+// the DS18B20 and the transmitter
+#define OPEN_CLOSE_PIN 5
+#define TEMP_PIN 2
+#define TXPIN 3
+
+// device id used in message transmitted for the
+// temp sensor
+#define DS18B20_SENSOR_ID 0x55
+
+// 2272 codes used to signify open or closed door
+#define DEVICE_2272_ID "1111FFFF000"
+#define CLOSED "1"
+#define OPEN "0"
+
+#define TRANSMIT_INTERVAL_SECONDS 120
+
+Device2272 tx(TXPIN, 350);
+ArduinoDS18B20Sensor tempSensor(DS18B20_SENSOR_ID, TEMP_PIN, TXPIN);
+int counter = 0;
+int lastState = 0;
+
+void setup() {
+  pinMode(OPEN_CLOSE_PIN, INPUT);
+}
+
+void loop() {
+  // we transmit the state of the door and the temperature every
+  // TRANSMIT_INTERVAL_SECONDS or when the state (open/close) of
+  // the door changes
+  delay(1000);
+  counter++;
+  int state = digitalRead(OPEN_CLOSE_PIN);
+  if ((lastState != state) || (counter == TRANSMIT_INTERVAL_SECONDS)) {
+     char message[NUM_CHARS_IN_MESSAGE+1];
+     memset(message, 0, NUM_CHARS_IN_MESSAGE+1);
+     strncat(message, DEVICE_2272_ID, NUM_CHARS_IN_MESSAGE);
+     if(state == 0) {
+       strncat(message, OPEN, NUM_CHARS_IN_MESSAGE);
+     } else {
+       strncat(message, CLOSED, NUM_CHARS_IN_MESSAGE);
+     }
+     tx.sendMessage(message);
+     tempSensor.sendTemp();
+     counter = 0;
+  }
+
+  lastState = state;
+}


changed time color and position

changed time color and position

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/rybus/mogette-ui.git/'


added Simple Temperature demo

added Simple Temperature demo

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

--- arduino/simple_temp_demo/simple_temp_demo.ino
+++ arduino/simple_temp_demo/simple_temp_demo.ino
@@ -0,0 +1,58 @@
+/*
+	|\/| _ | . _  _   (~ _  _  _ _
+	|  |(_||<|| |(_|  _)(/_| |_\(/_
+				  _|
+
+	Kashev Dalmia :: dalmia3
+	Isaac Dupree  :: dupree2
+
+	simple_bt_demo.ino
+*/
+
+/*
+ * Thanks to Kerry Wong:
+ *     http://www.kerrywong.com/2010/05/09/working-with-lm19-temperature-sensor/
+ */
+
+#define BAUD_RATE 9600
+
+/*
+ * PINS
+ */
+// LM19 V_out pin on Analog Pin 0
+#define pinLM19 0
+
+/*
+ *  ARDUINO REQUIRED - VOID & MAIN
+ */
+void
+setup (void)
+{
+	Serial.begin(BAUD_RATE);
+}
+
+/* GLOBAL VARIABLES */
+// globals are used so locals don't have to be reallocated every loop()
+float vin, tempC, tempF;
+
+void
+loop (void)
+{
+    // sensor realing
+    vin = 5.0 * analogRead(pinLM19) / 1024.0;
+    tempC = (1.8663 - vin) / 0.01169;
+    tempF = 1.8 * tempC + 32.0; // 9.0/5.0 * tempC + 32.0
+
+    // printing
+    Serial.print("V: ");
+    Serial.print(vin);
+    Serial.print(",  ");
+    Serial.print("C: ");
+    Serial.print(tempC);
+    Serial.print(",  ");
+    Serial.print("F: ");
+    Serial.println(tempF);
+
+    // to reduce jitter
+    delay(100);
+}


i2cscan

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

--- sketch_lg_i2cscan/sketch_lg_i2cscan.ino
+++ sketch_lg_i2cscan/sketch_lg_i2cscan.ino
@@ -0,0 +1,125 @@
+// Sketch to connect wino-board to wifi and read out the assigned IP address.
+// this will be the basis for more functionality later.
+// all the SerialUSB output is just for debugging and not needed if this logic
+// is used in other sketches.
+
+#include <ESP8266WiFi.h>
+#include <Wire.h>
+#include "config.h"
+
+const int delayms = 5 * 60 * 1000;
+const char *server = LG_HOST;
+const int port = LG_PORT;
+
+
+void setup() {
+  Serial.begin(115200); //Opens USB-Serial connection for terminal
+  delay(5000);
+  Serial.print("Serial interface is ready\r\n");
+  connectWifi();
+  Wire.begin(4, 5); // sda on pin D2, scl on pin D1
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  byte error, address;
+  int nDevices;
+
+  Serial.print("WiFi heartbeat - ms since boot: ");
+  Serial.print(millis());
+  Serial.println();
+  Serial.println("Scanning i2c devices... ");
+
+  nDevices = 0;
+  for(address = 1; address < 127; address++) {
+    Wire.beginTransmission(address);
+    error = Wire.endTransmission();
+
+    if (error == 0) {
+      Serial.print("I2C device found at address 0x");
+      if (address<16)
+        Serial.print("0");
+      Serial.print(address,HEX);
+      Serial.println("  !");
+
+      nDevices++;
+    }
+    else if (error==4) {
+      Serial.print("--Unknown error at address 0x");
+      if (address<16)
+        Serial.print("0");
+      Serial.println(address,HEX);
+    }
+  }
+  if (nDevices == 0)
+    Serial.println("--No I2C devices found\n");
+  else
+    Serial.println("done\n");
+
+  sendData(WiFi.hostname(), millis(), nDevices);
+  delay(delayms);
+
+}
+
+void connectWifi() {
+  Serial.print("Connecting to ");
+  Serial.println(WIFI_SSID);
+    // temporary fix until SDK 1.5.4 is used
+  WiFi.persistent(false);
+  WiFi.mode(WIFI_OFF);
+  WiFi.mode(WIFI_STA);
+    // temporary fix end
+  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
+  while (WiFi.status() != WL_CONNECTED) {
+      delay(1000);
+      Serial.print(WiFi.status());
+      Serial.print(".");
+  }
+
+  Serial.println("");
+  Serial.print("Connected with IP: "),
+  Serial.println(WiFi.localIP());
+}
+
+
+void sendData(String hostname, long uptime, int i2cDevices) {
+  WiFiClient client;
+
+  Serial.println("starting to sendData: " + hostname + ", " + String(uptime) + " to server: " + server);
+   if (client.connect(server, port)) {
+       Serial.println("WiFi Client connected ");
+
+       String postStr = "{ \"hostname\": \"";
+       postStr += String(hostname);
+       postStr += "\", \"uptime\": \"";
+       postStr += String(uptime);
+       postStr += "\", \"i2cDevices\": ";
+       postStr += String(i2cDevices);
+       postStr += " }";
+
+       String url = "POST /api/collections/hb?user_key=";
+       url += LG_API_KEY;
+       url += " HTTP/1.1\n";
+       url += "Host: ";
+       url += LG_HOST;
+       url += "\n";
+       url += "Connection: close\n";
+       url += "Content-Type: application/json\n";
+       url += "Content-Length: ";
+       url += String(postStr.length());
+       url += "\n\n";
+
+       Serial.println(url);
+       Serial.println(postStr);
+       client.print(url);
+       client.print(postStr);
+       delay(1000);
+
+   } else {
+     Serial.println("could not connect WifiClient");
+   }
+   client.stop();
+}
+
+
+


Create CO-Sensor-RGB-Common-Cathode-Out.ino

error: pathspec 'Sensors/CO-Sensor-RGB-Common-Cathode-Out.ino' did not match any file(s) known to git

--- Sensors/CO-Sensor-RGB-Common-Cathode-Out.ino
+++ Sensors/CO-Sensor-RGB-Common-Cathode-Out.ino
@@ -0,0 +1,34 @@
+int bpin = 9;
+int gpin = 11;
+int rpin = 10;
+
+int rval;
+int bval;
+int gval;
+
+int sensorRead;
+
+void setup()
+{
+  Serial.begin(9600);
+  pinMode(rpin, OUTPUT);
+  pinMode(gpin, OUTPUT);
+  pinMode(bpin, OUTPUT);
+
+
+}
+
+void loop()
+{
+ sensorRead = analogRead(A0);
+ Serial.println(sensorRead);
+ rval=map(sensorRead,0,400,0,255);
+ gval=map(sensorRead,400,0,0,255);
+ analogWrite(rpin,rval);
+ analogWrite(gpin,gval);
+ delay(10);
+
+}
+
+
+


Create HMClientTest.ino

Create HMClientTest.ino

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

--- examples/HMClientTest.ino
+++ examples/HMClientTest.ino
@@ -0,0 +1 @@
+#include <HMClient.h>


constant speed with accelstepper

constant speed with accelstepper

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/audetto/Adafruit_Motor_Shield_V2_Library.git/'


Spark Core example

Spark Core example

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

--- firmware/examples/Transports/SparkCore/SparkCore.ino
+++ firmware/examples/Transports/SparkCore/SparkCore.ino
@@ -0,0 +1,35 @@
+/**************************************************************
+ * Blynk is a platform with iOS and Android apps to control
+ * Arduino, Raspberry Pi and the likes over the Internet.
+ * You can easily build graphic interfaces for all your
+ * projects by simply dragging and dropping widgets.
+ *
+ *   Downloads, docs, tutorials: http://www.blynk.cc
+ *   Blynk community:            http://community.blynk.cc
+ *   Social groups:              http://www.fb.com/blynkapp
+ *                               http://twitter.com/blynk_app
+ *
+ * Blynk library is licensed under MIT license
+ * This example code is in public domain.
+ *
+ **************************************************************/
+
+//#define BLYNK_DEBUG
+#define BLYNK_PRINT Serial
+#include "blynk/BlynkSimpleSparkCore.h"
+
+// You should get Auth Token in the Blynk App.
+// Go to the Project Settings (nut icon).
+char auth[] = "YourAuthToken";
+
+void setup()
+{
+  Serial.begin(9600);
+  Blynk.begin(auth);
+}
+
+void loop()
+{
+  Blynk.run();
+}
+


Add first soccer file

Add first soccer file

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/EmanueleGiacomini/icaro-robotics.git/'


Add TestEspApi example, exercising the non-RTOS C API.

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

--- libraries/esp8266/examples/TestEspApi/TestEspApi.ino
+++ libraries/esp8266/examples/TestEspApi/TestEspApi.ino
@@ -0,0 +1,313 @@
+/**
+ * TestEspApi by Max Vilimpoc
+ * This code is released to the public domain.
+ *
+ * Test out the Expressif ESP8266 Non-OS API, exhaustively trying out
+ * as many of the built-in functions as possible.
+ *
+ * Some of the code is based on examples in:
+ * "20A-ESP8266__RTOS_SDK__Programming Guide__EN_v1.3.0.pdf"
+ */
+
+#ifdef ESP8266
+extern "C" {
+#include "user_interface.h"
+}
+#endif
+
+// Set up output serial port (could be a SoftwareSerial
+// if really wanted).
+
+Stream& ehConsolePort(Serial);
+
+// Wired to the blue LED on an ESP-01 board, active LOW.
+//
+// Cannot be used simultaneously with Serial.print/println()
+// calls, as TX is wired to the same pin.
+//
+// UNLESS: You swap the TX pin using the alternate pinout.
+const uint8_t LED_PIN = 1;
+
+const char * const RST_REASONS[] =
+{
+    "REASON_DEFAULT_RST",
+    "REASON_WDT_RST",
+    "REASON_EXCEPTION_RST",
+    "REASON_SOFT_WDT_RST",
+    "REASON_SOFT_RESTART",
+    "REASON_DEEP_SLEEP_AWAKE",
+    "REASON_EXT_SYS_RST"
+};
+
+const char * const FLASH_SIZE_MAP_NAMES[] =
+{
+    "FLASH_SIZE_4M_MAP_256_256",
+    "FLASH_SIZE_2M",
+    "FLASH_SIZE_8M_MAP_512_512",
+    "FLASH_SIZE_16M_MAP_512_512",
+    "FLASH_SIZE_32M_MAP_512_512",
+    "FLASH_SIZE_16M_MAP_1024_1024",
+    "FLASH_SIZE_32M_MAP_1024_1024"
+};
+
+const char * const OP_MODE_NAMES[]
+{
+    "NULL_MODE",
+    "STATION_MODE",
+    "SOFTAP_MODE",
+    "STATIONAP_MODE"
+};
+
+const char * const AUTH_MODE_NAMES[]
+{
+    "AUTH_OPEN",
+    "AUTH_WEP",
+    "AUTH_WPA_PSK",
+    "AUTH_WPA2_PSK",
+    "AUTH_WPA_WPA2_PSK",
+    "AUTH_MAX"
+};
+
+const char * const PHY_MODE_NAMES[]
+{
+    "",
+    "PHY_MODE_11B",
+    "PHY_MODE_11G",
+    "PHY_MODE_11N"
+};
+
+const char * const EVENT_NAMES[]
+{
+    "EVENT_STAMODE_CONNECTED",
+    "EVENT_STAMODE_DISCONNECTED",
+    "EVENT_STAMODE_AUTHMODE_CHANGE",
+    "EVENT_STAMODE_GOT_IP",
+    "EVENT_SOFTAPMODE_STACONNECTED",
+    "EVENT_SOFTAPMODE_STADISCONNECTED",
+    "EVENT_MAX"
+};
+
+const char * const EVENT_REASONS[]
+{
+    "",
+    "REASON_UNSPECIFIED",
+    "REASON_AUTH_EXPIRE",
+    "REASON_AUTH_LEAVE",
+    "REASON_ASSOC_EXPIRE",
+    "REASON_ASSOC_TOOMANY",
+    "REASON_NOT_AUTHED",
+    "REASON_NOT_ASSOCED",
+    "REASON_ASSOC_LEAVE",
+    "REASON_ASSOC_NOT_AUTHED",
+    "REASON_DISASSOC_PWRCAP_BAD",
+    "REASON_DISASSOC_SUPCHAN_BAD",
+    "REASON_IE_INVALID",
+    "REASON_MIC_FAILURE",
+    "REASON_4WAY_HANDSHAKE_TIMEOUT",
+    "REASON_GROUP_KEY_UPDATE_TIMEOUT",
+    "REASON_IE_IN_4WAY_DIFFERS",
+    "REASON_GROUP_CIPHER_INVALID",
+    "REASON_PAIRWISE_CIPHER_INVALID",
+    "REASON_AKMP_INVALID",
+    "REASON_UNSUPP_RSN_IE_VERSION",
+    "REASON_INVALID_RSN_IE_CAP",
+    "REASON_802_1X_AUTH_FAILED",
+    "REASON_CIPHER_SUITE_REJECTED",
+};
+
+const char * const EVENT_REASONS_200[]
+{
+    "REASON_BEACON_TIMEOUT",
+    "REASON_NO_AP_FOUND"
+};
+
+void wifi_event_handler_cb(System_Event_t * event)
+{
+    ehConsolePort.print(EVENT_NAMES[event->event]);
+    ehConsolePort.print(" (");
+
+    switch (event->event)
+    {
+        case EVENT_STAMODE_CONNECTED:
+            break;
+        case EVENT_STAMODE_DISCONNECTED:
+            break;
+        case EVENT_STAMODE_AUTHMODE_CHANGE:
+            break;
+        case EVENT_STAMODE_GOT_IP:
+            break;
+        case EVENT_SOFTAPMODE_STACONNECTED:
+        case EVENT_SOFTAPMODE_STADISCONNECTED:
+            {
+                char mac[32] = {0};
+                snprintf(mac, 32, MACSTR ", aid: %d" , MAC2STR(event->event_info.sta_connected.mac), event->event_info.sta_connected.aid);
+
+                ehConsolePort.print(mac);
+            }
+            break;
+    }
+
+    ehConsolePort.println(")");
+}
+
+void print_softap_config(Stream & consolePort, softap_config const& config)
+{
+    consolePort.println();
+    consolePort.println(F("SoftAP Configuration"));
+    consolePort.println(F("--------------------"));
+
+    consolePort.print(F("ssid:            "));
+    consolePort.println((char *) config.ssid);
+
+    consolePort.print(F("password:        "));
+    consolePort.println((char *) config.password);
+
+    consolePort.print(F("ssid_len:        "));
+    consolePort.println(config.ssid_len);
+
+    consolePort.print(F("channel:         "));
+    consolePort.println(config.channel);
+
+    consolePort.print(F("authmode:        "));
+    consolePort.println(AUTH_MODE_NAMES[config.authmode]);
+
+    consolePort.print(F("ssid_hidden:     "));
+    consolePort.println(config.ssid_hidden);
+
+    consolePort.print(F("max_connection:  "));
+    consolePort.println(config.max_connection);
+
+    consolePort.print(F("beacon_interval: "));
+    consolePort.print(config.beacon_interval);
+    consolePort.println("ms");
+
+    consolePort.println(F("--------------------"));
+    consolePort.println();
+}
+
+void print_system_info(Stream & consolePort)
+{
+    const rst_info * resetInfo = system_get_rst_info();
+    consolePort.print(F("system_get_rst_info() reset reason: "));
+    consolePort.println(RST_REASONS[resetInfo->reason]);
+
+    consolePort.print(F("system_get_free_heap_size(): "));
+    consolePort.println(system_get_free_heap_size());
+
+    consolePort.print(F("system_get_os_print(): "));
+    consolePort.println(system_get_os_print());
+    system_set_os_print(1);
+    consolePort.print(F("system_get_os_print(): "));
+    consolePort.println(system_get_os_print());
+
+    system_print_meminfo();
+
+    consolePort.print(F("system_get_chip_id(): 0x"));
+    consolePort.println(system_get_chip_id(), HEX);
+
+    consolePort.print(F("system_get_sdk_version(): "));
+    consolePort.println(system_get_sdk_version());
+
+    consolePort.print(F("system_get_boot_version(): "));
+    consolePort.println(system_get_boot_version());
+
+    consolePort.print(F("system_get_userbin_addr(): 0x"));
+    consolePort.println(system_get_userbin_addr(), HEX);
+
+    consolePort.print(F("system_get_boot_mode(): "));
+    consolePort.println(system_get_boot_mode() == 0 ? F("SYS_BOOT_ENHANCE_MODE") : F("SYS_BOOT_NORMAL_MODE"));
+
+    consolePort.print(F("system_get_cpu_freq(): "));
+    consolePort.println(system_get_cpu_freq());
+
+    consolePort.print(F("system_get_flash_size_map(): "));
+    consolePort.println(FLASH_SIZE_MAP_NAMES[system_get_flash_size_map()]);
+}
+
+void print_wifi_general(Stream & consolePort)
+{
+    consolePort.print(F("wifi_get_channel(): "));
+    consolePort.println(wifi_get_channel());
+
+    consolePort.print(F("wifi_get_phy_mode(): "));
+    consolePort.println(PHY_MODE_NAMES[wifi_get_phy_mode()]);
+}
+
+void secure_softap_config(softap_config * config, const char * ssid, const char * password)
+{
+    size_t ssidLen     = strlen(ssid)     < sizeof(config->ssid)     ? strlen(ssid)     : sizeof(config->ssid);
+    size_t passwordLen = strlen(password) < sizeof(config->password) ? strlen(password) : sizeof(config->password);
+
+    memset(config->ssid, 0, sizeof(config->ssid));
+    memcpy(config->ssid, ssid, ssidLen);
+
+    memset(config->password, 0, sizeof(config->password));
+    memcpy(config->password, password, passwordLen);
+
+    config->ssid_len = ssidLen;
+    config->channel  = 1;
+    config->authmode = AUTH_WPA2_PSK;
+//    config->ssid_hidden = 1;
+    config->max_connection = 4;
+//    config->beacon_interval = 1000;
+}
+
+void setup()
+{
+    // Reuse default Serial port rate, so the bootloader
+    // messages are also readable.
+
+    Serial.begin(74880);
+
+    // Try pushing frequency to 160MHz.
+    system_update_cpu_freq(SYS_CPU_160MHZ);
+
+    Serial.println();
+    Serial.println(F("ESP starting."));
+
+    // System usually boots up in about 200ms.
+
+    Serial.print(F("system_get_time(): "));
+    Serial.println(system_get_time());
+
+    // set_event_handler_cb_stream(Serial);
+    wifi_set_event_handler_cb(wifi_event_handler_cb);
+
+    print_system_info(Serial);
+
+    Serial.print(F("wifi_get_opmode(): "));
+    Serial.print(wifi_get_opmode());
+    Serial.print(F(" - "));
+    Serial.println(OP_MODE_NAMES[wifi_get_opmode()]);
+
+    Serial.print(F("wifi_get_opmode_default(): "));
+    Serial.print(wifi_get_opmode_default());
+    Serial.print(F(" - "));
+    Serial.println(OP_MODE_NAMES[wifi_get_opmode_default()]);
+
+    Serial.print(F("wifi_get_broadcast_if(): "));
+    Serial.println(wifi_get_broadcast_if());
+
+    softap_config config;
+    wifi_softap_get_config(&config);
+    secure_softap_config(&config, "TestAP", "testtesttest");
+    wifi_softap_set_config(&config);
+    print_softap_config(Serial, config);
+
+    print_wifi_general(Serial);
+
+    // This doesn't work on an ESP-01.
+    // wifi_set_sleep_type(LIGHT_SLEEP_T);
+
+    // Try this dirty little thing.
+    // Doesn't work because ESP-01 module doesn't link XPD_DCDC -> RST.
+    // ESP.deepSleep(15000);
+}
+
+void loop()
+{
+    Serial.print(F("system_get_time(): "));
+    Serial.println(system_get_time());
+    delay(1000);
+}
+


Create SparkTimeExample.ino

Create SparkTimeExample.ino

Move for new Spark Library

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

--- firmware/examples/SparkTimeExample.ino
+++ firmware/examples/SparkTimeExample.ino
@@ -0,0 +1,53 @@
+// This #include statement was automatically added by the Spark IDE.
+#include "SparkTime.h"
+
+UDP UDPClient;
+SparkTime rtc;
+
+unsigned long currentTime;
+unsigned long lastTime = 0UL;
+String timeStr;
+
+void setup() {
+  rtc.begin(&UDPClient, "north-america.pool.ntp.org");
+  rtc.setTimeZone(-5); // gmt offset
+  Serial.begin(9600);
+}
+
+void loop() {
+    currentTime = rtc.now();
+    if (currentTime != lastTime) {
+      byte sec = rtc.second(currentTime);
+      if (sec == 10) {
+	// Build Date String
+	timeStr = "";
+	timeStr += rtc.dayOfWeekString(currentTime);
+	timeStr += ", ";
+	timeStr += rtc.monthNameString(currentTime);
+	timeStr += " ";
+	timeStr += rtc.dayString(currentTime);
+	timeStr += ", ";
+	timeStr += rtc.yearString(currentTime);
+	Serial.print(timeStr);
+      } else if (sec == 40) {
+	// Including current timezone
+	Serial.print(rtc.ISODateString(currentTime));
+      } else if (sec == 50) {
+	// UTC or Zulu time
+	Serial.print(rtc.ISODateUTCString(currentTime));
+      } else {
+	// Just the time in 12 hour format
+	timeStr = "";
+	timeStr += rtc.hour12String(currentTime);
+	timeStr += ":";
+	timeStr += rtc.minuteString(currentTime);
+	timeStr += ":";
+	timeStr += rtc.secondString(currentTime);
+	timeStr += " ";
+	timeStr += rtc.AMPMString(currentTime);
+	Serial.print(timeStr);
+      }
+      lastTime = currentTime;
+    }
+
+}


arduino sketch to measure a few sensors

arduino sketch to measure a few sensors

error: pathspec 'firmware/stations/kitchen-control/kitchen-control.ino' did not match any file(s) known to git

--- firmware/stations/kitchen-control/kitchen-control.ino
+++ firmware/stations/kitchen-control/kitchen-control.ino
@@ -0,0 +1,135 @@
+#include <LiquidCrystal.h>
+LiquidCrystal lcd (12, 11, 5, 4, 3, 2);
+
+const int buttonPin = 6;
+const int sensorPin = A0;
+const int alarmPin = 7;
+const int led1 = 8;
+const int led2 = 9;
+const int led3 = 10;
+
+// Used for initial thermocouple reading.
+int sensorValue = 0;
+float thermoCoupleValue = 0;
+float oneWireValue = 0;
+
+bool alarmState = 0;
+bool buttonState = 0;
+int programState = 0;
+
+unsigned long lastMillis = millis();
+unsigned long currentMillis = millis();
+unsigned long thermoCoupleTimer = 0;
+unsigned long oneWireTimer = 0;
+int thermoCoupleRate = 10 * 1000;
+int oneWireRate = 10 * 1000;
+
+String str = "";
+
+void setup() {
+  lcd.begin(16, 2);
+  pinMode(buttonPin, INPUT);
+  pinMode(led1, OUTPUT);
+  digitalWrite(led1, HIGH);
+  pinMode(led2, OUTPUT);
+  digitalWrite(led2, LOW);
+  pinMode(led3, OUTPUT);
+  digitalWrite(led3, LOW);
+  Serial.begin(9600);
+}
+
+
+void loop() {
+  checkButton();
+  currentMillis = millis();
+  thermoCoupleTimer += currentMillis - lastMillis;
+  oneWireTimer += currentMillis - lastMillis;
+
+  lastMillis = currentMillis;
+  if (thermoCoupleTimer > thermoCoupleRate) {
+    readThermoCouple();
+    updateLCD();
+    thermoCoupleTimer = 0;
+  }
+  if (oneWireTimer > oneWireRate) {
+    readOneWire();
+    updateLCD();
+    oneWireTimer = 0;
+  }
+}
+
+void checkButton() {
+  buttonState = digitalRead(buttonPin);
+  if (buttonState == 1) {
+    programState += 1;
+    if (programState == 3) {
+      programState = 0;
+    }
+    switch(programState) {
+      case 0:
+        digitalWrite(led3, LOW);
+        digitalWrite(led1, HIGH);
+        thermoCoupleRate = 60 * 1000;
+        oneWireRate = 60 * 1000;
+        break;
+       case 1:
+        digitalWrite(led1, LOW);
+        digitalWrite(led2, HIGH);
+        thermoCoupleRate = 60 * 1000;
+        oneWireRate = 5 * 1000;
+        break;
+       case 2:
+        digitalWrite(led2, LOW);
+        digitalWrite(led3, HIGH);
+        thermoCoupleRate = 10 * 1000;
+        oneWireRate = 60 * 1000;
+        break;
+    }
+    delay(500);
+  }
+}
+
+void readThermoCouple() {
+  alarmState = digitalRead(alarmPin);
+  if (alarmState) {
+    thermoCoupleValue = 0;
+  } else {
+    sensorValue = analogRead(sensorPin);
+    thermoCoupleValue = adc_to_farhenheight(sensorValue);
+  }
+  Serial.print("{\"sensor\": {\"name\": \"kitchen-oven\", \"value\": ");
+  Serial.print((int)thermoCoupleValue*100);
+  Serial.println("}}");
+}
+
+void readOneWire() {
+  oneWireValue = 60;
+  Serial.print("{\"sensor\": {\"name\": \"kitchen-temperature\", \"value\": ");
+  Serial.print((int)oneWireValue*100);
+  Serial.println("}}");
+}
+int i = 0;
+
+void updateLCD() {
+  if (alarmState) {
+    lcd.setCursor(0, 0);
+    lcd.print("    Warning!    ");
+    lcd.print("Sensor Unplugged");
+  } else {
+    lcd.setCursor(0, 0);
+    lcd.print("Oven: ");
+    lcd.print(thermoCoupleValue);
+    lcd.print(" F");
+    lcd.setCursor(0, 1);
+    lcd.print("Wire: ");
+    lcd.print(oneWireValue);
+    lcd.print(" F ");
+    lcd.print(i);
+    i += 1;
+  }
+}
+
+float adc_to_farhenheight(int x){
+    return (((float) x / 2.046 * 9.0 / 5.0) + 32.0);
+}
+