near functionnal submenu

near functionnal submenu

#include <SPI.h>
#include <SparkFunMAX31855k.h>

#include <SPI.h>
#include <TFT.h>
#include <PID_v1.h>
#include <Servo.h>
#include <TaskScheduler.h>

#include "TempSensor.h"
#include "Label.h"

#define TFT_CS    19
#define TFT_DC    9
#define TFT_RESET 8

#define TC_CS     10

enum ButtonsEnum
{
  NoButton = 0,
  SetButton = 1,
  UpButton = 2,
  DownButton = 4,
  RightButton = 8
};

class Screen
{
  public:
    Screen()
      : _consignLabel(5, 1, Point(0, 32), Color(0, 255, 0)),
        _editLabel(1, 0, Point(0, 32), Color(255, 255, 255)),
        _currentTempLabel(5, 1, Point(0, 0), Color(255, 0, 0)),
        _outputLabel(5, 0, Point(0, 64), Color(0, 0, 255)),
        _editDigit(-1)
    {
      _currentTempLabel.setValue("?");
      _currentTempLabel.setFontSize(Size_20x32);

      _consignLabel.setValue("?");
      _consignLabel.setFontSize(Size_20x32);

      _editLabel.setValue("?");
      _editLabel.setFontSize(Size_20x32);

      _outputLabel.setValue("?");
      _outputLabel.setFontSize(Size_20x32);
    }

    virtual void draw(TFT &hw)
    {
      if (_editDigit >= 0) {
        if (_consignLabel.requireRefresh() && _editDigit >= 0)
        {
          _editLabel.setRequireRefresh(true);
        }
      }

      _consignLabel.draw(hw);
      _currentTempLabel.draw(hw);
      _outputLabel.draw(hw);

      if (_editDigit >= 0) {
        _editLabel.draw(hw);
      }

      hw.stroke(255, 255, 255);
      if (_aliveFlag)
      {
        hw.fill(255, 255, 255);
      }
      else
      {
        hw.fill(0, 0, 0);
      }
      hw.rect(150, 120, 8, 8);
      _aliveFlag = !_aliveFlag;
    }

    void setOutput(float output)
    {
      _outputLabel.setValue((int)output);
    }

    void setConsign(float consign)
    {
      _consignLabel.setValue(consign);
    }

    void setTemp(float currentTemp)
    {
      _currentTempLabel.setValue(currentTemp);
    }

    void editConsign(short editDigit, short editPower)
    {
      _editDigit = editDigit;
      _editLabel.setValue(_editDigit);
      Point pt(_consignLabel.position());

      short decimals = _consignLabel.decimals();
      short pos = _consignLabel.size() - 1;

      if (editPower >= 0)
      {
        if (decimals > 0)
        {
          pos -= (decimals + 1);
        }
      }

      if (editPower < 0)
      {
        pos -= (decimals + editPower);
      }
      else
      {
        pos -= editPower;
      }

      pt.x = _editLabel.fontSize() * 6 * pos;
      _consignLabel.setRequireRefresh(true);
      _editLabel.setPosition(pt);
    }

    void incEditDigit()
    {
      _editDigit = (_editDigit + 1) % 10;
      _editLabel.setValue(_editDigit);
    }

    void decEditDigit()
    {
      _editDigit--;
      if (_editDigit < 0)
      {
        _editDigit = 10 + _editDigit;
      }
      _editLabel.setValue(_editDigit);
    }

    short editDigit()
    {
      return _editDigit;
    }

    void disableEdit()
    {
      _editDigit = -1;
      _editLabel.setValue(_editDigit);
      _consignLabel.setRequireRefresh(true);
    }

  private:
    Label _consignLabel;
    Label _editLabel;
    Label _currentTempLabel;
    Label _outputLabel;
    short _editDigit;
    bool _aliveFlag;
};

#define DEBOUNCE_DELAY 30
#define LONG_PRESSED 1000

enum KeyEvent
{
  NoKeyEvent,
  ShortKeyUp,
  LongKeyDown
};

class Button
{
  public:
    Button(int pin)
      : _pin(pin),
        _lastReading(0),
        _longKeyDownSignaled(false),
        _event(NoKeyEvent),
        _duration(0),
        _highSince(0),
        _lowSince(0),
        _lastChanged(0)
    {
      unsigned long now(millis());

      _highSince = now;
      _lowSince = now;
      _lastChanged = now;
      loop();

      pinMode(pin, INPUT);
    }

    void loop()
    {
      unsigned long now(millis());
      int reading = digitalRead(_pin);

      _event = NoKeyEvent;

      if (now - _lastChanged > DEBOUNCE_DELAY)
      {
        if (_lastReading == LOW && _lowSince <= _highSince)
        {
          _lowSince = now;
          _duration = _lowSince - _highSince;

          if (_duration < LONG_PRESSED)
          {
            _event = ShortKeyUp;
          }
        }
        else if (_lastReading == HIGH)
        {
          if (_highSince <= _lowSince)
          {
            _longKeyDownSignaled = false;
            _highSince = now;
          }

          _duration = now - _highSince;

          if (_duration >= LONG_PRESSED && !_longKeyDownSignaled)
          {
            _event = LongKeyDown;
            _longKeyDownSignaled = true;
          }
        }
      }

      if (reading != _lastReading)
      {
        _lastChanged = now;
        _lastReading = reading;
      }
    }

    KeyEvent event()
    {
      return _event;
    }

  private:
    int _pin;
    int _lastReading;
    bool _longKeyDownSignaled;
    KeyEvent _event;
    unsigned long _duration;
    unsigned long _highSince;
    unsigned long _lowSince;
    unsigned long _lastChanged;

};

#define KEYPAD_BUTTONS 4

class KeyPad
{
  public:
    KeyPad()
    {
      _buttons[0] = new Button(2);
      _buttons[1] = new Button(4);
      _buttons[2] = new Button(6);
      _buttons[3] = new Button(5);
    }

    void loop()
    {
      for (int i = 0; i < KEYPAD_BUTTONS; i++)
      {
        _buttons[i]->loop();
      }
    }

    ButtonsEnum event(KeyEvent keyEvent)
    {
      int matchButtons = 0;

      for (int i = 0; i < KEYPAD_BUTTONS; i++)
      {
        if (_buttons[i]->event() == keyEvent)
        {
          matchButtons |= (1 << i);
        }
      }

      return (ButtonsEnum)matchButtons;
    }

  private:
    Button *_buttons[4];
};

namespace prg
{
  enum StateEnum
  {
    Idle,
    EditConsign
  };
}

class UpdateConsignStateMachine
{
  public:
    static bool run(double &consign, ButtonsEnum shortEvt, ButtonsEnum longEvt, Screen &screen)
    {
      if (!_running)
      {
        _running = true;
        _editState = 0;
        _originalConsign = consign;
        editConsign(consign, screen);
      }
      else
      {
        if ((longEvt & SetButton) != 0)
        {
          consign = _originalConsign;
          _running = false;
        }
        else if ((shortEvt & SetButton) != 0)
        {
          changeModifiedConsign(consign, screen);
          _running = false;
        }
        else if ((shortEvt & UpButton) != 0)
        {
          screen.incEditDigit();
        }
        else if ((shortEvt & DownButton) != 0)
        {
          screen.decEditDigit();
        }
        else if ((shortEvt & RightButton) != 0)
        {
          changeModifiedConsign(consign, screen);
          nextDigit();
          editConsign(consign, screen);
        }

        if (shortEvt != NoButton || longEvt != NoButton)
        {
          Serial.print("consign:");
          Serial.print(consign);
          Serial.print(" state:");
          Serial.println(_editState);
          Serial.print(" init:");
          Serial.println(_editInit);
        }
      }

      if (!_running)
      {
        screen.disableEdit();
      }

      return _running;
    }

  private:
    static double _originalConsign;
    static bool _running;
    static short _editState;
    static short _editInit;

    static void changeModifiedConsign(double &consign, Screen &screen)
    {
      consign += (screen.editDigit() - _editInit) * pow(10.0, _editState - 1);
    }

    static void nextDigit()
    {
      _editState = (_editState + 1) % 4;
    }

    static void editConsign(double &consign, Screen &screen)
    {
      _editInit = (short)(consign / pow(10.0, _editState - 1)) % 10;
      screen.editConsign(_editInit, _editState - 1);
    }
};

double UpdateConsignStateMachine::_originalConsign = 0.0;
bool UpdateConsignStateMachine::_running = false;
short UpdateConsignStateMachine::_editState = 0;
short UpdateConsignStateMachine::_editInit = 0;

Servo myservo;
int val;

class Program
{
  public:

    Program()
      : _p(2), _i(5), _d(1),
        _input(0), _output(0), _consign(0),
        _tft(TFT_CS, TFT_DC, TFT_RESET),
        _pid(&_input, &_output, &_consign, _p, _i, _d, DIRECT)
    {
      // Nothing to do...
    }

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

      _tft.begin();
      _tft.background(0, 0, 0);

      analogReference(EXTERNAL);

      _pid.SetOutputLimits(0.0, 2000.0);
      _pid.SetMode(AUTOMATIC);

      _input = 0.0;
      _output = 0.0;
      _consign = 32.0;

      myservo.attach(3);

      _state = prg::Idle;
    }

    void shortTask() {
      _keyPad.loop();

      ButtonsEnum longEvt = _keyPad.event(LongKeyDown);
      ButtonsEnum shortEvt = _keyPad.event(ShortKeyUp);

      if (shortEvt != NoButton || longEvt != NoButton)
      {
        Serial.print("LONG:");
        Serial.print(longEvt);
        Serial.print(" SHORT:");
        Serial.println(shortEvt);
      }

      switch (_state)
      {
        case prg::Idle:
          if ((longEvt & SetButton) != 0)
          {
            _state = prg::EditConsign;
          }
          break;
        case prg::EditConsign:
          if (!UpdateConsignStateMachine::run(_consign, shortEvt, longEvt, _mainScreen))
          {
            _state = prg::Idle;
          }
          break;
      }
    }

    void longTask() {
      float voltage = (analogRead(A3) * 3.3f) / 1024.0f;
      _input = (voltage - 0.5f) * 100.0f;
      _pid.Compute();

      myservo.write(map(_output, 0, 2000, 0, 100));

      _mainScreen.setConsign(_consign);
      _mainScreen.setTemp(_input);
      _mainScreen.setOutput(_output);
      _mainScreen.draw(_tft);
    }

  private:
    double _p;
    double _i;
    double _d;
    double _input;
    double _consign;
    double _output;
    TFT _tft;
    Screen _mainScreen;
    KeyPad _keyPad;
    PID _pid;
    prg::StateEnum _state;
};

void shortCallback();
void longCallback();

Program prog;
Scheduler sched;
Task shortTask(5, TASK_FOREVER, &shortCallback);
Task longTask(500, TASK_FOREVER, &longCallback);

void shortCallback()
{
  prog.shortTask();
}

void longCallback()
{
  prog.longTask();
}

void setup() {
  prog.setup();
  sched.init();
  sched.addTask(shortTask);
  sched.addTask(longTask);
  shortTask.enable();
  longTask.enable();
}

void loop()
{
  sched.execute();
}

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


Create ServoArduino.ino

Create ServoArduino.ino

Controle do servo por porta serial

#include <Servo.h>
Servo servo;

const int pino_led = 13;
char buf;
int angulo = 90;

void setup()
{
  servo.attach(8);
  servo.write(90);
  Serial.begin(9600);
}

void loop()
{
  while (Serial.available() > 0)
  {
    angulo = Serial.read();
    servo.write(angulo);
  }
}

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


Initial upload of test test code for MS5803-14BA

This code displays pressure and temperature values from the MS5803-14BA
detected through its I2C bus on the "serial monitor" screen in the
Arduino IDE.  Because the MS5803-14BA uses a 3v3 logic, the user should
take care to only power the devise with 3v3 (not 5v).  CLK and SDA seem
to work when attached directly to the Arduino, however.

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


Create Arduino_RTC_example1.ino

Create Arduino_RTC_example1.ino

// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
#include <Wire.h>
#include "RTClib.h"

#if defined(ARDUINO_ARCH_SAMD)
// for Zero, output on USB Serial console, remove line below if using programming port to program the Zero!
   #define Serial SerialUSB
#endif

RTC_PCF8523 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

void setup () {

#ifndef ESP8266
  while (!Serial); // for Leonardo/Micro/Zero
#endif

  Serial.begin(57600);
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }

  if (! rtc.initialized()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }
}

void loop () {
    DateTime now = rtc.now();

    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(" (");
    Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
    Serial.print(") ");
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();

    Serial.print(" since midnight 1/1/1970 = ");
    Serial.print(now.unixtime());
    Serial.print("s = ");
    Serial.print(now.unixtime() / 86400L);
    Serial.println("d");

    // calculate a date which is 7 days and 30 seconds into the future
    DateTime future (now + TimeSpan(7,12,30,6));

    Serial.print(" now + 7d + 30s: ");
    Serial.print(future.year(), DEC);
    Serial.print('/');
    Serial.print(future.month(), DEC);
    Serial.print('/');
    Serial.print(future.day(), DEC);
    Serial.print(' ');
    Serial.print(future.hour(), DEC);
    Serial.print(':');
    Serial.print(future.minute(), DEC);
    Serial.print(':');
    Serial.print(future.second(), DEC);
    Serial.println();

    Serial.println();
    delay(3000);
}

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


Fixed issue relating to stopping and starting oven.

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


Create MDriver_no_PWM.ino

Create MDriver_no_PWM.ino

#include "MDriver.h"

/*
 *Этот пример управляет двигателями без ШИМ(PWM) сигнала, при этом на пины
 *ENA и ENB на плате драйвера двигателей подтянуты к высокому логическому уровню (+5V).
 *
 * Библиотека MDrive предназначена для управление коллекторными двигателями
 * посредством драйвера двигателей на микросхеме L293 или L298.
 *
 * В данном примере выходы драйвера двигателей подключены к следующим
 * цифровым пинам Arduino:
 * 1) для первого двигателя:*/
#define IN1 2
#define IN2 4
  //2) для второго двигателя:
#define IN3 6
#define IN4 7

/*
 * Библиотека содержит следующие функции:
 * speed(uint8_t speed); - принимает значение от 0 до 255, управляет
 *  скоростью вращения. Если двигатель инициализирован без регулировки
 *  скорости, то эта функция становится неактивной.
 * forward(); и backward(); - управляют вращением двигателе в разных
 *  направлениях
 * stop(); - остановка двигателей
 */

//Подключение двигателей без регулировки скорости,
//подразумевается что пин EN на плате драйвера подтянут к +5V.
//Конструктор принимает следующие аргументы MDrive(IN1, IN2)
MDriver m1(IN1, IN2);
MDriver m2(IN3, IN4);

void setup(){}

void loop()
{
  m1.forward();
  m2.backward();
  delay(1000);

  m1.stop();
  m2.stop();
  delay(100);

  m1.backward();
  m2.forward();
  delay(1000);
}

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


smooth wave

smooth wave

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/stevelacy/LEDFade.git/'


Completed SW for PIR and Pressure sensors. TODO: EMG

/*
 * Sensor_Module.ino
 *
 * Created: 2/27/2015 12:18:38 PM
 * Author: Matthew
 */

/*
 *  Rfsr = [(Vcc * Rm) / Vdet] - Rm
 *  Force = 462.95*(Vout) - 153.86
 */
#include <SoftwareSerial.h>

#define VCC 5.0 // conversion constants
#define ADC 1024.0
//#define ADC 5.0/1024.0

#define emgPin 0
#define pirPin 1
#define p1Pin 2
#define p2Pin 3
#define p3Pin 4

int pinArray[5] = {
  1, 2, 3, 4, 5};	// defines the analog pins to use as inputs

double sensorValue[5] = {
  0, 0, 0, 0, 0}; // storage for the sensor readings

double emgBuffer[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // emg data memory
double pirBuffer[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // pir data memory

int emgpos = 0, pirpos = 0; // points to the oldest item in the buffer

double emgThresh = 1.0; // emg cutoff (volts)
double pirThresh = 1.0; // pir cutoff (volts)
double fsrThresh = 500.0; // pressure sens cutoff (grams)

int interrupt1 = 0; // Outgoing data pins
int interrupt2 = 0;
int emgOut = 0;
int pirOut = 0;
int fsr1 = 0;
int fsr2 = 0;
int fsr3 = 0;

SoftwareSerial mySerial(10, 11); // RX, TX

void setup()
{
  // Initialize comm with tiva
  initComm();

  // Setup GPIOs as inputs/outputs
  pinMode(A1, INPUT);
  pinMode(A2, INPUT);
  pinMode(A3, INPUT);
  pinMode(A4, INPUT);
  pinMode(A5, INPUT);

  pinMode(0, OUTPUT); // fsr1 out
  pinMode(1, OUTPUT); // fsr2 out
  pinMode(2, OUTPUT); // pir out
  pinMode(3, OUTPUT); // emg out

  //debug outputs
  pinMode(10, OUTPUT); // emg out
  pinMode(11, OUTPUT); // pir out
  pinMode(12, OUTPUT); // fsr1 out
  pinMode(13, OUTPUT); // fsr2 out

  delay(100);

  // Read some values from emg sensor to determine base value
  //calibrateEMG();

  // Repeat above for pir
  calibratePIR();

}

void loop()
{
  readSensorValues();

  // Process FSR
  double force = sensorValue[p1Pin]*462.95 - 153.86;

  proc_FSR(force);

  // Process EMG
  /*
  int emgOut = proc_EMG(sensorValue[emgPin]);

  if (emgOut == 1) digitalWrite(13, HIGH);
  else digitalWrite(13, LOW);
  */

  // Process PIR
  int pirOut = proc_PIR(sensorValue[pirPin]);

  if (pirOut == 1) {
    //digitalWrite(12, HIGH);
    digitalWrite(2, HIGH);
  }

  else {
    //digitalWrite(12, LOW);
    digitalWrite(2, LOW);
  }

  //printSensorValues();
}

int proc_EMG(double data) {

  emgBuffer[emgpos] = data;

  // Compute the average of the new buffer
  double avg = 0;

  for (int i = 0; i < 10; i++) {
     avg += emgBuffer[i];
  }

  avg /= 10;

  // Check if the average is above the threshold
  if (avg >= emgThresh)
    return 1;

  return 0;
}

void proc_FSR(double data) {

  if (data > 800) { // Medium force detected, set fsrpin 1 to HIGH
    //digitalWrite(12, HIGH); // debug
    digitalWrite(0, HIGH); // <-- actual comm. port to tiva
  }
  else {
    //digitalWrite(12, LOW); // debug
    digitalWrite(0, LOW); // <-- actual comm. port to tiva
  }

  if (data > 1000) { // High force detected, set fsr pin 2 to HIGH
    //digitalWrite(13, HIGH);
    digitalWrite(1, HIGH);
  }
  else {
    //digitalWrite(13, LOW);
    digitalWrite(1, LOW);
  }

}

int proc_PIR(double data) {

  pirBuffer[pirpos] = data;

  pirpos = (pirpos+1)%10; // advance to the next buffer pos

  // Compute the average of the new buffer
  double avg = 0;

  for (int i = 0; i < 10; i++) {
     avg += pirBuffer[i];
  }

  // THIS IS WHERE TO MODIFY THE DETECTION DISTANCE
  avg /= 1.5;

  // return true if the data has been reduced to half the threshold
  if (avg < pirThresh)
    return 1;

  return 0;
}

void readSensorValues() {

  for (int i = 0; i <= 4; i++) {
    // Store the analog read value & convert into a voltage between 0 & 5V
    sensorValue[i] = analogRead(pinArray[i])*(VCC/ADC);
  }

  //Serial.println(analogRead(pinArray[p1Pin]));
  //printSensorValues();
}

void printSensorValues() {

  //double force = sensorValue[2]*462.95 - 153.86;

  //Serial.print(force);

  for (int i = 0; i <= 4; i++) {
      Serial.print(i+1);
      Serial.print(": ");
      Serial.print(sensorValue[i]);
      Serial.print(" ");
  }

  Serial.println();
  delay(500);

}

void initComm() {
  Serial.begin(9600);
}

void calibrateEMG() {
  // fill the emg buffer
  for (int i = 0; i < 10; i++) {
     emgBuffer[i] = analogRead(pinArray[emgPin])*ADC;
  }

  // Take average of buffer & use as the "relaxed" value
  // TO DO
    // TO DO
      // TO DO
        // TO DO
          // TO DO
            // TO DO
}

void calibratePIR() {
  // Fill the pir buffer & compute avg
  double avg = 0;

  for (int i = 0; i < 10; i++) {
     pirBuffer[i] = analogRead(pinArray[pirPin])*VCC/ADC;
     avg = avg + pirBuffer[i];
  }

  // use average of buffer for baseline
  avg = avg / 10.0;

  pirThresh = avg;
}

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


initial commit

initial commit

//
// "Latch pulse" test for Adafruit_TLC59711 library
//
// 12 Mar 2016 by Ulrich Stern
//
// open source (see LICENSE file)
//
// notes:
// * for the Tlc59711 library, this test will be added to Tlc59711Test
// * for this test
//  - the red LEDs should be constant on
//  - the green and blue LEDs should blink (1s on, 1s off)
// * the test fails as follows
//  - the red LEDs change (every second) between 2 intensities
//  - the blue LEDs do not turn off fully
// * reason: see GitHub Wiki of the Tlc59711 library
//

#include <Adafruit_TLC59711.h>

const int NUM_TLC = 1;

Adafruit_TLC59711 tlc(NUM_TLC);
long writesPerSecond;

void setup() {
  tlc.begin();
  unsigned long us = micros();
  tlc.write();
  writesPerSecond = 1000000L / (micros() - us);
}

void loop() {
  uint16_t tv = 0x96c0;
    // MSBs: 0b100101 (0x25), then 0b10110 (OUTTMG, ...)
  for (int j=0; j<2; j++) {
    for (int i=0; i<4*NUM_TLC; i++)
      tlc.setLED(i, tv, tv*j, tv*j);
    for (long i=0, n=writesPerSecond; i<n; i++)
      tlc.write();
  }
}

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


Led8 class initial state

Led8 class initial state

Allows to control the 8 digit 7-segment screen

int clock = 5; // SCK pin
int latch = 6; // RCK pin
int data = 7; // DIO pin

class Led8
{
protected:
  int _data;
  int _clock;
  int _latch;
  int _symbols[16] =  {
//   76543210
    B11000000,    // 0
    B11111001,    // 1
    B10100100,    // 2
    B10110000,    // 3
    B10011001,    // 4
    B10010010,    // 5
    B10000010,    // 6
    B11111000,    // 7
    B10000000,    // 8
    B10010000,    // 9
    B10001000,    // A
    B10000011,    // B
    B11000110,    // C
    B10100001,    // D
    B10000110,    // E
    B10001110};   // F

  int const _space = 0xFF;

  int _buf[8];

  int _cursor = 0;

  void moveRight()
  {
    if (_cursor < 7) _cursor++;
  }

  void update()
  {
    outputSymbol(0, _buf[0]);
    outputSymbol(1, _buf[1]);
    outputSymbol(2, _buf[2]);
    outputSymbol(3, _buf[3]);
    outputSymbol(4, _buf[4]);
    outputSymbol(5, _buf[5]);
    outputSymbol(6, _buf[6]);
    outputSymbol(7, _buf[7]);
  }

  void outputSymbol(int pos, int symbol)
  {
    digitalWrite(_latch, LOW);
    shiftOut(_data, _clock, MSBFIRST, 1 << pos);
    shiftOut(_data, _clock, MSBFIRST, symbol);
    digitalWrite(_latch, HIGH);
  }

public:
  void setSymbol(int pos, int symbol)
  {
    _buf[pos] = symbol;
  }

  void andSymbol(int pos, int symbol)
  {
    setSymbol(pos, symbol & _buf[pos]);
  }

  void orSymbol(int pos, int symbol)
  {
    setSymbol(pos, symbol | _buf[pos]);
  }

  void init(int dataPin, int clockPin, int latchPin)
  {
    _data = dataPin;
    _clock = clockPin;
    _latch = latchPin;

    pinMode(_clock, OUTPUT);
    pinMode(_latch, OUTPUT);
    pinMode(_data, OUTPUT);
  }

  void clear()
  {
    setSymbol(0, _space);
    setSymbol(1, _space);
    setSymbol(2, _space);
    setSymbol(3, _space);
    setSymbol(4, _space);
    setSymbol(5, _space);
    setSymbol(6, _space);
    setSymbol(7, _space);
  }

  void printSymbol(int pos, int symbol)
  {
    setSymbol(pos, symbol);
  }

  void printSymbol(int symbol)
  {
    setSymbol(_cursor, symbol);
    moveRight();
  }

  void putSymbol(int symbol)
  {
    setSymbol(_cursor, symbol);
  }

  void print(int pos, int value)
  {
    setSymbol(pos, _symbols[value]);
  }

  void print(int value)
  {
    print(_cursor, value);
    moveRight();
  }

  void put(int value)
  {
    print(_cursor, value);
  }

  void printSpace()
  {
    setSymbol(_cursor, _space);
    moveRight();
  }

  void moveTo(int pos)
  {
    _cursor = pos;
  }

  void moveToStart()
  {
    moveTo(0);
  }

  void tick(int millis)
  {
    update();
  }
};

Led8 led;
int del = 300;
int start = 0;
int lastmils = 0;
int dir = 1;

void setup()
{
  led.init(data, clock, latch);
  led.clear();

  led.moveToStart();
  led.print(0);
  led.print(1);
  led.print(2);
  led.print(3);
  led.print(4);
  led.print(5);
  led.print(6);
  led.print(7);
}

void loop()
{
  led.tick(0);

  int mils = millis();
  if (mils - lastmils < del) return;
  lastmils = mils;

  led.moveToStart();
  for (int i=start; i<8+start;i++)
    led.print(i);

  if (dir > 0)
    if (start < 8)
      start++;
    else dir = -1;
  else if (start > 0)
    start--;
    else dir = 1;

}

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


int size is actually 2 bytes

int size is actually 2 bytes

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/jeremywrnr/wampum.git/'


initial commit

initial commit

/*

Description:   Prototype sketch for catchprhase device
Author:        Alex D Glover (alexdglover@gmail.com)
Initial Date:  21-Jun-2015
License:       GPLv2.1 (due to libraries being licensed under GPLv2.1)

Credits:
Code for timer functionality - http://playground.arduino.cc/Main/CountDownTimer
Original TFT library - https://github.com/Seeed-Studio/TFT_Touch_Shield_V2
Original Touchscreen Library - https://github.com/Seeed-Studio/Touch_Screen_Driver
Modified TFT Library for screen orientation - http://forum.arduino.cc/index.php?topic=150900.0

*/

// Paint application - Demonstate both TFT and Touch Screen
#include <stdint.h>
#include <SeeedTouchScreen.h>
#include <TFTv2.h>
#include <SPI.h>

int ColorPaletteHigh = 30;
int color = WHITE;  //Paint brush color
unsigned int colors[8] = {BLACK, RED, GREEN, BLUE, CYAN, YELLOW, WHITE, GRAY1};

//Timer related variables
unsigned long Watch, _micro, time = micros();
unsigned int Clock = 0, R_clock;
boolean Reset = false, Stop = false, Paused = false;
volatile boolean timeFlag = false;

//List of 'catchphrases' and the current 'catchphrase
char* listOfWords[]={"test", "puzzle", "watermelon","tree", "boat","squirrel"};
char* currentWord = "";
boolean needNewWord = true;

// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// The 2.8" TFT Touch shield has 300 ohms across the X plate

TouchScreen ts = TouchScreen(XP, YP, XM, YM); //init TouchScreen port pins

void setup()
{
    Tft.TFTinit();  //init TFT library
    Serial.begin(9600);
    //Draw the pallet
    /*for(int i = 0; i<8; i++)
    {
        Tft.fillRectangle(i*30, 0, 30, ColorPaletteHigh, colors[i]);
    }*/

    randomSeed(analogRead(0));
}

boolean CountDownTimer()
{
  static unsigned long duration = 1000000; // 1 second
  timeFlag = false;

  if (!Stop && !Paused) // if not Stopped or Paused, run timer
  {
    // check the time difference and see if 1 second has elapsed
    if ((_micro = micros()) - time > duration )
    {
      Clock--;
      timeFlag = true;

      if (Clock == 0) // check to see if the clock is 0
        Stop = true; // If so, stop the timer

     // check to see if micros() has rolled over, if not,
     // then increment "time" by duration
      _micro < time ? time = _micro : time += duration;
    }
  }
  return !Stop; // return the state of the timer
}

void ResetTimer()
{
  SetTimer(0,0,60);
  Stop = false;
}

void StartTimer()
{
  Watch = micros(); // get the initial microseconds at the start of the timer
  Stop = false;
  Paused = false;
}

void SetTimer(unsigned int hours, unsigned int minutes, unsigned int seconds)
{
  // This handles invalid time overflow ie 1(H), 0(M), 120(S) -> 1, 2, 0
  unsigned int _S = (seconds / 60), _M = (minutes / 60);
  if(_S) minutes += _S;
  if(_M) hours += _M;

  Clock = (hours * 3600) + (minutes * 60) + (seconds % 60);
  R_clock = Clock;
  Stop = false;
}

boolean TimeHasChanged()
{
  return timeFlag;
}

void getNewWord()
{
  int listOfWordsLength = sizeof(listOfWords) / sizeof(int);
  long randomLong = random(listOfWordsLength);
  Serial.print("Random number is ");
  Serial.println(randomLong);
  currentWord = listOfWords[randomLong];
  Serial.println(currentWord);
}

void loop()
{
    // a point object holds x y and z coordinates.
    Point p = ts.getPoint();

    //map the ADC value read to into pixel co-ordinates

    p.x = map(p.x, TS_MINX, TS_MAXX, 0, 240);
    p.y = map(p.y, TS_MINY, TS_MAXY, 0, 320);

    // we have some minimum pressure we consider 'valid'
    // pressure of 0 means no pressing!

    if (p.z > __PRESURE) {
        // Detect  paint brush color change
        if(p.y < ColorPaletteHigh+2)
        {
            color = colors[p.x/30];
        }
        else
        {
            Tft.fillCircle(p.x,p.y,2,color);
        }
    }

    if(needNewWord)
    {
      getNewWord();
      needNewWord = false;
    }

    //show phrase
    Tft.drawString(currentWord,60,100  ,3,WHITE);
    //Tft.drawString("World!!",60,220,4,WHITE);

    CountDownTimer(); // run the timer

    // this prevents the time from being constantly shown.
    if (TimeHasChanged() )
    {
      //Show timer/clock
    }

}
/*********************************************************************************************************
  END FILE
*********************************************************************************************************/

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


First round of AX25 receiver.

First round of AX25 receiver.

#define DDS_REFCLK_DEFAULT 9600

#include <HamShield.h>
#include <Wire.h>

HamShield radio;
DDS dds;

void setup() {
  Serial.begin(9600);
  Wire.begin();
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);

  Serial.println(F("Radio test connection"));
  Serial.println(radio.testConnection(), DEC);
  Serial.println(F("Initialize"));
  delay(100);
  radio.initialize();
  Serial.println(F("Frequency"));
  delay(100);
//  radio.setVHF();
//  radio.setRfPower(0);
//  radio.setModeReceive();
  radio.setVolume1(0xFF);
  radio.setVolume2(0xFF);
  radio.frequency(145050);
  Serial.println(F("DDS Start"));
  delay(100);
  dds.start();
  Serial.println(F("AFSK start"));
  delay(100);
  radio.afsk.start(&dds);
  Serial.println(F("Starting..."));
  pinMode(11, INPUT); // Bodge for now, as pin 3 is hotwired to pin 11
  delay(100);
  dds.setAmplitude(255);
}

uint32_t last = 0;
void loop() {
   if(radio.afsk.decoder.read() || radio.afsk.rxPacketCount()) {
      // A true return means something was put onto the packet FIFO
      Serial.println("Packet");
      // If we actually have data packets in the buffer, process them all now
      while(radio.afsk.rxPacketCount()) {
        AFSK::Packet *packet = radio.afsk.getRXPacket();
        if(packet) {
          for(unsigned short i = 0; i < packet->len; ++i)
            Serial.write((uint8_t)packet->getByte());
          AFSK::PacketBuffer::freePacket(packet);
        }
      }
    }
    /*if(last < millis()) {
      Serial.println(radio.readRSSI());
      last = millis()+1000;
    }*/
}

/*ISR(TIMER2_OVF_vect) {
  TIFR2 = _BV(TOV2);
  static uint8_t tcnt = 0;
  if(++tcnt == 8) {
  digitalWrite(2, HIGH);
  dds.clockTick();
  digitalWrite(2, LOW);
    tcnt = 0;
  }
}*/
ISR(ADC_vect) {
  static uint8_t tcnt = 0;
  TIFR1 = _BV(ICF1); // Clear the timer flag
  PORTD |= _BV(2); // Diagnostic pin (D2)
  //dds.clockTick();
  radio.afsk.timer();
  PORTD &= ~(_BV(2)); // Pin D2 off again
}

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


Added basic signal / slot test example

Added basic signal / slot test example

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


Use Serial1.available() instead of serialevent1()

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/relayr/Arduino-Bridge-Library.git/'


Create Triggers.ino

Create Triggers.ino

// Triggers checks the PID algorithms and timers, and decides whether to change the state of any of the relays

void Triggers (){

    // temp - PID
    coolPID.Compute();
    if(millis() - coolWindowStartTime > coolWindowSize)
        { //time to shift the Relay Window
          coolWindowStartTime += coolWindowSize;  }

    heatPID.Compute();
    if(millis() - heatWindowStartTime > heatWindowSize)
        { //time to shift the Relay Window
          heatWindowStartTime += heatWindowSize;   }

    // temp - logic
    if(Output > (millis() - coolWindowStartTime)/1000 && Output > 2 && (millis() - coolOffElapsed) > minCool*60000) coolON = 1;
    else {
       if (coolON == 1) coolOffElapsed = millis();
       coolON = 0;
    }
    if(Outputh > (millis() - heatWindowStartTime)/1000 && Outputh > 2) heatON = 1;
    else heatON = 0;

    // temp - pins
    if (coolON == 1) {
      digitalWrite(ControlCpin, LOW);
      }
    else {
      digitalWrite(ControlCpin, HIGH);
      }

    if (heatON == 1) digitalWrite(ControlHpin, LOW);
    else digitalWrite(ControlHpin, HIGH);

    //hum on
    //hum off

    // lights
    if ( (millis()+TimeAdjust)%86400000 > LightON && (millis()+TimeAdjust)%86400000 < LightOFF){
       digitalWrite(ControlLpin, LOW); }
    else {
       digitalWrite(ControlLpin, HIGH); }

    // fans
    if (fanOFF > 0){
      //If off, check for ON criteria
      if((millis() - fanOFFmillis) > (fanOFF * 60000) && fanstate == false && coolON == 1){
         digitalWrite(ControlApin, LOW);
         fanOFFmillis = millis();
         fanONmillis = millis();
         fanstate = true;
       }
      //if on, check ffor OFF criteria
      if((millis() - fanONmillis) > (fanON * 60000) && fanstate == true){
         digitalWrite(ControlApin, HIGH);
         fanONmillis = millis();
         fanOFFmillis = millis();
         fanstate = false;
       }
    }
    else {
      int x = PvT - Temp3 ;
      if(FanAuto == 0 && abs(x) > 3) //fan on when temp diff is >3 high
         digitalWrite(ControlApin, LOW);
      else digitalWrite(ControlApin, HIGH);
         //lcd.setCursor(15,0);
    }

    //brewtimer

    if (brewtimerON == 1 && millis() > brewtimerRef + (brewtimer * 60000)){
      brewtimerON = 0;
      SvT = brewtimerSv;}

    //backlight
    if(millis() - backlighton > backlighttime && menu == 0){
      lcd.noBacklight();
      pulselast = pulses;
    }
    else lcd.backlight();

    delay(50);
}

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


test sketch

test sketch

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


Add examples

Add examples

- add ThingSpeak API example that updates a channel with the temperature value

#include <Esp8266.h>
#include <SoftwareSerial.h>
#include <HttpRequest.h>

#include <ParkingShield.h>
#include <DeviceArduino.h>
#include <SevenSeg.h>

// CHANGE CHANNEL'S API KEY HERE:
static const char api_key[] = "QWERTZASDFYXCV";

SoftwareSerial espSerial(2,3);
Esp8266<SoftwareSerial> esp(espSerial);
ParkingShield shield;

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

  esp.configureBaud();
  esp.joinAccessPoint("ti_iot","ti_iot42!");
  esp.setMultipleConnections(1);
}

void loop()
{
  String temperature(shield.getTemperature());

  // Build GET request
  HttpRequest req(F("/update"));
  req.addParameter(F("api_key"), api_key);
  req.addParameter(F("field1"), temperature);

  // Build GET request string
  char getRequest[100];
  req.get(getRequest);

  // Send get request string
  esp.connect(1, F("api.thingspeak.com"), 80);
  esp.send(1, getRequest, strlen(getRequest));

  // Thingspeak requires 15 s delay between requests
  delay (16000);
}

error: pathspec 'libraries/ParkingShield/examples/03.ThingSpeak/UpdateChannel/UpdateChannel.ino' did not match any file(s) known to git


Started using front sensors

Started using front sensors

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/Scalpel78/Ghost.git/'


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/DaveCalaway/ESP8266.git/'


_01_kidSerie_sketch_01.ConfigBT.ino #Kidserie

_01_kidSerie_sketch_01.ConfigBT.ino #Kidserie

/*
  Project name:
     01 #kidSerie - Arduino & MIT App Instaler 2 & HC-06
     (Smart Phone App!)
     Flavour I -
     Hex File: _01_kidSerie_sketch_01.ConfigBT.ino
   Revision History:
     20161008:
       - board found on Arduino e Cia Examples
      (connect everything on HC-06 to access smart phone)

   Description:
        A Simple bluetooth config ardu_sketch to HC-06 setup!!!
        Please goto lib manager and download SoftwareSerial!!!

   MCU:                  Arduino 1.6.12 - @16MHz       http://www.arduino.cc/
   IC Chip:              Bluetooth Datasheet - HC-06   https://goo.gl/s9ZcNC

   Connections:
      See Official youtube channel vids: https://youtu.be/u1xqW6qtFXs

   Based on:   Módulo Bluetooth JY-MCU - HC-06 - Configuração (Arduino e Cia)
   https://goo.gl/W13Qnn
   Code by Arduino e Cia

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License v3 as published by
   the Free Software Foundation
*/
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11);        // RX, TX
String command = "";                    // Stores response of bluetooth device
                                        // which simply allows \n between each
                                        // response.

void setup()
{
                                        // Open serial communications and wait for port to open:
  Serial.begin(9600);                   // Default baudrate firmware
  //Serial.begin(115200);               // I changed to this baudrate...
  Serial.println("Type AT commands!");
                                        // SoftwareSerial "com port" data rate. JY-MCU v1.03 defaults to 9600.
  mySerial.begin(9600);
  //mySerial.begin(115200);             // ...and do not forget to match baudrate
}

void loop()
{
                                        // Read device output if available.
  if (mySerial.available())
  {
     while(mySerial.available())
     {                                  // While there is more to be read, keep reading.
       command += (char)mySerial.read();
     }
   Serial.println(command);
   command = "";                        // No repeats
  }

                                        // Read user input if available.
  if (Serial.available())
  {
    delay(10);                          // The DELAY!
    mySerial.write(Serial.read());
  }

}                                       // END loop()

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


Adding TrebleBoost_wApp

Adding TrebleBoost_wApp

/*
*   TrebleBoost_wApp
*
*   Created: Chip Audette, OpenAudio, August 2021
*   Purpose: Process audio by applying a high-pass filter followed by gain.  Include App interaction.
*
*   MIT License.  use at your own risk.
*/

//here are the libraries that we need
#include <Tympan_Library.h>  //include the Tympan Library

//set the sample rate and block size
const float sample_rate_Hz = 44100.0f ; //24000 or 44100 (or 44117, or other frequencies in the table in AudioOutputI2S_F32)
const int audio_block_samples = 32;     //do not make bigger than AUDIO_BLOCK_SAMPLES from AudioStream.h (which is 128)
AudioSettings_F32 audio_settings(sample_rate_Hz, audio_block_samples);

//create audio library objects for handling the audio
Tympan                    myTympan(TympanRev::E);     //do TympanRev::D or TympanRev::E
AudioInputI2S_F32         i2s_in(audio_settings);     //Digital audio in *from* the Teensy Audio Board ADC.
AudioFilterBiquad_F32     hp_filt1(audio_settings);   //IIR filter doing a highpass filter.  Left.
AudioFilterBiquad_F32     hp_filt2(audio_settings);   //IIR filter doing a highpass filter.  Right.
AudioEffectGain_F32       gain1;                      //Applies digital gain to audio data.  Left.
AudioEffectGain_F32       gain2;                      //Applies digital gain to audio data.  Right.
AudioOutputI2S_F32        i2s_out(audio_settings);    //Digital audio out *to* the Teensy Audio Board DAC.

//Make all of the audio connections
AudioConnection_F32       patchCord1(i2s_in, 0, hp_filt1, 0);   //connect the Left input
AudioConnection_F32       patchCord2(i2s_in, 1, hp_filt2, 0);   //connect the Right input
AudioConnection_F32       patchCord3(hp_filt1, 0, gain1, 0);    //Left
AudioConnection_F32       patchCord4(hp_filt2, 0, gain2, 0);    //right
AudioConnection_F32       patchCord5(gain1, 0, i2s_out, 0);     //connect the Left gain to the Left output
AudioConnection_F32       patchCord6(gain2, 0, i2s_out, 1);     //connect the Right gain to the Right output

//define class for handling the GUI on the app
TympanRemoteFormatter myGUI;  //Creates the GUI-writing class for interacting with TympanRemote App

//Create BLE
BLE ble = BLE(&Serial1);

// define the setup() function, the function that is called once when the device is booting
const float input_gain_dB = 10.0f;    //gain on the microphone
float digital_gain_dB = 0.0;      //this will be set by the app
float cutoff_Hz = 1000.f;             //frequencies below this will be attenuated
const float min_allowed_Hz = 100.0f;  //minimum allowed cutoff frequency (Hz)
const float max_allowed_Hz = 0.9 * (sample_rate_Hz/2.0);  //maximum allowed cutoff frequency (Hz);
bool printCPUtoGUI = false;
void setup() {
  //begin the serial comms (for debugging)
  myTympan.beginBothSerial(); delay(1000);
  Serial.println("TrebleBoost_wApp: Starting setup()...");

  //allocate the dynamic memory for audio processing blocks
  AudioMemory_F32(10,audio_settings);

  //Enable the Tympan to start the audio flowing!
  myTympan.enable(); // activate AIC

  //Choose the desired input
  myTympan.inputSelect(TYMPAN_INPUT_ON_BOARD_MIC);     // use the on board microphones
  //myTympan.inputSelect(TYMPAN_INPUT_JACK_AS_MIC);    // use the microphone jack - defaults to mic bias 2.5V
  //myTympan.inputSelect(TYMPAN_INPUT_JACK_AS_LINEIN); // use the microphone jack - defaults to mic bias OFF

  //Set the desired volume levels
  myTympan.volume_dB(0);                   // headphone amplifier.  -63.6 to +24 dB in 0.5dB steps.
  myTympan.setInputGain_dB(input_gain_dB); // set input volume, 0-47.5dB in 0.5dB setps

  //setup BLE
  while (Serial1.available()) Serial1.read(); //clear the incoming Serial1 (BT) buffer
  ble.setupBLE(myTympan.getBTFirmwareRev());  //this uses the default firmware assumption. You can override!

  //Set the cutoff frequency for the highpassfilter
  cutoff_Hz = 1000.f;
  setHighpassFilters_Hz(cutoff_Hz);   //function defined near the bottom of this file
  printHighpassCutoff();

  Serial.println("Setup complete.");
} //end setup()

// define the loop() function, the function that is repeated over and over for the life of the device
void loop() {

  //look for in-coming serial messages (via USB or via Bluetooth)
  if (Serial.available()) respondToByte((char)Serial.read());   //USB Serial

  //respond to BLE
  if (ble.available() > 0) {
    String msgFromBle; int msgLen = ble.recvBLE(&msgFromBle);
    for (int i=0; i < msgLen; i++) respondToByte(msgFromBle[i]);
  }

  //service the BLE advertising state
  ble.updateAdvertising(millis(),5000); //check every 5000 msec to ensure it is advertising (if not connected)

  //periodically print the CPU and Memory Usage
  if (printCPUtoGUI) {
    myTympan.printCPUandMemory(millis(),3000); //print every 3000 msec
    serviceUpdateCPUtoGUI(millis(),3000);      //print every 3000 msec
  }

} //end loop();

// ///////////////// Servicing routines

//respond to the received characters (from the SerialMonitor or from the App)
void respondToByte(char c) {
  Serial.print("Received character "); Serial.println(c);

  switch (c) {
    case 'J': case 'j':
      printTympanRemoteLayout();
      break;
    case 'k':
      changeGain(3.0);
      printGainLevels();
      setButtonText("gainIndicator", String(digital_gain_dB,1));  //send the current value to the App.  show 1 decimal place
      break;
    case 'K':
      changeGain(-3.0);
      printGainLevels();
      setButtonText("gainIndicator", String(digital_gain_dB,1)); //send the current value to the App.  show 1 decimal place
      break;
    case 't':
      incrementHighpassFilters(powf(2.0,1.0/3.0)); //raise by 1/3rd octave
      printHighpassCutoff();
      setButtonText("cutoffHz", String(cutoff_Hz,0));   //send the current value to the App.  show 0 decimal places
      break;
    case 'T':
      incrementHighpassFilters(1.0/powf(2.0,1.0/3.0));  //lower by 1/3rd octave
      printHighpassCutoff();
      setButtonText("cutoffHz", String(cutoff_Hz,0));  //send the current value to the App.  show 0 decimal places
      break;
    case 'c':
      Serial.println("Starting CPU reporting...");
      printCPUtoGUI = true;
      setButtonState("cpuStart",printCPUtoGUI);   //show the start button as "on"
      break;
    case 'C':
      Serial.println("Stopping CPU reporting...");
      printCPUtoGUI = false;
      setButtonState("cpuStart",printCPUtoGUI);  //show the start button as "off"
      break;
  }
}

//Test to see if enough time has passed to send up updated CPU value to the App
void serviceUpdateCPUtoGUI(unsigned long curTime_millis, unsigned long updatePeriod_millis) {
  static unsigned long lastUpdate_millis = 0;

  //has enough time passed to update everything?
  if (curTime_millis < lastUpdate_millis) lastUpdate_millis = 0; //handle wrap-around of the clock
  if ((curTime_millis - lastUpdate_millis) > updatePeriod_millis) { //is it time to update the user interface?
    //send the latest value to the GUI!
    setButtonText("cpuValue",String(audio_settings.processorUsage(),1)); //one decimal places

    lastUpdate_millis = curTime_millis;
  } // end if
} //end serviceUpdateCPUtoGUI();

// ///////////////// functions used to define the GUI on the phone

// Print the layout for the Tympan Remote app, in a JSON-ish string
// (single quotes are used here, whereas JSON spec requires double quotes.  The app converts ' to " before parsing the JSON string).
// Please don't put commas or colons in your ID strings!
void printTympanRemoteLayout(void) {
  if (myGUI.get_nPages() < 1) createTympanRemoteLayout();  //create the GUI, if it hasn't already been created
  Serial.println(myGUI.asString());
  ble.sendMessage(myGUI.asString());

  //send the values to populate the GUI with the numerical values
  setButtonText("gainIndicator", String(digital_gain_dB,1));
  setButtonText("cutoffHz", String(cutoff_Hz,0));
  setButtonText("inpGain",String(input_gain_dB,1));
  setButtonState("cpuStart",printCPUtoGUI);  //illuminate the button if we will be sending the CPU value
}

//define the GUI for the App
void createTympanRemoteLayout(void) {

  // Create some temporary variables
  TR_Page *page_h;  //dummy handle for a page
  TR_Card *card_h;  //dummy handle for a card

  //Add first page to GUI  (the indentation doesn't matter; it is only to help us see it better)
  page_h = myGUI.addPage("Treble Boost Demo");

      //Add a card under the first page
      card_h = page_h->addCard("Highpass Gain (dB)");
          //Add a "-" digital gain button with the Label("-"); Command("K"); Internal ID ("minusButton"); and width (4)
          card_h->addButton("-","K","",           4);  //displayed string, command, button ID, button width (out of 12)

          //Add an indicator that's a button with no command:  Label (value of the digital gain); Command (""); Internal ID ("gain indicator"); width (4).
          card_h->addButton("","","gainIndicator",4);  //displayed string (blank for now), command (blank), button ID, button width (out of 12)

          //Add a "+" digital gain button with the Label("+"); Command("K"); Internal ID ("minusButton"); and width (4)
          card_h->addButton("+","k","",           4);   //displayed string, command, button ID, button width (out of 12)

      //Add another card to this page
      card_h = page_h->addCard("Highpass Cutoff (Hz)");
          card_h->addButton("-","T","",        4);  //displayed string, command, button ID, button width (out of 12)
          card_h->addButton("", "", "cutoffHz",4);  //displayed string (blank for now), command (blank), button ID, button width (out of 12)
          card_h->addButton("+","t","",        4);  //displayed string, command, button ID, button width (out of 12)

  //Add a second page to the GUI
  page_h = myGUI.addPage("Globals");

    //Add an example card that just displays a value...no interactive elements
    card_h = page_h->addCard(String("Analog Input Gain (dB)"));
      card_h->addButton("",      "", "inpGain",   12); //label, command, id, width (out of 12)...THIS ISFULL WIDTH!

    //Add an example card where one of the buttons will indicate "on" or "off"
    card_h = page_h->addCard(String("CPU Usage (%)"));
      card_h->addButton("Start", "c", "cpuStart", 4);  //label, command, id, width...we'll light this one up if we're showing CPU usage
      card_h->addButton(""     , "",  "cpuValue", 4);  //label, command, id, width...this one will display the actual CPU value
      card_h->addButton("Stop",  "C", "",         4);  //label, command, id, width...this one will turn off the CPU display

  //add some pre-defined pages to the GUI (pages that are built-into the App)
  myGUI.addPredefinedPage("serialMonitor");
  //myGUI.addPredefinedPage("serialPlotter");
}

// ///////////////// functions used to respond to the commands

//change the gain from the App
void changeGain(float change_in_gain_dB) {
  digital_gain_dB = digital_gain_dB + change_in_gain_dB;
  gain1.setGain_dB(digital_gain_dB);  //set the gain of the Left-channel gain processor
  gain2.setGain_dB(digital_gain_dB);  //set the gain of the Right-channel gain processor
}

//Print gain levels
void printGainLevels(void) {
  Serial.print("Analog Input Gain (dB) = ");
  Serial.println(input_gain_dB); //print text to Serial port for debugging
  Serial.print("Digital Gain (dB) = ");
  Serial.println(digital_gain_dB); //print text to Serial port for debugging
}

//change the highpass cutoff frequency
void incrementHighpassFilters(float scaleFactor) { setHighpassFilters_Hz(cutoff_Hz*scaleFactor); }
float setHighpassFilters_Hz(float freq_Hz) {
  cutoff_Hz = min(max(freq_Hz,min_allowed_Hz),max_allowed_Hz); //set the new value as the new state
  hp_filt1.setHighpass(0, cutoff_Hz); //biquad IIR filter.  left channel
  hp_filt2.setHighpass(0, cutoff_Hz); //biquad IIR filter.  right channel
  return cutoff_Hz;
}

void printHighpassCutoff(void) {
  Serial.println("Highpass filter cutoff at " + String(cutoff_Hz,0) + " Hz");
}

// ///////////////// functions used to communicate back to the App

void setButtonText(String btnId, String text) {
  String str = "TEXT=BTN:" + btnId + ":"+text;
  Serial.println(str);
  ble.sendMessage(str);
}

void setButtonState(String btnId, bool newState) {
  String str = String("STATE=BTN:") + btnId;
  if (newState) {
    str = str + String(":1");
  } else {
    str = str + String(":0");
  }
  ble.sendMessage(str);
}

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


taylor

taylor

/*
 Robotics with the BOE Shield – LeftServoClockwise
 Generate a servo full speed clockwise signal on digital pin 13.
 */

#include <Servo.h>                           // Include servo library

Servo servoLeft;                             // Declare left servo

void setup()                                 // Built in initialization block
{
  servoLeft.attach(6);                      // Attach left signal to pin 13
  servoLeft.writeMicroseconds(1300);         // 1.3 ms full speed clockwise
}

void loop()                                  // Main loop auto-repeats
{                                            // Empty, nothing needs repeating
}

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


Temperature sensor

Temperature sensor

// Global variables
int reading;
int tempPin = 2;
int ledPin_high = 2;
int ledPin_low = 4;

// Setting everything up
void setup()
{
// Baud rate
  Serial.begin(9600);
  Serial.println('Starting...');

// Setting digital led ports as outputs
  pinMode(ledPin_high, OUTPUT);
  pinMode(ledPin_low, OUTPUT);
}

void loop()
{
// Reading from the analog pin connected to the lm35dz
  reading = analogRead(tempPin);

// Conversion to temperature
  float tCelsius = ( reading / 1024.0 )*500;
  float tFarh = ( tCelsius*9 )/5 + 32;

// This will light led red if bigger than 24 degrees
// and green otherwise.
  if ( tCelsius <= 24. )
  {
    digitalWrite(ledPin_low, HIGH);
    digitalWrite(ledPin_high, LOW);
  }
  else
  {
    digitalWrite(ledPin_high, HIGH);
    digitalWrite(ledPin_low, LOW);
  }

// Sending the temperature measurement throught serial port
  Serial.print("Temperature = ");
  Serial.print(tCelsius);
  Serial.print(" (oC)");
  Serial.println();

  delay(500);
}

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


Adding Arduino sketch

Adding Arduino sketch

int led_4 = 4;
int led_5 = 5;
int led_6 = 6;
int led_7 = 7;
int led_8 = 8;

void setup() {
  Serial.begin(9600);
  pinMode(led_4, OUTPUT);
  pinMode(led_5, OUTPUT);
  pinMode(led_6, OUTPUT);
  pinMode(led_7, OUTPUT);
  pinMode(led_8, OUTPUT);
  Serial.println("Enter LED number: ");
}

void loop() {
  if (Serial.available() > 0) {

    int led = ((int) Serial.read()) - 48;

    switch(led) {
      case 0:
        turn_off();
        return;
      break;
      case 1:
        turn_on();
        return;
      break;
    }

    if (led < led_4 || led > led_8) {
      Serial.println("Error");
      return;
    }

    Serial.println("Led signal: " + String(led));

    switch_led(led);
  }

}

// Switches a LED depending on its current state.
void switch_led(int led) {
  if (digitalRead(led) == LOW) {
    Serial.println("Turning on LED " + String(led));
    digitalWrite(led, HIGH);
  } else {
    Serial.println("Turning off LED " + String(led));
    digitalWrite(led, LOW);
  }
}

// Turn off all LEDs
void turn_off() {
  for (int i = led_4; i <= led_8; i++) {
    digitalWrite(i, LOW);
  }
  Serial.println("Turning off all LEDs");
}

// Turn on all LEDs
void turn_on() {
  for (int i = led_4; i <= led_8; i++) {
    digitalWrite(i, HIGH);
  }
  Serial.println("Turning on all LEDs");
}

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


Create pool_monitor.ino

Create pool_monitor.ino

//Project: Monitor water level (HC-SR04P) of Balacing tank and the Temperature of Water (DS18b20) / Ambient (DHT22)
//         Send alert via Blynk app if water level is too high, or water temperature is higher than 28 C
//         Device hang at the side of the tank

/*
//https://community.blynk.cc/t/water-tank-level-indicator-with-low-level-warning-notifications/26271

//v1.0 - Wifi Manager + Blynk
//v1.1 - added deep sleep function - https://community.blynk.cc/t/esp-deep-sleep/5622/13
//v1.2 - added run time change of deep sleep interval via UI setup
//v1.3 -

//**** Blynk Virtual Pin Assignments****
// V0 - Water temperature alert
// V1 - Tank Height (cm)
// V2 - Sensor distance from Tank (cm)
// V3 - Temperature
// V4 - Battery voltage
// V6 - Numeric Widget - Sleep interval (mins)
// V9 - Level V widget - Water Level %
//V10 - Numeric Widget - Level exceed then will trigger Alert
//V11 - Button Widget -  To enable / disable Alert
//V12 - Distance - height from sensor to water level

Hardware:
1. Wemos D1 Pro
2. DS18B20 Temperature Sensor
3. Ultra Sonic Sensor
4. 4.7k resistor - put between D4 and VCC

Ultra sonic Sensor: Vcc - D7, Gnd - Gnd, Echo - D6, Trigger - D5
DS18820 - Vcc - D8, Gnd - Gnd, Data - D4

Todo
----
- if sonar sensor out of range --> don't save but Alert
- water temperature alert

*/

#include <OneWire.h>
#include <DallasTemperature.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "<replace with yr blynk token>";

char ssid[] = "wifi name";
char pass[] = "wifi pwd";

BlynkTimer timer;

//HC-SR04 ultra sonic sensor
#define trigPin D5  // Trigger Pin
#define echoPin D6  // Echo Pin
#define RadarPowerPin D7 //GPIO12 = D6, GPIO14 = D5, GPIO15 = D8

//DS18820 temperature sensor
#define sensorPin D4
#define TempPowerPin D8

#define filterSamples   15              // filterSamples should  be an odd number, no smaller than 3

int alertLevelCounter = 0; //Counter starts at zero
//int volume1; // for smoothing algorithum
double wLevel; // for smoothing algorithum
int levelAlert;
int wateralert = 0;
//int sensSmoothArray1 [filterSamples];   // array for holding raw sensor values for sensor1
int smoothDistance;                     // variables for sensor1 data

//double alertInMin = 0.5;                //Alert time following alert water level being reached (0.5 = 30secs)
//const int alertDuration = 2;            //Alert sent every 2 minutes

int checkFreq = 2;                //how often run the check / sleep for how long before wake up, in mins
int tankHeight = 100;             //tank's height
int heightFrTank = 20;            //sensor distance from tank
long duration, distance;          // Duration used to calculate distance

//init DS11820
OneWire oneWire(sensorPin);
DallasTemperature DS18B20(&oneWire);
float temp;
float volt;

BLYNK_CONNECTED() { // runs once at device startup, once connected to server.
  Blynk.syncVirtual(V1);
  Blynk.syncVirtual(V2);
  Blynk.syncVirtual(V6);
  Blynk.syncVirtual(V10);
  Blynk.syncVirtual(V11);
}

BLYNK_WRITE(V1) {
  tankHeight = param.asInt();
  Serial.print("\nTank's Height: ");
  Serial.println(tankHeight);
  Serial.println();
}

BLYNK_WRITE(V2) {
  heightFrTank = param.asInt();
  Serial.print("Height from Tank: ");
  Serial.println(heightFrTank);
  Serial.println();
}

BLYNK_WRITE(V6) {
  checkFreq = param.asInt();
  Serial.print("Sleep Interval: ");
  Serial.println(checkFreq);
  Serial.println();
}

BLYNK_WRITE(V10) {
  levelAlert = param.asInt();
  Serial.print("Water Level Alert: ");
  Serial.println(levelAlert);
  Serial.println();
}

BLYNK_WRITE(V11) {

  int alertOff = param.asInt();

  if(alertOff == 0) {
    resetWaterLevelAlert();
    wateralert = 1;
    Serial.print("Level Alert is OFF.");
    Serial.println();
  }
  else {
    resetWaterLevelAlert();
    wateralert = 0;
    Serial.print("Level Alert is ON.");
    Serial.println();
  }

}

void resetWaterLevelAlert() {
  alertLevelCounter = 0;
  wateralert = 0;
}

void checkWaterLevel() {
  Serial.print("Water Level (%) = ");
  Serial.println(wLevel);
  Serial.print("Level Alert (%) = ");
  Serial.println(levelAlert);
  Serial.print("Alert (1 = off, 0 = on) = ");
  Serial.println(wateralert);

  if(wLevel > levelAlert && wateralert == 0){
//    alertLevelCounter += 1;
    Blynk.notify("Water Tank Level Alert"); // send push notification to blynk app

  }

//  if(alertLevelCounter > alertInMin * 60 && wateralert == 0){
//    Blynk.notify("Water Tank Level Alert"); // send push notification to blynk app
//    wateralert = 1;
//    resetWaterLevelAlert();
//  }
}

void MeasureCmForSmoothing() {

  //take multiple reading

  digitalWrite(RadarPowerPin, HIGH);  //provide power
  delay(1000);

    smoothDistance = mesureDistance();

  digitalWrite(RadarPowerPin, LOW);  //turn off power
  delay(100);

  Serial.print("Smoothed Distance: ");
  Serial.println(smoothDistance);

  //tank height 100 cm, sensor is 20 cm above the tank
  wLevel = (tankHeight + heightFrTank - smoothDistance);

  Serial.print("Water Level (cm): ");
  Serial.println(wLevel);

  //convert to %
  wLevel = wLevel / tankHeight * 100;

  Serial.print("Water Level (%): ");
  Serial.println(wLevel);

  Blynk.virtualWrite(V12, smoothDistance); // virtual pin
  Blynk.virtualWrite(V9, wLevel); // virtual pin
  delay(1000);
}

void UploadMeasureCmForSmoothing() {

  Blynk.virtualWrite(V3, temp); // Water level %
  Blynk.virtualWrite(V4, volt); // battery
  Blynk.virtualWrite(V9, wLevel); // Water level %
  Blynk.virtualWrite(V12, smoothDistance); // virtual pin

}

void setup() {
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);

  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  //pin to provide power to ultra sonic sensor
  pinMode(RadarPowerPin, OUTPUT);

  //pin to provide power to temperature sensor
  pinMode(TempPowerPin, OUTPUT);

  Serial.println("Measure Water Temperature");
  measurementEvent();

  Serial.println("\nMeasure Water Level");
  MeasureCmForSmoothing();

  Serial.println("Upload Data");
  UploadMeasureCmForSmoothing();

  Serial.println("check WaterLevel Alert");
  checkWaterLevel();

  goToSleep();

}

void loop() {

}

int digitalSmooth(int rawIn, int *sensSmoothArray){     // "int *sensSmoothArray" passes an array to the function - the asterisk indicates the array name is a pointer
int j, k, temp, top, bottom;
long total;
static int i;
// static int raw[filterSamples];
static int sorted[filterSamples];
boolean done;

i = (i + 1) % filterSamples;    // increment counter and roll over if necc. -  % (modulo operator) rolls over variable
sensSmoothArray[i] = rawIn;                 // input new data into the oldest slot

// Serial.print("raw = ");

 for (j=0; j<filterSamples; j++){     // transfer data array into anther array for sorting and averaging
     sorted[j] = sensSmoothArray[j];
 }

   done = 0;                // flag to know when we're done sorting
 while(done != 1){        // simple swap sort, sorts numbers from lowest to highest
      done = 1;
        for(j = 0; j < (filterSamples - 1); j++){
           if(sorted[j] > sorted[j + 1]){     // numbers are out of order - swap
             temp = sorted[j + 1];
             sorted [j+1] =  sorted[j] ;
             sorted [j] = temp;
             done = 0;
           }
        }
  }

   // throw out top and bottom 15% of samples - limit to throw out at least one from top and bottom
   //  bottom = max(((filterSamples * 15)  / 100), 1);
   //  top = min((((filterSamples * 85) / 100) + 1  ), (filterSamples - 1));   // the + 1 is to make up for asymmetry caused by integer rounding
   bottom = max(((filterSamples * 20)  / 100), 1);
   top = min((((filterSamples * 80) / 100) + 1  ), (filterSamples - 1));   // the + 1 is to make up for asymmetry caused by integer rounding
   k = 0;
   total = 0;
  for( j = bottom; j< top; j++){
 total += sorted[j];  // total remaining indices
 k++;
 //Serial.print(sorted[j]);
 //Serial.print("   ");
 //terminal.print(sorted[j]);
 //terminal.println("   ");

  }
   //terminal.print("average: ");
   //terminal.println(total/k);
   //terminal.flush();
   //Serial.println();
   //Serial.print("average = ");
   //Serial.println(total/k);
  return total / k;    // divide by number of samples
}

int mesureSingleDistance() {
      long duration, distance;

      digitalWrite(trigPin, LOW);
      delayMicroseconds(2);
      digitalWrite(trigPin, HIGH);
      delayMicroseconds(10);
      digitalWrite(trigPin, LOW);
      duration = pulseIn(echoPin, HIGH);
      distance = (duration/2) / 29.1;

      Serial.print("Distance: ");
      Serial.println(distance);

      return distance;
  }

/**
 * mresure distnce average delay 10ms
 */
int mesureDistance() {
    const int ULTRASONIC_MIN_DISTANCE = heightFrTank;  //20
    const int ULTRASONIC_MAX_DISTANCE = tankHeight + heightFrTank;  //120

      int i, total_count = 0, total_distance = 0, distance, values[10], average, temp, new_count = 0;

      for(i=0; i<5; i++){
          distance = mesureSingleDistance();
          //check if out of range
          if(distance > ULTRASONIC_MIN_DISTANCE && distance < ULTRASONIC_MAX_DISTANCE) {
              total_distance += distance;
              values[total_count++]=distance;
              Serial.printf("Value %d...\n", distance);
          }
      }

      Serial.print("total_count = ");
      Serial.println(total_count);
      if(total_count > 0) {

          average = total_distance / total_count;
          total_distance = 0;
          Serial.printf("Average %d...\n", average);

          for(i=0; i<total_count; i++){
              temp = (average - values[i])*100/average;
              Serial.printf("Analyze %d....%d...\n", values[i],temp);
              if(temp < 10 && temp > -10){
                  total_distance += values[i];
                  new_count++;
              }
          }

          if(new_count > 0) {
//              Serial.print("total_distance = ");
//              Serial.println(total_distance);
//              Serial.print("new_count = ");
//              Serial.println(new_count);
              return total_distance / new_count;
          }
      }
      Serial.println("Sonar sensor out of range");
      return 0;  //return 0 meaning the sensor out of range
  }

void goToSleep() {
  // calculate required sleep time and go to sleep

  Serial.print(" Going to sleep now for ");
  Serial.print(checkFreq);
  Serial.println(" mins");

  ESP.deepSleep(checkFreq * 60 * 1000000); //deepSleep is microseconds 1 sec = 1000000
  delay(100);

} // end of void goToSleep()

void measurementEvent() {

  //******Measure Water Temperature*********************************************
  digitalWrite(TempPowerPin, HIGH);  //provide power
  delay(2000);

  DS18B20.begin();
  DS18B20.requestTemperatures();
  temp = DS18B20.getTempCByIndex(0); // Celcius
  Serial.print("Temperature (C) = ");
  Serial.println(temp);

  digitalWrite(TempPowerPin, LOW);  //turn off power
  delay(100);

  //******Battery Voltage Monitoring*********************************************
  //depend on 220k or 100k resistor used, toggle between this 2 calculation

  // using 220k
  // Voltage divider R1=100k, R2 = (220k + 100k) + 220k = 540k
  // Calculation to get the factor: 4.2v * 100/540 = 0.7777, 0.7777 * y = 4.2, y = 5.4
//  float calib_factor = 5.28; // change this value to calibrate the battery voltage, 5.28 is so call calibrated
//  float calib_factor = 5.4;

  // using 100k
  // Voltage divider R1 = 100k, R2 = (220k + 100k) + 100k = 420k;
  // Calculation to get the factor: 4.2v * 100/420 = 1, 1 * y = 4.2, y = 4.2
  float calib_factor = 4.2;

  unsigned long raw = analogRead(A0);
//  Serial.print("raw analog = ");
//  Serial.println(raw);
  float volt = raw * calib_factor/1024;

  Serial.print( "\nVoltage = ");
  Serial.print(volt, 2); // print with 2 decimal places
  Serial.println (" V");

 //*******************************************************************************
}

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


Update pt_remote controlled car2.ino

Update pt_remote controlled car2.ino

pt_remote controlled car/pt_remote controlled car2.ino

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


Create spark-plotly.ino

Create spark-plotly.ino

#include "spark-plotly.h"

#define DATA_POINTS 4

char* data_point_tokens[NUM_TOKENS] = {"token1", "token2", "token3","token4"};
plotly graph = plotly("username", "secret", streaming_tokens, "streamname", DATA_POINTS);

void setup() {
   graph.init();
   graph.fileopt = "extend";
   graph.openStream();
}

void loop() {

    float val1;
    float val2;
    float val3;
    float val4;

    // up to you to decide what these values represent and how they get initialized/updated.

    unsigned long x = millis();

    graph.plot(x, val1, data_point_tokens[0]);
    graph.plot(x, val2, data_point_tokens[1]);
    graph.plot(x, val3, data_point_tokens[2]);
    graph.plot(x, val4, data_point_tokens[3]);

}

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


initial commit

initial commit

double x = 0;
double y = 0;

void setup() {
  // put your setup code here, to run once:
  setPinMode(11,HIGH);
  setPinMode(12,HIGH);
}

void loop() {
  // put your main code here, to run repeatedly:

  x = analogRead(A12);
  y = analogRead(A13);

  Serial.print(x);
  Serial.print(" ");
  Serial.println(y);
}

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


Create IRsendRawDemo.ino

Create IRsendRawDemo.ino

New example should go into new fordel of same name...sorry

/*
 * IRremote: IRsendRawDemo - demonstrates sending IR codes with sendRaw
 * An IR LED must be connected to Arduino PWM pin 3.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * http://arcfn.com
 *
 * IRsendRawDemo - added by AnalysIR (via www.AnalysIR.com), 24 August 2015
 *
 * This example shows how to send a RAW signal using the IRremote library.
 * The example signal is actually a 32 bit NEC signal.
 * Remote Control button: LGTV Power On/Off.
 * Hex Value: 0x20DF10EF, 32 bits
 *
 * It is more efficient to use the sendNEC function to send NEC signals.
 * Use of sendRaw here, serves only as an example of using the function.
 *
 */

#include <IRremote.h>

IRsend irsend;

void setup()
{

}

void loop() {
  int khz = 38; // 38kHz carrier frequency for the NEC protocol
  unsigned int irSignal[] = {9000, 4500, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 39416, 9000, 2210, 560}; //AnalysIR Batch Export (IRremote) - RAW

  irsend.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), khz); //Note the approach used to automatically calculate the size of the array.

  delay(5000); //In this example, the signal will be repeated every 5 seconds, approximately.
}

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


add dplay firmware

add dplay firmware

char remainData;

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

void initPorts () {
  for (int pinNumber = 0; pinNumber < 14; pinNumber++) {
    pinMode(pinNumber, OUTPUT);
    digitalWrite(pinNumber, LOW);
  }
}

void loop() {
  while (Serial.available()) {
    if (Serial.available() > 0) {
      char c = Serial.read();
      updateDigitalPort(c);
    }
  }
  delay(15);
  sendPinValues();
  delay(10);
}

void sendPinValues() {
  int pinNumber = 0;
  for (pinNumber = 0; pinNumber < 14; pinNumber++) {
      sendDigitalValue(pinNumber);
  }
  for (pinNumber = 0; pinNumber < 6; pinNumber++) {
      sendAnalogValue(pinNumber);
  }

}

void updateDigitalPort (char c) {
  // first data
  if (c>>7) {
    // is output
    if ((c>>6) & 1) {
      // is data end at this chunk
      if ((c>>5) & 1) {
        int port = (c >> 1) & B1111;
        setPortWritable(port);
        if (c & 1)
          digitalWrite(port, HIGH);
        else
          digitalWrite(port, LOW);
      }
      else {
        remainData = c;
      }
    } else {
      int port = (c >> 1) & B1111;
      setPortReadable(port);
    }
  } else {
    int port = (remainData >> 1) & B1111;
    int value = ((remainData & 1) << 7) + (c & B1111111);
    setPortWritable(port);
    analogWrite(port, value);
    remainData = 0;
  }
}

void sendAnalogValue(int pinNumber) {
  int value = analogRead(pinNumber);
  Serial.write(B11000000
               | ((pinNumber & B111)<<3)
               | ((value>>7) & B111));
  Serial.write(value & B1111111);
}

void sendDigitalValue(int pinNumber) {
  if (digitalRead(pinNumber) == HIGH) {
    Serial.write(B10000000
                 | ((pinNumber & B1111)<<2)
                 | (B1));
  } else {
    Serial.write(B10000000
               | ((pinNumber & B1111)<<2));
  }
}

void setPortReadable (int port) {
  if (isPortWritable(port)) {
    pinMode(port, INPUT);
  }
}

void setPortWritable (int port) {
  if (!isPortWritable(port)) {
    pinMode(port, OUTPUT);
  }
}

boolean isPortWritable (int port) {
  if (port > 7)
    return bitRead(DDRB, port - 8);
  else
    return bitRead(DDRD, port);
}

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


Add proof of concept code

Add proof of concept code

#define     MOTOR_ENCODER_A             2
#define     MOTOR_ENCODER_B             3

#define     LED_PIN                     13

#define     LOOP_TIME_10ms              5
#define     LOOP_TIME_100ms             100
#define     LOOP_TIME_1s                1000

#define     ENCODER_INTEGRAL_FORCE      1

// endcoder needed variables
uint32_t encoderSpeed, setPoint = 1000, powerLevel, encoderLastSignalChange = 0, encoderLastTimeBetweenPeaks = 0, bufferForEncoder;

// main tasks time handling
uint32_t LastFire10ms, LastFire100ms, LastFire1s, currentMillis;

// integration filter for encoders
float sumOfEncoderSpeed = 0.0;

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

    pinMode(MOTOR_ENCODER_A , INPUT);
    pinMode(MOTOR_ENCODER_B , INPUT);

    pinMode(LED_PIN         , OUTPUT);

    attachInterrupt(0, handleEncoderPinChange, CHANGE);
    attachInterrupt(1, handleEncoderPinChange, CHANGE);
}

void loop()
{
    currentMillis = millis();
    // 10 ms loop
    if(currentMillis - LastFire10ms > LOOP_TIME_10ms)
    {
        // update motor speed
        bufferForEncoder = getMotorSpeed();

        if (bufferForEncoder < 1500 && bufferForEncoder != 0 && bufferForEncoder != 82) // only when data is not over motor specs
        {
            encoderSpeed = bufferForEncoder;
        }

        // integrate the encoder output to reach smoother values
        sumOfEncoderSpeed -= (sumOfEncoderSpeed - ((float)encoderSpeed)) * ENCODER_INTEGRAL_FORCE;

        // load the speed in the output variable
        encoderSpeed = sumOfEncoderSpeed;

        // run 10 ms tasks
        sendDataToPC();

        // update lat fire
        LastFire10ms = currentMillis;
    }
}

uint32_t getMotorSpeed()
{
    // response buffer
    uint32_t responseVariable;

    // in case the current delay is lower than the last, we need to return the last as the current is still in progress
    if( micros() - encoderLastSignalChange < encoderLastTimeBetweenPeaks)
    {
        // load the response in the buffer
        responseVariable = encoderLastTimeBetweenPeaks;
    }
    else
    {
        // load the current time delay as the speed response
        responseVariable = micros() - encoderLastSignalChange;
    }

    // convert the encoder value to speed in RPM
    responseVariable = 1000000 / (responseVariable * 12);

    // response to the caller
    return responseVariable;
}

void handleEncoderPinChange()
{
    // static flag for peak detection
    static uint8_t peakStarted = 0;

    // in case the peak eneded we need to update the last time between peaks
    if (1 == peakStarted)
    {
        // load the new peap to peak time in the variable
        encoderLastTimeBetweenPeaks = micros() - encoderLastSignalChange;

        // reset peak started flag
        peakStarted = 0;
    }
    else
    {
        // set peak started flag
        peakStarted = 1;
    }

    // update last signal detected
    encoderLastSignalChange = micros();
}

void sendDataToPC()
{
  // send start to tester
  Serial.write(0x03);

  // send 32 bit value
  Serial.write(encoderSpeed);
  Serial.write(encoderSpeed >> 8);
  Serial.write(encoderSpeed >> 16);
  Serial.write(encoderSpeed >> 24);

  // send 32 bit value
  Serial.write(setPoint);
  Serial.write(setPoint >> 8);
  Serial.write(setPoint >> 16);
  Serial.write(setPoint >> 24);

  // send 32 bit value
  Serial.write(powerLevel);
  Serial.write(powerLevel >> 8);
  Serial.write(powerLevel >> 16);
  Serial.write(powerLevel >> 24);

  // send end to tester
  Serial.write(0xFC);
}

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


Create spark-http-server.ino

Create spark-http-server.ino

TCPServer server = TCPServer(80);
TCPClient client;

char   addr[16];
char   myInput[30];
char   myIncoming;
int    myLoop1;
String myInStr;

void setup()
{

   pinMode(D7, OUTPUT);
   digitalWrite(D7, HIGH);
   delay(1000);
   digitalWrite(D7, LOW);
   delay(1000);
   digitalWrite(D7, HIGH);
   delay(1000);
   digitalWrite(D7, LOW);
   delay(1000);
   delay(1000);
   delay(1000);  // give a few seconds to reflash the core if it gets unresponsive on startup
   digitalWrite(D7, HIGH);
   delay(300);
   digitalWrite(D7, LOW);

  server.begin();
  IPAddress localIP = WiFi.localIP();
  sprintf(addr, "%u.%u.%u.%u", localIP[0], localIP[1], localIP[2], localIP[3]);
  Spark.variable("Address", addr, STRING);
  Spark.variable("myIn",  myInput, STRING);
  Spark.variable("myLoop1", &myLoop1, INT);
}

void loop() {
    // listen for incoming clients
    client = server.available();
    if (client) {

        myLoop1 = 0;
        myInput[0] = '\0';

        boolean currentLineIsBlank = true;
        while (client.connected()) {

            if (client.available()) {

                myIncoming = client.read();       // read from the http request
               // client.write(myIncoming);         // great with Telnet to see what is going to the server
               if (myLoop1 < 29 ){                 // http request should be much longer than 29 characters!
                   myInput[myLoop1] = myIncoming; // put the character into an array

                } else {                           // read enough information from the http request

                    myInput[myLoop1] = '\0';      // helps make a char array compatible with a string.

                    myInStr = myInput;
                    myInStr.toUpperCase();

                   if (myInStr.indexOf("D7-ON") >= 0){   digitalWrite(D7, HIGH); }
                   if (myInStr.indexOf("D7-OFF") >= 0){  digitalWrite(D7, LOW); }

                   }

                 myLoop1++;

                if (myIncoming == '\n' && currentLineIsBlank) {

                    //client.println("
Hello World.
");   // use for debugging to check if http request can get returned

                    delay(1);
                    break;
                }
                if (myIncoming == '\n') {          // you're starting a new line
                    currentLineIsBlank = true;
                }
                else if (myIncoming != '\r') {     // you've gotten a character on the current line
                    currentLineIsBlank = false;
                }

            }
        }
        // give the web browser time to receive the data
        delay(1);
    }
    client.flush();
    client.stop();
}

/*

MAKE THIS HTML PAGE TO COMMUNICATE WITH YOUR CORE

Address

Click the above link after replacing CORE-ID AND ACCESS-TOKEN.

After clicking the above from the result change the below code to the correct IP

D7-ON...
D7-OFF

The serial printout looks like

192.145.1.65
GET /?D7-ON HTTP/1.1
Host: 192.145.1.65
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,* / *;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2231.0 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8

*/

error: pathspec 'spark-http-server.ino' did not match any file(s) known to git


Submitting basic weather data

Submitting basic weather data

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


cleanup

cleanup

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/nathankoch/arduino-videosynth.git/'


Create com2CsTest.ino

Create com2CsTest.ino

/*

 * Serial Port Monitor
 *
 *
 */
//Setup Output

int ledPin_3 = 3;

//Setup message bytes

byte inputByte_0;

byte inputByte_1;

byte inputByte_2;

byte inputByte_3;

byte inputByte_4;

//Setup

void setup() {

  pinMode(ledPin_3, OUTPUT);
  Serial.begin(9600);
  digitalWrite(ledPin_3, HIGH);//
  delay(250);//
  digitalWrite(ledPin_3, LOW);//
  delay(250);//
}

//Main Loop

void loop() {

  //Read Buffer
  if (Serial.available() == 5)
  {
    //Read buffer
    inputByte_0 = Serial.read();
    delay(100);
    inputByte_1 = Serial.read();
    delay(100);
    inputByte_2 = Serial.read();
    delay(100);
    inputByte_3 = Serial.read();
    delay(100);
    inputByte_4 = Serial.read();
  }
  //Check for start of Message
  if(inputByte_0 == 16)
  {
       //Detect Command type
       switch (inputByte_1)
       {
          case 127:
             //Set PIN and value
             switch (inputByte_2)
            {
              case 4:
                if(inputByte_3 == 255)
                {
                  digitalWrite(ledPin_3, HIGH);
                  break;
                }
                else
                {
                  digitalWrite(ledPin_3, LOW);
                  break;
                }
              break;
            }
            break;
          case 128:
            //Say hello
            Serial.print("HELLO FROM ARDUINO");
            break;
        }
        //Clear Message bytes
        inputByte_0 = 0;
        inputByte_1 = 0;
        inputByte_2 = 0;
        inputByte_3 = 0;
        inputByte_4 = 0;
        //Let the PC know we are ready for more data
        Serial.print("-READY TO RECEIVE");
  }
}

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


draw triangles demo

draw triangles demo

#include <SoftwareSerial.h>
#include <Warefab_TFT.h>

SoftwareSerial ss_tft(2, 3); // RX, TX
Warefab_TFT tft(&ss_tft);

void setup() {
  //initialize uart speed, 115200
  tft.begin(115200);
  //clear screen
  tft.clearScreen();
  delay(1000);
  //set brush color, fill color
  tft.brushColor(255, 0, 0);
  //set pen color
  tft.penColor(0, 255, 0);
  delay(20);
}

void loop() {
  //draw triangles
  for (int y = 0; y < 30; y++)
  {
    for (int x = 0; x < 11; x++)
    {
      if (x % 2) tft.fillTriangle(20 + 20 * x, 10 + y * 10, 10 + x * 20,
                                    20 + y * 10, 30 + x * 20, 20 + y * 10);
      else tft.drawTriangle(20 + 20 * x, 10 + y * 10, 10 + x * 20,
                              20 + y * 10, 30 + x * 20, 20 + y * 10);
    }
    delay(20);
  }
  //delay for 5 sec before clear screen
  delay(5000);
}

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


Arduino official ethernet shield initial commit

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/Countly/countly-sdk-iot-cpp.git/'


First version of sensor firmware: debugging with LEDs and serial port, no networking

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/qiwi/parking.git/'


Create mainRead.ino

Create mainRead.ino

// CRAP Codes
#define USER_ID 0b0110
#define ENCRYPTED_MESSAGE 0b0100
#define SUCCESSFUL_ACKNOWLEDGEMENT 0b0111
#define FAILED_ACKNOWLEDGEMENT 0b1111
#define INVALID_USER_ID 0b0101

// variables for tracking protocol state
uint16_t crapUserId = 0;
uint16_t crapMessage = 0;
int incomingByteIndex = 0;
bool didLastMessageFail = false;
bool isWaiting = true;

// helper function for creating a byte for the protocol
uint8_t createByte(uint8_t protocolCode, uint8_t data) {
    uint8_t byte = (protocolCode << 4) | data;
    return byte;
}

// converts a user id and message into something that can be sent with a serial communication
/*uint8_t* convertMessage(uint16_t userId, uint16_t message) {
    uint8_t[8] convertedMessage = new uint8_t [8];
    // converting the userId into in the protocol
    for (int i = 0; i < 4; i++) {
        int userIdPositon = (3 - i) * 4;
        uint16_t userIdMask = 0b1111 << userIdPosition;
        uint8_t data = (userId & userIdMask) >> userIdPosition;
        convertedMessage[i] = createByte(USER_ID, data);
    }
    // converting the message into in the protocol
    for (int i = 0; i < 4; i++) {
        int messagePositon = (3 - i) * 4;
        uint16_t messageMask = 0b1111 << messagePosition;
        uint8_t data = (message & messageMask) >> messagePosition;
        convertedMessage[i+4] = createByte(ENCRYPTED_MESSAGE, data);
    }
    return convertedMessage;
}*/

// helper function for reading the code off an incoming byte
uint8_t getProtocolCode(uint8_t protocolByte) {
    return (protocolByte >> 4) & 0b1111;
}

// helper function for reading the data off an incoming byte
uint8_t getProtocolData(uint8_t protocolByte) {
    return protocolByte & 0b1111;
}

// processes incoming byte for the receiver of incoming messages
void processIncomingByte(uint8_t incomingByte) {
    uint8_t code = getProtocolCode(incomingByte);
    uint8_t data = getProtocolData(incomingByte);
    if (0 <= incomingByteIndex && incomingByteIndex <= 3 && code == USER_ID) {
        // successful incoming user id
        didLastMessageFail = false;
        isWaiting = true;
        int userIdPosition = (3 - incomingByteIndex) * 4;
        crapUserId = crapUserId | (data << userIdPosition);
        incomingByteIndex++;
    } else if (4 <= incomingByteIndex && incomingByteIndex <= 7 && code == ENCRYPTED_MESSAGE) {
        // successful incoming message
        didLastMessageFail = false;
        isWaiting = true;
        int messagePositon = (7 - incomingByteIndex) * 4;
        crapMessage = crapMessage | (data << messagePositon);
        incomingByteIndex++;
        if (incomingByteIndex == 8) {
            // message complete
            incomingByteIndex = 0;
            isWaiting = false;
        }
    } else {
        // invalid data, reset protocol and signal that the message failed
        crapUserId = 0;
        crapMessage = 0;
        incomingByteIndex = 0;
        didLastMessageFail = true;
    }
}

// functions for reading protocol state
bool isMessageComplete() {
    return !isWaiting;
}

bool hasMessageFailed() {
    return didLastMessageFail;
}

uint16_t getUserId() {
    return crapUserId;
}

uint16_t getMessage() {
    return crapMessage;
}

uint8_t nextByte = 0;

void updateStatusIndicators() {}

void setup() {
    // initialize
    Serial.begin(9600);
    pinMode(LED_BUILTIN, OUTPUT);
}

  void loop() {
    // waiting for incoming data
    if (Serial.available()) {
        // reading the next byte and sending it to the CRA Protocol
        nextByte = Serial.read();
        processIncomingByte(nextByte);
        Serial.print("code: ");
        Serial.print(getProtocolCode(nextByte), BIN);
        Serial.print(", data: ");
        Serial.print(getProtocolData(nextByte), BIN);
        Serial.println();

        // check to see if the message is complete
        if (isMessageComplete()) {
          uint16_t userId = getUserId();
          uint16_t message = getMessage();
          Serial.println(userId, BIN);
          Serial.println(message, BIN);
        }
    }
    if (hasMessageFailed()) {
      digitalWrite(LED_BUILTIN, HIGH);
    } else {
      digitalWrite(LED_BUILTIN, LOW);
    }
}

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


first commit of control procedure

first commit of control procedure

#include <EEPROM.h>
#include <Adafruit_BMP085_U.h>

Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);
bool sensorStatus=false;
uint16_t writePos=0x000;

const uint16_t FLAG_ADDR=0x000;
enum EEPROM_FLAGS {
  FLAG_BLANK=0x00,
  FLAG_DEFAULT=0xA0,
  FLAG_FIRST_WRITE=0xA1,
  FLAG_ADDITIONAL_WRITE=0xA2,
  FLAG_COMPLETED=0xFF
};

EEPROM_FLAGS eeprom_state=FLAG_DEFAULT;

const uint16_t PRESS_ADDR=0x001;
float baseLevelPressure=1023.25f;

enum ACTUATOR_STATE {
  STATE_DISENGAGED,
  STATE_ARMED,
  STATE_ENGAGED,
  STATE_EXPIRED
};

enum ACTUATOR_TYPE {
  TYPE_DROGUE,
  TYPE_MAIN_CHUTE
};

ACTUATOR_STATE states[2]={STATE_DISENGAGED};

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);

  // Initialize EEPROM
  // read EEPROM, check if there's something written by checking 0x000
  // then, set write location to rightmost nonzero position
  // EEPROM.write(FLAG_ADDR,FLAG_BLANK);
  byte flags = EEPROM.read(FLAG_ADDR);

  if(flags==FLAG_BLANK){// Buffer is in a blank state:
    // write first write flag to address 0x000
    EEPROM.write(FLAG_ADDR,FLAG_FIRST_WRITE);
    eeprom_state=FLAG_FIRST_WRITE;
    // set writepos to next address
    ++writePos;

  } else if(flags==FLAG_FIRST_WRITE) {// Buffer has been written to previously, but not terminated correctly
    EEPROM.write(FLAG_ADDR,FLAG_ADDITIONAL_WRITE);
    eeprom_state=FLAG_ADDITIONAL_WRITE;
    // start reading from the back and search for first byte !=0x00
    for(uint16_t i=0x398;i>PRESS_ADDR+sizeof(float);--i){
      if(EEPROM.read(i)!=0x00){//When found
        // set write position to next address
        writePos=i+1;
        // write code 0xF0 (240)
        EEPROM.write(writePos,0xF0);
        // move writepos to next address
        ++writePos;
        break;
      }
    }

  } else if(flags==FLAG_COMPLETED){// Buffer has been written to and terminated successfully
    Serial.println("EEPROM has been written to successfully and hasn't yest been unloaded. Aborting.");
    uint16_t longt=400;
    uint16_t shortt=100;
    while(true){
      digitalWrite(LED_BUILTIN, HIGH);
      delay(shortt);
      digitalWrite(LED_BUILTIN, LOW);
      delay(shortt);
      digitalWrite(LED_BUILTIN, HIGH);
      delay(shortt);
      digitalWrite(LED_BUILTIN, LOW);
      delay(longt);
    }
  }

  // Initialize atmospheric sensor and height

  Serial.println("Pressure Sensor Test");
  sensorStatus=bmp.begin();

  if(!sensorStatus){
    Serial.println("BMP180 Sensor not detected. Aborting.");
    uint16_t longt=400;
    uint16_t shortt=100;
    while(true){
      digitalWrite(LED_BUILTIN, HIGH);
      delay(longt);
      digitalWrite(LED_BUILTIN, LOW);
      delay(longt);
      digitalWrite(LED_BUILTIN, HIGH);
      delay(shortt);
      digitalWrite(LED_BUILTIN, LOW);
      delay(longt);
    }

  } else {
    if(eeprom_state==FLAG_FIRST_WRITE){
      sensors_event_t event;
      bmp.getEvent(&event);
      while(!event.pressure){
        bmp.getEvent(&event);
      }
      Serial.println("Pressure event detected.");

      baseLevelPressure=event.pressure;
      EEPROM.put(PRESS_ADDR,baseLevelPressure);
      Serial.print("Pressure:  ");
      Serial.println(baseLevelPressure);

    } else if(eeprom_state==FLAG_ADDITIONAL_WRITE) {
      Serial.println("Getting pressure value from eeprom");
      EEPROM.get(PRESS_ADDR,baseLevelPressure);
      Serial.print("Pressure:  ");
      Serial.println(baseLevelPressure);
    }

  }

  // Initialize actuators

}

void loop() {

  digitalWrite(LED_BUILTIN, HIGH);
  // put your main code here, to run repeatedly:

}

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


Added a real time clock to the CAN logger

Adapted the Teensy Examples to ad RTC. Also uses an elapsedMillis
construct to get milliseconds per second.

//Reading data from CAN and displaying it on a serial port
//Include the realtime clock functions inspired by the TimeTeensy3.ino example

//Include the CAN libraries for the Teensy microprocessor
#include <FlexCAN.h>
#include <TimeLib.h>

//Declare which pin is connected to the LED
//Use the Teensy Reference Card and the board schematics to determine the pin number
const int redLEDpin = 21;

//initiate the CAN library at 250kbps
FlexCAN CANbus(250000);

//Set up the CAN data structure
static CAN_message_t rxmsg;

//set up a counter for each received message
unsigned long int rxCount = 0;

//set up a timer to toggle the LEDs so the delay function isn't needed.
elapsedMillis LEDtoggleTimer;
elapsedMillis millisecondsPerSecond;

//Keep track of the LED state
boolean ledState = true;

//set up a variable to keep track of the timestamp
time_t previousTime = 0;

void setup() {
  // put your setup code here, to run once:

  // set the Time library to use Teensy 3.0's RTC to keep time
  setSyncProvider(getTeensy3Time);

  //declare the LED Pin to be the output
  pinMode(redLEDpin,OUTPUT);
  digitalWrite(redLEDpin,ledState); //Turn on the LED

  //start the CAN access
  CANbus.begin();
  rxmsg.timeout = 0;

  //try to wait for the Serial bus to come up for 1 second
  delay(1000);
  Serial.println(F("Teensy 3.2 CAN Receive Test."));

  //Set System Time
  if (timeStatus()!= timeSet) {
    Serial.println(F("Unable to sync with the RTC"));
  }
  else {
    Serial.println(F("RTC has set the system time"));
  }

  //print a header
  Serial.print(F("Count\tuSec\tYYYY-MM-DD HH:MM:SS.milli\tID\tDLC"));
  for (uint8_t i = 1; i<9;i++){ //label the byte columns according to J1939
    char byteDigits[4]; //declare a byte display array
    sprintf(byteDigits,"\tB%i",i);
    Serial.print(byteDigits);
  }

  //before entering the loop, set the previous time
  previousTime = now();
  //synchronize the millisecondPerSecond timer
  while (now() - previousTime < 1){
    millisecondsPerSecond = 0;
  }
}

void loop() {
  // put your main code here, to run repeatedly:

  //check to see if the number of seconds has changed to reset the millisecond timer for each second
  if (now() - previousTime == 1){
    previousTime = now();
    millisecondsPerSecond = 0;
  }

  // Uncomment this to synchronize the RTC to your PC time.
  /*  if (Serial.available()) {
      time_t t = processSyncMessage();
      if (t != 0) {
        Teensy3Clock.set(t); // set the RTC
        setTime(t);
      }
    }
  */

  while(CANbus.read(rxmsg)){
    rxCount++;

    uint32_t ID = rxmsg.id;
    uint8_t len = rxmsg.len;

    char timeCountIDandDLCdigits[50];
    sprintf(timeCountIDandDLCdigits,"%10i\t%10i\t%04i-%02i-%02iT%02i:%02i:%02i.%03i\t%08X\t%1i",rxCount,micros(),year(),month(),day(),hour(),minute(),second(),int(millisecondsPerSecond),ID,len);
    Serial.print(timeCountIDandDLCdigits);

    for (uint8_t i = 0; i<len;i++){
      char byteDigits[4];
      sprintf(byteDigits,"\t%02X",rxmsg.buf[i]);
      Serial.print(byteDigits);
    }
    Serial.println();
  }

  if (LEDtoggleTimer >=100){
    LEDtoggleTimer = 0; //reset the timer
    ledState = !ledState; // Toggle values
    digitalWrite(redLEDpin,ledState);
  }

}

time_t getTeensy3Time(){
  return Teensy3Clock.get();
}

/*  code to process time sync messages from the serial port   */
unsigned long processSyncMessage() {
  unsigned long pctime = 0L;
  const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013

  if(Serial.find("T")) {
     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;
}

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


Support for cosmos

Support for cosmos

int leds[][2] = {
                {A0, D0},
                {A1, D1},
                {A2, D2}
                };
int prevIndex = 0;

void lightRandom();

void setup() {
  for(int i = 0; i < 3; i ++)
  {
    pinMode(leds[i][0], OUTPUT);
    pinMode(leds[i][1], OUTPUT);
  }
}

void loop() {
  lightRandom();
  delay(5000);
}

void lightRandom() {
  digitalWrite(leds[prevIndex][0], LOW);
  digitalWrite(leds[prevIndex][1], LOW);
  prevIndex = random(3);
  digitalWrite(leds[prevIndex][0], HIGH);
  digitalWrite(leds[prevIndex][1], HIGH);
}

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


Initial code import, button box

Initial code import, button box

#define WHITE 5
#define RED 6
#define ID0 12
#define ID1 13
#define BUTTON_WHITE 0
#define BUTTON_RED 1

uint8_t white = 0, red = 0, white_state = 0, red_state = 0;
uint8_t id = 0;

void setup () {
	Serial.begin(9600);
	pinMode(WHITE, INPUT);
	pinMode(RED, INPUT);
	pinMode(ID0, INPUT);
	pinMode(ID1, INPUT);
	id += digitalRead(ID0);
	id += digitalRead(ID1);
	Serial.println("[Button Box]");
	Serial.print("[ID: ");
	Serial.print(id);
	Serial.println("]");
}

void loop () {
	white = digitalRead(WHITE);
	red = digitalRead(RED);
	if(white == LOW && white_state == 0) {
		white_state = 1;
		txButton(BUTTON_WHITE);
		delay(200);
	}
	else if(white == HIGH && white_state == 1) {
		white_state = 0;
	}
	if(red == LOW && red_state == 0) {
		red_state = 1;
		txButton(BUTTON_RED);
		delay(200);
	}
	else if(red == HIGH && red_state == 1) {
		red_state = 0;
	}
	delay(50);
}

void txButton(uint8_t button) {
	Serial.print("#"); Serial.print(id); Serial.print(":");
	Serial.print(button);
	Serial.println(";");
}

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


updated heater pins for heat control

updated heater pins for heat control

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