SxXbee2 hinzugefügt

SxXbee2 hinzugefügt

/*
 * SxXBee2.ino
 *
 *  Created on: 28.08.2015
 *  Changed on: 30.08.2015
 *  Changed on: 04.09.2015   broadcast of power state
 *
 *  Author and Copyright: Michael Blank
 *
 *  reads date from xbee and sends them to SX Bus
 *
 *  !!! SX lib does not work with SoftwareSerial Lib !!!
 *
 *  Hardware: SX-Basisplatine von R.Thamm
 *     + Xbee an RX/TX des Arduino Pro Mini
 */

#include <SX22.h>   // this is the Selectrix library
#include <SX22Command.h>   // this is the Selectrix Command library
#include <XBee.h> // XBee library by Andrew Rapp

#define LED  13   // LED indicator at pin 13

SX sx;                // selectrix library
SXCommand sxcmd;      // holds command data

static int ledState = LOW;
static byte oldSx[MAX_CHANNEL_NUMBER];
long lastPowerSent = 0;    // timer for repeating the power state messages

String inputString = "";         // a string to hold incoming data

static uint8_t track, oldTrack;

uint8_t payload[12] ;   // 12 byte string for sending data to coordinator

// Create an XBee object
XBee xbee = XBee();
XBeeResponse response = XBeeResponse();

// create reusable response objects for responses we expect to handle
ZBRxResponse rx = ZBRxResponse();
ModemStatusResponse msr = ModemStatusResponse();

// Address of receiving XBee
XBeeAddress64 broadcast64;
ZBTxRequest zbTx;
ZBTxStatusResponse txStatus;

void sxisr(void) {
    // if you want to understand this, see:
    // http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1239522239
    sx.isr();
}

void ledToggle() {
    static uint8_t ledState = LOW;
    if (ledState == HIGH) {
       ledState = LOW;
    } else {
       ledState = HIGH;
    }
    digitalWrite(LED, ledState);
}

/** init communication and XBee data package
*/
void setup() {

    Serial.begin(9600);      // for comm with xbee
    pinMode(LED,OUTPUT);     // indicator for rec. packet
    xbee.setSerial(Serial);
    broadcast64 = XBeeAddress64(0, 0x0000FFFF);  //broadcast address
    zbTx = ZBTxRequest(broadcast64, payload, sizeof(payload));  // 64bit address
    zbTx.setAddress16(0xFFFE); // addr16 for broadcast;
    txStatus = ZBTxStatusResponse();

    track = oldTrack = 0;

    // RISING slope on INT0 triggers the interrupt routine sxisr (see above)
    attachInterrupt(0, sxisr, RISING);

    delay(100); // give some time to initalize
}

/** transmit power state as broadcast to all XBees
 *  "P 1" = track power (gleisbit) is on
 *  "P 0" = track power is off
*/
void send_power_state(uint8_t on) {
  for (int i=0; i <12; i++) {
    payload[i]=0;
  }
      payload[0]='P';
      payload[1]= ' ';
      if (on == 1) {
         payload[2] = '1';
      } else {
         payload[2] = '0';
      }
      payload[3]=0;  // string end  */

      xbee.send(zbTx);
}

/** receive loop for:
 *     a) receiving data from XBee Throttles
 *     b) send (regularly) broadcast of power state to XBee Throttles
*/
void loop() {
   xbee.readPacket();
   if (xbee.getResponse().isAvailable()) {
      // got something
      if (xbee.getResponse().getApiId() == ZB_RX_RESPONSE) {
         digitalWrite(LED,HIGH);  // indicate start of received packet
         // got a zb rx packet
         // now fill our zb rx class
         xbee.getResponse().getZBRxResponse(rx);
         String s="";
         for (int i=0; i<rx.getDataLength(); i++) {
            char c = rx.getData(i);
            s += c;
         }

         // interpret SX command from XBee
         int n= s.indexOf(' '); // command split by space
         // example:  "44 31" = set loco #44 to speed 31,
         //                forward, Light=off, F=off
         //       (standard selectrix data format, 8 bit)
         if (n != -1) {
            String ch = s.substring(0,n);
            int i_ch = ch.toInt();
            String s2 = s.substring(n+1,s.length());
            int i_value = s2.toInt();
            do {
 		delay(10);
            } while (sx.set(i_ch,i_value));  // send to SX bus

         }
         digitalWrite(LED,LOW);  // indicate stop of send to SX Bus
      }
   } /* else if (xbee.getResponse().isError()) {
      Serial.println("Error reading packet.  Error code: ");
CURRENTLY NOT HANDLED
   }  ******************************************************/

    // poll trackbit info and send as broadcast at least every 10 secs
    int track = sx.getTrackBit();
    if ((track != oldTrack) || ( (millis() - lastPowerSent) > 10000 ) ){
      oldTrack = track;
      lastPowerSent = millis();
      send_power_state(track);
    }

}

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


gsm lcd

gsm lcd

/*
  LiquidCrystal Library - Hello World

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.

 This sketch prints "Hello World!" to the LCD
 and shows the time.

 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(
                  5,  // RS
                  6,  // EN

                  7,   // D4
                  8,   // D5
                  9,   // D6
                  10    // D7
                  );
/*
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 */

#define		APN 		"internet.vodafone.net"

/*
THIS CODE IS STILL IN PROGRESS!

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

Note that if you need to set a GPRS APN, username, and password scroll down to
the commented section below at the end of the setup() function.
*/
#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];

// 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);

uint8_t type;

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");

  while (!Serial);

  Serial.begin(115200);
  Serial.println(F("Initializing....(May take 3 seconds)"));

  fonaSerial->begin(4800);
  if (! fona.begin(*fonaSerial)) {
    Serial.println(F("Couldn't find FONA"));
    while (1);
  }
  type = fona.type();
  Serial.println(F("FONA is OK"));

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

  // Optionally configure a GPRS APN, username, and password.
  // You might need to do this to access your network's GPRS/data
  // network.  Contact your provider for the exact APN, username,
  // and password values.  Username and password are optional and
  // can be removed, but APN is required.
  //fona.setGPRSNetworkSettings(F("your APN"), F("your username"), F("your password"));
  fona.setGPRSNetworkSettings(F(APN));

  // Optionally configure HTTP gets to follow redirects over SSL.
  // Default is not to follow SSL redirects, however if you uncomment
  // the following line then redirects over SSL will be followed.
  //fona.setHTTPSRedirect(true);

}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
//  lcd.print(millis()/1000);

  // read the RSSI
  uint8_t n = fona.getRSSI();
  int8_t r;

  Serial.print(F("RSSI = "));
  Serial.print(n);
  Serial.print(": ");

  lcd.print(F("RSSI = "));
  lcd.print(n);
//  lcd.print(": ");

  if (n == 0) r = -115;
  if (n == 1) r = -111;
  if (n == 31) r = -52;
  if ((n >= 2) && (n <= 30)) {
    r = map(n, 2, 30, -110, -54);
  }
  Serial.print(r);
  Serial.println(F(" dBm"));

//  lcd.print(r);
//  lcd.print(F(" dBm"));

}

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


finished finally

finished finally

exploration use IR sensor to turn/src/main.ino

error: pathspec 'exploration' did not match any file(s) known to git
error: pathspec 'use' did not match any file(s) known to git
error: pathspec 'IR' did not match any file(s) known to git
error: pathspec 'sensor' did not match any file(s) known to git
error: pathspec 'to' did not match any file(s) known to git
error: pathspec 'turn/src/main.ino' did not match any file(s) known to git


Added updated version with code for RBG LED "blinkenlights".

/*
 * $Id: DHT_Test.ino,v 1.17 2016/01/07 01:23:13 anoncvs Exp $
 *
 * Test program for the AI Thinker "Black board T5", after
 * modification to remove the 8051-based QFP micro and wire
 * the DHT11 sensor and blue LED directly to the ESP8266.
 *
 * Spends most of the time with the ESP8266 in deep-sleep;
 * waking every 10-minutes to read the DHT11 sensor and
 * publish the data to MQTT.
 *
 * NOTE - All user-specific settings (SSID/Passwd, etc)
 *        are in user_config.h.  These settings -MUST-
 *        be customized for -your- network.
 */

#include <ESP8266WiFi.h>
#include <pgmspace.h>
#include <DHT.h>
#include <MQTT.h>
#include "user_config.h"

/* Globals (Terribly bad style, old boy!) */
boolean flgIsConnected = false;	// MQTT connected-to-server flag.
boolean flgIsPublished = false;	// MQTT publish-completed flag.
int BLED = BLED_PIN;		// Blue debug LED (set in user_config.h).
int GLED = GLED_PIN;		// Green debug LED (set in user_config.h).
int RLED = RLED_PIN;		// Red debug LED (set in user_config.h).
char buff[MQ_TOPIC_SIZE];
char clidbuff[15], vbuff[TEMPR_SIZE], tbuff[TEMPR_SIZE], hbuff[TEMPR_SIZE];
float temperature = 0;
float humidity = 0;

/* The following line is required for proper operation of VCC measurements. */
ADC_MODE(ADC_VCC);

/* Initialize the DHT sensor type to DHT11 (pin configured in usr_config.h). */
DHT dht(DHT_PIN, DHT11, 15);

/* Create WiFi client object. */
WiFiClient wclient;

/* NOTE:- All of these values are configured in user_config.h.  */
const byte ip[] = WIFI_IPADDR;
const byte gateway[] = WIFI_GATEWY;
const byte netmask[] = WIFI_NETMSK;
const byte dnssrv[] = WIFI_DNSSRV;

/*
 * Turn on the individual LEDs for a short
 * flash. Note that on the T5 board the LEDs
 * are driven by low-side switches.
 */
void LedFlash(int led_pin) {
    digitalWrite(led_pin, LOW);
    delay(40);
    digitalWrite(led_pin, HIGH);
}

/*
 * Wrappers for individual colour LED flash routine.
 */
void BFlash() {
    LedFlash(BLED);
}
void GFlash() {
    LedFlash(GLED);
}
void RFlash() {
    LedFlash(RLED);
}

/*
 * Show the world we're alive. A short, rapid flash cycle
 * for the blue LED at power-up.
 */
void OnFlash() {
    for (int i = 0; i < 3; i++) {
	BFlash();
	delay(30);
	GFlash();
	delay(30);
	RFlash();
	delay(30);
    }
}

/*
 * Try to get a valid reading from the DHT11 sensor
 * (not always easy).
 */
void getSensorData() {
    temperature = dht.readTemperature();
    humidity = dht.readHumidity();
    while ((isnan(temperature) || isnan(humidity))
	   || (temperature == 0 && humidity == 0)) {
#ifdef DEBUG
	Serial.print(F("!"));
#endif
	delay(500);
	temperature = dht.readTemperature();
	humidity = dht.readHumidity();
    }
#ifdef DEBUG
    Serial.println("");
#endif
}

/*
 *  Create callbacks for the MQTT functions.
 */
void dsConnectedCb() {
#ifdef DEBUG
    Serial.println(F("MQTT connected."));
#endif
    flgIsConnected = true;
}

void dsDisconnectedCb() {
#ifdef DEBUG
    Serial.println(F("MQTT disconnected."));
#endif
    flgIsConnected = false;
    flgIsPublished = false;
}

void dsPublishedCb() {
#ifdef DEBUG
    Serial.println(F("Published."));
#endif
    flgIsPublished = true;
}

void dsDataCb(String & topic, String & data) {
#ifdef DEBUG
    Serial.print(topic);
    Serial.print(F(": "));
    Serial.println(data);
#endif
}

/*
 * Call deep-sleep.  The DSLEEP_SECS seconds count is set in
 * user_config.h.
 * Note that "NOTREACHED" should never be displayed if
 * deep-sleep is working correctly, as the processor will do
 * a full reset when it wakes up.
 */
void DSleep() {
    /*
     * Close down our WiFi connections cleanly before sleeping.
     */
    WiFi.disconnect(true);	// Switch-off WiFi = "true".
    yield();
    delay(500);

#ifdef DEBUG
    Serial.println(F("Zzzz..."));
#endif
    // ESP.deepSleep(DSLEEP_SECS * 1000 * 1000, WAKE_RF_DISABLED);
    ESP.deepSleep(DSLEEP_SECS * 1000 * 1000);

    /*
     * Pause everything to give the system time to set up deep-sleep
     * and shut itself down before restarting the default loop.
     */
    yield();
    delay(5000);
    Serial.println("/*NOTREACHED*/");	/* Lint on the ESP?!? :-) */
}

void setup() {
    int conn_tries = 0;

    Serial.begin(115200);
    delay(500);
    Serial.println();

    pinMode(BLED, OUTPUT);	// Ensure our blue LED driver pin is an output,
    pinMode(GLED, OUTPUT);	// ...and the green LED pin,
    pinMode(RLED, OUTPUT);	// ...and the red LED pin, too.
#ifdef DEBUG
    OnFlash();			// We're alive!
#endif

    dht.begin();		// Initialize the DHT11 interface.

    /* Get a unique client-ID for this ESP8266. */
    sprintf(clidbuff, MQTT_CLIENT_ID, ESP.getChipId());
    float vdd = ESP.getVcc() / 1000.0;	// Grab the current battery voltage.
    dtostrf(vdd, 4, 2, vbuff);	// Convert to ASCII and store.

    /*
     * This delay is for use when testing =without= using deep-sleep
     * and should normally be commented-out.
     */
//    delay(LDELAY);    // Disable this loop delay if using deep-sleep.

    getSensorData();
#ifdef DEBUG
    BFlash();			// A quick flash to show we've accessed the DHT11.
#endif
    dtostrf(temperature, 4, 2, tbuff);	// Convert and store.
    dtostrf(humidity, 4, 2, hbuff);	// Convert and store.
    snprintf(buff, MQ_TOPIC_SIZE, "%s, %sC, %s%% %sV", clidbuff, tbuff,
	     hbuff, vbuff);
#ifdef DEBUG
    Serial.println(buff);
#endif

#ifdef DEBUG
    Serial.print(F("   ClientID: "));
    Serial.println(clidbuff);
    Serial.print(F("Temperature: "));
    Serial.print(tbuff);
    Serial.println(F("C"));
    Serial.print(F("   Humidity: "));
    Serial.print(hbuff);
    Serial.println(F("%"));
    Serial.print(F("    Voltage:  "));
    Serial.print(vbuff);
    Serial.println(F("V"));
#endif

    /*
     * Now we have the temperature, humidity and voltage readings, so
     * we're ready to bring up the network and talk to the outside
     * world.
     */
#ifdef DEBUG
    Serial.println();
    Serial.print(F("Connecting to "));
    Serial.println(STA_SSID);
#endif

    /*
     * An open-ended loop  here will flatten the battery on
     * the sensor if, for instance, the access point is
     * down, so limit our connection attempts.
     */
    Serial.print("WiFi Stat: ");
    Serial.println(WiFi.status());		// Meant to fix slow-start problem.
    WiFi.mode(WIFI_STA);
    WiFi.config(IPAddress(ip), IPAddress(gateway),
		IPAddress(netmask), IPAddress(dnssrv));
//    wifi_station_set_auto_connect(false);
    WiFi.begin(STA_SSID, STA_PASS, WIFI_CHANNEL, NULL);
    yield();

    while ((WiFi.status() != WL_CONNECTED)
	   && (conn_tries++ < WIFI_RETRIES)) {
	delay(500);
	Serial.print(".");
    }
    if (conn_tries == WIFI_RETRIES) {
#ifdef DEBUG
	Serial.println(F("No WiFi connection ...sleeping."));
#endif
	DSleep();
    }
#ifdef DEBUG
    Serial.println();
    WiFi.printDiag(Serial);
    Serial.print(F("IP: "));
    Serial.println(WiFi.localIP());
#endif

    /*
     * Now that we have a WiFi link, publish our data to the MQTT
     * server.  As with the WiFi connection, the MQTT publish
     * attempts are in a limited loop to prevent a failed connection
     * from holding the ESP8266 on and draining the battery.
     */
    MQTT mqttClient(clidbuff, MQTT_HOST, MQTT_PORT);

    /* Configure MQTT callbacks.  */
    mqttClient.onConnected(dsConnectedCb);
    mqttClient.onDisconnected(dsDisconnectedCb);
    mqttClient.onPublished(dsPublishedCb);
    mqttClient.onData(dsDataCb);

    /*
     * MQTT connect/publish loop.
     */
    // mqttClient.connect();
    yield();
    conn_tries = 0;		// Reset tries counter to zero.
    while (!flgIsPublished && (conn_tries++ < WIFI_RETRIES)) {
	delay(MQCONDEL);
	if (flgIsConnected) {
	    mqttClient.publish(TOPIC3, buff, strlen(buff), 0, 0);	// Topics set in user_config.h.
	} else {
#ifdef DEBUG
	    Serial.print(F("Connecting to MQTT server: "));
	    Serial.println(MQTT_HOST);
#endif
	    mqttClient.connect();
	}
    }

    /*
     * If we didn't manage to publish, for whatever reason, we're
     * going to give up and go back to sleep to save battery
     * power, otherwise do a clean disconnect from the MQTT server.
     */
    if (!flgIsPublished) {
#ifdef DEBUG
	Serial.println(F("No MQTT ...sleeping."));
#endif
    }
    mqttClient.disconnect();
    delay(500);

    /*
     * Put the unit into deep sleep (requires
     * GPIO16 to be connected to RST for
     * wake-up).
     */
    DSleep();
}

/* We should never get as far as the loop() function. */
void loop() {
    // Nuthin' to see here.  Move along now!
    ESP.restart();
}

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


Add example for storing JSON config file in SPIFFS

// Example: storing JSON configuration file in flash file system
//
// Uses ArduinoJson library by Benoit Blanchon.
// https://github.com/bblanchon/ArduinoJson
//
// Created Aug 10, 2015 by Ivan Grokhotkov.
//
// This example code is in the public domain.

#include <ArduinoJson.h>
#include "FS.h"

bool loadConfig() {
  File configFile = SPIFFS.open("/config.json", "r");
  if (!configFile) {
    Serial.println("Failed to open config file");
    return false;
  }

  size_t size = configFile.size();
  if (size > 1024) {
    Serial.println("Config file size is too large");
    return false;
  }

  // Allocate a buffer to store contents of the file.
  std::unique_ptr<char[]> buf(new char[size]);

  // We don't use String here because ArduinoJson library requires the input
  // buffer to be mutable. If you don't use ArduinoJson, you may as well
  // use configFile.readString instead.
  configFile.readBytes(buf.get(), size);

  StaticJsonBuffer<200> jsonBuffer;
  JsonObject& json = jsonBuffer.parseObject(buf.get());

  if (!json.success()) {
    Serial.println("Failed to parse config file");
    return false;
  }

  const char* serverName = json["serverName"];
  const char* accessToken = json["accessToken"];

  // Real world application would store these values in some variables for
  // later use.

  Serial.print("Loaded serverName: ");
  Serial.println(serverName);
  Serial.print("Loaded accessToken: ");
  Serial.println(accessToken);
  return true;
}

bool saveConfig() {
  StaticJsonBuffer<200> jsonBuffer;
  JsonObject& json = jsonBuffer.createObject();
  json["serverName"] = "api.example.com";
  json["accessToken"] = "128du9as8du12eoue8da98h123ueh9h98";

  File configFile = SPIFFS.open("/config.json", "w");
  if (!configFile) {
    Serial.println("Failed to open config file for writing");
    return false;
  }

  json.printTo(configFile);
  return true;
}

void setup() {
  Serial.begin(115200);
  Serial.println("");
  delay(1000);
  Serial.println("Mounting FS...");

  if (!SPIFFS.begin()) {
    Serial.println("Failed to mount file system");
    return;
  }

  if (!saveConfig()) {
    Serial.println("Failed to save config");
  } else {
    Serial.println("Config saved");
  }

  if (!loadConfig()) {
    Serial.println("Failed to load config");
  } else {
    Serial.println("Config loaded");
  }
}

void loop() {
}

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


Add file: Blink-yun.ino

Add file: Blink-yun.ino

From https://github.com/gmacario/gmacario.github.io/tree/master/test/Blink-yun

See https://github.com/gmacario/gmacario.github.io/issues/10

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

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

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

  This example code is in the public domain.

  modified 8 May 2014
  by Scott Fitzgerald
 */

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(3000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
}

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


Added example WifiUdpSendReceiveString

Added example WifiUdpSendReceiveString

/*
  WiFi UDP Send and Receive String

 This sketch wait an UDP packet on localPort using a WiFi shield.
 When a packet is received an Acknowledge packet is sent to the client on port remotePort

 Circuit:
 * WiFi shield attached

 created 30 December 2012
 by dlf (Metodo2 srl)

 */

#include <SPI.h>
#include <WiFi.h>
#include <WiFiUdp.h>

int status = WL_IDLE_STATUS;
char ssid[] = "yourNetwork"; //  your network SSID (name)
char pass[] = "secretPassword";    // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0;            // your network key Index number (needed only for WEP)

unsigned int localPort = 2390;      // local port to listen on

char packetBuffer[255]; //buffer to hold incoming packet
char  ReplyBuffer[] = "acknowledged";       // a string to send back

WiFiUDP Udp;

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while(true);
  }

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid);

    // wait 10 seconds for connection:
    delay(10000);
  }
  Serial.println("Connected to wifi");
  printWifiStatus();

  Serial.println("\nStarting connection to server...");
  // if you get a connection, report back via serial:
  Udp.begin(localPort);
}

void loop() {

  // if there's data available, read a packet
  int packetSize = Udp.parsePacket();
  if(packetSize)
  {
    Serial.print("Received packet of size ");
    Serial.println(packetSize);
    Serial.print("From ");
    IPAddress remoteIp = Udp.remoteIP();
    Serial.print(remoteIp);
    Serial.print(", port ");
    Serial.println(Udp.remotePort());

    // read the packet into packetBufffer
    int len = Udp.read(packetBuffer,255);
    if (len >0) packetBuffer[len]=0;
    Serial.println("Contents:");
    Serial.println(packetBuffer);

    // send a reply, to the IP address and port that sent us the packet we received
    Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
    Udp.write(ReplyBuffer);
    Udp.endPacket();
   }
}

void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}

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


Added explanation comments

Added explanation comments

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


esp now new example

esp now new example

error: pathspec 'TTGO/Code/ESP' did not match any file(s) known to git
error: pathspec 'Now/ESP_Now_clock/ESP_Now_clock.ino' did not match any file(s) known to git


delete auto align during shortest path

delete auto align during shortest path

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


Fix #98

Fix #98

/**************************************************************
 * Blynk is a platform with iOS and Android apps to control
 * Arduino, Raspberry Pi and the likes over the Internet.
 * You can easily build graphic interfaces for all your
 * projects by simply dragging and dropping widgets.
 *
 *   Downloads, docs, tutorials: http://www.blynk.cc
 *   Blynk community:            http://community.blynk.cc
 *   Social networks:            http://www.fb.com/blynkapp
 *                               http://twitter.com/blynk_app
 *
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 *
 **************************************************************
 * This example shows how value can be pushed from Arduino to
 * the Blynk App.
 *
 * WARNING :
 * For this example you'll need SimpleTimer library:
 *   https://github.com/jfturcot/SimpleTimer
 * and Adafruit DHT sensor library:
 *   https://github.com/adafruit/DHT-sensor-library
 *
 * App project setup:
 *   Value Display widget attached to V5
 *   Value Display widget attached to V6
 *
 **************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <SimpleTimer.h>
#include <DHT.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

#define DHTPIN 2          // What digital pin we're connected to

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

DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
}

void setup()
{
  Serial.begin(9600); // See the connection status in Serial Monitor
  Blynk.begin(auth);

  dht.begin();

  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);
}

void loop()
{
  Blynk.run(); // Initiates Blynk
  timer.run(); // Initiates SimpleTimer
}

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


Create keypad.ino

Create keypad.ino

/* @file keypad.ino
|| @version 1.0
|| @author Ryan Stewart, base code from Alexander Brevig
|| @contact ryan@ryanstewart.com
|| @contact alexanderbrevig@gmail.com
||
|| @description
|| | Uses the arduino keypad library to get a series of numbers/letters from the 4x4 membrane keypad.
|| | Then sends that string by webhook to a php script (notify.php)
|| #
*/
#include "Keypad/Keypad.h"

const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3', 'A'},
  {'4','5','6', 'B'},
  {'7','8','9', 'C'},
  {'*','0','#','D'}
};
byte rowPins[ROWS] = {D0, D1, D2, D3}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {D4, D5, D6, D7}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

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

void loop(){
    String value = "";
    String reset = "*-*-*-RESET-*-*-*";
    char key;
    while(true)
    {
        delay(20);
        key = keypad.getKey();
        if (key == NO_KEY) continue;
        if (key == '#') break; // send the key combination when the pound key is pressed
        if (key == '*') // if the star key is pressed, that's a reset
            {
                value = "";
                goto reset_button;
            }
        value += key;
        // TODO: display value here

       do
       {
           delay(20);
        }
        while (keypad.getKey() != NO_KEY); // wait until key is released
        //Serial.println(key);
    }
    Serial.println(value);
    // Call the webhook here and send the value to it.
    Particle.publish("venus", String(value), 60, PRIVATE);
    delay(5000);
    reset_button: // reset the value to empty
        Serial.println(reset);

}

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


XMerge branch 'master' of https://github.com/medialab-prado/Interactivos-15-Ego

#include "Keyboard.h"
#include "Mouse.h"

// set pin numbers for the five buttons:
const int killSwitch = 13;

void setup() { // initialize the buttons' inputs:
  pinMode(killSwitch, INPUT);
  digitalWrite(killSwitch, HIGH);
  // initialize mouse control:
  Mouse.begin();
  Keyboard.begin();
}

void loop() {
delay(100);
// only do the keyboard/mouse interaction if killswitch is connected to
ground...
  if(digitalRead(killSwitch)==LOW) {
    Mouse.click(MOUSE_LEFT);
    Mouse.click(MOUSE_LEFT);
    Mouse.move(0, -40);
    Keyboard.press('w');
    delay(100);
    Keyboard.press(' ');
    delay(50);
    Keyboard.releaseAll();
    Mouse.click(MOUSE_LEFT);
    Mouse.move(0, 40);
    Keyboard.press('w');
    delay(100);
    Keyboard.press(' ');
    delay(50);
    Keyboard.releaseAll();
    Mouse.move(-40, 0);
    Keyboard.press('w');
    delay(100);
    Keyboard.press(' ');
    delay(50);
    Keyboard.releaseAll();
    Mouse.click(MOUSE_LEFT);
    Mouse.move(40, 0);
    Keyboard.press('w');
    delay(100);
    Keyboard.press(' ');
    Mouse.click(MOUSE_LEFT);
    delay(50);
    Keyboard.releaseAll();
    Mouse.click(MOUSE_LEFT);
    Keyboard.press('w');
    delay(100);
    Keyboard.press(' ');
    delay(50);
    Keyboard.releaseAll();
    Mouse.click(MOUSE_LEFT);
    Mouse.click(MOUSE_LEFT);
  }
}

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


Modificando o codigo Arduino

Modificando o codigo Arduino

Terminei o código , agora testar e modificar os erros.

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/Gsirius14/sirius.git/'


Made more fixes, prevented left and reset buttons from confusing. Added LCD 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/ocean-x/erikson-1.git/'


arduino code

arduino code

adding arduino code to the project

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


Avances en sketch principal.

Avances en sketch principal.

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/nverdicchio/soa-2017-bicicleta-inteligente.git/'


Tested code button interface

Tested code button interface

unsigned const int SizeColumns = 3;
unsigned const int SizeRows = 3;

const char * noKey {"no"};
byte columns[SizeColumns] = { 2, 3, 4 }; //fix name of the pins
byte rows[SizeRows] = { 5, 6, 7 };//fix name of the pins

//  Antibounce system variables
unsigned int lastReadTime;
unsigned int bounceTime = 40;//ms

const unsigned short int delay_key_press = 50;

//-------------------------------------------------------------------

//  Messages to send
char keymap[][SizeRows][SizeColumns] = {
  { "B1", "B2", "B3" },
  { "B4", "B5", "B6" },
  { "B7", "B8", "B9" }
};

//  Current button states
boolean current_state[SizeRows][SizeColumns] = {
  { LOW, LOW, LOW },
  { LOW, LOW, LOW },
  { LOW, LOW, LOW }
};

//  Last button states
boolean last_state[SizeRows][SizeColumns] = {
  { LOW, LOW, LOW },
  { LOW, LOW, LOW },
  { LOW, LOW, LOW }
};

//-------------------------------------------------------------------

void setup(){

  Serial.begin(9600);

  lastReadTime = millis();

  for(int j = 0; j < SizeColumns; j++){
    pinMode(columns[j],OUTPUT); // Setting pins for input
    //digitalWrite(columns[j], LOW);
  }

  for (int i = 0; i < SizeRows; i++){
    pinMode(rows[i], INPUT); // Setting pins for input
    digitalWrite(rows[i], HIGH);
  }
}

void loop() {
  if ( (millis() - lastReadTime) > bounceTime ) {

    //Если время с начала работы программы минус
    //последнее считаннове время больше 30мс(bounceTime)

    for(int c = 0; c < SizeColumns; c++)
    {
      //pinMode(columns[c], OUTPUT);
      digitalWrite(columns[c], LOW);
      //опрашиваем горизонтальные дорожки
      for(int r = 0; r < SizeRows; r++)
      {
        if(digitalRead(rows[r]) == LOW)
        {
          if (current_state[r][c] == LOW) {
            Serial.println(keymap[r][c]);
          }
          current_state[r][c] = HIGH;

          //если у нас на горизонтальной дорожке
          //будет значение 1 то запоминаем позиию
          //foundKey = keymap[r][c];
          //strcpy(foundKey, keymap[r][c]);
          // И отправляем её в Serial
          //Serial.println(foundKey);
        }  else {
          current_state[r][c] = LOW;
        }
      }

      digitalWrite(columns[c], HIGH);
      //pinMode(columns[c], INPUT);

    }
    lastReadTime = millis();
  }
  ////////////////////////////////////////////////////////////////////

  for (short int c = 0; c < SizeColumns; ++c) {
    for (short int r = 0; r < SizeRows; ++r) {

    }
  }

}

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


Added motor.ino

Added motor.ino

int motorPin = 9;
void setup() {
  pinMode(motorPin, OUTPUT);
}

void loop() {
 digitalWrite(motorPin, HIGH);
 delay(100);

 digitalWrite(motorPin, LOW);
 delay(1000);

 digitalWrite(motorPin, HIGH);
 delay(100);

 digitalWrite(motorPin, LOW);
 delay(200);
}

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


restructured for arduino ide

restructured for arduino ide

int incomingByte = 0; // for incoming serial data

void setup() {

  // Green
  pinMode(12, OUTPUT);
  // Yellow
  pinMode(11, OUTPUT);
  // Red
  pinMode(10, OUTPUT);

  Serial.begin(9600); // opens serial port, sets data rate to 9600 bps

}

void loop() {

  if (Serial.available() > 0) {
    incomingByte = Serial.read();
  }

  if (incomingByte == 'b') {
    green();
  } else if (incomingByte == 'y') {
    yellow();
  } else if (incomingByte == 'r') {
    red();
  } else if (incomingByte == 'all') {
    all();
  }

}

void green() {

  digitalWrite(12, HIGH);
  digitalWrite(11, LOW);
  digitalWrite(10, LOW);
  delay(1000);

}

void yellow() {

  digitalWrite(12, LOW);
  digitalWrite(11, HIGH);
  digitalWrite(10, LOW);
  delay(1000);

}

void red() {

  digitalWrite(12, LOW);
  digitalWrite(11, LOW);
  digitalWrite(10, HIGH);
  delay(1000);

}

void all() {

  digitalWrite(12, HIGH);
  digitalWrite(11, HIGH);
  digitalWrite(10, HIGH);
  delay(1000);

}

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


Create custom_color_array.ino

Create custom_color_array.ino

//***************************************************************
// Example of assigning colors from a custom color array.
//
// Marc Miller, Aug 2018
//***************************************************************

#include "FastLED.h"
#define LED_TYPE LPD8806
#define DATA_PIN 11
#define CLOCK_PIN 13
#define NUM_LEDS 32
#define COLOR_ORDER GRB
#define BRIGHTNESS 255
CRGB leds[NUM_LEDS];

uint8_t colorPick;

// Custom color array
CRGB colorArray[] = {
  colorArray[0] = CRGB::Red,
  colorArray[1] = CRGB::Grey,
  colorArray[2] = CRGB::Blue,
  colorArray[3] = CRGB(0,255,0),
  colorArray[4] = CHSV(195,255,255),
};

//---------------------------------------------------------------
void setup() {
  Serial.begin(115200);  // Allows serial monitor output (check your baud rate)
  delay(2000);  // Startup delay
  FastLED.addLeds<LED_TYPE,DATA_PIN,CLOCK_PIN,COLOR_ORDER>(leds, NUM_LEDS);  // ***For strips using Clock.
  //FastLED.addLeds<LED_TYPE,DATA_PIN>(leds, NUM_LEDS);  // ***For Clock-less strips.
  FastLED.setBrightness(BRIGHTNESS);
}

//---------------------------------------------------------------
void loop() {
  //pick a random color from the custom color array
  colorPick = random8( sizeof(colorArray) / sizeof(colorArray[0]) );

  for (uint8_t i = 0; i < NUM_LEDS; i++) {
    leds[i] = colorArray[colorPick];
    FastLED.show();
    delay(50);
    fadeToBlackBy(leds, NUM_LEDS, 220);
  }

}//end_main_loop

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


this should be the right (direction) homing??

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


Yep, it's broken. Going to make a clean test version.

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


Something is broken. Lots of code commented out. Probably LCD output string formatting.


Initial lightControl

Initial lightControl

#include "radioNode.h"
#include "debounced.h"

#define GATEWAYID 1;

Debounced lightSwitch = Debounced(4, &switchAction);
bool enableLight = false;
const int HEADER = sizeof(RadioHeader);

void setup() {
  Serial.begin(SERIAL_BAUD);
  delay(10)
  RadioNode::setupRadio();
}

void loop() {
  // read radio for commands
  // read switch for changes
  lightSwtich.readButton();
}

void switchAction(int state)
{
  enableLight = !enableLight;
  byte[RF69_MAX_DATA_LEN] data;
  getPacket(data);
  RadioNode::sendData()
}

void getPacket(byte *buff)
{
  RadioHeader header = (RadioHeader) { NODEID, millis(), LIGHT_STATUS };
  memcpy(buff, &header, HEADER);

  LightStatus body = (LightStatus) { enableLight };
  memcpy(&buff[HEADER], &body, sizeof(LightStatus));
}

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


Initial upload of test test code for MS5803-14BA

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

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


Compass library via Adafruit

Compass library via Adafruit

/***************************************************************************
  This is a library example for the HMC5883 magnentometer/compass

  Designed specifically to work with the Adafruit HMC5883 Breakout
  http://www.adafruit.com/products/1746

  *** You will also need to install the Adafruit_Sensor library! ***

  These displays use I2C to communicate, 2 pins are required to interface.

  Adafruit invests time and resources providing this open source code,
  please support Adafruit andopen-source hardware by purchasing products
  from Adafruit!

  Written by Kevin Townsend for Adafruit Industries with some heading example from
  Love Electronics (loveelectronics.co.uk)

 This program is free software: you can redistribute it and/or modify
 it under the terms of the version 3 GNU General Public License as
 published by the Free Software Foundation.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.

 ***************************************************************************/

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_HMC5883_U.h>

/* Assign a unique ID to this sensor at the same time */
Adafruit_HMC5883_Unified mag = Adafruit_HMC5883_Unified(12345);

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

  /* Initialise the sensor */
  if(!mag.begin())
  {
    /* There was a problem detecting the HMC5883 ... check your connections */
    Serial.println("Ooops, no HMC5883 detected ... Check your wiring!");
    while(1);
  }
}

float getHeading() {
  /* Get a new sensor event */
  sensors_event_t event;
  mag.getEvent(&event);

  /* Display the results (magnetic vector values are in micro-Tesla (uT)) */
  Serial.print("X: "); Serial.print(event.magnetic.x); Serial.print("  ");
  Serial.print("Y: "); Serial.print(event.magnetic.y); Serial.print("  ");
  Serial.print("Z: "); Serial.print(event.magnetic.z); Serial.print("  ");Serial.println("uT");

  // Hold the module so that Z is pointing 'up' and you can measure the heading with x&y
  // Calculate heading when the magnetometer is level, then correct for signs of axis.
  float heading = atan2(event.magnetic.y, event.magnetic.x);

  // Once you have your heading, you must then add your 'Declination Angle', which is the 'Error' of the magnetic field in your location.
  // Find yours here: http://www.magnetic-declination.com/
  // Mine is: -13* 2' W, which is ~13 Degrees, or (which we need) 0.22 radians
  // If you cannot find your Declination, comment out these two lines, your compass will be slightly off.
  float declinationAngle = 0.22;
  heading += declinationAngle;

  // Correct for when signs are reversed.
  if(heading < 0)
    heading += 2*PI;

  // Check for wrap due to addition of declination.
  if(heading > 2*PI)
    heading -= 2*PI;

  // Convert radians to degrees for readability.
  float headingDegrees = heading * 180/M_PI;

  return(headingDegrees);
}

void loop(void)
{
  Serial.print("Heading (degrees): "); Serial.println(getHeading());
  delay(500);
}

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


Project 4

Project 4

const int greenLED = 9;
const int redLED = 11;
const int blueLED = 10;

const int redSensor = A0;
const int greenSensor = A1;
const int blueSensor = A2;

int redOut = 0;
int greenOut = 0;
int blueOut = 0;

int redIn = 0;
int greenIn = 0;
int blueIn = 0;

void setup() {
  Serial.begin(9600);
  pinMode(greenLED, OUTPUT);
  pinMode(redLED, OUTPUT);
  pinMode(blueLED, OUTPUT);
}

void loop() {
  redIn = analogRead(redSensor);
  delay(5);
  greenIn = analogRead(greenSensor);
  delay(5);
  blueIn = analogRead(blueSensor);

  Serial.print("Raw sensor values \t Red: ");
  Serial.print(redIn);
  Serial.print("\t Green: ");
  Serial.print(greenIn);
  Serial.print("\t Blue: ");
  Serial.println(blueIn);

  redOut = redIn / 4;
  greenOut = greenIn / 4;
  blueOut = blueIn / 4;

  analogWrite(redLED, redOut);
  analogWrite(greenLED, greenOut);
  analogWrite(blueLED, blueOut);
}

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


initial commit

initial commit

/*
 *Circuit: Common-anode RGB LED wired like so:
 * Red cathode: digital pin 3
 * Green cathode: digital pin 5
 * blue cathode: digital pin 6
 * anode: +5V
 */

 #define NL 13

 // pins for the LEDs:
const int redPin = 9;
const int greenPin = 5;
const int bluePin = 6;

const char SET_COLOR = '#';

char cmd;
char buffer[7];
char color_value[3];
int characters_received;
int red;
int green;
int blue;

void setup() {
  // initialize serial:
  Serial.begin(9600);
  Serial.println("usage: ");
  // make the pins outputs:
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
}

void loop() {
 if (Serial.available()) {
   char ch = char(Serial.read());
   Serial.print("command: ");
   Serial.println(ch);

   switch (ch) {
     case SET_COLOR:
       Serial.print("set color: ");
         characters_received = Serial.readBytesUntil(NL, buffer, 7);
         if(characters_received==7) {
           Serial.println(buffer);
           // todo extract method
           color_value[0] = buffer[0];
           color_value[1] = buffer[1];
           color_value[2] = 0; //null-terminate
           red = atoi(color_value);
           Serial.print("red: ");
           Serial.println(red);
           Serial.print("green: ");
           Serial.println(green);
           Serial.print("blue: ");
           Serial.println(blue);
         } else {
          Serial.print("Invalid color value:");
          Serial.println(color_value);
         }

       break;
     default:
       Serial.println("invalid command");
   }
 }
}

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


minor changes to Color Sensor

minor changes to Color Sensor

error: pathspec 'Sensor' did not match any file(s) known to git
error: pathspec 'Modules/Color' did not match any file(s) known to git
error: pathspec 'Sensor/ColorSensorArduino/ColorSensorArduino.ino' did not match any file(s) known to git


Create chase_target_values_verB.ino

Create chase_target_values_verB.ino

// Test of chasing random target values, version B.
//
// Random target values are generated and assigned to random pixels.
// Pixel brightness is then increased or decreased toward the target.
//
// This version incorporates a hue shift based on the pixel value.
// The high and low color choices can be changed below in the variables.
// Saturation is kept at full, but it could also easily be tweaked.
//
// Marc Miller,  April 2015
//---------------------------------------------------------------

#include "FastLED.h"
#define LED_TYPE NEOPIXEL  // *Update to your strip type.  NEOPIXEL, APA102, LPD8806, etc..
#define DATA_PIN 6         // *Set this to your data pin.
#define NUM_LEDS 12        // *Update to the number of pixels in your strip.
//#define COLOR_ORDER BGR
#define MASTER_BRIGHTNESS 255

CRGB leds[NUM_LEDS];
CHSV leds_vu[NUM_LEDS];  // FastLED array using HSV.

int target[NUM_LEDS];  // Array to store target brightness values.
int count;
int delta;
int temp;
int highCutoff = 200;
int lowCutoff = 30;

// ***** A few color combinations to try out: *****
int hue_high = 0;  // red for high values with,
int hue_low = 96;  // green for low values.
    // or
//int hue_high = 96;  // green for high values with,
//int hue_low = 192;  // purple for low values.
    // or
//int hue_high = 84;  // yellow-green for high values.
//int hue_low = 56;  // orange for low values.

//---------------------------------------------------------------
void setup() {
  delay(1500);
  FastLED.addLeds<LED_TYPE,DATA_PIN>(leds, NUM_LEDS);
  FastLED.setBrightness(MASTER_BRIGHTNESS);
  Serial.begin(115200);  // Allows serial output (check baud rate)
}

//---------------------------------------------------------------
void loop() {
  // Assign random target values whenever count is zero.
  if (count == 0){
    for (int i=0; i < NUM_LEDS; i++){
      target[random8(NUM_LEDS)] = random8();  // Pick random pixels, assign random values.
      if (target[i] < lowCutoff){
        target[i] = 0;  // Force low values to clamp to zero.
      }
    }
    count = random8(35,70);  // Pick a new count value.
    Serial.println("*New targets assigned!*");
  }

  for (int i=0; i < NUM_LEDS; i++){
    // Check current values against target values.
    if (leds_vu[i].value < target[i]){  // less then the target, so fade up.
      delta = (leds_vu[i].value - target[i]) / 5;
      if (leds_vu[i].value + delta >= target[i]){
        leds_vu[i].value = target[i];  // limit to target.
      }
      else {
        leds_vu[i].value += delta;
      }
    }

    else {  // greater then the target, so fade down.
      delta = ((leds_vu[i].value - target[i])/8) + 1;  // +1 so delta is always at least 1.
      if (leds_vu[i].value - delta <= target[i]){
        leds_vu[i].value = target[i];  // limit to target.
      }
      else {
        leds_vu[i].value -= delta;
      }
    }
    if (i == 0){ temp = delta; }  // Save first pixel's delta number to print below.

    // Tweak hue color based on brightness.
    int c_hue = constrain(leds_vu[i].value,lowCutoff,highCutoff);
    leds_vu[i].hue = map(c_hue, lowCutoff, highCutoff, hue_low, hue_high);
                  // map(valueIn, fromLow,   fromHigh,   toLow,   toHigh)

    leds_vu[i].saturation = 255;  // Set saturation to full.

    // Copy the HSV leds_vu[] data to the leds[] array.
    leds[i] = leds_vu[i];
      // FastLED will automatically convert HSV to RGB data.  Converting from HSV
      // to RGB is very fast and also accurate.  It is possible to convert from
      // RGB to HSV, but it is not automatic, not totally acurate, and not as fast.

    // Continously fade target to zero.
    if (target[i] > lowCutoff){
      target[i] -= 2;  // Fade by this ammount.
    }
    else {
      target[i] = 0;  // If target less then lowCutoff, clamp to zero.
    }

  }//end of looping over pixels.

  FastLED.show();  // Display the leds[] array.

  // Print out info for led[0] to understand how the numbers are changing.
  Serial.print("c: "); Serial.print(count);
  Serial.print("\t target: "); Serial.print(target[0]);
  Serial.print("\t  leds_vu[0].hue: "); Serial.print(leds_vu[0].hue);
  Serial.print("\t  leds_vu[0].value: "); Serial.print(leds_vu[0].value);
  Serial.print("\t  delta: "); Serial.println(temp);

  count--;  // reduce count by one.
  delay(10);

}//end main loop

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


Add simple-shift to use a 74HC164 with 8 LEDs

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


Revert "Added buggy Sound Sensor"

Revert "Added buggy Sound Sensor"

This reverts commit 7c292b2102d95ad7382008a5954522c9bad4a963.

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


Create zombo.ino

Create zombo.ino

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/brosnanyuen/zombo.com.git/'


Fixed up booleans

Fixed up booleans

// C64 Joystick Emulator for the Arduino Nano

#define PIN_UP    2
#define PIN_DOWN  3
#define PIN_LEFT  4
#define PIN_RIGHT 5
#define PIN_FIRE  6
#define PIN_LED   13

void setup()
{
  pinMode(PIN_UP,   OUTPUT);
  pinMode(PIN_DOWN, OUTPUT);
  pinMode(PIN_LEFT, OUTPUT);
  pinMode(PIN_RIGHT,OUTPUT);
  pinMode(PIN_FIRE, OUTPUT);
  pinMode(PIN_LED,  OUTPUT);

  digitalWrite(PIN_UP,   LOW);
  digitalWrite(PIN_DOWN, LOW);
  digitalWrite(PIN_LEFT, LOW);
  digitalWrite(PIN_RIGHT,LOW);
  digitalWrite(PIN_FIRE, LOW);
  digitalWrite(PIN_LED,  LOW);

  Serial.begin(57600);
}

void loop()
{
   // Wait for a byte
  if (Serial.available())
  {
    digitalWrite(PIN_LED, HIGH);
    byte inByte = Serial.read();
    doJoystick(inByte);
    digitalWrite(PIN_LED, LOW);
  }
  else
  {
    digitalWrite(PIN_LED, LOW);
  }
}

void doJoystick(byte inByte)
{
   bool up    = false;
   bool down  = false;
   bool left  = false;
   bool right = false;
   bool fire  = false;

   if ((inByte | 0xFE) == 0xFE) { up   = true; }
   if ((inByte | 0xFD) == 0xFD) { down = true; }
   if ((inByte | 0xFB) == 0xFB) { left = true; }
   if ((inByte | 0xF7) == 0xF7) { right= true; }
   if ((inByte | 0xEF) == 0xEF) { fire = true; }

   digitalWrite(PIN_UP,   up);
   digitalWrite(PIN_DOWN, down);
   digitalWrite(PIN_LEFT, left);
   digitalWrite(PIN_RIGHT,right);
   digitalWrite(PIN_FIRE, fire);
}

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


Create blink_demo.ino

Create blink_demo.ino

#define STATUSLED 13
#define STATUSLED_ON HIGH
#define STATUSLED_OFF LOW

#include <sleeplib.h>

ISR(WDT_vect) { watchdogEvent(); }

void setup(void) {
}

void loop(void) {
  digitalWrite(STATUSLED,STATUSLED_ON);
  sleep4ms(1000);
  digitalWrite(STATUSLED,STATUSLED_OFF);
  sleep4ms(1000);
}

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


init version

init version

#include <PubSubClient.h>
#include <ESP8266WiFi.h>
#include <Ticker.h>
#include <DHT.h>

#define DHT_PIN                               6
#define HUMIDIFIER_PIN                        5
#define PUMP_PIN                              6
#define UVLED_PIN                             7
#define FAN_PIN                               8
#define WATERLEVEL_LOW_PIN                    9
#define WATERLEVEL_HIGH_PIN                  10
#define SOIL_MEASURE_PIN                     A0
#define DHT_TYPE                          DHT22
#define SSID                        "XXX"
#define SSID_PASSWD      "XXX"
#define MQTT_SERVER                    "cortex"
#define MQTT_CLIENT     "LivingRoomPlantClient"
#define TEMP_CAL                          23.80
#define TEMP_MEASURE                      22.89
#define TEMP_DELTA    (TEMP_CAL - TEMP_MEASURE)
#define PRE_HUMIDIFIER_TIMER                0.8
#define HUMIDIFIER_TIMER                    0.7
#define HUMIDIFIER_TIMER_COUNTS              15
#define PRE_PUMP_TIMER                      1.1
#define PUMP_TIMER                          4.2

WiFiClient                           espClient;
PubSubClient                   mqtt(espClient);
DHT                     dht(DHT_PIN, DHT_TYPE);
Ticker                           prePumpTicker;
Ticker                              pumpTicker;
Ticker                       preHumidifyTicker;
Ticker                          humidifyTicker;
char                                  msg[500];
uint64_t                           counter = 0;
uint8_t                         humcounter = 0;
float                            airtemp = 0.0;
float                           humidity = 0.0;
bool                     highwatermark = false;
bool                      lowwatermark = false;
float                               soil = 0.0;
bool                      humidifieron = false;

void setup() {
  Serial.begin(115200);
  pinMode(     HUMIDIFIER_PIN, OUTPUT  );
  digitalWrite(HUMIDIFIER_PIN, true    );
  setup_wifi();
  delay(100);
  mqtt.setServer(MQTT_SERVER, 1883);
  mqtt.setCallback(callback);
  mqttConnector();
  delay(100);
  //dht.begin();
}

void setup_wifi() {
  delay(100);
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(SSID);

  WiFi.begin(SSID, SSID_PASSWD);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

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

void PreHumidifier(){
  Serial.println("PreHumidifier");
  preHumidifyTicker.attach(PRE_HUMIDIFIER_TIMER, HumidifierOn);
}

void HumidifierOn(){
  Serial.println("HumidifierON");
  preHumidifyTicker.detach();
  humcounter = HUMIDIFIER_TIMER_COUNTS;
  humidifyTicker.attach(HUMIDIFIER_TIMER, HumidifierToggle);
}

void HumidifierToggle(){
  if(humcounter--){
    if(humidifieron){
      Serial.println("Humi OFF");
      humidifieron = false;
      digitalWrite(HUMIDIFIER_PIN, true);
    }else{
      Serial.println("Humi ON");
      digitalWrite(HUMIDIFIER_PIN, false);
      humidifieron = true;
    }
  }else{
    Serial.println("Switching Humidity Timer OFF");
    humidifyTicker.detach();
    humidifieron = false;
    digitalWrite(HUMIDIFIER_PIN, true);
  }
}

void PrePump(){
  Serial.print("PrePump");
  prePumpTicker.attach(PRE_PUMP_TIMER, PumpOn);
}

void PumpOn(){
  Serial.print("PumpON");
  prePumpTicker.detach();
  pumpTicker.attach(PUMP_TIMER, PumpOff);
}

void PumpOff(){
  Serial.print("PumpOFF");
  pumpTicker.detach();
}

void callback(char* topic, byte* payload, unsigned int length) {
  String s = String(topic);
  char vchar[50];
  Serial.print("Message arrived [");
  Serial.print(topic);
  Serial.print("] ");
  for (uint8_t i = 0; i < length; i++) {
    vchar[i] = payload[i];
  }
  vchar[length] = '\0';
  Serial.println(vchar);
  double dval = atof(vchar);

  if (String("livingroom/humidifier") == s){
    Serial.print("Humidify");
    PreHumidifier();
  }

  if (String("livingroom/plant/water") == s){
    Serial.print("Water");
    PrePump();
  }

}

void mqttConnector() {
  while (!mqtt.connected()) {
    Serial.print("Attempting MQTT connection...");
    if (mqtt.connect(MQTT_CLIENT)) {
      Serial.println("connected");
      snprintf(msg, sizeof(msg), "%ld", millis());
      mqtt.publish("livingroom/plant/online", msg);
      mqtt.subscribe("livingroom/humidifier");
      mqtt.subscribe("livingroom/plant/water");
      mqtt.subscribe("livingroom/plant/light");
    } else {
      Serial.print("failed, rc=");
      Serial.print(mqtt.state());
      Serial.println(" try again in 5 seconds");
      delay(5000);
    }
  }
}

void measure(){
  airtemp   = dht.readTemperature();
  humidity  = dht.readHumidity();
}

void msgString(float f){
  uint8_t h = floor(f);
  uint8_t l = (f - h) * pow(10, 2);
  snprintf (msg, sizeof(msg), "%d.%02d", h, l);
}

void sendMessage(){
  msgString(airtemp + TEMP_DELTA);
  mqtt.publish("livingroom/plant/airtemp", msg);
  msgString(humidity);
  mqtt.publish("livingroom/plant/humidity", msg);
  msgString(highwatermark);
  mqtt.publish("livingroom/plant/waterlevelhigh", msg);
  msgString(lowwatermark);
  mqtt.publish("livingroom/plant/waterlevellow", msg);
  msgString(soil);
  mqtt.publish("livingroom/plant/soil", msg);
}

void loop() {
  yield();
  mqttConnector();
  yield();
  mqtt.loop();
  yield();
  counter++;
  yield();
  if(counter > 1000){
    //measure();
    yield();
    sendMessage();
    counter = 0;
  }
  delay(10);
}

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


Add drum sequencer example

Add drum sequencer example

/**
 * This is a demonstration sketch for the OPL3 Duo! It implements a simple 16-step drum sequencer using 4-operator drum
 * instruments.
 *
 * Code by Maarten Janssen, 2021-01-18
 * WWW.CHEERFUL.NL
 * Most recent version of the library can be found at my GitHub: https://github.com/DhrBaksteen/ArduinoOPL2
 */

#include <OPL3Duo.h>
#include <midi_drums_4op.h>

struct Pattern {
	Instrument4OP instrument;
	bool isPlaying;
	byte steps[16];
};

OPL3Duo opl3Duo;

// Setup a demo sequence.
// A sequence consists of 12 Patterns. Each pattern can have its own instrument, a boolean to indicate whether the
// pattern is to be played and an array of 16 bytes where a value other than 0 indicates that there should be a drum
//sound playing at that step in the sequence.

const byte BPM = 110;
Pattern sequence[OPL3DUO_NUM_4OP_CHANNELS]  = {
	{ opl3Duo.loadInstrument4OP(DRUMINS_BASS_DR1), true,  { 1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0 }},
	{ opl3Duo.loadInstrument4OP(DRUMINS_SNARE_AC), true,  { 0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,1 }},
	{ opl3Duo.loadInstrument4OP(DRUMINS_CLAP),     true,  { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1 }},
	{ opl3Duo.loadInstrument4OP(DRUMINS_HIHAT_CL), true,  { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }},
	{ opl3Duo.loadInstrument4OP(DRUMINS_LO_WDBLK), true,  { 0,0,1,0,0,0,1,0,1,1,0,1,0,0,0,0 }},
	{ opl3Duo.loadInstrument4OP(DRUMINS_HI_WDBLK), true,  { 1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1 }},
	{ opl3Duo.loadInstrument4OP(DRUMINS_HI_AGOGO), true,  { 1,0,1,0,0,0,0,0,1,1,0,1,0,0,0,0 }},
	{ opl3Duo.loadInstrument4OP(DRUMINS_LO_AGOGO), true,  { 0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0 }},
	{ opl3Duo.loadInstrument4OP(DRUMINS_BASS_DR1), false, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }},
	{ opl3Duo.loadInstrument4OP(DRUMINS_BASS_DR1), false, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }},
	{ opl3Duo.loadInstrument4OP(DRUMINS_BASS_DR1), false, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }},
	{ opl3Duo.loadInstrument4OP(DRUMINS_BASS_DR1), false, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}
};

//const byte BPM = 90;
//Pattern sequence[OPL3DUO_NUM_4OP_CHANNELS]  = {
//  { opl3Duo.loadInstrument4OP(DRUMINS_BASS_DR1), true,  { 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1 }},
//  { opl3Duo.loadInstrument4OP(DRUMINS_BASS_DR1), true,  { 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1 }},
//  { opl3Duo.loadInstrument4OP(DRUMINS_BASS_DR1), true,  { 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1 }},
//  { opl3Duo.loadInstrument4OP(DRUMINS_BASS_DR2), true,  { 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1 }},
//  { opl3Duo.loadInstrument4OP(DRUMINS_TAIKO),    true,  { 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1 }},
//  { opl3Duo.loadInstrument4OP(DRUMINS_SNARE_AC), true,  { 1,1,1,1,1,1,1,1,1,0,0,0,1,0,0,0 }},
//  { opl3Duo.loadInstrument4OP(DRUMINS_BASS_DR1), false, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }},
//  { opl3Duo.loadInstrument4OP(DRUMINS_BASS_DR1), false, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }},
//  { opl3Duo.loadInstrument4OP(DRUMINS_BASS_DR1), false, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }},
//  { opl3Duo.loadInstrument4OP(DRUMINS_BASS_DR1), false, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }},
//  { opl3Duo.loadInstrument4OP(DRUMINS_BASS_DR1), false, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }},
//  { opl3Duo.loadInstrument4OP(DRUMINS_BASS_DR1), false, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}
//};

unsigned long tTick = 60000 / (BPM * 4);
byte step = 0;

void setup() {
	opl3Duo.begin();
	opl3Duo.setOPL3Enabled(true);
	opl3Duo.setAll4OPChannelsEnabled(true);

	// Assign instruments to all channels.
	for (byte i = 0; i < OPL3DUO_NUM_4OP_CHANNELS; i ++) {
		opl3Duo.setInstrument4OP(i, sequence[i].instrument);
	}
}

void loop() {
	unsigned long t = millis();

	for (byte i = 0; i < OPL3DUO_NUM_4OP_CHANNELS; i ++) {
		if (sequence[i].isPlaying && sequence[i].steps[step]) {
			byte note = sequence[i].instrument.subInstrument[0].transpose;
			byte octave = note / 12;
			note = note % 12;

			byte ch4op = opl3Duo.get4OPControlChannel(i);
			opl3Duo.playNote(ch4op, octave, note);
		}
	}

	step = (step + 1) % 16;
	delay(tTick - (millis() - t));
}

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


Update ramdemo.ino

Update ramdemo.ino

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/kaaLabs15/mcp7940.git/'


Fixing

Fixing

/* This is my Sketch for the Touch Screen interface for the relay box that will be installed in my Jeep
    Robert L. Wardecker
    cna2rn@gmail.com

    This code is in public domain.

Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

NonCommercial — You may not use the material for commercial purposes.

ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.

No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.
*/

#include <SoftwareSerial.h>
#include <Nextion.h>

const int relayaPin = 52;
const int relaybPin = 53;
const int relaycPin = 50;
const int relaydPin = 51;

SoftwareSerial nextion(10, 11);// Nextion TX to pin 10 and RX to pin 11 of Arduino

Nextion myNextion(nextion, 9600); //create a Nextion object named myNextion using the nextion serial port @ 9600bps

boolean button1State;
boolean button2State;
boolean button3State;
boolean button4State;
boolean button5State;

void setup() {

  Serial.begin(9600);
  myNextion.init(); // send the initialization commands for Page 0

  pinMode(relayaPin, OUTPUT);
  pinMode(relaybPin, OUTPUT);
  pinMode(relaycPin, OUTPUT);
  pinMode(relaydPin, OUTPUT);

}

void loop() {

  String message = myNextion.listen(); //check for message

  //52" Lightbar
  if (message == "65 0 1 1 ffff ffff ffff") {
    myNextion.buttonToggle(button1State, "b0", 0, 2);

    if (button1State == HIGH) {
      // turn Relay on:
      digitalWrite(relayaPin, HIGH);
    } else {
      // turn Relay off:
      digitalWrite(relayaPin, LOW);
    }
  }

  //6" Pods
  if (message == "65 0 2 1 ffff ffff ffff") {
    myNextion.buttonToggle(button2State, "b1", 0, 2);
    if (button2State == HIGH) {
      // turn Relay on:
      digitalWrite(relaybPin, HIGH);
    } else {
      // turn Relay off:
      digitalWrite(relaybPin, LOW);
    }
  }

  //Fender Pods
  if (message == "65 0 3 1 ffff ffff ffff") {
    myNextion.buttonToggle(button3State, "b2", 0, 2);
    if (button3State == HIGH) {
      // turn Relay on:
      digitalWrite(relaycPin, HIGH);
    } else {
      // turn Relay off:
      digitalWrite(relaycPin, LOW);
    }
  }

  //Rock Lights
  if (message == "65 0 4 1 ffff ffff ffff") {
    myNextion.buttonToggle(button4State, "b3", 0, 2);
    if (button4State == HIGH) {
      // turn Relay on:
      digitalWrite(relaydPin, HIGH);
    } else {
      // turn Relay off:
      digitalWrite(relaydPin, LOW);
    }
  }

  //All On
  if (message == "65 0 5 1 ffff ffff ffff") {
    myNextion.buttonToggle(button5State, "b4", 0, 2);

    if (button5State == HIGH) {
      digitalWrite(relayaPin, HIGH);
      digitalWrite(relaybPin, HIGH);
      digitalWrite(relaycPin, HIGH);
      digitalWrite(relaydPin, HIGH);
    }
    else {
      digitalWrite(relayaPin, LOW);
      digitalWrite(relaybPin, LOW);
      digitalWrite(relaycPin, LOW);
      digitalWrite(relaydPin, LOW);
    }
  }

}

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


Rename to be used with ide

Rename to be used with ide

// Copyright (c) 2013 Nautilabs
// https://github.com/baptistelabat/robokite

// This file used SoftwareSerial example (Copyright (c) 2012 Dimension Engineering LLC) for Sabertooth http://www.dimensionengineering.com/software/SabertoothSimplifiedArduinoLibrary/html/index.html
// See license.txt in the Sabertooth arduino library for license details.
// It is as well derived from HBridgePWM.ino from robokite project
// http://code.google.com/p/robokite/source/browse/HBridgePWM/HBridgePWM.ino
// The selector 1 3 5 6 have to be on on.
#include <SoftwareSerial.h>
#include <SabertoothSimplified.h>
#include <TinyGPS++.h>
#include <PID_v1.h>

SoftwareSerial SWSerial(NOT_A_PIN, 8); // RX on no pin (unused), TX on pin 11 (to S1).
SabertoothSimplified ST(SWSerial); // Use SWSerial as the serial port.

const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to

int sensorValue = 0;        // Value read from the potentiometer
int initialSensorValue = 0;
double alphaSigned1 = 0;
double alphaSigned2 = 0;
String inputString = "";         // A string to hold incoming data
boolean stringComplete = false;  // Whether the string is complete
boolean isSerialControl = true;
boolean isManualControl = false;
// Read the analog in value
// The range was reduced
double sensorValueMin = 200;//0
double sensorValueMax = 800;//1023
double deadBand = 0.1; // Use to ensure zero speed. Should not be zero
double serialFrequency = 1;
long lastSerialInputTime = 0;
long lastWriteTime = 0;

TinyGPSPlus nmea;
// O stands for Opensource, R for Robokite
// The index is the place of the field in the NMEA message
TinyGPSCustom pwm1     (nmea, "ORPW1", 1);  // Dimentionless voltage setpoint (Pulse Width Modulation) for Sabertooth output 1
TinyGPSCustom pwm2     (nmea, "ORPW2", 1);  // Dimentionless voltage setpoint (Pulse Width Modulation) for Sabertooth output 2
TinyGPSCustom setss1   (nmea, "ORSS1", 1);  // Set speed for Sabertooth output 1
TinyGPSCustom setss2   (nmea, "ORSS2", 1);  // Set speed for Sabertooth output 2
TinyGPSCustom setpos1  (nmea, "ORSP1", 1);  // Position setpoint for Sabertooth output 1
TinyGPSCustom setpos2  (nmea, "ORSP2", 1);  // Position setpoint for Sabertooth output 2
TinyGPSCustom roll     (nmea, "ORKST", 1);  // Kite STate roll (rotation in camera frame)
TinyGPSCustom elevation(nmea, "ORKST", 2);  // Kite STate elevation
TinyGPSCustom bearing  (nmea, "ORKST", 3);  // Kite STate bearing
TinyGPSCustom kpm      (nmea, "ORKPM", 1);  // Proportional coefficient multiplicator
TinyGPSCustom kim	   (nmea, "ORKIM", 1);  // Integral coefficient multiplicator
TinyGPSCustom kdm      (nmea, "ORKDM", 1);  // Derivative coefficient multiplicator

//Define Variables we'll be connecting to
double Setpoint, Input, Output;

//Specify the links and initial tuning parameters (Kp, Ki, Kd)
PID myPID(&Input, &Output, &Setpoint, 1, 1, 1, DIRECT);

void setup()
{
  // Initialize software serial communication with Sabertooth
  SWSerial.begin(9600);
  // Initialize serial communications at 9600 bps:
  Serial.begin(19200);
  Input = 0;
  Setpoint = 0;
  //turn the PID on
  myPID.SetMode(AUTOMATIC);
  myPID.SetOutputLimits(-50, 50);
}

void serialEvent() {

  inputString="";
  Serial.flush();
  while (Serial.available()) {
    // Get the new byte:
    char inChar = (char)Serial.read();
    // Add it to the inputString:
    inputString += inChar;
    // If the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    }
  }
  if (inputString[0] == 'i')
  {
    Serial.flush();
    isSerialControl = true;
    initialSensorValue = analogRead(analogInPin);// Read the joystick position to overide if joystick is moved
    if (inputString.substring(1)=="")
    {
      serialFrequency = 0;
    }
    else
    {
      serialFrequency = StrToFloat(inputString.substring(1));
    }
  }
  else
  {
    if (inputString == "o")
    {
      isSerialControl = false;
    }
    else
    {
      char c[50];
      inputString.toCharArray(c, 50);
      char *gpsStream = c;
      while (*gpsStream)
        if (nmea.encode(*gpsStream++))
      {
        alphaSigned1 = StrToFloat(pwm1.value());
        alphaSigned2 = StrToFloat(pwm2.value());
        Input = StrToFloat(elevation.value());
        lastSerialInputTime = millis();
        myPID.SetTunings(kpm, kim, kdm);
      }
    }
  }
}

void loop()
{
  myPID.Compute();
  int power1, power2;
  sensorValue = analogRead(analogInPin);
  setMode();
  //alphaSigned=Output/127.0;
  computeAlphaSigned();
  power1 = alphaSigned1*127;
  power2 = alphaSigned2*127;
  ST.motor(1, power1);
  ST.motor(2, power2);
  delay(10);
  if (millis()-lastWriteTime>100)
  {
    lastWriteTime = millis();

    Serial.print(power1);
    Serial.print(" ");
    Serial.println(power2);
    if (isSerialControl)
    {
      //Serial.println("S");
    }
    else
    {
      if (isManualControl)
      {
        //Serial.println("M");
      }
    }

  }
  Serial.flush();
}

void setMode()
{
  // If the analog value is changed, it means that the user wants to take control with the joystick
  // so fallback to joystick control
  if (fabs(initialSensorValue-sensorValue) > 10)
  {
    isSerialControl = false;
  }

  // Fallback to manual control if the analog voltage is close to zero (probably unplugged)
  // Place after hardware limit if possible
  // This avoids to go to full speed if one cable in the potentiometer is unplugged
  // Warning: if the midle cable of the potentiometer is unplugged, the signal is free, and the fault can not be detected
  // \todo invert polarity to be able to detect floating pin.
  isManualControl = false;//(sensorValue < 5)|(sensorValue >1023-5);
}

float StrToFloat(String str){
  char carray[str.length() + 1]; // Determine the size of the array
  str.toCharArray(carray, sizeof(carray)); // Put str into an array
  return atof(carray);
}

void computeAlphaSigned()
{
  if (serialFrequency != 0)
  { // Fallbacks to zero as we received no message in the expected time (twice the time)
    if ((millis()-lastSerialInputTime) > 2*1/serialFrequency*1000)
    {
      alphaSigned1 = 0;
      alphaSigned2 = 0;
    }
  }

  // If not in Serial control overwrite the value
  if (false == isSerialControl)
  {
    // Compute the value corresponding to the deadband
    double sensorDeadBandMax = sensorValueMin + (deadBand/2.0+0.5)*(sensorValueMax - sensorValueMin);
    double sensorDeadBandMin = sensorValueMin + (-deadBand/2.0+0.5)*(sensorValueMax - sensorValueMin);
    if (sensorValue < sensorDeadBandMin) //strictly to avoid alphaSigned equals zero
    {
      alphaSigned1 = (sensorValue-sensorValueMin)/(sensorDeadBandMax - sensorValueMin)-1;
      alphaSigned2 = 0;
    }
    else
    {
      if (sensorValue > sensorDeadBandMax)
      {
        alphaSigned1 = (sensorValue-sensorDeadBandMax)/(sensorValueMax - sensorDeadBandMax);
        alphaSigned2 = 0;
      }
      else
      {
        alphaSigned1 = 0;
        alphaSigned2 = 0;
      }
    }
    if (isManualControl)
    {
      alphaSigned1 = 0;
      alphaSigned2 = 0;
    }
  }
  alphaSigned1 = min(1, max(-1, alphaSigned1));
  alphaSigned2 = min(1, max(-1, alphaSigned2));
}

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


Dat code yo

Dat code yo

#include <Wire.h>
#define accel_module (0x53)
#define xyzregister (0x32)

byte values[6] ;
char output[512];
byte base[3];
byte reading[3];

void setup(){
  Wire.begin();
  Serial.begin(9600);
  Wire.beginTransmission(accel_module);
  Wire.write(0x2D);
  Wire.write(0);
  Wire.endTransmission();
  Wire.beginTransmission(accel_module);
  Wire.write(0x2D);
  Wire.write(16);
  Wire.endTransmission();
  Wire.beginTransmission(accel_module);
  Wire.write(0x2D);
  Wire.write(8);
  Wire.endTransmission();
  delay(200);
  readAccel();
  base[0] = reading[0];
  base[1] = reading[1];
  base[2] = reading[2];
}

void loop(){
  readAccel();
  int diff = abs(base[0]-reading[0]) + abs(base[1]-reading[1]) + abs(base[2]-reading[2]);
  if (diff > 30) {
    sprintf(output, "%d %d %d", reading[0],reading[1] ,reading[2]);
    Serial.print(output);
    Serial.write(10);
    //This is where we can change the interval
    delay(200);
  }
}

void readAccel() {
  Wire.beginTransmission(accel_module);
  Wire.write(xyzregister);
  Wire.endTransmission();
  Wire.beginTransmission(accel_module);
  Wire.requestFrom(accel_module, 6);
  int i = 0;
  while(Wire.available()){
    values[i] = Wire.read();
    i++;
  }
  Wire.endTransmission();
  reading[0] = (((int)values[1]) << 8) | values[0];
  reading[1] = (((int)values[3]) << 8) | values[2];
  reading[2] = (((int)values[5]) << 8) | values[4];
}

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


Fixed steering compensation

Fixed steering compensation

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


fixed sizeof things to calculate elements, etc

error: pathspec 'Teensy-MIDI/Arduino' did not match any file(s) known to git
error: pathspec 'Sketch/teensy3.2_midi_IO_04/teensy3.2_midi_IO_04.ino' did not match any file(s) known to git


Added Servo Objects

Added Servo Objects

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


Parachute Altitude / More GPS Telem

Parachute Altitude / More GPS Telem

Added altitude constraints for parachute deployment as well as more GPS
parameters to the telemetry.

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


Added a level sensor to test tilt using the MPU6050

// I2C device class (I2Cdev) demonstration Arduino sketch for MPU6050 class using DMP (MotionApps v2.0)
// 6/21/2012 by Jeff Rowberg <jeff@rowberg.net>
// Updates should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib

// I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files
// for both classes must be in the include path of your project
#include "I2Cdev.h"

#include "MPU6050_6Axis_MotionApps20.h"
//#include "MPU6050.h" // not necessary if using MotionApps include file

// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
// is used in I2Cdev.h
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
    #include "Wire.h"
#endif

// class default I2C address is 0x68
// specific I2C addresses may be passed as a parameter here
// AD0 low = 0x68 (default for SparkFun breakout and InvenSense evaluation board)
// AD0 high = 0x69
MPU6050 mpu;
//MPU6050 mpu(0x69); // <-- use for AD0 high

/* =========================================================================
   NOTE: In addition to connection 3.3v, GND, SDA, and SCL, this sketch
   depends on the MPU-6050's INT pin being connected to the Arduino's
   external interrupt #0 pin. On the Arduino Uno and Mega 2560, this is
   digital I/O pin 2.
 * ========================================================================= */

/* =========================================================================
   NOTE: Arduino v1.0.1 with the Leonardo board generates a compile error
   when using Serial.write(buf, len). The Teapot output uses this method.
   The solution requires a modification to the Arduino USBAPI.h file, which
   is fortunately simple, but annoying. This will be fixed in the next IDE
   release. For more info, see these links:

   http://arduino.cc/forum/index.php/topic,109987.0.html
   http://code.google.com/p/arduino/issues/detail?id=958
 * ========================================================================= */

#define LED_PIN 13 // (Arduino is 13, Teensy is 11, Teensy++ is 6)
#define calibrateCount 1250
bool blinkState = false;
int tilted = 12;    // Red LED
int moving = 11;    // Yellow LED
int level = 10;     // Green LED
int count = 0;      // Counts to a number while calibrating sensor (10 secs)
int refX, refY, refZ;     // Reference value after calibration
int dx, dy, dz, tempx, tempy, tempz;
int accelX, accelY, accelZ;
bool setRef = false;      // false until reference values are set

// MPU control/status vars
bool dmpReady = false;  // set true if DMP init was successful
uint8_t mpuIntStatus;   // holds actual interrupt status byte from MPU
uint8_t devStatus;      // return status after each device operation (0 = success, !0 = error)
uint16_t packetSize;    // expected DMP packet size (default is 42 bytes)
uint16_t fifoCount;     // count of all bytes currently in FIFO
uint8_t fifoBuffer[64]; // FIFO storage buffer

// orientation/motion vars
Quaternion q;           // [w, x, y, z]         quaternion container
VectorInt16 aa;         // [x, y, z]            accel sensor measurements
VectorInt16 aaReal;     // [x, y, z]            gravity-free accel sensor measurements
VectorInt16 aaWorld;    // [x, y, z]            world-frame accel sensor measurements
VectorFloat gravity;    // [x, y, z]            gravity vector
float euler[3];         // [psi, theta, phi]    Euler angle container
float ypr[3];           // [yaw, pitch, roll]   yaw/pitch/roll container and gravity vector

// packet structure for InvenSense teapot demo
uint8_t teapotPacket[14] = { '$', 0x02, 0,0, 0,0, 0,0, 0,0, 0x00, 0x00, '\r', '\n' };

// ================================================================
// ===               INTERRUPT DETECTION ROUTINE                ===
// ================================================================

volatile bool mpuInterrupt = false;     // indicates whether MPU interrupt pin has gone high
void dmpDataReady() {
    mpuInterrupt = true;
}

// ================================================================
// ===                      INITIAL SETUP                       ===
// ================================================================

void setup() {
    // join I2C bus (I2Cdev library doesn't do this automatically)
    #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
        Wire.begin();
        TWBR = 24; // 400kHz I2C clock (200kHz if CPU is 8MHz)
    #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
        Fastwire::setup(400, true);
    #endif

    // initialize serial communication
    // (115200 chosen because it is required for Teapot Demo output, but it's
    // really up to you depending on your project)
    Serial.begin(57600);
    while (!Serial); // wait for Leonardo enumeration, others continue immediately

    // NOTE: 8MHz or slower host processors, like the Teensy @ 3.3v or Ardunio
    // Pro Mini running at 3.3v, cannot handle this baud rate reliably due to
    // the baud timing being too misaligned with processor ticks. You must use
    // 38400 or slower in these cases, or use some kind of external separate
    // crystal solution for the UART timer.

    // initialize device
    Serial.println(F("Initializing I2C devices..."));
    mpu.initialize();

    // verify connection
    Serial.println(F("Testing device connections..."));
    Serial.println(mpu.testConnection() ? F("MPU6050 connection successful") : F("MPU6050 connection failed"));

    // wait for ready
    Serial.println(F("\nSend any character to begin DMP programming and demo: "));
    while (Serial.available() && Serial.read()); // empty buffer
    Serial.write('j');
    while (Serial.available() && Serial.read()); // empty buffer again

    // load and configure the DMP
    Serial.println(F("Initializing DMP..."));
    devStatus = mpu.dmpInitialize();

    // supply your own gyro offsets here, scaled for min sensitivity
    mpu.setXGyroOffset(220);
    mpu.setYGyroOffset(76);
    mpu.setZGyroOffset(-85);
    mpu.setZAccelOffset(1788); // 1688 factory default for my test chip

    // make sure it worked (returns 0 if so)
    if (devStatus == 0) {
        // turn on the DMP, now that it's ready
        Serial.println(F("Enabling DMP..."));
        mpu.setDMPEnabled(true);

        // enable Arduino interrupt detection
        Serial.println(F("Enabling interrupt detection (Arduino external interrupt 0)..."));
        attachInterrupt(0, dmpDataReady, RISING);
        mpuIntStatus = mpu.getIntStatus();

        // set our DMP Ready flag so the main loop() function knows it's okay to use it
        Serial.println(F("DMP ready! Waiting for first interrupt..."));
        dmpReady = true;

        // get expected DMP packet size for later comparison
        packetSize = mpu.dmpGetFIFOPacketSize();
    } else {
        // ERROR!
        // 1 = initial memory load failed
        // 2 = DMP configuration updates failed
        // (if it's going to break, usually the code will be 1)
        Serial.print(F("DMP Initialization failed (code "));
        Serial.print(devStatus);
        Serial.println(F(")"));
    }

    // configure LED for output
    pinMode(LED_PIN, OUTPUT);
    pinMode(tilted, OUTPUT);
    pinMode(moving, OUTPUT);
    pinMode(level, OUTPUT);
}

// ================================================================
// ===                    MAIN PROGRAM LOOP                     ===
// ================================================================

void loop() {
    // if programming failed, don't try to do anything
    if (!dmpReady) return;

    // wait for MPU interrupt or extra packet(s) available
    while (!mpuInterrupt && fifoCount < packetSize) {
        // other program behavior stuff here
        // .
        // .
        // .
        // if you are really paranoid you can frequently test in between other
        // stuff to see if mpuInterrupt is true, and if so, "break;" from the
        // while() loop to immediately process the MPU data
        // .
        // .
        // .
    }

    // reset interrupt flag and get INT_STATUS byte
    mpuInterrupt = false;
    mpuIntStatus = mpu.getIntStatus();

    // get current FIFO count
    fifoCount = mpu.getFIFOCount();

    // check for overflow (this should never happen unless our code is too inefficient)
    if ((mpuIntStatus & 0x10) || fifoCount == 1024) {
        // reset so we can continue cleanly
        mpu.resetFIFO();
        Serial.println(F("FIFO overflow!"));

    // otherwise, check for DMP data ready interrupt (this should happen frequently)
    } else if (mpuIntStatus & 0x02) {
        // wait for correct available data length, should be a VERY short wait
        while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount();

        // read a packet from FIFO
        mpu.getFIFOBytes(fifoBuffer, packetSize);

        // track FIFO count here in case there is > 1 packet available
        // (this lets us immediately read more without waiting for an interrupt)
        fifoCount -= packetSize;

            // display Euler angles in degrees
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetEuler(euler, &q);
            int xDeg = euler[0] * 180/M_PI;
            int yDeg = euler[1] * 180/M_PI;
            int zDeg = euler[2] * 180/M_PI;
            Serial.print("euler\t");
            Serial.print(xDeg);
            Serial.print("\t");
            Serial.print(yDeg);
            Serial.print("\t");
            Serial.print(zDeg);
            Serial.print("\t");

            Serial.print("\tXRef: ");
            Serial.print(refX);
            Serial.print("\tYRef: ");
            Serial.print(refY);
            Serial.print("\tZRef: ");
            Serial.print(refZ);
            Serial.print("\tCount: ");
            Serial.println(count);

/*
            // display real acceleration, adjusted to remove gravity
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetAccel(&aa, fifoBuffer);
            mpu.dmpGetGravity(&gravity, &q);
            mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
            Serial.print("areal\t");
            Serial.print(aaReal.x);
            Serial.print("\t");
            Serial.print(aaReal.y);
            Serial.print("\t");
            Serial.print(aaReal.z);
            Serial.print("\t");

            Serial.print("Count: ");
            Serial.println(count);

        // Set acceleration values here
        dx = aaReal.x - tempx;
        dy = ay - tempy;
        dz = az - tempz;
        dx = (dx/10);
        int modx = dx%10;
        dx = dx-modx;
        dy = (dy/10);
        int mody = dy%10;
        dy = dy-mody;
        dz = (dz/10);
        int modz = dz%10;
        dz = dz-modz;

        tempx = ax;
        tempy = ay;
        tempz = az;
 */
        if(count < calibrateCount) {
          count++;
          if(count%100 < 50) {
            digitalWrite(tilted, HIGH);
            digitalWrite(moving, HIGH);
            digitalWrite(level, HIGH);
          } else {
            digitalWrite(tilted, LOW);
            digitalWrite(moving, LOW);
            digitalWrite(level, LOW);
          }
        } else if (!setRef) {
          // Play a speaker tone when calibrated for feedback?
          refX = xDeg;
          refY = yDeg;
          refZ = zDeg;
          digitalWrite(tilted, LOW);
          digitalWrite(moving, LOW);
          digitalWrite(level, LOW);
          setRef = true;
        } else {
          //Test to see if moving here

          if(abs(abs(xDeg)-abs(refX)) < 8 && abs(abs(zDeg)-abs(refZ)) < 8) {
            digitalWrite(tilted, LOW);
            digitalWrite(moving, LOW);
            digitalWrite(level, HIGH);
          } else {
            digitalWrite(tilted, HIGH);
            digitalWrite(moving, LOW);
            digitalWrite(level, LOW);
          }
        }

            /*
             // display real acceleration, adjusted to remove gravity
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetAccel(&aa, fifoBuffer);
            mpu.dmpGetGravity(&gravity, &q);
            mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
            Serial.print("areal\t");
            Serial.print(aaReal.x);
            Serial.print("\t");
            Serial.print(aaReal.y);
            Serial.print("\t");
            Serial.println(aaReal.z);
            */

            /*
            // display initial world-frame acceleration, adjusted to remove gravity
            // and rotated based on known orientation from quaternion
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetAccel(&aa, fifoBuffer);
            mpu.dmpGetGravity(&gravity, &q);
            mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
            mpu.dmpGetLinearAccelInWorld(&aaWorld, &aaReal, &q);
            Serial.print("aworld\t");
            Serial.print(aaWorld.x);
            Serial.print("\t");
            Serial.print(aaWorld.y);
            Serial.print("\t");
            Serial.println(aaWorld.z);
            */

        // blink LED to indicate activity
        blinkState = !blinkState;
        digitalWrite(LED_PIN, blinkState);
    }
}

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


remove debug blinks

remove debug blinks

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/dave-ausbone/TJU-SST.git/'


Using pulse in function

Using pulse in function

Using pulse in function. More accurate.

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


fixes to detectwater and pin declarations

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/ocean-x/erikson-1.git/'


Processing supported

Processing supported

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/WSPCrea/2017-aki-kada.git/'


Create simplemodbusslave.ino

Create simplemodbusslave.ino

#include <SimpleModbusSlave.h>

/*
   SimpleModbusSlaveV10 supports function 3, 6 & 16.

   This example code will receive the adc ch0 value from the arduino master.
   It will then use this value to adjust the brightness of the led on pin 9.
   The value received from the master will be stored in address 1 in its own
   address space namely holdingRegs[].

   In addition to this the slaves own adc ch0 value will be stored in
   address 0 in its own address space holdingRegs[] for the master to
   be read. The master will use this value to alter the brightness of its
   own led connected to pin 9.

   The modbus_update() method updates the holdingRegs register array and checks
   communication.

   Note:
   The Arduino serial ring buffer is 64 bytes or 32 registers.
   Most of the time you will connect the arduino to a master via serial
   using a MAX485 or similar.

   In a function 3 request the master will attempt to read from your
   slave and since 5 bytes is already used for ID, FUNCTION, NO OF BYTES
   and two BYTES CRC the master can only request 58 bytes or 29 registers.

   In a function 16 request the master will attempt to write to your
   slave and since a 9 bytes is already used for ID, FUNCTION, ADDRESS,
   NO OF REGISTERS, NO OF BYTES and two BYTES CRC the master can only write
   54 bytes or 27 registers.

   Using a USB to Serial converter the maximum bytes you can send is
   limited to its internal buffer which differs between manufactures.
*/
#define baud 9600
#define timeout 1000
#define polling 200 // the scan rate
#define retry_count 10

// used to toggle the receive/transmit pin on the driver
#define TxEnablePin 2
#define  LED 9

// Using the enum instruction allows for an easy method for adding and
// removing registers. Doing it this way saves you #defining the size
// of your slaves register array each time you want to add more registers
// and at a glimpse informs you of your slaves register layout.

//////////////// registers of your slave ///////////////////
enum
{
  // just add or remove registers and your good to go...
  // The first register starts at address 0
  ADC_VAL,
  PWM_VAL,
  HOLDING_REGS_SIZE // leave this one
  // total number of registers for function 3 and 16 share the same register array
  // i.e. the same address space
};

unsigned int holdingRegs[HOLDING_REGS_SIZE]; // function 3 and 16 register array
////////////////////////////////////////////////////////////

void setup()
{
  /* parameters(HardwareSerial* SerialPort,
                long baudrate,
		unsigned char byteFormat,
                unsigned char ID,
                unsigned char transmit enable pin,
                unsigned int holding registers size,
                unsigned int* holding register array)
  */

  /* Valid modbus byte formats are:
     SERIAL_8N2: 1 start bit, 8 data bits, 2 stop bits
     SERIAL_8E1: 1 start bit, 8 data bits, 1 Even parity bit, 1 stop bit
     SERIAL_8O1: 1 start bit, 8 data bits, 1 Odd parity bit, 1 stop bit

     You can obviously use SERIAL_8N1 but this does not adhere to the
     Modbus specifications. That said, I have tested the SERIAL_8N1 option
     on various commercial masters and slaves that were suppose to adhere
     to this specification and was always able to communicate... Go figure.

     These byte formats are already defined in the Arduino global name space.
  */

  modbus_configure(&Serial, 115200, SERIAL_8N2, 1, 2, HOLDING_REGS_SIZE, holdingRegs);

  // modbus_update_comms(baud, byteFormat, id) is not needed but allows for easy update of the
  // port variables and slave id dynamically in any function.
  modbus_update_comms(9600, SERIAL_8N2, 1);

  pinMode(LED, OUTPUT);
}

void loop()
{
  // modbus_update() is the only method used in loop(). It returns the total error
  // count since the slave started. You don't have to use it but it's useful
  // for fault finding by the modbus master.

  modbus_update();

  holdingRegs[ADC_VAL] = analogRead(A0); // update data to be read by the master to adjust the PWM

 analogWrite(LED, holdingRegs[1]); // constrain adc value from the arduino master to 255
  //digitalWrite(LED,holdingRegs[PWM_VAL]);

  /* Note:
     The use of the enum instruction is not needed. You could set a maximum allowable
     size for holdinRegs[] by defining HOLDING_REGS_SIZE using a constant and then access
     holdingRegs[] by "Index" addressing.
     I.e.
     holdingRegs[0] = analogRead(A0);
     analogWrite(LED, holdingRegs[1]/4);
  */

}

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