initial commit

initial commit

#include <Audio.h>
#include <SD.h>
#include <SPI.h>
#include <SerialFlash.h>
#include <Wire.h>
#include <synth_simple_drum.h>

//A simple chord player for teensy + audio which allows
// selection of the most common chords in pop
// (e.g. I, ii, IV, V, vi) with some decorations.

// GUItool: begin automatically generated code
AudioSynthSimpleDrum     drum2;          //xy=58,80
AudioSynthSimpleDrum     drum4;          //xy=62,161
AudioSynthSimpleDrum     drum3;          //xy=78,124
AudioSynthSimpleDrum     drum1;          //xy=90,33
AudioSynthKarplusStrong  string4;        //xy=142,440
AudioSynthKarplusStrong  string2;        //xy=144,367
AudioSynthKarplusStrong  string3;        //xy=144,404
AudioSynthKarplusStrong  string1;        //xy=150,330
AudioSynthKarplusStrong  string5;        //xy=208,523
AudioSynthKarplusStrong  string6;        //xy=209,561
AudioMixer4              mixerDrums;         //xy=392,141
AudioMixer4              mixerStrings1;         //xy=409,237
AudioMixer4              mixerStrings2;         //xy=426,331
AudioMixer4              mixerFinal;         //xy=592,142
AudioOutputI2S           i2s1;           //xy=716,59
AudioConnection          patchCord1(drum2, 0, mixerDrums, 1);
AudioConnection          patchCord2(drum4, 0, mixerDrums, 3);
AudioConnection          patchCord3(drum3, 0, mixerDrums, 2);
AudioConnection          patchCord4(drum1, 0, mixerDrums, 0);
AudioConnection          patchCord5(string4, 0, mixerStrings1, 1);
AudioConnection          patchCord6(string2, 0, mixerStrings1, 2);
AudioConnection          patchCord7(string3, 0, mixerStrings1, 3);
AudioConnection          patchCord8(string1, 0, mixerStrings1, 0);
AudioConnection          patchCord9(string5, 0, mixerStrings2, 0);
AudioConnection          patchCord10(string6, 0, mixerStrings2, 1);
AudioConnection          patchCord11(mixerDrums, 0, mixerFinal, 0);
AudioConnection          patchCord12(mixerStrings1, 0, mixerFinal, 1);
AudioConnection          patchCord13(mixerStrings2, 0, mixerFinal, 2);
AudioConnection          patchCord14(mixerFinal, 0, i2s1, 0);
AudioConnection          patchCord15(mixerFinal, 0, i2s1, 1);
AudioControlSGTL5000     sgtl5000_1;     //xy=637,447
// GUItool: end automatically generated code

AudioSynthKarplusStrong *strings [] = { &string1, &string2, &string3, &string4, &string5, &string6 };

int major7[6] = {48, 59, 64, 67, 71, 76};
int minor7[6] = {48, 58, 63, 67, 70, 72};
int dominant7[6] = {48, 58, 64, 67, 70, 76};
int major[6] = {48, 55, 60, 64, 67, 76};
int major6[6] = {48, 55, 60, 64, 67, 69};
int sus4[6] = {48, 55, 60, 65, 67, 76};
int sus2[6] = {48, 55, 62, 64, 67, 76};
int dominant[6] = {48, 55, 60, 64, 67, 76};
int diminished[6] = {48, 54, 60, 63, 66, 72};
int minor[6] = {48, 55, 60, 63, 67, 75};

//int chords[7] = { &major7, &minor7, &minor7, &major7, &dominant7, &minor7, &minor7 };
int offsets[7] = {0, 2, 4, 5, 7, 9, 11};

bool buttonStates[4] = {false, false, false, false};

const float tune_frequencies2_PGM[128] =
{
  8.1758,    8.6620,    9.1770,    9.7227,    10.3009,    10.9134,    11.5623,    12.2499,
  12.9783,   13.7500,   14.5676,   15.4339,   16.3516,    17.3239,    18.3540,    19.4454,
  20.6017,   21.8268,   23.1247,   24.4997,   25.9565,    27.5000,    29.1352,    30.8677,
  32.7032,   34.6478,   36.7081,   38.8909,   41.2034,    43.6535,    46.2493,    48.9994,
  51.9131,   55.0000,   58.2705,   61.7354,   65.4064,    69.2957,    73.4162,    77.7817,
  82.4069,   87.3071,   92.4986,   97.9989,   103.8262,   110.0000,   116.5409,   123.4708,
  130.8128,  138.5913,  146.8324,  155.5635,  164.8138,   174.6141,   184.9972,   195.9977,
  207.6523,  220.0000,  233.0819,  246.9417,  261.6256,   277.1826,   293.6648,   311.1270,
  329.6276,  349.2282,  369.9944,  391.9954,  415.3047,   440.0000,   466.1638,   493.8833,
  523.2511,  554.3653,  587.3295,  622.2540,  659.2551,   698.4565,   739.9888,   783.9909,
  830.6094,  880.0000,  932.3275,  987.7666,  1046.5023,  1108.7305,  1174.6591,  1244.5079,
  1318.5102, 1396.9129, 1479.9777, 1567.9817, 1661.2188,  1760.0000,  1864.6550,  1975.5332,
  2093.0045, 2217.4610, 2349.3181, 2489.0159, 2637.0205,  2793.8259,  2959.9554,  3135.9635,
  3322.4376, 3520.0000, 3729.3101, 3951.0664, 4186.0090,  4434.9221,  4698.6363,  4978.0317,
  5274.0409, 5587.6517, 5919.9108, 6271.9270, 6644.8752,  7040.0000,  7458.6202,  7902.1328,
  8372.0181, 8869.8442, 9397.2726, 9956.0635, 10548.0818, 11175.3034, 11839.8215, 12543.8540
};

static uint32_t next;

void strumOff() {
  for (int i = 0; i < 6; i++) {
    strings[i] -> noteOff(random(0,100) / 100.0);
  }
}

void strum() {
  int* chord = major;
  int root = 0;
  int keyAnalog = analogRead(1);
  int keyOffset = 0;

  if (keyAnalog > 900) {
    keyOffset = 5;
  } else if (keyAnalog > 800) {
    keyOffset = 4;
  } else if (keyAnalog > 700) {
    keyOffset = 3;
  } else if (keyAnalog > 600) {
    keyOffset = 2;
  } else if (keyAnalog > 500) {
    keyOffset = 1;
  } else if (keyAnalog > 400) {
    keyOffset = 0;
  } else if (keyAnalog > 300) {
    keyOffset = -1;
  } else if (keyAnalog > 200) {
    keyOffset = -2;
  } else if (keyAnalog > 100) {
    keyOffset = -3;
  } else {
    keyOffset = -4;
  }

  if (buttonStates[0] && buttonStates[1]) {
    root = 0;
    chord = sus2;
  } else if (buttonStates[0] && buttonStates[2] && buttonStates[3]) {
    root = 0;
    chord = dominant7;
  } else if (buttonStates[0] && buttonStates[3]) {
    root = 0;
    chord = major7;
  } else if (buttonStates[0] && buttonStates[2]) {
    root = 0;
    chord = sus4;
  } else if (buttonStates[0]) {
    root = 0;
    chord = major;
  } else if (buttonStates[1] && buttonStates[2]) {
    chord = minor7;
    root = -10;
  } else if (buttonStates[1] && buttonStates[3]) {
    chord = minor;
    root = -7;
  } else if (buttonStates[1]) {
    chord = major;
    root = -7;
  } else if (buttonStates[2] && buttonStates[3]) {
    chord = diminished;
    root = -4;
  } else if (buttonStates[2]) {
    chord = dominant;
    root = -5;
  } else if (buttonStates[3]) {
    chord = minor;
    root = -3;
  } else {
    chord = NULL;
    root = 0;
  }

  int delayAnalog = analogRead(0);
  int delayAmt = map(delayAnalog, 0,1023, 0, 50);
  if (chord != NULL) {
    for (int i = 0; i < 6; i++) {
      strings[i] -> noteOn(tune_frequencies2_PGM[keyOffset + root + chord[i]], random(20, 40) / 100.0);
      delay(delayAmt);
    }
  }
}

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

  Serial.begin(115200);
  for(int i=3; i < 7; i++) {
    pinMode(i, INPUT_PULLUP);
  }

  // audio library init
  AudioMemory(20);

  next = millis() + 1000;

  AudioNoInterrupts();

  drum1.frequency(60);
  drum1.length(1500);
  drum1.secondMix(0.0);
  drum1.pitchMod(0.55);

  drum2.frequency(60);
  drum2.length(300);
  drum2.secondMix(0.0);
  drum2.pitchMod(1.0);

  drum3.frequency(60);
  drum3.length(1500);
  drum3.secondMix(0.0);
  drum3.pitchMod(0.60);

  drum4.frequency(600);
  drum4.length(150);
  drum4.secondMix(0.0);
  drum4.pitchMod(0.0);

  sgtl5000_1.enable();
  sgtl5000_1.volume(0.5);

  AudioInterrupts();

}
void showButtonStates() {
    Serial.print("buttons ");
    Serial.print(buttonStates[0]);
    Serial.print(buttonStates[1]);
    Serial.print(buttonStates[2]);
    Serial.println(buttonStates[3]);
}
void loop() {
  // put your main code here, to run repeatedly:

  static uint32_t num = 0;

  if (millis() == next)
  {
    for(int bn = 0; bn < 4; bn++){
      buttonStates[bn] = digitalRead(3+bn)==LOW;
    }
    //showButtonStates();
    int waitTime = map(analogRead(2), 0, 1023, 300, 700);
    next = millis() + waitTime;
    switch (num % 4)
    {
      case 0:
        //drum1.noteOn();
        //strumOff();
        break;
      case 1:
        //drum2.noteOn();
        strum();
        break;
      case 2:
        //drum1.noteOn();
        //strumOff();
        break;
      case 3:
        //drum2.frequency(random(54, 65));
        //drum2.noteOn();
        strum();
        break;
    }
    num++;

    Serial.print("Diagnostics (Audio CPU and Audio Mem max usages: ");
    Serial.print(AudioProcessorUsageMax());
    Serial.print(" ");
    Serial.println(AudioMemoryUsageMax());
    AudioProcessorUsageMaxReset();
  }

}

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


added old code for the three rail display

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


attiny1634 compile notice deleted

attiny1634 compile notice deleted

// MewPro
//
// The following small-factor micro processor boards are known to work with MewPro at least core functionalities and fit within the GoPro housing.
// Not all the sensors, however, are supported by each of them.
//
//   Arduino Pro Mini 328 3.3V 8MHz
//          w/ Arduino IDE 1.5.7+
//          if you have troubles in compiling unused or nonexistent libraries, simply comment out #include line as //#include (see Note* below)
//
//   Arduino Pro Micro - 3.3V 8MHz
//          w/ Arduino IDE 1.5.7+
//          if you have troubles in compiling unused or nonexistent libraries, simply comment out #include line as //#include (see Note* below)
//
//   Teensy 3.x / Teensy LC
//          [POWER SUPPLY: The VIN-VUSB pad connection on the bottom side of Teensy 3.x/LC needs to be cut.]
//          To compile the code with Teensy 3.x/LC:
//          1. use Arduino IDE 1.0.6+ and Teensyduino 1.20+
//          2. comment out all unused #include as //#include (see Note* below)
//
//   (Note*: There is an infamous Arduino IDE's preprocessor bug (or something) that causes to ignore #ifdef/#else/#endif directives and forces
//    to compile unnecessary libraries.)
//
//   Intel Edison
//          Since Intel Edison can not work as I2C slave, it requires an I2C proxy.
//
//   GR-KURUMI
//          [POWER SUPPLY: The dummy resistor soldered on JP1 of the MewPro board needs replacement w/ a general purpose diode of >100mA w/ dropoff voltage 1V
//           (eg. Bourns S0180); Anode should be located on the Herobus side and Cathode on the Arduino side.]
//          To compile the code with GR-KURUMI using Renesas web compiler http://www.renesas.com/products/promotion/gr/index.jsp#cloud :
//          1. open a new project with the template GR-KURUMI_Sketch_V1.04.zip.
//          2. create a folder named MewPro and upload all the files there.
//          3. at project's home directory, replace all the lines of gr_scketch.cpp by the following code (BEGIN / END lines should be excluded).
/* BEGIN copy
#include <RLduino78.h>
#include "MewPro/MewPro.ino"
#include "MewPro/a_Queue.ino"
#include "MewPro/b_TimeAlarms.ino"
#include "MewPro/c_I2C.ino"
#include "MewPro/d_BacpacCommands.ino"
#include "MewPro/e_Shutter.ino"
#include "MewPro/f_Switch.ino"
#include "MewPro/g_IRremote.ino"
#include "MewPro/h_LightSensor.ino"
#include "MewPro/i_PIRsensor.ino"
#include "MewPro/j_VideoMotionDetect.ino"
#include "MewPro/k_Genlock.ino"
END copy */
//

//   Copyright (c) 2014-2015 orangkucing
//
// MewPro firmware version string for maintenance
#define MEWPRO_FIRMWARE_VERSION "2015051800"

//
#include <Arduino.h>
#include <EEPROM.h>
#include "MewPro.h"

// enable console output
// set false if this is MewPro #0 of dual dongle configuration
boolean debug = true;

//////////////////////////////////////////////////////////
// Options:
//   Choose either "#define" to use or "#undef" not to use.
//   if #define then don't forget to remove // before //#include

//********************************************************
// a_TimeAlarms: MewPro driven timelapse
#undef  USE_TIME_ALARMS
// Time and TimeAlarms libraries are downloadable from
//   http://www.pjrc.com/teensy/td_libs_Time.html
//   and http://www.pjrc.com/teensy/td_libs_TimeAlarms.html
// In order to compile the code on Pro Mini 328, find the following and edit the first line of them
//   #if defined(__AVR__)
//   #include <avr/pgmspace.h>
//   #else
// to
//   #if defined(__AVR__) && !defined(__AVR_ATmega328P__)
//   #include <avr/pgmspace.h>
//   #else
// appeared in Documents/Arduino/libraries/Time/DateStrings.cpp
//#include <Time.h> // *** please comment out this line if USE_TIME_ALARMS is not defined ***
//#include <TimeAlarms.h> // *** please comment out this line if USE_TIME_ALARMS is not defined ***

//********************************************************
// c_I2C: I2C interface (THIS PART CAN'T BE OPTED OUT)
//
// Note: in order to use MewPro reliably, THE FOLLOWING MODIFICATIONS TO STANDARD ARDUINO LIBRARY SOURCE IS
// STRONGLY RECOMMENDED:
//
// Arduino Pro Mini / Arduino Pro Micro
//     1. hardware/arduino/avr/libraries/Wire/Wire.h
//            old: #define BUFFER_LENGTH 32                        -->   new: #define BUFFER_LENGTH 64
//     2. hardware/arduino/avr/libraries/Wire/utility/twi.h
//            old: #define TWI_BUFFER_LENGTH 32                    -->   new: #define TWI_BUFFER_LENGTH 64
// Arduino Due
//     hardware/arduino/sam/libraries/Wire/Wire.h
//            old: #define BUFFER_LENGTH 32                        -->   new: #define BUFFER_LENGTH 64
#include <Wire.h> // *** please comment out this line if __MK20DX256__ or __MK20DX128__ or __MKL26Z64__ or __AVR_ATtiny1634__ is defined ***
#if BUFFER_LENGTH < 64
#error Please modify Arduino Wire library source code to increase the I2C buffer size
#endif
//
// Teensy 3.0 or 3.1 or LC
//#include <i2c_t3.h> // *** please comment out this line if __MK20DX256__ and __MK20DX128__ and __MKL26Z64__ are not defined ***
//
// ATtiny1634 core https://github.com/SpenceKonde/arduino-tiny-841
//    WireS library is downloadable from https://github.com/orangkucing/WireS
//#include <WireS.h> // *** please comment out this line if __AVR_ATtiny1634__ is not defined ***

#undef  USE_I2C_PROXY // define if using I2C proxy and this CPU acts as I2C master

//********************************************************
// e_Shutters: A remote shutters without contact bounce or chatter
#undef  USE_SHUTTER

//********************************************************
// f_Switches: One or two mechanical switches
#undef  USE_SWITCHES

//********************************************************
// g_IRremote: IR remote controller
#undef  USE_IR_REMOTE
// IRremote2 is downloadable from https://github.com/enternoescape/Arduino-IRremote-Due
// (this works not only on Due but also on Pro Mini etc.)
//#include <IRremote2.h> // *** please comment out this line if USE_IR_REMOTE is not defined ***

//********************************************************
// h_LightSensor: Ambient light sensor
#undef  USE_LIGHT_SENSOR

//********************************************************
// i_PIRsensor: Passive InfraRed motion sensor
#undef  USE_PIR_SENSOR

//********************************************************
// j_VideoMotionDetect: Video Motion Detector
//   Video motion detect consumes almost all the dynamic memory. So if you want to use this then #undef all options above.
#undef  USE_VIDEOMOTION
// The part of code utilizes the following library except GR-KURUMI. Please download and install:
//   https://github.com/orangkucing/analogComp
//#include "analogComp.h" // *** please comment out this line if USE_VIDEOMOTION is not defined or GR-KURUMI ***

//********************************************************
// k_Genlock: Generator Lock
//   Note: MewPro #0 in dual dongle configuration should always boolean debug = false;
#undef  USE_GENLOCK

// end of Options
//////////////////////////////////////////////////////////

// if __AVR_ATmega32U4__ (Leonardo or Pro Micro) then use Serial1 (TTL) instead of Serial (USB) to communicate with genlock dongle
#if defined(USE_GENLOCK) && defined(__AVR_ATmega32U4__)
#define Serial Serial1
#endif

boolean lastHerobusState = LOW;  // Will be HIGH when camera attached.
int eepromId = 0;

void userSettings()
{
  // This function is called once after camera boot.
  // you can set put any camera commands here. For example:
  // queueIn("AI1");
  // queueIn("TI5");
}

void setup()
{
  // Remark. Arduino Pro Mini 328 3.3V 8MHz is too slow to catch up with the highest 115200 baud.
  //     cf. http://forum.arduino.cc/index.php?topic=54623.0
  // Set 57600 baud or slower.
  Serial.begin(57600);

  setupShutter();
  setupSwitch();
  setupIRremote();
  setupLightSensor();
  setupPIRSensor();
  setupGenlock();

  setupLED(); // onboard LED setup
  pinMode(BPRDY, OUTPUT); digitalWrite(BPRDY, LOW);    // Show camera MewPro attach.

  // don't forget to switch pin configurations to INPUT.
  pinMode(I2CINT, INPUT);  // Teensy: default disabled
  pinMode(HBUSRDY, INPUT); // default: analog input
  pinMode(PWRBTN, INPUT);  // default: analog input
}

void loop()
{
  // Attach or detach bacpac
  if (digitalRead(HBUSRDY) == HIGH) {
    if (lastHerobusState != HIGH) {
#if !defined(USE_I2C_PROXY)
      pinMode(I2CINT, OUTPUT); digitalWrite(I2CINT, HIGH);
#endif
      lastHerobusState = HIGH;
      if (eepromId == 0) {
        isMaster(); // determine master/slave and resetI2C()
      } else {
        resetI2C();
      }
    }
  } else {
    if (lastHerobusState != LOW) {
      pinMode(I2CINT, INPUT);
      lastHerobusState = LOW;
    }
  }
  checkTimeAlarms();
  checkBacpacCommands();
  checkCameraCommands();
  checkSwitch();
  checkIRremote();
  checkLightSensor();
  checkPIRSensor();
  checkVMD();
  checkGenlock();
}

// MewPro
//
// The following small-factor micro processor boards are known to work with MewPro at least core functionalities and fit within the GoPro housing.
// Not all the sensors, however, are supported by each of them.
//
//   Arduino Pro Mini 328 3.3V 8MHz
//          w/ Arduino IDE 1.5.7+
//          if you have troubles in compiling unused or nonexistent libraries, simply comment out #include line as //#include (see Note* below)
//
//   Arduino Pro Micro - 3.3V 8MHz
//          w/ Arduino IDE 1.5.7+
//          if you have troubles in compiling unused or nonexistent libraries, simply comment out #include line as //#include (see Note* below)
//
//   Teensy 3.x / Teensy LC
//          [POWER SUPPLY: The VIN-VUSB pad connection on the bottom side of Teensy 3.x/LC needs to be cut.]
//          To compile the code with Teensy 3.x/LC:
//          1. use Arduino IDE 1.0.6+ and Teensyduino 1.20+
//          2. comment out all unused #include as //#include (see Note* below)
//
//   (Note*: There is an infamous Arduino IDE's preprocessor bug (or something) that causes to ignore #ifdef/#else/#endif directives and forces
//    to compile unnecessary libraries.)
//
//   Intel Edison
//          Since Intel Edison can not work as I2C slave, it requires an I2C proxy.
//
//   GR-KURUMI
//          [POWER SUPPLY: The dummy resistor soldered on JP1 of the MewPro board needs replacement w/ a general purpose diode of >100mA w/ dropoff voltage 1V
//           (eg. Bourns S0180); Anode should be located on the Herobus side and Cathode on the Arduino side.]
//          To compile the code with GR-KURUMI using Renesas web compiler http://www.renesas.com/products/promotion/gr/index.jsp#cloud :
//          1. open a new project with the template GR-KURUMI_Sketch_V1.04.zip.
//          2. create a folder named MewPro and upload all the files there.
//          3. at project's home directory, replace all the lines of gr_scketch.cpp by the following code (BEGIN / END lines should be excluded).
/* BEGIN copy
#include <RLduino78.h>
#include "MewPro/MewPro.ino"
#include "MewPro/a_Queue.ino"
#include "MewPro/b_TimeAlarms.ino"
#include "MewPro/c_I2C.ino"
#include "MewPro/d_BacpacCommands.ino"
#include "MewPro/e_Shutter.ino"
#include "MewPro/f_Switch.ino"
#include "MewPro/g_IRremote.ino"
#include "MewPro/h_LightSensor.ino"
#include "MewPro/i_PIRsensor.ino"
#include "MewPro/j_VideoMotionDetect.ino"
#include "MewPro/k_Genlock.ino"
END copy */
//

//   Copyright (c) 2014-2015 orangkucing
//
// MewPro firmware version string for maintenance
#define MEWPRO_FIRMWARE_VERSION "2015051800"

//
#include <Arduino.h>
#include <EEPROM.h>
#include "MewPro.h"

// enable console output
// set false if this is MewPro #0 of dual dongle configuration
boolean debug = true;

//////////////////////////////////////////////////////////
// Options:
//   Choose either "#define" to use or "#undef" not to use.
//   if #define then don't forget to remove // before //#include

//********************************************************
// a_TimeAlarms: MewPro driven timelapse
#undef  USE_TIME_ALARMS
// Time and TimeAlarms libraries are downloadable from
//   http://www.pjrc.com/teensy/td_libs_Time.html
//   and http://www.pjrc.com/teensy/td_libs_TimeAlarms.html
// In order to compile the code on Pro Mini 328, find the following and edit the first line of them
//   #if defined(__AVR__)
//   #include <avr/pgmspace.h>
//   #else
// to
//   #if defined(__AVR__) && !defined(__AVR_ATmega328P__)
//   #include <avr/pgmspace.h>
//   #else
// appeared in Documents/Arduino/libraries/Time/DateStrings.cpp
//#include <Time.h> // *** please comment out this line if USE_TIME_ALARMS is not defined ***
//#include <TimeAlarms.h> // *** please comment out this line if USE_TIME_ALARMS is not defined ***

//********************************************************
// c_I2C: I2C interface (THIS PART CAN'T BE OPTED OUT)
//
// Note: in order to use MewPro reliably, THE FOLLOWING MODIFICATIONS TO STANDARD ARDUINO LIBRARY SOURCE IS
// STRONGLY RECOMMENDED:
//
// Arduino Pro Mini / Arduino Pro Micro
//     1. hardware/arduino/avr/libraries/Wire/Wire.h
//            old: #define BUFFER_LENGTH 32                        -->   new: #define BUFFER_LENGTH 64
//     2. hardware/arduino/avr/libraries/Wire/utility/twi.h
//            old: #define TWI_BUFFER_LENGTH 32                    -->   new: #define TWI_BUFFER_LENGTH 64
// Arduino Due
//     hardware/arduino/sam/libraries/Wire/Wire.h
//            old: #define BUFFER_LENGTH 32                        -->   new: #define BUFFER_LENGTH 64
#include <Wire.h> // *** please comment out this line if __MK20DX256__ or __MK20DX128__ or __MKL26Z64__ or __AVR_ATtiny1634__ is defined ***
#if BUFFER_LENGTH < 64
#error Please modify Arduino Wire library source code to increase the I2C buffer size
#endif
//
// Teensy 3.0 or 3.1 or LC
//#include <i2c_t3.h> // *** please comment out this line if __MK20DX256__ and __MK20DX128__ and __MKL26Z64__ are not defined ***
//
// ATtiny1634 core https://github.com/SpenceKonde/arduino-tiny-841
//    WireS library is downloadable from https://github.com/orangkucing/WireS
//    - In order to use F(" ") macro, hardware/arduino-tiny-841/avr/cores/tiny/{Print|WString}.{cpp|h} must
//      be replaced by hardware/arduino/avr/cores/arduino/{Print|WString}.{cpp|h}
//    - And hardware/arduino/avr/cores/arduino/Printable.h must be copied to
//      hardware/arduino-tiny-841/avr/cores/tiny/Printable.h
//    - Please also refer this commit: https://github.com/orangkucing/WireS/commit/e5d0a80ebd1f0797fc750a10208918a6392a488a
//#include <WireS.h> // *** please comment out this line if __AVR_ATtiny1634__ is not defined ***

#undef  USE_I2C_PROXY // define if using I2C proxy and this CPU acts as I2C master

//********************************************************
// e_Shutters: A remote shutters without contact bounce or chatter
#undef  USE_SHUTTER

//********************************************************
// f_Switches: One or two mechanical switches
#undef  USE_SWITCHES

//********************************************************
// g_IRremote: IR remote controller
#undef  USE_IR_REMOTE
// IRremote2 is downloadable from https://github.com/enternoescape/Arduino-IRremote-Due
// (this works not only on Due but also on Pro Mini etc.)
//#include <IRremote2.h> // *** please comment out this line if USE_IR_REMOTE is not defined ***

//********************************************************
// h_LightSensor: Ambient light sensor
#undef  USE_LIGHT_SENSOR

//********************************************************
// i_PIRsensor: Passive InfraRed motion sensor
#undef  USE_PIR_SENSOR

//********************************************************
// j_VideoMotionDetect: Video Motion Detector
//   Video motion detect consumes almost all the dynamic memory. So if you want to use this then #undef all options above.
#undef  USE_VIDEOMOTION
// The part of code utilizes the following library except GR-KURUMI. Please download and install:
//   https://github.com/orangkucing/analogComp
//#include "analogComp.h" // *** please comment out this line if USE_VIDEOMOTION is not defined or GR-KURUMI ***

//********************************************************
// k_Genlock: Generator Lock
//   Note: MewPro #0 in dual dongle configuration should always boolean debug = false;
#undef  USE_GENLOCK

// end of Options
//////////////////////////////////////////////////////////

// if __AVR_ATmega32U4__ (Leonardo or Pro Micro) then use Serial1 (TTL) instead of Serial (USB) to communicate with genlock dongle
#if defined(USE_GENLOCK) && defined(__AVR_ATmega32U4__)
#define Serial Serial1
#endif

boolean lastHerobusState = LOW;  // Will be HIGH when camera attached.
int eepromId = 0;

void userSettings()
{
  // This function is called once after camera boot.
  // you can set put any camera commands here. For example:
  // queueIn("AI1");
  // queueIn("TI5");
}

void setup()
{
  // Remark. Arduino Pro Mini 328 3.3V 8MHz is too slow to catch up with the highest 115200 baud.
  //     cf. http://forum.arduino.cc/index.php?topic=54623.0
  // Set 57600 baud or slower.
  Serial.begin(57600);

  setupShutter();
  setupSwitch();
  setupIRremote();
  setupLightSensor();
  setupPIRSensor();
  setupGenlock();

  setupLED(); // onboard LED setup
  pinMode(BPRDY, OUTPUT); digitalWrite(BPRDY, LOW);    // Show camera MewPro attach.

  // don't forget to switch pin configurations to INPUT.
  pinMode(I2CINT, INPUT);  // Teensy: default disabled
  pinMode(HBUSRDY, INPUT); // default: analog input
  pinMode(PWRBTN, INPUT);  // default: analog input
}

void loop()
{
  // Attach or detach bacpac
  if (digitalRead(HBUSRDY) == HIGH) {
    if (lastHerobusState != HIGH) {
#if !defined(USE_I2C_PROXY)
      pinMode(I2CINT, OUTPUT); digitalWrite(I2CINT, HIGH);
#endif
      lastHerobusState = HIGH;
      if (eepromId == 0) {
        isMaster(); // determine master/slave and resetI2C()
      } else {
        resetI2C();
      }
    }
  } else {
    if (lastHerobusState != LOW) {
      pinMode(I2CINT, INPUT);
      lastHerobusState = LOW;
    }
  }
  checkTimeAlarms();
  checkBacpacCommands();
  checkCameraCommands();
  checkSwitch();
  checkIRremote();
  checkLightSensor();
  checkPIRSensor();
  checkVMD();
  checkGenlock();
}


free ram belongs to the diagnostic info as well …

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/trinamic/T-Bone.git/'


Funny action : angle corrigé

Funny action : angle corrigé

error: pathspec 'Module' did not match any file(s) known to git
error: pathspec 'Funny' did not match any file(s) known to git
error: pathspec 'Action/Software/Funny_action/Funny_action.ino' did not match any file(s) known to git


Added another example which uses all helpers

/*
  Simple demo of using all the timing helpers elapsedMillis makes available.

  Either attach LEDs with series resistors to the indicated pins, or a
  six led / six bit 'Chartreuse' module plugged into pins 8 through GND.

  Wired up in order, the leds have a nice walking/counting effect.

  This example code is in the public domain.
*/

#include <elapsedMillis.h>

//declare these global if you don't want them reset every time loop runs
elapsedMicros LED1micro;
elapsedMicros LED2micro;
elapsedMillis LED3millis;
elapsedMillis LED4millis;
elapsedSeconds LED5seconds;
elapsedSeconds LED6seconds;

const int LED1 = 8;
const int LED2 = 9;
const int LED3 = 10;
const int LED4 = 11;
const int LED5 = 12;
const int LED6 = 13;

// delay between blinks of the LED
unsigned long LED1_Interval = 62500;
unsigned long LED2_Interval = 125000;
unsigned int LED3_Interval = 250;
unsigned int LED4_Interval = 500;
unsigned int LED5_Interval = 1;
unsigned int LED6_Interval = 2;

void setup()
{
  // initialize the LED pins as outputs
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
  pinMode(LED4, OUTPUT);
  pinMode(LED5, OUTPUT);
  pinMode(LED6, OUTPUT);
}

void loop()
{
  if (LED1micro >= LED1_Interval)
  {
    digitalWrite(LED1, !(digitalRead(LED1))); // toggle the LED state
    LED1micro = 0;                            // reset the counter to 0 so the counting starts over...
  }

  if (LED2micro >= LED2_Interval)
  {
    digitalWrite(LED2, !(digitalRead(LED2))); // toggle the LED state
    LED2micro = 0;                            // reset the counter to 0 so the counting starts over...
  }

  if (LED3millis >= LED3_Interval)
  {
    digitalWrite(LED3, !(digitalRead(LED3))); // toggle the LED state
    LED3millis = 0;                           // reset the counter to 0 so the counting starts over...
  }

  if (LED4millis >= LED4_Interval)
  {
    digitalWrite(LED4, !(digitalRead(LED4))); // toggle the LED state
    LED4millis = 0;                           // reset the counter to 0 so the counting starts over...
  }

  if (LED5seconds >= LED5_Interval)
  {
    digitalWrite(LED5, !(digitalRead(LED5))); // toggle the LED state
    LED5seconds = 0;                          // reset the counter to 0 so the counting starts over...
  }

  if (LED6seconds >= LED6_Interval)
  {
    digitalWrite(LED6, !(digitalRead(LED6))); // toggle the LED state
    LED6seconds = 0;                          // reset the counter to 0 so the counting starts over...
  }
}

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


Initial commit

Initial commit

#include <SPI.h>
#include <Wire.h>
#include <JeeLib.h>

#include <DHT.h>
#include <RTC_DS1307.h>

#include <LCD03.h>

#define LED_13_PIN 13

#define DHTPIN A0
#define DHTTYPE DHT22

#define LCD_CHAR_LENGTH 16

#define LCD_DEGREES_SYMBOL (char) 223

#define REFRESH_INTERVAL 5 //Minimum 5 seconds for DHT22 to refresh. Do not exceed 59

#define SLEEP_INTERVAL 250 //0.25s
#define SLEEP_LONG_INTERVAL 45000 //45s

#define OFF_HOUR 01
#define OFF_MIN 00

#define ON_HOUR 06
#define ON_MIN 30

#define TURN_OFF_AT_TIMES true  //Set to false if you don't want the screen and readings to stop at certain times.

#define THERM_ICON_REP 1
#define HUM_ICON_REP 2

//Icons from http://www.instructables.com/id/Clock-with-termometer-using-Arduino-i2c-16x2-lcd-D/
byte thermIcon[8] = //icon for thermometer
{
  B00100,
  B01010,
  B01010,
  B01110,
  B01110,
  B11111,
  B11111,
  B01110
};

byte humIcon[8] = //icon for humidity
{
  B00100,
  B00100,
  B01010,
  B01010,
  B10001,
  B10001,
  B10001,
  B01110,
};

DHT dht(DHTPIN, DHTTYPE);
RTC_DS1307 RTC;  //Code for this works although I use DS3231. For the initial time setting convenience.
ISR(WDT_vect) { Sleepy::watchdogEvent(); } // Setup for low power waiting
// Create new LCD03 instance
LCD03 lcd;

int prevIntervalReadingSecond = 0;
int prevUpdateTimeSecond = 0;
int prevUpdateTurnOnAndOffMinute = 0;

bool currentlyOn = true;

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

  //Disable LED Pin 13 (Optional). I just hate the constant LED light.
  pinMode(LED_13_PIN, OUTPUT);
  digitalWrite(LED_13_PIN, LOW);

  //Start RTC
  Wire.begin();
  RTC.begin();

  if (!RTC.isrunning()) {
    Serial.println("RTC is NOT running");
  }

  // This section grabs the current datetime and compares it to
  // the compilation time.  If necessary, the RTC is updated.
  DateTime now = RTC.now();
  DateTime compiled = DateTime(__DATE__, __TIME__);

  if (now.unixtime() < compiled.unixtime()) {
    Serial.println("RTC is older than compile time! Updating");
    RTC.adjust(DateTime(__DATE__, __TIME__));
  }

  //Start LCD
  lcd.begin(LCD_CHAR_LENGTH, 2);

  lcd.createChar(THERM_ICON_REP,thermIcon);
  lcd.createChar(HUM_ICON_REP,humIcon);

  //Turns off backlight
  lcd.noBacklight();

  printThisOnLCDLine("By: YKM", 1);

  //Start DTT
  dht.begin();

}

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

  int second = now.second();
  int minute = now.minute();
  int hour = now.hour();

  if(currentlyOn){

  //Update time only if second changes. Prevent needless requests to LCD
    if(second != prevUpdateTimeSecond){
      prevUpdateTimeSecond = second;
      String dateString = generateDateTimeString(now.year(), now.month(), now.day(), now.hour(), now.minute(), now.second());
      printThisOnLCDLine(dateString, 0);
    }

  //Every refresh interval
    if((second % REFRESH_INTERVAL) == 0 && second != prevIntervalReadingSecond){
      //Prevent multiple readings every interval
      prevIntervalReadingSecond = second;
      Serial.println();
      Serial.print("Take DHT22 Readings: ");

      float DHTTemp = dht.readTemperature();
      float DHTHum = dht.readHumidity();

      Serial.print(DHTHum);
      Serial.print("\t");
      Serial.println(DHTTemp);

      generateAndPrintTempHumString(DHTTemp, DHTHum);

  }
}

  //Prevent too many execution since only need to check once a minute
  if(TURN_OFF_AT_TIMES && prevUpdateTurnOnAndOffMinute != minute){
    prevUpdateTurnOnAndOffMinute= minute;

    Serial.println("Checking time");
    if(currentlyOn){

      if(hour == OFF_HOUR && minute == OFF_MIN){
        currentlyOn = false;
        lcd.clear();
        longSleep();
      }

   } else {

    if(hour == ON_HOUR && minute == ON_MIN){
      currentlyOn = true;
    } else {
      longSleep();
    }

   }
  }

 shortSleep();

}

void shortSleep(){
   Sleepy::loseSomeTime(SLEEP_INTERVAL);

}

void longSleep(){
  Sleepy::loseSomeTime(SLEEP_LONG_INTERVAL);
}

void generateAndPrintTempHumString(float temp, float hum){

  String tempString = ftoa(temp, 1);
  String humString = ftoa(hum, 1);

  String intermediate1 = " " + tempString + LCD_DEGREES_SYMBOL + "C ";
  String intermediate2 = " " + humString + "%";

  lcd.setCursor (0, 1);
  lcd.write((byte) THERM_ICON_REP);
  lcd.print(intermediate1);
  lcd.write((byte) HUM_ICON_REP);
  lcd.print(intermediate2);

}

String generateTempHumString(float temp, float hum){
  String tempString = ftoa(temp, 1);
  String humString = ftoa(hum, 1);
  String result = "P:" + tempString + LCD_DEGREES_SYMBOL + "C H:" + humString + "%";
  return result;

}

//Convert float/double to String as ardiuno sprintf does not support float/double
String ftoa(double f, int precision)
{
  long p[] = {0,10,100,1000,10000,100000,1000000,10000000,100000000};

  char temp[5];
  char * a = temp;
  long heiltal = (long)f;
  itoa(heiltal, a, 10);
  while (*a != '\0') a++;
  *a++ = '.';
  long desimal = abs((long)((f - heiltal) * p[precision]));
  itoa(desimal, a, 10);
  String result = temp;
  return result;
}

void printThisOnLCDLine(String text, int line){

  //Clear current line only if the new line cannot occupy the old line
  if(text.length() < LCD_CHAR_LENGTH){
    lcd.setCursor (0, line);
    lcd.print("                ");
  }

  lcd.setCursor (0, line);
  lcd.print(text);
}

String generateDateTimeString(int year, int month, int day, int hour, int minute, int second){
  char buff[3];

  sprintf(buff, "%02d", hour);
  String hourString = buff;

  sprintf(buff, "%02d", minute);
  String minuteString = buff;

  sprintf(buff, "%02d", second);
  String secondString = buff;

  String result = hourString + ":" + minuteString + ":" + secondString + " ";

  String dayOfWeek = getDayOfTheWeek(year, month, day);

  sprintf(buff, "%02d", day);
  String dayString = buff;

  String monthString = getMonth(month);

  if(0 <= second && second <= 40){
    result += " " + dayOfWeek + " " + dayString;
  } else {
    result += monthString + year;
  }
  return result;
}

// From http://stackoverflow.com/a/21235587
String getDayOfTheWeek(int y, int m, int d) {
  String weekdayname[] = {"Sun", "Mon", "Tue",
  "Wed", "Thu", "Fri", "Sat"};

  int weekday = (d+=m<3?y--:y-2,23*m/9+d+4+y/4-y/100+y/400)%7;

  return weekdayname[weekday];
}

String getMonth(int month){
  switch(month){
    case 1: return "Jan";
    case 2: return "Feb";
    case 3: return "Mar";

    case 4: return "Apr";
    case 5: return "May";
    case 6: return "Jun";

    case 7: return "Jul";
    case 8: return "Aug";
    case 9: return "Sep";

    case 10: return "Oct";
    case 11: return "Nov";
    case 12: return "Dec";
    default : return "Nil";
  }

}

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


beauty

beauty


you have to start somewhere …

you have to start somewhere …


Callback version - tested to work & stable.

/*
    This sketch shows the Ethernet event usage
    First light Aart 10-12-2017

*/

#define ETH_PHY_ADDR      1
#define ETH_PHY_MDC       23
#define ETH_PHY_MDIO      18
#define ETH_PHY_POWER     17
#define ETH_PHY_TYPE      ETH_PHY_LAN8720

#if 0
// Labeling as on the 'red' RFID MFRC522 boards and numbers
// as per labels on the back of PoE board v1.00.
//
// See also page 525 of https://pc7x.net/archive/misc/ESP32_Programming.pdf
//
#define MFRC522_SCK     (14)
#define MFRC522_MISO    (12)
#define MFRC522_MOSI    (13)
#define MFRC522_SS      (15)
#define MFRC522_3V3     /* 3v3 */
#define MFRC522_GND     /* gnd pin */
#define MFRC522_IRQ     (33)
#define MFRC522_RSTO    (32)
#endif

// Labeleing as per `blue' RFID MFRC522 - MSL 1471 'fixed'
//
#define MFRC522_SDA      (15)
#define MFRC522_SCK     (14)
#define MFRC522_MOSI    (13)
#define MFRC522_MISO    (12)
#define MFRC522_IRQ     (33)
#define MFRC522_GND     /* gnd pin */
#define MFRC522_RSTO    (32)
#define MFRC522_3V3     /* 3v3 */

#define MFRC522_SS MFRC522_SDA

#include <ETH.h>
#include <ArduinoOTA.h>

#include <SPI.h>
#include <MFRC522.h>    // Requires modifed MFRC522 (see pull rq) or the -master branch as of late DEC 2017.

SPIClass spirfid = SPIClass(VSPI);
const SPISettings spiSettings = SPISettings(SPI_CLOCK_DIV4, MSBFIRST, SPI_MODE0);
MFRC522 mfrc522(MFRC522_SS, MFRC522_RSTO, &spirfid, spiSettings);

static bool eth_connected = false;

static bool ota = false;
void enableOTA() {
  if (ota)
    return;

  // Port defaults to 3232
  // ArduinoOTA.setPort(3232);

  // Hostname defaults to esp3232-[MAC]
  // ArduinoOTA.setHostname("myesp32");

  // No authentication by default
  // ArduinoOTA.setPassword("admin");

  // Password can be set with it's md5 value as well
  // MD5(admin) = 21232f297a57a5a743894a0e4a801fc3
  // ArduinoOTA.setPasswordHash("21232f297a57a5a743894a0e4a801fc3");

  ArduinoOTA.onStart([]() {
    String type;
    if (ArduinoOTA.getCommand() == U_FLASH)
      type = "sketch";
    else // U_SPIFFS
      type = "filesystem";

    // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
    Serial.println("Start updating " + type);
  });

  ArduinoOTA.onEnd([]() {
    Serial.println("\nEnd");
  });

  ArduinoOTA.onError([](ota_error_t error) {
    Serial.printf("Error[%u]: ", error);
    if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
    else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
    else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
    else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
    else if (error == OTA_END_ERROR) Serial.println("End Failed");
  });

  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
    static int lp = -1 ;
    int p = progress / (total / 10);
    if (p != lp) Serial.printf("Progress: %u%%\n", p * 10);
    lp = p;
  });

  // Unfortunately - deep in OTA it auto defaults to Wifi. So we
  // force it to ETH -- requires pull RQ https://github.com/espressif/arduino-esp32/issues/944
  // and https://github.com/espressif/esp-idf/issues/1431.
  //
  ArduinoOTA.begin(TCPIP_ADAPTER_IF_ETH);

  Serial.println("\nOTA enabled.\n");
  ota = true;
}

void WiFiEvent(WiFiEvent_t event)
{
  switch (event) {
    case SYSTEM_EVENT_ETH_START:
      Serial.println("ETH Started");
      //set eth hostname here
      ETH.setHostname("esp32-ethernet");
      break;
    case SYSTEM_EVENT_ETH_CONNECTED:
      Serial.println("ETH Connected");
      break;
    case SYSTEM_EVENT_ETH_GOT_IP:
    case SYSTEM_EVENT_STA_GOT_IP:
      Serial.print("ETH MAC: ");
      Serial.print(ETH.macAddress());
      Serial.print(", IPv4: ");
      Serial.print(ETH.localIP());
      if (ETH.fullDuplex()) {
        Serial.print(", FULL_DUPLEX");
      }
      Serial.print(", ");
      Serial.print(ETH.linkSpeed());
      Serial.printf("Mbps (event %d)\n", event);
      eth_connected = true;
      break;
    case SYSTEM_EVENT_ETH_DISCONNECTED:
      Serial.printf("ETH Disconnected (event %d)\n", event);
      eth_connected = false;
      break;
    case SYSTEM_EVENT_ETH_STOP:
      Serial.println("ETH Stopped");
      eth_connected = false;
      break;
    default:
      Serial.printf("Unknown event %d\n", event);
      break;
  }
}

void testClient(const char * host, uint16_t port)
{
  Serial.print("\nconnecting to ");
  Serial.println(host);

  WiFiClient client;
  if (!client.connect(host, port)) {
    Serial.println("connection failed");
    return;
  }
  client.printf("GET / HTTP/1.1\r\nHost: %s\r\n\r\n", host);
  while (client.connected() && !client.available());
  while (client.available()) {
    Serial.write(client.read());
  }

  Serial.println("closing connection\n");
  client.stop();
}

volatile boolean irqCardSeen = false;

void readCard() {
  irqCardSeen = true;
}

/* The function sending to the MFRC522 the needed commands to activate the reception
*/
void activateRec(MFRC522 mfrc522) {
  mfrc522.PCD_WriteRegister(mfrc522.FIFODataReg, mfrc522.PICC_CMD_REQA);
  mfrc522.PCD_WriteRegister(mfrc522.CommandReg, mfrc522.PCD_Transceive);
  mfrc522.PCD_WriteRegister(mfrc522.BitFramingReg, 0x87);
}

/*  The function to clear the pending interrupt bits after interrupt serving routine
*/
void clearInt(MFRC522 mfrc522) {
  mfrc522.PCD_WriteRegister(mfrc522.ComIrqReg, 0x7F);
}

void setup()
{
  const char  * pname = rindex(__FILE__, '/');

  Serial.begin(115200);
  Serial.print("\n\n\nStart ");
  Serial.print(pname);
  Serial.println(" " __DATE__ " " __TIME__);

  WiFi.onEvent(WiFiEvent);

  ETH.begin();

  Serial.println("SPI init");
  spirfid.begin(MFRC522_SCK, MFRC522_MISO, MFRC522_MOSI, MFRC522_SS);

  Serial.printf("MFRC522 init SPI=%p spi=%p setting=%d/%d/%d\n", &SPI, &spirfid, spiSettings._clock, spiSettings._bitOrder, spiSettings._dataMode);
  mfrc522.PCD_Init();   // Init MFRC522

  Serial.println("MFRC522 dump version");
  mfrc522.PCD_DumpVersionToSerial();  // Show details of PCD - MFRC522 Card Reader details

  Serial.println("MFRC522 IRQ and callback setup.");

  pinMode(MFRC522_IRQ, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(MFRC522_IRQ), readCard, FALLING);

  byte regVal = 0xA0; //rx irq
  mfrc522.PCD_WriteRegister(mfrc522.ComIEnReg, regVal);

  Serial.println("setup() done");
}

void loop()
{
  if (eth_connected) {
    if (ota)
      ArduinoOTA.handle();
    else
      enableOTA();
  }
  static unsigned long tock = 0;
  if (millis() - tock  > 30 * 1000) {
    Serial.println("Tock - 30 seconds");
    tock = millis();
  }

#if 0
  static unsigned long google = 0;
  if (eth_connected && millis() - google > 60 * 1000) {
    testClient("google.com", 80);
    google = millis();
  }
#endif
  //
#if 0
  static byte i;
  pinMode(MFRC522_SS, OUTPUT);
  spirfid.beginTransaction(spiSettings);
  digitalWrite(MFRC522_SS, LOW);
  spirfid.transfer(i++);
  digitalWrite(MFRC522_SS, HIGH);
  spirfid.endTransaction();
  return;
#endif

  if (irqCardSeen) {
    if (mfrc522.PICC_ReadCardSerial()) {
      MFRC522::Uid uid = mfrc522.uid;

      Serial.print("Card detected: len=(");
      Serial.print(uid.size);
      Serial.print(") ");

      for (int i = 0; i < uid.size; i++) {
        if (i) Serial.print("-");
        Serial.print(uid.uidByte[i]);
      };
      Serial.println(".");
    };
    mfrc522.PICC_HaltA(); // Stop reading

    clearInt(mfrc522);
    irqCardSeen = false;
  };

  // Re-arm/retrigger the scanning regularly.
  {
    static unsigned long reminderToRead = 0;
    if (millis() - reminderToRead > 100) {
      activateRec(mfrc522);
      reminderToRead = millis();
    }
  }
  // Dump debug info about the card; PICC_HaltA() is automatically called
  // mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
}

error: pathspec 'test/PoE-test/ETH-LAN8720-OTA-MFRC522-callback/ETH-LAN8720-OTA-MFRC522-callback.ino' did not match any file(s) known to git


Added WiFiCheck example to Bridge Library

/*
  Arduino Yun Wireless Config Check

 Checks the wireless state of Arduino Yun by calling
 the linux command iwconfig.

 Upload this to an Arduino Yun via serial (not WiFi)
 then open the serial monitor to see the status of
 your Yun's WiFi connection. If it's connected to
 a wireless network, the ESSID (name) of that network
 and the signal strength will appear.

 The circuit:
 * Arduino Yun

 created 22 May 2013
 by Tom Igoe

 This example code is in the public domain.
 */

#include <Process.h>

void setup() {
  Serial.begin(9600);  // initialize serial communication
  while(!Serial);      // do nothing until the serial monitor is opened

  pinMode(13,OUTPUT);
  digitalWrite(13, LOW);
  Bridge.begin();      // make contact with the linux processor
  digitalWrite(13, HIGH);

  delay(2000);         // wait 2 seconds

  Process wifiCheck;    // initialize a new process

  wifiCheck.begin("iwconfig");        // command you want to run
  wifiCheck.addParameter("wlan0");    // parameter of the command
  wifiCheck.run();                    // run the command

  // while there's any characters coming back from the
  // process, print them to the serial monitor:
  while (wifiCheck.available() > 0) {
    char thisChar = wifiCheck.read();
    Serial.print(thisChar);
  }
}

void loop() {
  // nothing to do here.
}

error: pathspec 'hardware/arduino/avr/libraries/Bridge/examples/WiFiCheck/WiFiCheck.ino' did not match any file(s) known to git


ESP8266 Blink example for the blue LED on the ESP-01 module

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

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

void setup() {
  pinMode(ledPin, OUTPUT);     // Initialize the ledPin as an output
  ESP.wdtDisable();            // Disable the watchdog timer built into the ESP8266
                               // otherwise the ESP8266 reboots during the "delay(1000);"
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(ledPin, LOW);   // turn the LED on (Note that LOW is the voltage level
                               // but actually the LED is on; this is because
                               // it is acive low on the ESP-01)
  delay(1000);                 // Wait for a second
  digitalWrite(ledPin, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(2000);                 // Wait for two seconds (to demonstrate the active low LED)
}

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


initial code

initial code

// ---------------------------------------------------------------------------
// Example NewPing library sketch that does a ping about 20 times per second.
// ---------------------------------------------------------------------------

#include <NewPing.h>

#define TRIGGER_PIN_1  12  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN_1     11  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define TRIGGER_PIN_2  10  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN_2     9  // Arduino pin tied to echo pin on the ultrasonic sensor.

#define DETECTION_THRESH 50 // Distance cutoff for passing
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

NewPing sonar_1(TRIGGER_PIN_1, ECHO_PIN_1, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
NewPing sonar_2(TRIGGER_PIN_2, ECHO_PIN_2, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

int counter = 0;

void setup() {
  Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.
}

void loop() {
  delay(50);                     // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
  int ping_1 = sonar_1.ping_cm();
  int ping_2 = sonar_2.ping_cm();
  printpings(ping_1, ping_2);

  counter = (counter + 1) % 5;
}

void printpings(int ping_1, int ping_2) {
  Serial.print("Ping 1: ");
  Serial.print(ping_1); // Send ping, get distance in cm and print result (0 = outside set distance range)
  Serial.print(" cm | Ping 2: ");
  Serial.print(ping_2); // Send ping, get distance in cm and print result (0 = outside set distance range)
  Serial.println(" cm");
}

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


SENSOR_HUMEDAD_TIERRA_LIB.ino

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


update code

update code

error: pathspec 'arduino/opencr_arduino/opencr/libraries/ROS/examples/02.' did not match any file(s) known to git
error: pathspec 'Sensors/c_Ultrasonic/c_Ultrasonic.ino' did not match any file(s) known to git


Piezo as input

Piezo as input

#include <Servo.h>

Servo myServo;
const int piezo = A0;
const int switchPin = 2;
const int yellowLed = 3;
const int greenLed = 4;
const int redLed = 5;
int knockVal;
int switchVal;
const int quietKnock = 10;
const int loudKnock = 100;
boolean locked = false;
int numberOfKnocks = 0;

void setup() {
  myServo.attach(9);
  pinMode(yellowLed, OUTPUT);
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(switchPin, INPUT);
  Serial.begin(9600);
  digitalWrite(greenLed, HIGH);
  myServo.write(0);
  Serial.println("Unlocked");
}

void loop() {
  if (!locked) {
    switchVal = digitalRead(switchPin);
    if (switchVal == HIGH) {
      locked = true;
      digitalWrite(greenLed, LOW);
      digitalWrite(redLed, HIGH);
      myServo.write(90);
      Serial.println("Locked");
      delay(1000);
    }
  }
  else {
    knockVal = analogRead(piezo);
    if (numberOfKnocks < 3 && knockVal > 0) {
      if (checkForKnock(knockVal) == true) {
        numberOfKnocks++;
      }
      Serial.print(3 - numberOfKnocks);
      Serial.println(" more knocks to go");
    }
    if (numberOfKnocks >= 3) {
      locked = false;
      myServo.write(0);
      delay(20);
      digitalWrite(greenLed, HIGH);
      digitalWrite(redLed, LOW);
      Serial.println("Unlocked");
      numberOfKnocks = 0;
    }
  }
}

boolean checkForKnock(int value) {
  if (value > quietKnock && value < loudKnock) {
    digitalWrite(yellowLed, HIGH);
    delay(50);
    digitalWrite(yellowLed, LOW);
    Serial.print("Valid knock of value ");
    Serial.println(value);
    return true;
  }
  else {
    Serial.print("Bad knock value ");
    Serial.println(value);
    return false;
  }
}

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


Some test code for octotemp using the TI128d818.

#include <Math.h>
#include <Wire.h>

#define SDAPIN 13
#define SCLPIN 12

// TODO(z2amiller):  Set up interrupts to call back when the temperature
//                   on one of the pins gets too hot.
#define ADC_INT 14

#define ADC_ADDR 0x37

// TODO(z2amiller):  Cut this out into a separate library.
class TI128D818 {
 public:
  TI128D818();
  TI128D818(uint8_t add_addr);
  bool init(uint8_t adc_mode = 0);
  float temp(uint8_t channel = 0);
 private:
  uint8_t read8(uint8_t addr);
  uint16_t read16(uint8_t addr);
  void write8(uint8_t addr, uint8_t data);
  void pollUntilReady();
  uint8_t adc_addr_;
};

TI128D818::TI128D818() {
  adc_addr_ = ADC_ADDR;
}

TI128D818::TI128D818(uint8_t adc_addr) {
    adc_addr_ = adc_addr;
}

// TODO(z2amiller):  Have a maximum allowed elapsed time?
// TODO(z2amiller):  Can't dump to serial in a library.  #ifdef debug?
void TI128D818::pollUntilReady() {
  bool ok = false;
  int delay_time = 33;
  while (!ok) {
    delay(delay_time);
    Serial.print("Polling ADC for ready state..");
    int r = read8(0x0C);
    if (r && 0x02) {
      Serial.print(" not OK yet, state = ");
      Serial.println(r);
      delay_time *= 1.4;
    } else {
      ok = true;
      Serial.println(" Ready!");
    }
  }
}

// TODO(z2amiller):  Have the TI128D818 library only return the raw
//                   temperature value, this temperature conversion
//                   is very application specific.
float TI128D818::temp(uint8_t channel) {
  uint16_t t = read16(channel);
  // This is a 12 bit ADC; bit shift this 16 bit value to get the
  // 12 bits we are interested in.
  t >>= 4;
  // Calculate the actual temperature using the Steinhart-Hart
  // formula.
  const int measured_resistance = 10000.0 * ((4096.0 / t) - 1);
  const float mr_log = log(measured_resistance / 10000.0);
  // Steinhart-hart coefficients for the Vishay NTCLG100E2103.
  // (10K @ 25C thermistor)
  const float tempK = 1 / (0.003354016 +
                          (0.0002569850 * mr_log) +
                          (0.000002620131 * pow(mr_log, 2)) +
                          (0.00000006383091 * pow(mr_log, 3)));
  return tempK - 273.15; // tempC
}

// TODO(z2amiller):  Provide a configuration class that encapsulates
//                   all of the ADC configuration options.
//                   (pins, modes, etc).
bool TI128D818::init(uint8_t adc_mode) {
  Wire.begin(SDAPIN, SCLPIN);
  write8(0x00, 0x00); // disable all.
  pollUntilReady();
  write8(0x0B, 0x02 | 0x01); // Mode 1, external vref.
  write8(0x07, 0x01);        // continuous conversion.
  write8(0x00, 0x02 | 0x01); // interrupt enable, start ADC.
  return true;
}

void TI128D818::write8(uint8_t addr, uint8_t data) {
  Wire.beginTransmission(adc_addr_);
  Wire.write(addr);
  Wire.write(data);
  Wire.endTransmission();
}

uint8_t TI128D818::read8(uint8_t addr) {
  Wire.beginTransmission(adc_addr_);
  Wire.write(addr);
  Wire.endTransmission();
  Wire.beginTransmission(adc_addr_);
  Wire.requestFrom(adc_addr_, (uint8_t)1);
  uint8_t ret;
  ret = Wire.read();
  Wire.endTransmission();
  return ret;
}

uint16_t TI128D818::read16(uint8_t addr) {
  Wire.beginTransmission(adc_addr_);
  Wire.write(addr);
  Wire.endTransmission();
  Wire.beginTransmission(adc_addr_);
  Wire.requestFrom(adc_addr_, (uint8_t)2);
  uint16_t ret;
  ret = Wire.read();
  ret <<= 8;
  ret |= Wire.read();
  Serial.print(" (raw read ");
  Serial.print(ret);
  Serial.print(") ");
  Wire.endTransmission();
  return ret;
}

TI128D818 adc = TI128D818();
void setup(void)
{
  Serial.begin(115200);
  adc.init(0x1);
}

// TODO(z2amiller):  Do something interesting with this data.
//                   Post to prometheus or MQTT or something.
void loop(void)
{
  Serial.print("ch 0 = ");
  Serial.print(adc.temp(0x20));
  Serial.print("  ch 1 = ");
  Serial.print(adc.temp(0x21));
  Serial.println("");
  Serial.print("ch 2 = ");
  Serial.print(adc.temp(0x22));
  Serial.print("  ch 3 = ");
  Serial.print(adc.temp(0x23));
  Serial.println("");
  Serial.println("");
  delay(5000);
}

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


Initial commit of working ADS7825 firmware

/**
 * This firmware is intended to interface with a ADS7825 from TI/BB, and
 * provide digital codes to the control software over USB-Serial.
 */

// Adding _ prefix b/c arduino api uses some of these names otherwise
#define     _A0       (22)
#define     _A1       (23)
#define     _BYTE     (24)
#define     _RC       (25)
#define     _BUSY     (26)

#define     _D0       (37)
#define     _D1       (36)
#define     _D2       (35)
#define     _D3       (34)
#define     _D4       (33)
#define     _D5       (32)
#define     _D6       (31)
#define     _D7       (30)

#define     _LED       (13)

#define     _TRIGGER   (40)

void setup() {
  uint8_t outputs[] = {_A0, _A1, _BYTE, _RC, _LED};
  uint8_t inputs[] = {_BUSY, _D0, _D1, _D2, _D3, _D4, _D5, _D6, _D7, _TRIGGER};

  for (int idx = 0; idx < sizeof outputs; ++idx) {
    pinMode(outputs[idx], OUTPUT);
  }

  for (int idx = 0; idx < sizeof inputs; ++idx) {
    pinMode(inputs[idx], INPUT);
  }

  // put the chip into read mode by default
  digitalWrite(_RC, HIGH);

  wait_busy();

  // set the next channel to be read to 0
  read_analog(0);

  Serial.begin(19200);
  Serial.println("Ready");
}

/**
  Waits for BUSY to go high
  */
void wait_busy() {
  while(digitalRead(_BUSY) == LOW) {
    digitalWrite(_LED, ~digitalRead(_BUSY));
  }
}

/**
  Reads in the current conversion value, and sets the next channel to be
  sampled.
  */
int16_t read_analog(uint8_t next_chan) {
  // select the channel for the next read
  digitalWrite(_A0, next_chan&0x01);
  digitalWrite(_A1, next_chan>>1);

  // pre-select the high byte for reading
  digitalWrite(_BYTE, LOW);

  // begin a conversion
  digitalWrite(_RC, LOW);
  delayMicroseconds(1);
  digitalWrite(_RC, HIGH);

  // wait for busy to go high
  wait_busy();

  // use port manipulation to read the data pins. Note that our pinmapping
  // is such that port C maps exactly onto the parallel output from the
  // ADS7825.
  uint8_t hbyte = PINC;

  // now for the high byte
  digitalWrite(_BYTE, HIGH);
  delayMicroseconds(1);

  uint8_t lbyte = PINC;

  return (hbyte<<8 | lbyte)&0xFFFF;
}

void ser_print_si(char * s, int i) {
  Serial.print(s);
  Serial.print(i, DEC);
}

void ser_print_sx(char * s, int i) {
  Serial.print(s);
  Serial.print(i, HEX);
}

int16_t cnt = 0;
void loop() {
  Serial.print(cnt, DEC);
  ser_print_si(" ", read_analog(1));
  ser_print_si(" ", read_analog(2));
  ser_print_si(" ", read_analog(3));
  ser_print_si(" ", read_analog(0));
  Serial.println();
  cnt += 1;
}


Working nightrider #awesome

Working nightrider #awesome

error: pathspec 'SmartKitchen-Emdebbed' did not match any file(s) known to git
error: pathspec 'System/Software/Arduino/Testing/Blinking_with_I2C_method/Blinking_with_I2C_method.ino' did not match any file(s) known to git


Init with read analog example

Init with read analog example

/*
  AnalogReadSerial
  Reads an analog input on pin 0, prints the result to the serial monitor.
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

 This example code is in the public domain.
 */

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // print out the value you read:
  Serial.println(sensorValue);
  delay(1);        // delay in between reads for stability
}

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


Added Button Status Detection Tester

Added Button Status Detection Tester

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/Duke-Medical-Instrumentation/InceptionTI.git/'


add retry on dht read and rfm12b send

add retry on dht read and rfm12b send

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/timson/yaws.git/'


get timezone and adjust from UTC time

get timezone and adjust from UTC time

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/cwilkens/helioscope-lamp.git/'


New Sketch: traffic-light

New Sketch: traffic-light

Signed-off-by: Gianpaolo Macario <f8885408b8c3d931b330bae3c3a28a3af912c463@gmail.com>

// Blink green/yellow/red LED while the button is pressed

const int LED_GREEN  = 11;   // the pin for the green LED
const int LED_YELLOW = 10;   // the pin for the yellow LED
const int LED_RED    =  9;   // the pin for the red LED
const int BUTTON     =  7;   // the input pin where the pushbutton is connected

const int TRANSITION_MS = 1000;

int val = 0; // val will be used to store the state of the input pin

void setup() {
  pinMode(LED_GREEN, OUTPUT); // tell Arduino LED is an output
  pinMode(LED_YELLOW, OUTPUT); // tell Arduino LED is an output
  pinMode(LED_RED, OUTPUT); // tell Arduino LED is an output
  pinMode(BUTTON, INPUT); // and BUTTON is an input
}

void loop(){
  val = digitalRead(BUTTON); // read input value and store it

  // check whether the input is HIGH (button pressed)
  if (val == HIGH) {
    digitalWrite(LED_GREEN, HIGH); // turn green LED ON
    digitalWrite(LED_YELLOW, LOW);
    digitalWrite(LED_RED, LOW);
    delay(TRANSITION_MS);
    digitalWrite(LED_GREEN, LOW); // turn green LED off
    digitalWrite(LED_YELLOW, HIGH);
    delay(TRANSITION_MS);
    digitalWrite(LED_YELLOW, LOW);
    digitalWrite(LED_RED, HIGH);
    delay(TRANSITION_MS);
    digitalWrite(LED_RED,LOW);
  }
  else {
    digitalWrite(LED_GREEN, LOW);
    digitalWrite(LED_YELLOW, LOW);
    digitalWrite(LED_RED, LOW);
  }
}

// EOF

error: pathspec 'Sketches/traffic-light/traffic-light.ino' did not match any file(s) known to git


Added Interrupt Functions

Added Interrupt Functions

Compilation Confirmation -- Verification after power tests.

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


add non blocking example

add non blocking example

#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
WiFiManager wm;

void setup() {
    // put your setup code here, to run once:
    Serial.begin(115200);

    //reset settings - wipe credentials for testing
    //wm.resetSettings();

    wm.setConfigPortalBlocking(false);

    //automatically connect using saved credentials if they exist
    //If connection fails it starts an access point with the specified name
    if(wm.autoConnect("AutoConnectAP")){
        Serial.println("connected...yeey :)");
    }
    else {
        Serial.println("Configportal running");
    }
}

void loop() {
    wm.process();
    // put your main code here, to run repeatedly:
}

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


Create photon-json.ino

Create photon-json.ino

    // Global variables here

void setup(){
    // Any general setup stuff goes here to run once

    pinMode(D7, OUTPUT);

    Spark.subscribe("hook-response/post-to-particle", gotHookReply, MY_DEVICES);
	Particle.publish("post-to-particle");

}

void gotHookReply(const char *name, const char *data){

    if (String(data) == "The access token was not found"){
       digitalWrite(D7, 1);   // light D7
    }

}

void loop(){
  // your looping stuff goes here

}

  // Note: type into your browser https://api.spark.io/v1/devices/
  // to see what the full json reply is
  // {
  //   "error": "invalid_request",
  //   "error_description": "The access token was not found"
  // }

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


arduino file

arduino file

main arduino file

// version 2015.11.07.0

#include <AccelStepper.h>

#define num_motors 4

//Declare pin functions on Arduino
int dir_pins[num_motors] = {2,5,8,11};
int step_pins[num_motors] = {3,6,9,12};
int enable_pins[4] = {4,7,10,13};

int default_motor_speed = 3200; //maximum steps per second
int default_motor_acceleration = 800; //steps/second/second to accelerate

AccelStepper *steppers[num_motors];

char current_buffer[65];

//--------------------------------------------------------------------------------------------
void setup()
{
  for (int m = 0; m < num_motors; m++){
    steppers[m] = new AccelStepper(AccelStepper::DRIVER, step_pins[m], dir_pins[m]);
    steppers[m]->setMaxSpeed(default_motor_speed);
    steppers[m]->setSpeed(default_motor_speed);
    steppers[m]->setAcceleration(default_motor_acceleration);
  }

  reset_pins();

  Serial.begin(9600); //Open Serial connection
  Serial.println("jenny 5 firmaware version 2015.11.09.4");
  Serial.println();
  //Print function list for user selection5
  Serial.println("Commands are:");
  Serial.println("motor index can be between 0 and num_motors - 1");
  Serial.println("M1 100# // move motor 1 to 100 steps");
  Serial.println("D1#  // Disable 1");
  Serial.println("S1 100# // set speed of motor 1 to 100");
  Serial.println("A1 100# // set acceleration of motor 1 to 100");

  Serial.println();

  current_buffer[0] = 0;
}
//--------------------------------------------------------------------------------------------
//Main loop
void loop() {

  if (Serial.available()) {
    int num_read = 0;
    char arduino_buffer[65];

    num_read = Serial.readBytes(arduino_buffer, 64); //Read up to 64 bytes
    arduino_buffer[num_read] = 0;// terminate the string
    if (num_read){
      strcat(current_buffer, arduino_buffer);
      // parse from the beginning until I find a M, D, S or A
      int buffer_length = strlen(current_buffer);
      //Serial.write(current_buffer);
      for (int i = 0; i < buffer_length; i++)
        if (current_buffer[i] == 'M'){// move motor
          // find the terminal character #
          int j = i + 1;
          for (; j < buffer_length && current_buffer[j] != '#'; j++);// parse until I find the termination char
          if (j < buffer_length){
              char tmp_str[64];
             // Serial.println(i);
             // Serial.println(j);
              strncpy(tmp_str, current_buffer + i + 1, j - i - 1);
              tmp_str[j - i - 1] = 0;
              int motor_index, num_steps;
        //      Serial.write(tmp_str);
              sscanf(tmp_str, "%d%d", &motor_index, &num_steps);
              move_motor(motor_index, num_steps);
              // remove the current executed command
              strcpy(current_buffer, current_buffer + j + 1);
          //    Serial.write(current_buffer);
              break;
          }
          else{// the string is not completed ... so I must wait more...
            break; // for i
          }
        }
        else
        if (current_buffer[i] == 'D'){// disable motor
          // find the terminal character #
          int j = i + 1;
          for (; j < buffer_length && current_buffer[j] != '#'; j++);// parse until I find the termination char
          if (j < buffer_length){
              char tmp_str[64];
             // Serial.println(i);
             // Serial.println(j);
              strncpy(tmp_str, current_buffer + i + 1, j - i - 1);
              tmp_str[j - i - 1] = 0;
              int motor_index;
        //      Serial.write(tmp_str);
              sscanf(tmp_str, "%d", &motor_index);
              disable_motor(motor_index);
              // remove the current executed command
              strcpy(current_buffer, current_buffer + j + 1);
          //    Serial.write(current_buffer);
              break;
          }
          else{// the string is not completed ... so I must wait more...
            break; // for i
          }
        }

    }
  }

// run motors
  for (int m = 0; m < num_motors; m++)
    if (steppers[m]->distanceToGo())
      steppers[m]->run();
    else
      steppers[m]->setCurrentPosition(0);
}
//--------------------------------------------------------------------------------------------
//Reset pins to default states
void reset_pins()
{
  for (int m = 0; m < num_motors; m++){
    digitalWrite(step_pins[m], LOW);
    digitalWrite(dir_pins[m], LOW);
    digitalWrite(enable_pins[m], HIGH); // all motors are disabled now
  }
}
//--------------------------------------------------------------------------------------------
void move_motor(int motor_index, int num_steps)
{
  digitalWrite(enable_pins[motor_index], LOW); // turn motor on
  //Serial.println("Moving motor1 forward at default step mode.");
  steppers[motor_index]->moveTo(num_steps); //move num_steps
  //Serial.println("Enter new option");
  Serial.println();
}
//--------------------------------------------------------------------------------------------
void set_motor_speed(int motor_index, int motor_speed)
{
    steppers[motor_index]->setMaxSpeed(motor_speed);
    steppers[motor_index]->setSpeed(motor_speed);
}
//--------------------------------------------------------------------------------------------
void set_motor_acceleration(int motor_index, int motor_acceleration)
{
    steppers[motor_index]->setAcceleration(motor_acceleration);
}
//--------------------------------------------------------------------------------------------
void disable_motor(int motor_index)
{
  digitalWrite(enable_pins[motor_index], HIGH); // disable motor
}
//--------------------------------------------------------------------------------------------

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


a long way to got baby

a long way to got baby

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/trinamic/T-Bone.git/'


Add Fn layer support to buttons

Add Fn layer support to buttons

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/mvines/futboard.git/'


Add Arduino/Teensy demo snippet

Add Arduino/Teensy demo snippet

// *** SNDEMO ***

// This example shows how to autoconnect between the SPAD.neXt and Arduino.
//
// It demonstrates how to
// - Respond to a connection request from SPAD.neXt
// - Use a identifier to handshake
// - Expose a data value to SPAD.neXt
// - Request Data Updates from SPAD.neXt

#include <CmdMessenger.h>  // CmdMessenger

// Internal led
const int ledPin = 13;

// Listen on serial connection for messages from the pc
CmdMessenger messenger(Serial);

// This is the list of recognized commands. These can be commands that can either be sent
// or received.
// In order to receive, attach a callback function to these events
enum
{
  kRequest = 0, // Request from SPAD.neXt
  kCommand = 1, // Command to SPAD.neXt
  kEvent = 2, // Events from SPAD.neXt
  kDebug = 3, // Debug strings to SPAD.neXt Logfile
  kLed = 10, // CMDID for exposed data to SPAD.neXt
  kHeading = 11, // CMDID for data updates from SPAD.neXt
};

void attachCommandCallbacks()
{
  // Attach callback methods
  messenger.attach(onUnknownCommand);
  messenger.attach(kRequest  , onIdentifyRequest);
  messenger.attach(kLed , onTurnLedOn);
  messenger.attach(kHeading , onHeadingLockChanged);
}

// ------------------  C A L L B A C K S -----------------------

// Called when a received command has no attached function
void onUnknownCommand()
{
  messenger.sendCmdStart(kDebug);
  messenger.sendCmdArg("UNKNOWN COMMAND");
  messenger.sendCmdArg(messenger.lastCommandId);
  messenger.sendCmdArg(messenger.commandBuffer);
  messenger.sendCmdEnd();
}

// Callback function to respond to indentify request. This is part of the
// Auto connection handshake.
void onIdentifyRequest()
{
  char *szRequest = messenger.readStringArg();

  if (stricmp(szRequest, "INIT") == 0) {
    messenger.sendCmdStart(kRequest);
    messenger.sendCmdArg("SPAD");
    // Unique Device ID
    messenger.sendCmdArg(F("{DD7E3826-E439-4484-B186-A1443F3BC521}"));
    // Device Name for UI
    messenger.sendCmdArg("Arduino Demo");
    messenger.sendCmdEnd();
    return;
  }

  if (stricmp(szRequest, "PING") == 0) {
    messenger.sendCmdStart(kRequest);
    messenger.sendCmdArg("PONG");
    messenger.sendCmdArg(messenger.readInt32Arg());
    messenger.sendCmdEnd();
    return;
  }
  if (stricmp(szRequest, "CONFIG") == 0) {

    // Expose LED
    messenger.sendCmdStart(kCommand);
    messenger.sendCmdArg("ADD");
    messenger.sendCmdArg(kLed);
    messenger.sendCmdArg("leds/systemled"); // will become "SERIAL:<guid>/leds/systemled"
    messenger.sendCmdArg("U8");
    messenger.sendCmdArg("RW");
    messenger.sendCmdArg("Led");
    messenger.sendCmdArg("Toggle LED on/off");
    messenger.sendCmdEnd();

    // Request Heading Lock Dir Updates
    messenger.sendCmdStart(kCommand);
    messenger.sendCmdArg("SUBSCRIBE");
    messenger.sendCmdArg(kHeading);
    messenger.sendCmdArg("SIMCONNECT:AUTOPILOT HEADING LOCK DIR");
    messenger.sendCmdEnd();

    // tell SPAD.neXT we are done with config
    messenger.sendCmd(kRequest, "CONFIG");
    return;
  }
}

// Callback to perform some action
void onTurnLedOn()
{
  int32_t newLed = messenger.readInt32Arg();
  if (newLed == 1)
  {
    digitalWrite(ledPin, HIGH);
    messenger.sendCmd(kDebug, "LED COMMAND ON");
  }
  else
  {
    digitalWrite(ledPin, LOW);
    messenger.sendCmd(kDebug, "LED COMMAND OFF");

    // When we turned it off we unsubscribe from the heading lock for demo purpose
    messenger.sendCmdStart(kCommand);
    messenger.sendCmdArg("UNSUBSCRIBE");
    messenger.sendCmdArg(kHeading);
    messenger.sendCmdArg("SIMCONNECT:AUTOPILOT HEADING LOCK DIR");
    messenger.sendCmdEnd();
  }
}

// LED on if Heading > 180 else off;
void onHeadingLockChanged()
{
  int32_t newHeading = messenger.readInt32Arg();
  if (newHeading > 180)
  {
    digitalWrite(ledPin, HIGH);
    messenger.sendCmd(kDebug, "HEADING > 180");
  }
  else
  {
    digitalWrite(ledPin, LOW);
    messenger.sendCmd(kDebug, "HEADING < 180");
  }
}

// ------------------ M A I N  ----------------------

// Setup function
void setup()
{
  // Listen on serial connection for messages from the pc

  // 115200 is typically the maximum speed for serial over USB
  Serial.begin(115200);

  // Attach my application's user-defined callback methods
  attachCommandCallbacks();

  // initialize the digital pin as an output.
  pinMode(ledPin, OUTPUT);

  // Make sure led is turned off after start or reset
  digitalWrite(ledPin, LOW);
}

// Loop function
void loop()
{
  // Process incoming serial data, and perform callbacks
  messenger.feedinSerialData();
}

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


Added new servo control example

Added new servo control example

#include <Servo.h>
#include <ubrain.h>
#include <uspeech.h>

signal voice(A0);
int time;
bool first =  true, process = false;
syllable s;
Servo myservo;
void left(){
  Serial.println("left(): called");
  myservo.write(0);
}
void right(){
  Serial.println("right(): called");
  myservo.write(180);
}
void center(){
  Serial.println("center(): called");
   myservo.write(90);
}
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  myservo.attach(9);
  voice.f_enabled = true;
  voice.minVolume = 1500;
  voice.fconstant = 400;
  voice.econstant = 1;
  voice.aconstant = 2;
  voice.vconstant = 3;
  voice.shconstant = 4;
  voice.calibrate();
}

void loop() {
  // put your main code here, to run repeatedly:
  char c = voice.getPhoneme();

  if(c==' '){
    if(process){
      int sum = s.f+s.o+s.v+s.s+s.h;
      if(sum>30){
        s.debugPrint();
        Serial.println();
        if(s.f>3){
          if(s.s>3){
            center();
          }
          else{
          left();
          }
        }
        else{
          if(s.s>3){
            center();
          }
          else{
            right();
          }
        }
      }
      s.f = 0;
      s.e = 0;
      s.o = 0;
      s.v = 0;
      s.s = 0;
      s.h = 0;
      process = false;

    }
  }
  else{
    if(first){
      time = millis();
    }
    else{

    }
    s.classify(c);
    process = true;
  }
}

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


Create XPTCalibrate.ino

Create XPTCalibrate.ino

/*
 * Copyright (c) 2017 razorlt, Spiros Papadimitriou
 *
 * This file is part of github.com/spapadim/XPT2046 and is released
 * under the MIT License: https://opensource.org/licenses/MIT
 *
 * This software is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied.
 */
 //ILI9341_TFT
 // A2 : SS(Slave Select)
 // A3 : SCK(Serial Clock)
 // A4 : MISO(Master In Slave Out)
 // A5 : MOSI(Master Out Slave In)
 // The other pins are: cs - Chip select (aka slave select), dc - D/C or A0 on the screen (Command/Data switch), rst - Reset

 #include "application.h"
 #include <Adafruit_mfGFX.h>
 #include "Adafruit_ILI9341.h"
 #include "XPT2046.h"

 Adafruit_ILI9341 tft = Adafruit_ILI9341(/*cs=*/A2, /*dc=*/A1, /*rst=*/A0);
 XPT2046 touch(/*cs=*/ D2, /*irq=*/ D7);

 static void calibratePoint(uint16_t x, uint16_t y, uint16_t &vi, uint16_t &vj) {
  // Draw cross
  tft.drawFastHLine(x - 8, y, 16, ILI9341_WHITE);
  tft.drawFastVLine(x, y - 8, 16, ILI9341_WHITE);
  while (!touch.isTouching()) {
    delay(10);
  }
  touch.getRaw(vi, vj);
  // Erase by overwriting with black
  tft.drawFastHLine(x - 8, y, 16, ILI9341_BLACK);
  tft.drawFastVLine(x, y - 8, 16, ILI9341_BLACK);
}

void calibrate() {
  uint16_t x1, y1, x2, y2;
  uint16_t vi1, vj1, vi2, vj2;
  touch.getCalibrationPoints(x1, y1, x2, y2);
  calibratePoint(x1, y1, vi1, vj1);
  delay(1000);
  calibratePoint(x2, y2, vi2, vj2);
  touch.setCalibration(vi1, vj1, vi2, vj2);

  char buf[80];
  snprintf(buf, sizeof(buf), "%d,%d,%d,%d", (int)vi1, (int)vj1, (int)vi2, (int)vj2);
  //ucg.setFont(ucg_font_helvR14_tr);
  //ucg.setColor(0xff, 0xff, 0xff);
  tft.setTextColor(ILI9341_RED);  tft.setTextSize(2);
  //ucg.setPrintPos(0, 25);
  tft.setCursor(160, 160);
  tft.print("setCalibration params:");
  tft.setCursor(0, 50);
  tft.print(buf);
}
void setup() {
  delay(300);
  tft.begin();
  delay(10);
  tft.setRotation(0);
  tft.fillScreen(ILI9341_BLACK);
  delay(100);
  touch.begin(ILI9341_TFTWIDTH, ILI9341_HEIGHT);
  touch.setRotation(touch.ROT0);

  calibrate();
}

void loop() {
  // Do nothing
  delay(1000);
}

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


more strings in flash

more strings in flash


Asservissement: caractérisation - déplacement du fichier

error: pathspec 'Module' did not match any file(s) known to git
error: pathspec 'Moteur/Software/Asservissement/CaraterisationVitesseMoteur/caraterisationVitesseMoteur/caraterisationVitesseMoteur.ino' did not match any file(s) known to git


arduino code style fixed

arduino code style fixed

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


Add arduino sonic array.

Add arduino sonic array.

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/kkaczkowski/Hoover.git/'


Set LED to offline if initial connect fails.

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/lgramatikov/celeste.git/'


Fix Arduino Subscriber

Fix Arduino Subscriber

I accidentally put scan_msg instead of the thread name, "Scan". Hopefully allows the subscriber to work now.

LIDAR Data Extraction/LidarCommands/Currently Used/arduino/lidar_servo_driver/lidar_servo_driver.ino

error: pathspec 'LIDAR' did not match any file(s) known to git
error: pathspec 'Data' did not match any file(s) known to git
error: pathspec 'Extraction/LidarCommands/Currently' did not match any file(s) known to git
error: pathspec 'Used/arduino/lidar_servo_driver/lidar_servo_driver.ino' did not match any file(s) known to git


dining philosophers example

dining philosophers example

#include <Interrupted.h>
#include <Tasks.h>

#define MAX	6

Semaphore forks[MAX];
static byte ids = 1;
static byte leds[] = { LED1, LED2, LED3, LED4, LED5, LED6, LED7, LED8 };

void eating(byte id, byte weight) {
	Serial.print("Philosopher ");
	Serial.print(id);
	Serial.print(" eats: ");
	Serial.println(weight);

	digitalWrite(leds[id], HIGH);
	delay(500);
	digitalWrite(leds[id], LOW);

	Tasks::ready(Tasks::current());
	Tasks::reschedule();
}

class Philosopher: public Task<50> {
public:
	void setup() {
		_id = ids++;
	}

	void loop() {
		forks[_id - 1].wait();
		forks[_id].wait();

		eating(_id, _w++);

		forks[_id - 1].signal();
		forks[_id].signal();
	}

private:
	byte _id, _w;
};

Philosopher philosophers[MAX-1];

void setup() {
	Serial.begin(9600);
	Tasks::init();
	for (int i = 0; i < MAX; i++) {
		forks[i].signal();
		pinMode(leds[i], OUTPUT);
	}
	for (int i = 0; i < MAX-1; i++)
		Tasks::start(philosophers[i]);
}

void loop() {
	static byte weight;

	forks[0].wait();
	forks[MAX-1].wait();

	eating(0, weight++);

	forks[0].signal();
	forks[MAX-1].signal();
}

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


Fix minor bug with console output displaying wrong menu option character.

Improve console output to be slightly more friendly

/*
  SDCard Tester

  Test SD Card read/write functionality with simple Serial interface.

  Notes:
  - Behind the scenes uses SD Fat library instead of the default SD library
  - File clear not implemented yet
  - Write file appends to existing content

  Created 14 6 2014
  Modified 22 6 2014
*/
#include <UASensors_SDCard.h>

// UA Sensors SDCard - Dependencies
#include <SdFat.h>
#include <String.h>

// Pin connected to SD Card CS
const int CS_PIN = 10;

// Maximum number of characters allowed for message input
// Includes one extra slot for null byte terminator.
const int MESSAGE_SIZE = 101;

// Set the name of the file to be read.
#define FILENAME "testfile.txt"

// Instantiate SDCard object. Need to call begin before using.
UASensors_SDCard sd(CS_PIN);

// Menu options recognized from Serial input
const char SHOW_MENU = 'm';
const char READ_FILE = 'r';
const char WRITE_FILE = 'w';

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

  doShowMenu();

  // Call begin to initialize SD Card
  sd.begin();
}

void loop()
{
  if (Serial.available())
  {
    switch (Serial.read())
    {
      case SHOW_MENU:
        doShowMenu();
        break;
      case READ_FILE:
        doReadFile();
        break;
      case WRITE_FILE:
        doWriteFile();
        break;
    }
  }
}

void doShowMenu()
{
  Serial.println("SD Card Tester commands");
  Serial.println("-----------------------");
  Serial.println("m: Show menu");
  Serial.println("r: Reads contents of file");
  Serial.println("w: Write contents to file");
  Serial.println();
}

// Reads contents from specified file and returns
// the contents as String that will be printed to
// Serial console.
void doReadFile()
{
  String contents = sd.readFile(FILENAME);

  if (contents.length() > 0)
  {
    Serial.println("Contents of " + String(FILENAME) + ":");
    Serial.println(contents);
    Serial.println();
  }
  else
  {
    Serial.println("Notice: No contents found on file.\n");
  }
}

void doWriteFile()
{
  char buffer[MESSAGE_SIZE];
  int inputLength = 0;

  Serial.print("Write a message up to ");
  Serial.print(MESSAGE_SIZE - 1);
  Serial.println(" characters:");

  // Wait for user to enter a message
  while (!Serial.available())
  {
    delay(100);
  }

  // Read input until newline character is seen. May need
  // to adjust serial console accordingly
  inputLength = Serial.readBytesUntil('\n', buffer, MESSAGE_SIZE);
  buffer[inputLength] = '\0';

  if (inputLength == 0)
  {
    Serial.println("Error: No valid input was found!\n");
    return;
  }

  // Convert char string to string. SDCard writeFile method expects String.
  String message = String(buffer);

  Serial.println("Writing to " + String(FILENAME) + ":");
  Serial.println(message);
  Serial.println();

  bool isSuccess = sd.writeFile(FILENAME, message);

  if (isSuccess)
  {
    Serial.println("Message written to file successfully!\n");
  }
  else
  {
    Serial.println("Error: Could not write message to file!\n");
  }
}

/*
  SDCard Tester

  Test SD Card read/write functionality with simple Serial interface.

  Notes:
  - Behind the scenes uses SD Fat library instead of the default SD library
  - File clear not implemented yet
  - Write file appends to existing content

  Created 14 6 2014
  Modified 14 6 2014
*/
#include <UASensors_SDCard.h>

// UA Sensors SDCard - Dependencies
#include <SdFat.h>
#include <String.h>

// Pin connected to SD Card CS
const int CS_PIN = 10;

// Maximum number of characters allowed for message input
// Includes one extra slot for null byte terminator.
const int MESSAGE_SIZE = 101;

// Set the name of the file to be read.
#define FILENAME "backup.txt"

// Instantiate SDCard object. Need to call begin before using.
UASensors_SDCard sd(CS_PIN);

// Menu options recognized from Serial input
const char READ_FILE = 'r';
const char WRITE_FILE = 'w';

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

  Serial.println("SD Card Tester commands");
  Serial.println("-----------------------");
  Serial.println("r: Reads contents of file");
  Serial.println("f: Write contents to file");

  // Call begin to initialize SD Card
  sd.begin();
}

void loop()
{
  if (Serial.available())
  {
    switch (Serial.read())
    {
      case READ_FILE:
        doReadFile();
        break;
      case WRITE_FILE:
        doWriteFile();
        break;
    }
  }
}

// Reads contents from specified file and returns
// the contents as String that will be printed to
// Serial console.
void doReadFile()
{
  String contents = sd.readFile(FILENAME);

  if (contents.length() > 0)
  {
    Serial.println("Contents of " + String(FILENAME) + ":");
    Serial.println(contents);
  }
  else
  {
    Serial.println("Notice: No contents found on file.");
  }
}

void doWriteFile()
{
  char buffer[MESSAGE_SIZE];
  int inputLength = 0;

  Serial.print("Write a message up to ");
  Serial.print(MESSAGE_SIZE - 1);
  Serial.println(" characters:");

  // Wait for user to enter a message
  while (!Serial.available())
  {
    delay(100);
  }

  // Read input until newline character is seen. May need
  // to adjust serial console accordingly
  inputLength = Serial.readBytesUntil('\n', buffer, MESSAGE_SIZE);
  buffer[inputLength] = '\0';

  if (inputLength == 0)
  {
    Serial.println("Error: No valid date was found!");
    return;
  }

  // Convert char string to string. SDCard writeFile method expects String.
  String message = String(buffer);

  bool isSuccess = sd.writeFile(FILENAME, message);

  if (isSuccess)
  {
    Serial.println("Message written to file successfully!");
  }
  else
  {
    Serial.println("Error: Could not write message to file!");
  }
}


Rename myservo to doorServo

Rename myservo to doorServo

I also added pins for servo at the beginning of the code.

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


Added whereselaiza_test.ino

Added whereselaiza_test.ino

New test sketch allows to return SMS with GSPLOC data

/*
  THIS CODE IS STILL IN PROGRESS!

  Open up the serial console on the at 115200 baud to interact with SIM808

  This code will receive an SMS, identify the sender's phone number, and automatically send a  GPRSloc response

  For use with SIM808

      Written by Marco Longoria , 2018
*/

#include "Adafruit_FONA.h"

#define FONA_RX 2
#define FONA_TX 3
#define FONA_RST 4

// this is a large buffer for replies
char replybuffer[255];
char gpsbuffer[20];

// We default to using software serial. If you want to use hardware serial
// (because softserial isnt supported) comment out the following three lines
// and uncomment the HardwareSerial line
#include <SoftwareSerial.h>
//SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
//SoftwareSerial *fonaSerial = &fonaSS;

// Hardware serial is also possible!
  HardwareSerial *fonaSerial = &Serial1;

// Use this for FONA 800 and 808s
Adafruit_FONA fona = Adafruit_FONA(FONA_RST);
// Use this one for FONA 3G
//Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST);

uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout = 0);

void setup() {
  while (!Serial);

  Serial.begin(115200);
  Serial.println(F("FONA SMS caller ID test"));
  Serial.println(F("Initializing....(May take 3 seconds)"));

  // make it slow so its easy to read!
  fonaSerial->begin(4800);
  if (! fona.begin(*fonaSerial)) {
    Serial.println(F("Couldn't find FONA"));
    while (1);
  }
  Serial.println(F("FONA is OK"));

  // Print SIM card IMEI number.
  char imei[16] = {0}; // MUST use a 16 character buffer for IMEI!
  uint8_t imeiLen = fona.getIMEI(imei);
  if (imeiLen > 0) {
    Serial.print("SIM card IMEI: "); Serial.println(imei);
  }

  fonaSerial->print("AT+CNMI=2,1\r\n");  //set up the FONA to send a +CMTI notification when an SMS is received
  // enable GPRS
  fona.enableGPRS(false);
  Serial.println(F("Disabling GPRS"));
  delay(5000);
  if (!fona.enableGPRS(true)) {
    Serial.println(F("Failed to enable GPRS"));
  }
  Serial.println("FONA Ready");
}

char fonaNotificationBuffer[64];          //for notifications from the FONA
char smsBuffer[250];

void loop() {

  char* bufPtr = fonaNotificationBuffer;    //handy buffer pointer

  if (fona.available())      //any data available from the FONA?
  {
    int slot = 0;            //this will be the slot number of the SMS
    int charCount = 0;
    //Read the notification into fonaInBuffer
    do  {
      *bufPtr = fona.read();
      Serial.write(*bufPtr);
      delay(1);
    } while ((*bufPtr++ != '\n') && (fona.available()) && (++charCount < (sizeof(fonaNotificationBuffer) - 1)));

    //Add a terminal NULL to the notification string
    *bufPtr = 0;

    //Scan the notification string for an SMS received notification.
    //  If it's an SMS message, we'll get the slot number in 'slot'
    if (1 == sscanf(fonaNotificationBuffer, "+CMTI: " FONA_PREF_SMS_STORAGE ",%d", &slot)) {
      Serial.print("slot: "); Serial.println(slot);

      char callerIDbuffer[32];  //we'll store the SMS sender number in here
      char location[32];
      uint16_t returncode;
      float lat, lon;

      fona.getGSMLoc(&returncode, gpsbuffer, 120); //Pulls GPRS Location

      char *lonp = strtok(gpsbuffer, ","); //Begin to parse GPRS location to strings
      char *latp = strtok(NULL, ",");
      lat = atof(latp);                   //convert from string to floats
      lon = atof(lonp);

      char latresult[20] = "";            //char lat+lon results pointer
      char lonresult[20] = "";

      dtostrf(lat, 6, 6, latresult);      //converting lat+lon to latresult+lonresult string
      dtostrf(lon, 6, 6, lonresult);

      String stringgmap, stringlat, stringlon;

      stringgmap = ("https://www.google.com/maps/place/"); //adding strings together
      stringlat += stringgmap;
      stringlat += String(latresult);
      stringlon = String(lonresult);
      stringlat += ",";
      stringlat +=stringlon;                              // strings added to finalchar[]

      char finalchar[60];
      stringlat.toCharArray(finalchar, 60);

      //stringlat += (char)finalchar;

//      char finalresult[35] = ""; // you have to be aware of how long your data can be
//                      // not forgetting unprintable and null term chars
//      sprintf(finalresult,"%d,%d",latresult,lonresult);
//

      Serial.print("GPSLOC TEST:");       // GPRS DEBUG INIT
      Serial.println();
      Serial.print(lat);
      Serial.print(",");
      Serial.print(lon);
      Serial.println();
      Serial.println("STRINGLAT");
      Serial.println(stringlat);
      Serial.println();
      Serial.println("SMS Message:");
      Serial.println(finalchar);      // GPRS DEBUG END

      // Retrieve SMS sender address/phone number.
      if (! fona.getSMSSender(slot, callerIDbuffer, 31)) {
        Serial.println("Didn't find SMS message in slot!");
      }
      Serial.print(F("FROM: ")); Serial.println(callerIDbuffer);

      // Retrieve SMS value.
      uint16_t smslen;
      if (fona.readSMS(slot, smsBuffer, 250, &smslen)) { // pass in buffer and max len!
        Serial.println(smsBuffer);
      }

      //Send back an automatic response
      Serial.println("Sending reponse...");
      if (!fona.sendSMS(callerIDbuffer, finalchar )) {
        Serial.println(F("Failed"));
      } else {
        Serial.println(F("Sent!"));
      }

      // delete the original msg after it is processed
      //   otherwise, we will fill up all the slots
      //   and then we won't be able to receive SMS anymore
      if (fona.deleteSMS(slot)) {
        Serial.println(F("Deleted SMS in slot!"));
      } else {
        Serial.print(F("Couldn't delete SMS in slot ")); Serial.println(slot);
        fona.print(F("AT+CMGD=?\r\n"));
      }
    }
  }
}

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


Major sketch rewrite

Major sketch rewrite

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/tyler-cromwell/Acid.git/'