Added Touchscreen_GUI_Signaling example.

/**************************************************************
 *
 *  Touchscreen_GUI_Template
 *
 *  Use this template as a starting point.
 *  The required libraries "includes" and configuration
 *  sample code is provided to help you quickly create
 *  a working sketch.
 *
 *  This library was developed for Seeedstudio
 *  TouchShield v2.0, based on their TFTv2 and SeeedTouchscreen
 *  libraries.
 *
 *  Comment out lines that are not required for your project.
 *
 *  Author: Jose Rullan
 *
 *************************************************************/

// Required includes
#include <SPI.h>

// TouchscreenGUI includes
#include <Button.h>

// Create the objects
//==========================================
Canvas canvas = Canvas(); // Memory used: (storage/ram: 1,676/36)  3,372/228
Button btnLed = Button(20,BLACK,BLACK,GRAY2); // Memory used: (storage/ram: 3,624/63)  6,996/291
Button btnLeft = Button(80,40,GRAY1,BLACK,GRAY2); // Memory used: (storage/ram: 3,624/63)  6,996/291
Button btnRight = Button(80,40,GRAY1,BLACK,GRAY2); // Memory used: (storage/ram: 3,624/63)  6,996/291
Button btnHazard = Button(80,40,GRAY1,BLACK,GRAY2); // Memory used: (storage/ram: 3,624/63)  6,996/291

// Global variables
const int leftPin = 22;
const int rightPin = 24;
bool leftActive = false;
bool rightActive = false;
bool hazardActive = false;
int blinkSpeed = 400;
unsigned long lastTime = 0;

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

  canvas.init(TFT_LANDSCAPE);

  //Configure the widgets
  //=========================================
    //button.setSize(80,40);
    //button.setColors(GRAY1,BLACK,WHITE);

    btnLed.init();

    btnLeft.setText("<-");
    btnLeft.setEventHandler(&btnLeftEventHandler);
    btnLeft.init();

    btnRight.setText("->");
    btnRight.setEventHandler(&btnRightEventHandler);
    btnRight.init();

    btnHazard.setText("<->");
    btnHazard.setEventHandler(&btnHazardEventHandler);
    btnHazard.init();

  // Add widgets to canvas
  // (Use layout template for coordinates)
  //=========================================
  //canvas.add(&btnLed,140,0);
  canvas.add(&btnLeft,55,50);
  canvas.add(&btnRight,185,50);
  canvas.add(&btnHazard,120,150);

  lastTime = millis();
}

void loop() {

  canvas.scan();

  if(btnLeft.touched == true){
    blinkSignal(&leftActive,leftPin);
  }

  if(btnRight.touched == true){
    blinkSignal(&rightActive,rightPin);
  }

  if(btnHazard.touched == true){
    blinkHazard(&hazardActive,leftPin,rightPin);
  }

}

// Event Handler Functions for buttons
// (one per button)
//==========================================
void btnLeftEventHandler(Button* btn){
  leftActive = true;
  if(btn->touched){
    setBackground(btn,GREEN);
  }else{
    setBackground(btn,GRAY1);
    digitalWrite(leftPin,LOW);
  }

  //Deactivate other buttons
  btnRight.touched = false;
  setBackground(&btnRight,GRAY1);
  btnHazard.touched = false;
  setBackground(&btnHazard,GRAY1);

  //Turn off the other LED
  digitalWrite(rightPin,LOW);
}

void btnRightEventHandler(Button* btn){
  rightActive = true;
  if(btn->touched){
    setBackground(btn,GREEN);
  }else{
    setBackground(btn,GRAY1);
    digitalWrite(rightPin,LOW);
  }

  //Deactivate other buttons
  btnLeft.touched = false;
  setBackground(&btnLeft,GRAY1);
  btnHazard.touched = false;
  setBackground(&btnHazard,GRAY1);

  //Turn off the other LED
  digitalWrite(leftPin,LOW);
}

void btnHazardEventHandler(Button* btn){
  if(btn->touched){
    setBackground(btn,GREEN);
  }else{
    setBackground(btn,GRAY1);
    digitalWrite(leftPin,LOW);
    digitalWrite(rightPin,LOW);
  }

  //Deactivate other buttons
  btnLeft.touched = false;
  btnRight.touched = false;
  setBackground(&btnLeft,GRAY1);
  setBackground(&btnRight,GRAY1);
}

// Helper routines
//==========================================
void blinkSignal(bool* signal, int pin){
  if(millis() > lastTime + blinkSpeed){
    if(*signal){
      digitalWrite(pin,HIGH);
    }else{
      digitalWrite(pin,LOW);
    }
    *signal = !*signal;
    lastTime = millis();
  }
}

void blinkHazard(bool* signal, int pin1, int pin2){
  if(millis() > lastTime + blinkSpeed){
    if(*signal){
      digitalWrite(pin1,HIGH);
      digitalWrite(pin2,HIGH);
    }else{
      digitalWrite(pin1,LOW);
      digitalWrite(pin2,LOW);
    }
    *signal = !*signal;
    lastTime = millis();
  }
}

void setBackground(Button* btn, int color){
  btn->setColors(color,btn->fgColor,btn->borderColor);
  btn->show();
}

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


Added sensor control file

Added sensor control file

error: pathspec 'Sensors/Sensor-Main.ino' did not match any file(s) known to git


use symbloci link instead

use symbloci link instead

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


Pitch and Roll Gain Amp

Pitch and Roll Gain Amp

Increased P gain for FW pitch and roll

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/lowjunen/THOR.git/'


Add sketch for emulating a USB gamepad (to make cocktail cabinets compatible with joy to key, and the game lab switcher)

//
// *** Sketch to emulate a USB gamepad with the cocktail cabinet
//     joysticks for use with the UCLA Game Lab switcher.
//
// *** Currently setup assuming a digital (not-analog) joystick
//
// *** This sketch file is for use with Arduino Leonardo and
//     Arduino Micro only.
//
// *** Requires this Arduino library
// https://github.com/MHeironimus/ArduinoJoystickLibrary
//--------------------------------------------------------------------

#include <Joystick.h>

/*
//pin values from keyboard version of sketch
int upPin = 2;
int downPin = 3;
int leftPin = 4;
int rightPin = 5;
int buttonOnePin = 6;
int buttonTwoPin = 7;
int buttonThreePin = 8;
int buttonFourPin = 9;
int buttonFivePin = 10;
int buttonSixPin = 11;
int playerSelectBitOnePin = 12;
int playerSelectBitTwoPin = 13;

*/
#define pinGamepadButtonPairs_SIZE 12
int pinGamepadButtonPairs[] =
{
  6, 3,
  7, 4,
  8, 5,
  9, 0,
  10, 1,
  11, 2
  };

int lastQuitButtonChordState;
#define quitButtonPinChord_LENGTH 3
int quitButtonPinChord[] = { 9,10,11 };
#define USE_QUIT_BUTTON_CHORD true
#define QUIT_JOYSTICK_BUTTON 7

//UP >  DOWN > LEFT > RIGHT
  #define pinJoystickDirectionPins_SIZE 4
  //horizontal -> vertical
int pinJoystickDirectionPins[] =
{
  2,
  3,
  4,
  5
  };

  // Constant that maps the phyical pin to the joystick button.
const int pinToButtonMap = 6;

// Last state of the button
int lastButtonState[pinGamepadButtonPairs_SIZE];//= {0,0,0,0};

void setup() {
  // Initialize Button Pins
  for (int i = 0; i < pinGamepadButtonPairs_SIZE; i+=2)
  {
    int pin = pinGamepadButtonPairs[i];
    pinMode(pin, INPUT_PULLUP);
  }

    for (int i = 0; i < pinJoystickDirectionPins_SIZE; i++)
  {
    int pin = pinJoystickDirectionPins[i];
    pinMode(pin, INPUT_PULLUP);
  }

  pinMode(A0, INPUT_PULLUP);
  // Initialize Joystick Library
  Joystick.begin();
}

void loop() {

  // Read pin values
  for (int i = 0; i < pinGamepadButtonPairs_SIZE; i+=2)
  {
    int pin = pinGamepadButtonPairs[i];
    int joystickButton = pinGamepadButtonPairs[i + 1];
    int currentButtonState = !digitalRead(pin);
    if (currentButtonState != lastButtonState[i])
    {
      Joystick.setButton(joystickButton, currentButtonState);
      lastButtonState[i] = currentButtonState;
    }
  }

  for (int i = 0; i < pinJoystickDirectionPins_SIZE / 2; i++)
  {
    int posPin = !digitalRead(pinJoystickDirectionPins[(2*i)+1]);
    int negativePin = !digitalRead(pinJoystickDirectionPins[(2*i)]);
    int finalAxisVal = 0;
     bool isHorizontal = i == 1;
    if (posPin)
    {

      finalAxisVal = 127;

    }
    else if (negativePin)
    {
      finalAxisVal = -127;
    }

    if (isHorizontal)
      {
        Joystick.setXAxis(finalAxisVal);
      }
      else
      {
        Joystick.setYAxis(finalAxisVal);
      }
  }

  //--- QUIT BUTTON SIMULATED ----
  if (USE_QUIT_BUTTON_CHORD)
  {
    bool currentQuitButtonChordState = true;

    for (int i = 0; i< quitButtonPinChord_LENGTH; i++)
    {
      currentQuitButtonChordState &= !digitalRead(quitButtonPinChord[i]);
    }

    if (currentQuitButtonChordState != lastQuitButtonChordState)
    {
      Joystick.setButton(QUIT_JOYSTICK_BUTTON, currentQuitButtonChordState);
    }

    lastQuitButtonChordState = currentQuitButtonChordState;
  }
    //------

  delay(10);
}

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


Add remote control, rear IR sensor

Add remote control, rear IR sensor

//Analog read pins
const int xPin = 0;
const int yPin = 1;

//to hold the caculated values
int x;
int y;
int z;

// XBEE
#include <XBee.h>

// The address of the Rover XBee
#define ROVER_XBEE_ADDR 0x6524
// #define ROVER_XBEE_ADDR 0xffff

// Create an array for holding the data you want to send.
uint8_t payload[] = { ' ' };

// 16-bit addressing: Enter address of remote XBee, typically the coordinator
Tx16Request tx = Tx16Request(ROVER_XBEE_ADDR, payload, sizeof(payload));
TxStatusResponse txStatus = TxStatusResponse();

// create reusable response objects for responses we expect to handle

// XBeeResponse response = XBeeResponse();
Rx16Response rx16 = Rx16Response();
Rx64Response rx64 = Rx64Response();

uint8_t option = 0;
uint8_t data = 0;

unsigned long last_sent = millis();

XBee xbee = XBee();

enum Direction { FORWARD, BACK, LEFT, RIGHT, STOP };

Direction newDirection = STOP;
Direction currentDirection = STOP;
Direction joystickDirection = STOP;

// Serial movement commands
int serialcom = 0;

// ********** SETUP ***********

void setup () {

  // Serial
  Serial.begin(115200);

  // Create an XBee object at the top of your sketch
  xbee.setSerial(Serial3);

  // Tell XBee to start Serial
  xbee.begin(9600);

  xbeeCheck();

  // Wait 3 seconds
  delay(3000);

  Serial.println("Rover Remote Control Start!");
}

// ********** MAIN ***********

void loop ()
{

  if (!serialcom) {
      newDirection = STOP;
  }

  // Read joystick position data
  int x = analogRead(xPin);
  int y = analogRead(yPin);

  // Output the values
  Serial.print("Joystick x: ");
  Serial.print(x);
  Serial.print(" | y: ");
  Serial.println(y);

  // Forward: 25 < x < 70
  // Backwards: 300 < x < 350
  // Left: 300 <  y < 350
  // Right: 25 < y < 70

  // Decide which direction to go

  if ( y >= 700 ) {
     newDirection = FORWARD;
     serialcom = 0;
  }

  if ( y<= 200 ) {
     newDirection = BACK;
     serialcom = 0;
  }

  if (newDirection == STOP) {
    if ( x <= 100 ) {
       newDirection = LEFT;
       serialcom = 0;
    }

    if ( x >= 700  ) {
       newDirection = RIGHT;
       serialcom = 0;
    }
  }

  // Read serial data if available and if there isn't a joystick position
  if (Serial.available() > 0) {
      // read the incoming byte:
      int incomingByte = Serial.read();

      switch (incomingByte) {

          case 'U':
            newDirection = FORWARD;
            serialcom = 1;
            break;

          case 'D':
            newDirection = BACK;
            serialcom = 1;
            break;

          case 'L':
            newDirection = LEFT;
            serialcom = 1;
            break;

          case 'R':
            newDirection = RIGHT;
            serialcom = 1;
            break;

          case 'e':
            newDirection = STOP;
            serialcom = 0;
            break;
      }
   }

  // Send the command to the rover
  if (newDirection != currentDirection) {

     switch (newDirection) {

       case FORWARD:
            Serial.println("Go forward!");
            sendCommand('W');
            break;

       case BACK:
            Serial.println("Go back!");
            sendCommand('S');
            break;

       case LEFT:
            Serial.println("Go left!");
            sendCommand('A');
            break;

       case RIGHT:
            Serial.println("Go right!");
            sendCommand('D');
            break;

       case STOP:
            Serial.println("STOP!");
            sendCommand(' ');
            break;

     }

     currentDirection = newDirection;
  }

  delay(250); //just here to slow down the serial output - Easier to read

}

// ********** FUNCTIONS ***********

void sendCommand(char cmd)
{

  payload[0] = cmd;
  Serial.print("Sending cmd: [");
  Serial.print(cmd);
  Serial.println("]");

  // 16-bit addressing: Enter address of remote XBee, typically the coordinator
  Tx16Request tx = Tx16Request(ROVER_XBEE_ADDR, payload, sizeof(payload));

  xbee.send(tx);

      // after sending a tx request, we expect a status response
      // wait up to 5 seconds for the status response
      if (xbee.readPacket(5000)) {
        // got a response!

        // should be a znet tx status
    	if (xbee.getResponse().getApiId() == TX_STATUS_RESPONSE) {
    	   xbee.getResponse().getZBTxStatusResponse(txStatus);

    	   // get the delivery status, the fifth byte
           if (txStatus.getStatus() == SUCCESS) {
            	// success.  time to celebrate
                Serial.println("success!");
           } else {
            	// the remote XBee did not receive our packet. is it powered on?
               Serial.println("did not receive packet");
           }
        }
      } else if (xbee.getResponse().isError()) {
        Serial.print("error reading packet.  Error code: ");
        Serial.println(xbee.getResponse().getErrorCode());
        // or flash error led
      } else {
        // local XBee did not provide a timely TX Status   Radio is not configured properly or connected
        Serial.println("unknown error");
      }

}

void xbeeCheck()
{

}

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


Add parameterized commands to start to set heat parameters and output in BLE.

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


Hello World :)

Hello World :)

void setup() {
  // put your setup code here, to run once:
  // Patrick's new Project
}

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

}

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


NLMS

NLMS

Rev1

/* NLMS Acousitc Echo Cancelation
 * Copyright (c) 2016, Sergey Makitrin, Kyler Fillerup
 *
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice, development funding notice, and this permission
 * notice shall be included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

// Microphone to Speaker output
#define NUMEL(x) (sizeof(x)/sizeof((x)[0])) // retuns/calculates the size of an array

#include "NLMS.h"
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

//*****functions**********
void getBuffer1();
void playData();
void displayData();
void NLMS_AEC();

// GUItool: begin automatically generated code
AudioInputI2S            Mic;           //microphone
AudioPlayQueue           MicMem;         //queue for microphone
AudioRecordQueue         Memory;
AudioOutputI2S           headphones;           //output
AudioConnection          patchCord1(Mic, 0, Memory, 0);
AudioConnection          patchCord2(MicMem, 0, headphones,0);
AudioConnection          patchCord3(MicMem, 0, headphones,1);
AudioControlSGTL5000     sgtl5000_1;     //xy=339.6666564941406,285.6666488647461

const int numBlocks = 2; //min block size is 2!!!!!!
const int lFilt = numBlocks-1;
const int gg = lFilt*128;
int16_t *pAddr; //pointer to 128 block of getBuffer
int16_t lblock = numBlocks*128; //length of arrays
int16_t ablock[128*numBlocks];  // set an array block
int16_t error[128];
int16_t *Perror;
int16_t *pablock; // pointer to an array block
int16_t *pp; // pointer to getBuffer
int n;
unsigned long time1; // time variable

//***************NMLS const and settings*************************
const int16_t numTaps = gg;
int16_t mu = 13;
int16_t mu0 = 0;
int8_t psi = 1;
int16_t w[numTaps];
int16_t *pw; // pointer to w
int16_t yhat = 0;
int64_t xtdl = 0;

//define input/source
const int micInput = AUDIO_INPUT_MIC;

void setup() {
  memset(w,0,numTaps);
  memset(ablock,100,128*numBlocks*2);
  memset(error,0,128);
  //initialize pointers for NLMS
  pw = w;
  Perror = error;
  Serial.begin(9600); // initiate baud rate for serial comm.
  AudioMemory(8); // allocate # of audio memory (each block has 128 sample of data)
  sgtl5000_1.enable(); // enalbe
  sgtl5000_1.volume(0.5); // output volume
  sgtl5000_1.inputSelect(micInput); //input selection (mic or line in)
  sgtl5000_1.micGain(26); // mic gain
  //set array values to zero
  pablock = ablock; // assign pointer to array
  delay(1000);
}

//***************************MAIN LOOP********************************************************************
void loop() {
//Serial.println(millis()); // print time
getBuffer1(numBlocks); //returns pointer to the buffered data
//print sample to serial plotter
//displayData(pablock); // print data to serial plotter
//NLMS_AEC(pablock,pablock);
//for(int i = 0; i<128;i++){
//  Serial.println(w[i]);
//}
}
//*********************************************************************************************************
// print data to serial plotter
void displayData(int16_t * data){
  for(int i = 0; i<128*numBlocks;i++){
  Serial.println(*(data+i));
}
}
// play data to speaker
void playData(int16_t *data, int i){
    pAddr = MicMem.getBuffer(); //get pointer to 128 array playBuffer
    // take one block from buffer array (ablock) and copy it to playBuffer pointer
    // play that block
    memcpy((byte*)pAddr,(byte*)data+(256*i),256);
    MicMem.playBuffer();
}

// buffer an array with samples from Microphone
// function receives and array and integer indicating number of blocks
void getBuffer1(int x) {
  Memory.begin(); // begin putting sample data into memory
  int l = 0;
  memcpy((byte*)pablock,(byte*)pablock+256,256*(x-1));
  // put 128 blocks of sample into an array size of 128*(number of blocks)
    while(l == 0){ // wait until block samples are available
      if(Memory.available() ==1) {// if availabe copy 128 block to array and get out of while loop
        //read one 128 block of samples and copy it into array
        memcpy((byte*)pablock+(256*(x-1)),Memory.readBuffer(),256);
        Memory.freeBuffer(); // free buffer memory
//        NLMS_AEC(pablock,pablock);
//        playData(Perror,0); // play 128 block from buffered array
        l = 1; // set n to 1 to get out of while loop
      }//end if
    }//end while
    NLMS_AEC(pablock,pablock);
    playData(Perror,0); // play 128 block from buffered array
    l = 0;
   Memory.clear(); // clear all audio memory
   Memory.end();
//   return ablock; // regurn pointer to array
}

// NMLS algorithm
// inputs are Mic Signal, far end signal and index of n-1 block wher n is the current block itteration
// previous block data is used to modify current block data samples
void NLMS_AEC(int16_t *Mic, int16_t *x){
  for(int h = 0; h<128;h+=1){
    for(int j = gg; j>0;j-=1){
      yhat += (x[j+h]*pw[gg-j])/32768;
      xtdl += x[j+h]*x[j+h];
    }
    error[h] = Mic[gg+h]-yhat;
    yhat = 0;
    xtdl = xtdl + psi;
    mu0 = (67108864*mu)/xtdl;
    xtdl = 0;

    //update filter taps
    for(int j = 0; j<gg;j+=1){
    pw[j] = pw[j] + (x[gg-j+h]*mu0*error[h])/131072;
    }//end for
  }//end for outer
}// end NLMS_AEC


Create possible.ino

Create possible.ino

// SYNTAX
//form spark community https://community.spark.io/t/tcp-connection-to-private-server-spark-core-as-tcp-client/4823/9

//TCPClient client;
// EXAMPLE USAGE

TCPClient client;
byte server[] = { 192, 168, 164, 3 }; // Google
void setup()
{
Serial.begin(9600);
delay(1000);
Serial.println("connecting...");

if (client.connect(server, 2088))
{
Serial.println("connected");
client.println("GET /search?q=unicorn HTTP/1.0");
client.println("Host: www.google.com");
client.println("Content-Length: 0");
client.println();
}
else
{
Serial.println("connection failed");
}
}

void loop()
{
if (client.available())
{
Serial.println("connected");
char c = client.read();
Serial.print(c);
}

if (!client.connected())
{
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
{
Serial.println("connection failed");
}
}
}

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


Implemented motor control

Implemented motor control

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


Did a bunch of class tybluServo stuff that really needs to move to its own file.

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


Created a finite state machine to using a buttin cycle through the states.

const int buttonPin = 8;     // the number of the pushbutton pin
const int numberOfStates = 3;

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status
int currentState = numberOfStates - 1;
bool buttonPressed;

void setup() {
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);

  Serial.begin(9600);

}

void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
    buttonPressed = true;
  } else {
    if (buttonPressed) {
      currentState = (currentState + 1) % numberOfStates;
      buttonPressed = false;
      Serial.print("Pressed!");
      Serial.print("  ");
      Serial.println(currentState);
    } else {
      buttonPressed = false;
    }

  }
}

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


Added ConsolePixel example

Added ConsolePixel example

/*
  Console Pixel

 An example of using the Arduino board to receive data from the
 Console on the Arduino Yun.  In this case, the Arduino boards turns on an LED when
 it receives the character 'H', and turns off the LED when it
 receives the character 'L'.

 To see the Console, pick your Yun's name and IP address in the Port menu
 then open the Port Monitor. You can also see it by opening a terminal window
 and typing
 ssh root@ yourYunsName.local 'telnet localhost 6571'
 then pressing enter. When prompted for the password, enter it.

 The circuit:
 * LED connected from digital pin 13 to ground

 created 2006
 by David A. Mellis
 modified 25 Jun 2013
 by Tom Igoe

 This example code is in the public domain.

 */
#include <Console.h>

const int ledPin = 13; // the pin that the LED is attached to
char incomingByte;      // a variable to read incoming Console data into

void setup() {
  // initialize Console communication:
  Bridge.begin();
  Console.begin();
  while(!Console);  // wait for the Console to open from the remote side
  Console.println("type H or L to turn pin 13 on or off");
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // see if there's incoming Console data:
  if (Console.available() > 0) {
    // read the oldest byte in the Console buffer:
    incomingByte = Console.read();
    Console.println(incomingByte);
    // if it's a capital H (ASCII 72), turn on the LED:
    if (incomingByte == 'H') {
      digitalWrite(ledPin, HIGH);
    }
    // if it's an L (ASCII 76) turn off the LED:
    if (incomingByte == 'L') {
      digitalWrite(ledPin, LOW);
    }
  }
}

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


Envelope noise floor variable added to muscle SS

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


added SerialTest arduino sketch

added SerialTest arduino sketch

/*
	Adruino sketch to test serial communication with mono
*/
void setup()
{
	Serial.begin(9600);
}

void loop()
{
	analyse();
}

char com[20];
char inChar=-1;
byte index=0;

void analyse()
{
	while (Serial.available() > 0)
	{
		if(index < 19)
		{
			inChar = Serial.read();
			com[index] = inChar;
			index++;
			com[index] = '\0';
		}
	}

	if (strcmp(com,"Hello") == 0)
	{
		Serial.write("Hi");
	}
	if ( strcmp(com,"How are you") == 0 )
	{
		Serial.write("good and you?");
	}
	Serial.flush();
	memset(com, 0, sizeof(com));
	index = 0;
	inChar=-1;
}

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


Modified to output data to serial, and slowed down to allow for more accurate multimeter measurements during operation.

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


dPIN 8 = LOW, reads/Tx all sensors slow. dPIN 8 = HIGH reads/tx CH0 fast

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/reynal74/sensor_projects.git/'


Sketch to test the time taken to read the temperature from the DS18B20 sensors

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


add REST interface to LED strip

add REST interface to LED strip

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


add minimum ppg sensor

add minimum ppg sensor

#include <FreqCounter.h>

void setup() {
  Serial.begin(115200);                    // connect to the serial port
}

long int frq;
void loop() {

 FreqCounter::f_comp= 12;             // Set compensation to 12
 FreqCounter::start(10);            // Start counting with gatetime of 100ms
 while (FreqCounter::f_ready == 0)         // wait until counter ready

 frq=FreqCounter::f_freq;            // read result
 Serial.println(frq);                // print result
 delay(4);
}

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


Lightweight sketch

Lightweight sketch

/*
  This is a minimal sketch without using the library at all but only works for
  the 10 pole dip switch sockets. It saves a lot of memory and thus might be
  very useful to use with ATTinys :)

  http://code.google.com/p/rc-switch/
*/

int RCLpin = 7;

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

void loop() {
    RCLswitch(0b010001000001);  // DIPs an Steckdose: 0100010000 An:01
    delay(2000);

    RCLswitch(0b010001000010);  // DIPs an Steckdose: 0100010000 Aus:10
    delay(2000);
}

void RCLswitch(uint16_t code) {
    for (int nRepeat=0; nRepeat<6; nRepeat++) {
        for (int i=4; i<16; i++) {
            RCLtransmit(1,3);
            if (((code << (i-4)) & 2048) > 0) {
                RCLtransmit(1,3);
            } else {
                RCLtransmit(3,1);
            }
        }
        RCLtransmit(1,31);
    }
}

void RCLtransmit(int nHighPulses, int nLowPulses) {
    digitalWrite(RCLpin, HIGH);
    delayMicroseconds( 350 * nHighPulses);
    digitalWrite(RCLpin, LOW);
    delayMicroseconds( 350 * nLowPulses);
}

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


Arduino client sketch

Arduino client sketch

Using Ethernet shield and N buttons

/*

  XTRM feedback system
  Arduino client

  This sketch detects button click and
  sends data to the server through TCP

  Using - Ethernet shield
      - 4 buttons

 */

#include <SPI.h>
#include <Ethernet.h>

byte macAddress[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x23, 0x58 };
IPAddress server(192, 168, 1, 50); // Server IP address
int serverPort = 3001; // Server port

// Ethernet TCP client
EthernetClient client;

// Starts ethernet connection
void setupEthernet() {
  // Automatic IP, DNS, gateway and subnet mask
  Ethernet.begin(macAddress);
  delay(1000);

  Serial.println("Device connected: " + Ethernet.localIP());

  // Attempt server connection
  if (client.connect(server, serverPort)) {
      Serial.println("Connected to the server!");
  }
  else {
    Serial.println("Failed connection to the server");
  }
}

void setup() {

  // Start serial connection
  Serial.begin(9600);
  Serial.println("Connecting to the server...");

  // Setup ethernet connection
  setupEthernet();

}

void loop() {
  // Check if connection is still valid
  checkServerConnection();

  // Get the pressed button id
  int pressedButtonId = checkPressedButton();

  // Send the feedback!
  if (pressedButtonId > -1) {
      sendFeedback(pressedButtonId);
  }
}

// Returns the id (0...3) of the last pressed button
int checkPressedButton() {
  // TODO
}

void sendFeedback(int buttonId) {
  // Create CSV payload
  String payload = "arduinoUnoAgnagnu;" + buttonId;

  Serial.println(payload);

  // Send data
  client.println(payload);
}

// Stops the client if connection is lost
void checkServerConnection() {
  if (!client.connected()) {
    Serial.println();
    Serial.println("Server disconnected");
    client.stop();

    while (true) ;
  }
}

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


Add example of retain usage

Add example of retain usage

/***************************************************
  Adafruit MQTT Library Retain Flag Example

  This example demonstrates use of the retain flag when publishing messages.
  If retain is set, the MQTT broker will store the message. When a new
  client subscribes to the topic, the retained message will be republished
  to that client. This is useful for configuration messages and 'last known
  good' values.

  Written by Ben Willmore.
  MIT license, all text above must be included in any redistribution
 ****************************************************/

#include <ESP8266WiFi.h> // use <WiFi.h> for ESP32
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"

/************************* WiFi Access Point *********************************/

#define WLAN_SSID       "...your SSID..."
#define WLAN_PASS       "...your password..."

/************************* Adafruit.io Setup *********************************/

#define MQTT_SERVER "...your MQTT server..."
#define MQTT_SERVERPORT 1883 // use 8883 for SSL
#define MQTT_USERNAME "MQTT username"
#define MQTT_KEY "MQTT key"
#define DEVICE_ID "mqtt-retain-example"

/************ Global State (you don't need to change this!) ******************/

// Create a WiFiClient class to connect to the MQTT server.
WiFiClient client;
// or... use WiFiClientSecure for SSL
//WiFiClientSecure client;

// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
Adafruit_MQTT_Client mqtt(&client, MQTT_SERVER, MQTT_SERVERPORT, MQTT_USERNAME, MQTT_KEY);

/****************************** Feeds ***************************************/

// Set up for publishing and subscribing to the same feed, for demonstration only
Adafruit_MQTT_Publish publish_feed = Adafruit_MQTT_Publish(&mqtt, DEVICE_ID "/temp");
Adafruit_MQTT_Subscribe subscribe_feed = Adafruit_MQTT_Subscribe(&mqtt, DEVICE_ID "/temp");

/*************************** Sketch Code ************************************/

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

  Serial.println(F("MQTT retain flag demo"));

  // Connect to WiFi access point.
  Serial.println(); Serial.println();
  Serial.print("Connecting to ");
  Serial.println(WLAN_SSID);

  WiFi.begin(WLAN_SSID, WLAN_PASS);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println();

  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

  // Connect to MQTT broker, then publish a retained message and a
  // non-retained message.
  Serial.print("\nConnecting to MQTT broker...");
  MQTT_connect();
  Serial.println("connected");

  Serial.println("Publishing messages while not subscribed");
  publish_feed.publish("This message should be retained", true);
  publish_feed.publish("This message should not be retained");

  Serial.println("Disconnecting from MQTT broker\n");
  mqtt.disconnect();

  subscribe_feed.setCallback(subscribe_callback);
  mqtt.subscribe(&subscribe_feed);
}

void subscribe_callback(char *data, uint16_t len) {
  Serial.print("--> Message received: \"");
  Serial.print(data);
  Serial.println("\"\n");
}

void loop() {

  // Connect to MQTT broker. We should receive the retained message only.
  Serial.println("Connecting to broker. Expect to receive retained message:");
  MQTT_connect();

  mqtt.processPackets(1000);

  Serial.println("Publishing non-retained message. Expect to receive it immediately:");
  publish_feed.publish("This message should be received immediately but not retained");

  mqtt.processPackets(1000);

  Serial.println("Publishing retained message. Expect to receive it immediately and on re-subscribing:");
  publish_feed.publish("This message should be received immediately AND retained", true);

  mqtt.processPackets(10000);

  Serial.println("Disconnecting from broker\n");
  mqtt.disconnect();

  delay(15000);
}

// Function to connect and reconnect as necessary to the MQTT server.
// Should be called in the loop function and it will take care if connecting.
void MQTT_connect() {
  int8_t ret;

  // Stop if already connected.
  if (mqtt.connected()) {
    return;
  }

  uint8_t retries = 3;
  while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected
       Serial.println(mqtt.connectErrorString(ret));
       Serial.println("Retrying MQTT connection in 5 seconds...");
       mqtt.disconnect();
       delay(5000);  // wait 5 seconds
       retries--;
       if (retries == 0) {
         // basically die and wait for WDT to reset me
         while (1);
       }
  }
}

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


firmware add calibrate for 3 sensors

firmware add calibrate for 3 sensors

/* 3 sensors VWC audo calibrate sample code
 *  Features:
 *    load/save VWC boundry value at EEPROM address 0 ( size = 2* int )
 *    Press button to start/stop calibrate mode.
 *    Calibrating with LED on
 *
 *  Connection:
 *    Button : D2, default high
 *    VWC sensor: A3,A4,A5
 *    LED 13, embedded
 *
 *  Behavior:
 *    per second print out
 *    (Sensor_ADC, VWC(%), Bound_Down, Bound_Top )*3
 *
 *  Calibrate procedure:
 *    Power On
 *    Press Button - see LED on
 *    In any sequence in the Air and Water. Suggest have 10 seconds in each state
 *    Press Button - see LED off
 *
 *  Detail:
 *    Without calibrate, the default value is DEF_TOP, DEF_DOWN
 *    Calibrate start initial bound to CALINIT_TOP, CALINIT_DOWN
 *    Sensor : http://www.icshop.com.tw/product_info.php/products_id/24987
 *
 *  Author: Wuulong 2017/4/24
 */
#include <EEPROM.h>

#define PIN_BUTTON 2
#define PIN_LED 13
#define CALINIT_TOP 400
#define CALINIT_DOWN 350
#define DEF_TOP 520
#define DEF_DOWN 261
#define VWC_CNT 3
struct ADC_Bound {
  int v_top; // value sense at air
  int v_down; // value sense at water
};
ADC_Bound bound[VWC_CNT];
int pin_vwc[VWC_CNT] = {A3,A4,A5};
int mode =0; //mode 0: normal mode , mode 1: calibrate mode
int count=0; // lopp count

void save_setting(){
  for(int i=0;i<VWC_CNT;i++){
    EEPROM.put(0+i*sizeof(ADC_Bound), bound[i]);
  }
}
void load_setting(){
  for(int i=0;i<VWC_CNT;i++){
    EEPROM.get(0+i*sizeof(ADC_Bound), bound[i]);

    if(bound[i].v_top==0 || bound[i].v_down ==0 ){
      bound[i].v_top = DEF_TOP;
      bound[i].v_down = DEF_DOWN;
    }
  }
}

void setup() {
  Serial.begin(115200);
  pinMode(PIN_BUTTON,INPUT);
  for(int i=0;i<VWC_CNT;i++){
    pinMode(pin_vwc[i],INPUT);
    bound[i].v_top = DEF_TOP;
    bound[i].v_down = DEF_DOWN;
  }
  pinMode(PIN_LED,OUTPUT);
  load_setting();

}

void sensing(){
  // sense and pring
  int val[VWC_CNT];
  float vwc[VWC_CNT];

  for(int i=0;i<VWC_CNT;i++){
    val[i] = analogRead(pin_vwc[i]); //connect sensor to Analog 0
    if( mode == 1 ){
      if(val[i]> bound[i].v_top) bound[i].v_top = val[i];
      if(val[i]< bound[i].v_down ) bound[i].v_down = val[i];
    }

    vwc[i] = 1.0-((float(val[i])-bound[i].v_down)/(bound[i].v_top-bound[i].v_down));
  //Serial.println(vwc*100); //print the value to serial port
  Serial.print(val[i]); Serial.print(",");
  Serial.print(vwc[i]*100); Serial.print(",");
  Serial.print(bound[i].v_down); Serial.print(",");
  Serial.print(bound[i].v_top);
  if(i != VWC_CNT-1 ) Serial.print(",");
  }
  Serial.println("");

}
void mode_check_and_run(){
  int btn_state;
  //detect if btn click
  btn_state = digitalRead(PIN_BUTTON);
  if( btn_state ==0 ){ // button down
    mode = 1- mode;
    if( mode == 0 ){ // cal complete
      Serial.println("Calibrate Complete!");
      digitalWrite(PIN_LED,0);
      save_setting();
    }else{ //mode = 1 , cal start
      Serial.println("Calibrate Start!");
      digitalWrite(PIN_LED,1);
      for(int i=0;i<VWC_CNT;i++){
        bound[i].v_top = CALINIT_TOP;
        bound[i].v_down = CALINIT_DOWN;
      }
    }
    delay(500); // to avoid single click with multiple action
  }

}
/*
 * normal mode sensor to console every 1 second
 */
//

void loop() {
  mode_check_and_run();
  if(count % 20 == 0 ){
    sensing();
  }
  count++;
  delay(50);
}

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


one-button-keyboard

one-button-keyboard

const int port_num = 2;

void setup() {
  pinMode(2, INPUT_PULLUP);
  Keyboard.begin();
}

void loop() {
  // wait for falling edge on pin 9
  while(digitalRead(port_num));

  // send keystroke
  Keyboard.press('w');

  delay(50);

  Keyboard.releaseAll();

  // wait for rising edge on pin 9
  while(!digitalRead(port_num));

  delay(50);
}

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


Add files via upload

Add files via upload

Believe this is the final version in use.. includes ip authorization for a little security.. Power is shut down at night anyways but didn't want keyboard jockeys finding the page and possibly operating the door without being to visibly see the door operation..

 /*--------------------------------------------------------------
 Program:      eth_websrv_Door_control

 Description:  Arduino web server that shows controls for operating 3 garage doors.
 there is open,stop, and close for each door.

 Hardware:     Arduino Uno and official Arduino Ethernet
 shield. Should work with other Arduinos and
 compatible Ethernet shields.
 1Gb micro SD card formatted FAT16.
 D5-D6-D7 for door 1, A0-A2 for door 2, A3-A5 for door 3
 Ethernet shield has reset pin and rest on ICSP header removed.. Reset is wired to D8..
 This is to reset ethernet on powerup otherwise you must reset manually everytime..

 Software:     Developed using Arduino 1.0.5 software
 Should be compatible with Arduino 1.0 +
 SD card contains web page called index.htm

 References:   - WebServer example by David A. Mellis and
 modified by Tom Dupras  tek1229@yahoo.com
 - SD card examples by David A. Mellis and Tom Igoe
 - Ethernet library documentation:
 http://arduino.cc/en/Reference/Ethernet
 - SD Card library documentation:
 http://arduino.cc/en/Reference/SD

 Date:         4 April 2013
 Modified:     11 Jan 2014
 - removed use of the String class

 Author:       W.A. Smith, http://startingelectronics.com
 Modified by Thomas Dupras on Jan 22nd,2014
 this revision also checks for ip address and uses the last number to verify authorized users.. not the best but it works for what is needed..
 --------------------------------------------------------------*/

#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>
// size of buffer used to capture HTTP requests
#define REQ_BUF_SZ   60

// MAC address from Ethernet shield sticker under board
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // should be changed to something else
IPAddress ip(10, 16, 246, 211); // IP address, may need to change depending on network
EthernetServer server(80);  // create a server at port 80
File webFile;               // the web page file on the SD card
char HTTP_req[REQ_BUF_SZ] = {
  0}; // buffered HTTP request stored as null terminated string
char req_index = 0;              // index into HTTP_req buffer
int LED_state[8] = {0}; // stores the states of the LEDs
byte rip[] = { 0,0,0,0 };  // rip[] is the returned ip address of client requesting
boolean key=false;

void setup()
{
  // disable Ethernet chip
  pinMode(10, OUTPUT);
  digitalWrite(10, HIGH);

  Serial.begin(9600);       // for debugging
  //Serial.println(F("Ip Address is 10.16.246.11"));
  // initialize SD card
     if (!SD.begin(4)) {
    Serial.println(F("ERROR - SD init failed!"));
    return;    // init failed
  }
  //Serial.println(F("SUCCESS - SD card initialized."));
  // check for index.htm file
  if (!SD.exists("index.htm")) {
    Serial.println(F("ERROR!"));
    return;  // can't find index file
  }
  Serial.println(F("SUCCESS - Found index.htm"));
  // door outputs turning them high before using pinMode keeps them from twitching on startup..
  PORTD = PORTD | B11100000; // sets digital pins 7,6,5 HIGH
  PORTC = PORTC | B00111111; // sets analog pins 2,1,0 HIGH

DDRD = DDRD | B11100000; // turns 5,6,7 into outputs..
DDRC = DDRC | B00111111; // turns analog 0-5 into outputs..
  pinMode(8, OUTPUT); // reset ethernet shield output
  digitalWrite(8,LOW); // reset ethernet
  delay(200);
  digitalWrite(8,HIGH); // done resetting
  delay(200);
  pinMode(8, INPUT); // pin 8 into input in case reset is pushed so pin isn't shorted out..
  delay(2000);

  Ethernet.begin(mac, ip);  // initialize Ethernet device
  server.begin();           // start to listen for clients
}

void loop()
{
  EthernetClient client = server.available();  // try to get client

  if (client) {  // got client?
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {   // client data available to read
        char c = client.read(); // read 1 byte (character) from client
        // limit the size of the stored received HTTP request
        // buffer first part of HTTP request in HTTP_req array (string)
        // leave last element in array as 0 to null terminate string (REQ_BUF_SZ - 1)
        if (req_index < (REQ_BUF_SZ - 1)) {
          HTTP_req[req_index] = c;          // save HTTP request character
          req_index++;
        }
        // last line of client request is blank and ends with \n
        // respond to client only after last line received
        if (c == '\n' && currentLineIsBlank) {
          client.getRemoteIP(rip); // where rip is defined as byte rip[] = {0,0,0,0 };
          checkIP();

          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          // remainder of header follows below, depending on if
          // web page or XML page is requested
          // Ajax request - send XML file
          if (key== true && StrContains(HTTP_req, "ajax_inputs")) {
            // send rest of HTTP header
            client.println("Content-Type: text/xml");
            client.println("Connection: keep-alive");
            client.println();
            SetLEDs();  // parse the http get request and control outputs accordingly
                     }
          else  {  // web page request
            // send rest of HTTP header
            client.println("Content-Type: text/html");
            client.println("Connection: keep-alive");
            client.println();
            // send web page
            if (key == true) webFile = SD.open("index.htm");        // open web page file
            else webFile = SD.open("BadIP.htm"); // if not autorized by IP then an error page is displayed..
            if (webFile) {
              while(webFile.available()) {
                client.write(webFile.read()); // send web page to client
              }
              webFile.close();
            }
          }

          // display received HTTP request on serial port uncomment below  to view
          // Serial.print(HTTP_req);
          req_index = 0; // reset index
          StrClear(HTTP_req, REQ_BUF_SZ); // clear buffer
          break;
        }

        // every line of text received from the client ends with \r\n
        if (c == '\n') {
          // last character on line of received text
          // starting new line with next character read
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // a text character was received from client
          currentLineIsBlank = false;
        }
      } // end if (client.available())
    } // end while (client.connected())
    delay(1);      // give the web browser time to receive the data
    client.stop(); // close the connection
  } // end if (client)
  Relaysoff();
}

// checks if received HTTP request is switching on/off LEDs
// also saves the state of the LEDs

// sets every element of str to 0 (clears array)
void StrClear(char *str, char length)
{
  for (int i = 0; i < length; i++) {
    str[i] = 0;
  }
}

// searches for the string sfind in the string str
// returns 1 if string found
// returns 0 if string not found
char StrContains(char *str, char *sfind)
{
  char found = 0;
  char index = 0;
  char len;

  len = strlen(str);

  if (strlen(sfind) > len) {
    return 0;
  }
  while (index < len) {
    if (str[index] == sfind[found]) {
      found++;
      if (strlen(sfind) == found) {
        return 1;
      }
    }
    else {
      found = 0;
    }
    index++;
  }

  return 0;
}

void checkIP()  // I want to use this to identify ip addresses of computers connecting.. I can log them or disallow access if unknown.. This can be bypassed but this is simple security..
{
  // client.getRemoteIP(rip); // where rip is defined as byte rip[] = {0,0,0,0 };
  if (rip[3] == 14 || rip[3] == 48 || rip[3] == 23 || rip[3] == 30 || rip[3]== 25 || rip[3] == 65) key=true;
  else key=false; // the numbers above are the last segments of the ip's of trusted computers.. 5 computers..
  //client.getRemoteIP(rip); // where rip is defined as byte rip[] = {0,0,0,0 };
  //Serial.print("IP is:");
  //Serial.println(rip[3]);
}
void Relaysoff()

{

  if(LED_state[0] == 0)   digitalWrite(5, HIGH); // door 1 open
  else LED_state[0]--; // subtracts 1 from LED+state[] kind of a timer to hold the led on slightly

  if(LED_state[1] == 0)   digitalWrite(6, HIGH); // door 1 stop
  else LED_state[1]--;

  if(LED_state[2] == 0)   digitalWrite(7, HIGH); // door 1 close
  else LED_state[2]--;

  if(LED_state[3] == 0)   digitalWrite(A0, HIGH); // door 2 open
  else LED_state[3]--;

  if(LED_state[4] == 0)   digitalWrite(A1, HIGH); // door 2 stop
  else LED_state[4]--;

  if(LED_state[5] == 0)   digitalWrite(A2, HIGH); // door 2 clos
  else LED_state[5]--;

  if(LED_state[6] == 0)   digitalWrite(A3, HIGH); // door 3 open
  else LED_state[6]--;

  if(LED_state[7] == 0)   digitalWrite(A4, HIGH); // door 2 stop
  else LED_state[7]--;

  if(LED_state[8] == 0)   digitalWrite(A5, HIGH); // door 3 close
  else LED_state[8]--;

}
void SetLEDs(void)
{
  // door 1
  if (StrContains(HTTP_req, "d1=1")) { // door 1 open
    LED_state[0] =2550;  // save LED state
    digitalWrite(5, LOW); // door 1 open
    Serial.println(F("Door1 open"));
  }
  if (StrContains(HTTP_req, "d1=2")) { // door 1 stop
    LED_state[1] = 2550;  // save LED state
    digitalWrite(6, LOW); // door 1 stop
    Serial.println(F("Door1 stop"));
  }
  if (StrContains(HTTP_req, "d1=3")) { // door 1 close
    LED_state[2] = 2550;  // save LED state
    digitalWrite(7, LOW); // door 1 close
    Serial.println(F("Door1 close"));
  }
  if (StrContains(HTTP_req, "d2=1")) { // door 2 open
    LED_state[3] = 2550;  // save LED state
    digitalWrite(A0, LOW); // door 1 open
    Serial.println(F("Door2 open"));
  }
  if (StrContains(HTTP_req, "d2=2")) { // door 2 stop
    LED_state[4] = 2550;  // save LED state
    digitalWrite(A1, LOW); // door 1 stop
    Serial.println(F("Door2 stop"));
  }
  if (StrContains(HTTP_req, "d2=3")) { // door 2 close
    LED_state[5] = 2550;  // save LED state
    digitalWrite(A2, LOW); // door 1 close
    Serial.println(F("Door2 close"));
  }

  if (StrContains(HTTP_req, "d3=1")) { // door 3 open
    LED_state[6] = 2550;  // save LED state
    digitalWrite(A3, LOW); // door 3 open
    Serial.println(F("Door3 open"));
  }
  if (StrContains(HTTP_req, "d3=2")) { // door 3 stop
    LED_state[7] = 2550;  // save LED state
    digitalWrite(A4, LOW); // door 3 stop
    Serial.println(F("Door3 stop"));
  }
  if (StrContains(HTTP_req, "d3=3")) { // door 3 close
    LED_state[8] = 2550;  // save LED state
    digitalWrite(A5, LOW); // door 3 close
    Serial.println(F("Door3 close"));
  }

}

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


added code to prescale the chip-clock

added code to prescale the chip-clock


guess it wasn't the final

guess it wasn't the final

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/rosalindfdt/huzzahbadge.git/'


Some testing done in unrelared gargbage at file read

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/JulioOrdonezV/pvcloud.git/'