Create AuroraInverter3.ino

Create AuroraInverter3.ino

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266mDNS.h>
#include <ESP8266WebServer.h>
#include <SoftwareSerial.h>

//RS485 control
#define SSerialTxControl 5 //GPIO5 (D1)
#define RS485Transmit HIGH
#define RS485Receive LOW

#define RX 3  //GPIO3 (RX)
#define TX 1  //GPIO1 (TX)

class clsAurora {
private:
  int MaxAttempt = 1;
  byte Address = 0;

  void clearData(byte *data, byte len) {
    for (int i = 0; i < len; i++) {
      data[i] = 0;
    }
  }

  int Crc16(byte *data, int offset, int count)
  {
    byte BccLo = 0xFF;
    byte BccHi = 0xFF;

    for (int i = offset; i < (offset + count); i++)
    {
      byte New = data[offset + i] ^ BccLo;
      byte Tmp = New << 4;
      New = Tmp ^ New;
      Tmp = New >> 5;
      BccLo = BccHi;
      BccHi = New ^ Tmp;
      Tmp = New << 3;
      BccLo = BccLo ^ Tmp;
      Tmp = New >> 4;
      BccLo = BccLo ^ Tmp;

    }

    return (int)word(~BccHi, ~BccLo);
  }

  bool Send(byte address, byte param0, byte param1, byte param2, byte param3, byte param4, byte param5, byte param6)
  {

    SendStatus = false;
    ReceiveStatus = false;

    byte SendData[10];
    SendData[0] = address;
    SendData[1] = param0;
    SendData[2] = param1;
    SendData[3] = param2;
    SendData[4] = param3;
    SendData[5] = param4;
    SendData[6] = param5;
    SendData[7] = param6;

    int crc = Crc16(SendData, 0, 8);
    SendData[8] = lowByte(crc);
    SendData[9] = highByte(crc);

    clearReceiveData();

    for (int i = 0; i < MaxAttempt; i++)
    {
      digitalWrite(SSerialTxControl, RS485Transmit);
      delay(50);

      if (Serial.write(SendData, sizeof(SendData)) != 0) {
        Serial.flush();
        SendStatus = true;

        digitalWrite(SSerialTxControl, RS485Receive);

        if (Serial.readBytes(ReceiveData, sizeof(ReceiveData)) != 0) {
          if ((int)word(ReceiveData[7], ReceiveData[6]) == Crc16(ReceiveData, 0, 6)) {
            ReceiveStatus = true;
            break;
          }
        }
      }
    }
    return ReceiveStatus;
  }

  union {
    byte asBytes[4];
    float asFloat;
  } foo;

  union {
    byte asBytes[4];
    unsigned long asUlong;
  } ulo;

public:
  bool SendStatus = false;
  bool ReceiveStatus = false;
  byte ReceiveData[8];

  clsAurora(byte address) {
    Address = address;

    SendStatus = false;
    ReceiveStatus = false;

    clearReceiveData();
  }

  void clearReceiveData() {
    clearData(ReceiveData, 8);
  }

  String TransmissionState(byte id) {
    switch (id)
    {
    case 0:
      return F("Everything is OK.");
      break;
    case 51:
      return F("Command is not implemented");
      break;
    case 52:
      return F("Variable does not exist");
      break;
    case 53:
      return F("Variable value is out of range");
      break;
    case 54:
      return F("EEprom not accessible");
      break;
    case 55:
      return F("Not Toggled Service Mode");
      break;
    case 56:
      return F("Can not send the command to internal micro");
      break;
    case 57:
      return F("Command not Executed");
      break;
    case 58:
      return F("The variable is not available, retry");
      break;
    default:
      return F("Sconosciuto");
      break;
    }
  }

  String GlobalState(byte id) {
    switch (id)
    {
    case 0:
      return F("Sending Parameters");
      break;
    case 1:
      return F("Wait Sun / Grid");
      break;
    case 2:
      return F("Checking Grid");
      break;
    case 3:
      return F("Measuring Riso");
      break;
    case 4:
      return F("DcDc Start");
      break;
    case 5:
      return F("Inverter Start");
      break;
    case 6:
      return F("Run");
      break;
    case 7:
      return F("Recovery");
      break;
    case 8:
      return F("Pausev");
      break;
    case 9:
      return F("Ground Fault");
      break;
    case 10:
      return F("OTH Fault");
      break;
    case 11:
      return F("Address Setting");
      break;
    case 12:
      return F("Self Test");
      break;
    case 13:
      return F("Self Test Fail");
      break;
    case 14:
      return F("Sensor Test + Meas.Riso");
      break;
    case 15:
      return F("Leak Fault");
      break;
    case 16:
      return F("Waiting for manual reset");
      break;
    case 17:
      return F("Internal Error E026");
      break;
    case 18:
      return F("Internal Error E027");
      break;
    case 19:
      return F("Internal Error E028");
      break;
    case 20:
      return F("Internal Error E029");
      break;
    case 21:
      return F("Internal Error E030");
      break;
    case 22:
      return F("Sending Wind Table");
      break;
    case 23:
      return F("Failed Sending table");
      break;
    case 24:
      return F("UTH Fault");
      break;
    case 25:
      return F("Remote OFF");
      break;
    case 26:
      return F("Interlock Fail");
      break;
    case 27:
      return F("Executing Autotest");
      break;
    case 30:
      return F("Waiting Sun");
      break;
    case 31:
      return F("Temperature Fault");
      break;
    case 32:
      return F("Fan Staucked");
      break;
    case 33:
      return F("Int.Com.Fault");
      break;
    case 34:
      return F("Slave Insertion");
      break;
    case 35:
      return F("DC Switch Open");
      break;
    case 36:
      return F("TRAS Switch Open");
      break;
    case 37:
      return F("MASTER Exclusion");
      break;
    case 38:
      return F("Auto Exclusion");
      break;
    case 98:
      return F("Erasing Internal EEprom");
      break;
    case 99:
      return F("Erasing External EEprom");
      break;
    case 100:
      return F("Counting EEprom");
      break;
    case 101:
      return F("Freeze");
    default:
      return F("Sconosciuto");
      break;
    }
  }

  String DcDcState(byte id) {
    switch (id)
    {
    case 0:
      return F("DcDc OFF");
      break;
    case 1:
      return F("Ramp Start");
      break;
    case 2:
      return F("MPPT");
      break;
    case 3:
      return F("Not Used");
      break;
    case 4:
      return F("Input OC");
      break;
    case 5:
      return F("Input UV");
      break;
    case 6:
      return F("Input OV");
      break;
    case 7:
      return F("Input Low");
      break;
    case 8:
      return F("No Parameters");
      break;
    case 9:
      return F("Bulk OV");
      break;
    case 10:
      return F("Communication Error");
      break;
    case 11:
      return F("Ramp Fail");
      break;
    case 12:
      return F("Internal Error");
      break;
    case 13:
      return F("Input mode Error");
      break;
    case 14:
      return F("Ground Fault");
      break;
    case 15:
      return F("Inverter Fail");
      break;
    case 16:
      return F("DcDc IGBT Sat");
      break;
    case 17:
      return F("DcDc ILEAK Fail");
      break;
    case 18:
      return F("DcDc Grid Fail");
      break;
    case 19:
      return F("DcDc Comm.Error");
      break;
    default:
      return F("Sconosciuto");
      break;
    }
  }

  String InverterState(byte id) {
    switch (id)
    {
    case 0:
      return F("Stand By");
      break;
    case 1:
      return F("Checking Grid");
      break;
    case 2:
      return F("Run");
      break;
    case 3:
      return F("Bulk OV");
      break;
    case 4:
      return F("Out OC");
      break;
    case 5:
      return F("IGBT Sat");
      break;
    case 6:
      return F("Bulk UV");
      break;
    case 7:
      return F("Degauss Error");
      break;
    case 8:
      return F("No Parameters");
      break;
    case 9:
      return F("Bulk Low");
      break;
    case 10:
      return F("Grid OV");
      break;
    case 11:
      return F("Communication Error");
      break;
    case 12:
      return F("Degaussing");
      break;
    case 13:
      return F("Starting");
      break;
    case 14:
      return F("Bulk Cap Fail");
      break;
    case 15:
      return F("Leak Fail");
      break;
    case 16:
      return F("DcDc Fail");
      break;
    case 17:
      return F("Ileak Sensor Fail");
      break;
    case 18:
      return F("SelfTest: relay inverter");
      break;
    case 19:
      return F("SelfTest : wait for sensor test");
      break;
    case 20:
      return F("SelfTest : test relay DcDc + sensor");
      break;
    case 21:
      return F("SelfTest : relay inverter fail");
      break;
    case 22:
      return F("SelfTest timeout fail");
      break;
    case 23:
      return F("SelfTest : relay DcDc fail");
      break;
    case 24:
      return F("Self Test 1");
      break;
    case 25:
      return F("Waiting self test start");
      break;
    case 26:
      return F("Dc Injection");
      break;
    case 27:
      return F("Self Test 2");
      break;
    case 28:
      return F("Self Test 3");
      break;
    case 29:
      return F("Self Test 4");
      break;
    case 30:
      return F("Internal Error");
      break;
    case 31:
      return F("Internal Error");
      break;
    case 40:
      return F("Forbidden State");
      break;
    case 41:
      return F("Input UC");
      break;
    case 42:
      return F("Zero Power");
      break;
    case 43:
      return F("Grid Not Present");
      break;
    case 44:
      return F("Waiting Start");
      break;
    case 45:
      return F("MPPT");
      break;
    case 46:
      return F("Grid Fail");
      break;
    case 47:
      return F("Input OC");
      break;
    default:
      return F("Sconosciuto");
      break;
    }
  }

  String AlarmState(byte id) {
    switch (id)
    {
    case 0:
      return F("No Alarm");
      break;
    case 1:
      return F("Sun Low");
      break;
    case 2:
      return F("Input OC");
      break;
    case 3:
      return F("Input UV");
      break;
    case 4:
      return F("Input OV");
      break;
    case 5:
      return F("Sun Low");
      break;
    case 6:
      return F("No Parameters");
      break;
    case 7:
      return F("Bulk OV");
      break;
    case 8:
      return F("Comm.Error");
      break;
    case 9:
      return F("Output OC");
      break;
    case 10:
      return F("IGBT Sat");
      break;
    case 11:
      return F("Bulk UV");
      break;
    case 12:
      return F("Internal error");
      break;
    case 13:
      return F("Grid Fail");
      break;
    case 14:
      return F("Bulk Low");
      break;
    case 15:
      return F("Ramp Fail");
      break;
    case 16:
      return F("Dc / Dc Fail");
      break;
    case 17:
      return F("Wrong Mode");
      break;
    case 18:
      return F("Ground Fault");
      break;
    case 19:
      return F("Over Temp.");
      break;
    case 20:
      return F("Bulk Cap Fail");
      break;
    case 21:
      return F("Inverter Fail");
      break;
    case 22:
      return F("Start Timeout");
      break;
    case 23:
      return F("Ground Fault");
      break;
    case 24:
      return F("Degauss error");
      break;
    case 25:
      return F("Ileak sens.fail");
      break;
    case 26:
      return F("DcDc Fail");
      break;
    case 27:
      return F("Self Test Error 1");
      break;
    case 28:
      return F("Self Test Error 2");
      break;
    case 29:
      return F("Self Test Error 3");
      break;
    case 30:
      return F("Self Test Error 4");
      break;
    case 31:
      return F("DC inj error");
      break;
    case 32:
      return F("Grid OV");
      break;
    case 33:
      return F("Grid UV");
      break;
    case 34:
      return F("Grid OF");
      break;
    case 35:
      return F("Grid UF");
      break;
    case 36:
      return F("Z grid Hi");
      break;
    case 37:
      return F("Internal error");
      break;
    case 38:
      return F("Riso Low");
      break;
    case 39:
      return F("Vref Error");
      break;
    case 40:
      return F("Error Meas V");
      break;
    case 41:
      return F("Error Meas F");
      break;
    case 42:
      return F("Error Meas Z");
      break;
    case 43:
      return F("Error Meas Ileak");
      break;
    case 44:
      return F("Error Read V");
      break;
    case 45:
      return F("Error Read I");
      break;
    case 46:
      return F("Table fail");
      break;
    case 47:
      return F("Fan Fail");
      break;
    case 48:
      return F("UTH");
      break;
    case 49:
      return F("Interlock fail");
      break;
    case 50:
      return F("Remote Off");
      break;
    case 51:
      return F("Vout Avg errror");
      break;
    case 52:
      return F("Battery low");
      break;
    case 53:
      return F("Clk fail");
      break;
    case 54:
      return F("Input UC");
      break;
    case 55:
      return F("Zero Power");
      break;
    case 56:
      return F("Fan Stucked");
      break;
    case 57:
      return F("DC Switch Open");
      break;
    case 58:
      return F("Tras Switch Open");
      break;
    case 59:
      return F("AC Switch Open");
      break;
    case 60:
      return F("Bulk UV");
      break;
    case 61:
      return F("Autoexclusion");
      break;
    case 62:
      return F("Grid df / dt");
      break;
    case 63:
      return F("Den switch Open");
      break;
    case 64:
      return F("Jbox fail");
      break;
    default:
      return F("Sconosciuto");
      break;
    }
  }

  typedef struct {
    byte TransmissionState;
    byte GlobalState;
    byte InverterState;
    byte Channel1State;
    byte Channel2State;
    byte AlarmState;
    bool ReadState;
  } DataState;

  DataState State;

  bool ReadState() {
    State.ReadState = Send(Address, (byte)50, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);

    if (State.ReadState == false) {
      ReceiveData[0] = 255;
      ReceiveData[1] = 255;
      ReceiveData[2] = 255;
      ReceiveData[3] = 255;
      ReceiveData[4] = 255;
      ReceiveData[5] = 255;
    }

    State.TransmissionState = ReceiveData[0];
    State.GlobalState = ReceiveData[1];
    State.InverterState = ReceiveData[2];
    State.Channel1State = ReceiveData[3];
    State.Channel2State = ReceiveData[4];
    State.AlarmState = ReceiveData[5];

    return State.ReadState;
  }

  typedef struct {
    byte TransmissionState;
    byte GlobalState;
    String Par1;
    String Par2;
    String Par3;
    String Par4;
    bool ReadState;
  } DataVersion;

  DataVersion Version;

  bool ReadVersion() {
    Version.ReadState = Send(Address, (byte)58, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);

    if (Version.ReadState == false) {
      ReceiveData[0] = 255;
      ReceiveData[1] = 255;
    }

    Version.TransmissionState = ReceiveData[0];
    Version.GlobalState = ReceiveData[1];

    switch ((char)ReceiveData[2])
    {
    case 'i':
      Version.Par1 = F("Aurora 2 kW indoor");
      break;
    case 'o':
      Version.Par1 = F("Aurora 2 kW outdoor");
      break;
    case 'I':
      Version.Par1 = F("Aurora 3.6 kW indoor");
      break;
    case 'O':
      Version.Par1 = F("Aurora 3.0 - 3.6 kW outdoor");
      break;
    case '5':
      Version.Par1 = F("Aurora 5.0 kW outdoor");
      break;
    case '6':
      Version.Par1 = F("Aurora 6 kW outdoor");
      break;
    case 'P':
      Version.Par1 = F("3 - phase interface (3G74)");
      break;
    case 'C':
      Version.Par1 = F("Aurora 50kW module");
      break;
    case '4':
      Version.Par1 = F("Aurora 4.2kW new");
      break;
    case '3':
      Version.Par1 = F("Aurora 3.6kW new");
      break;
    case '2':
      Version.Par1 = F("Aurora 3.3kW new");
      break;
    case '1':
      Version.Par1 = F("Aurora 3.0kW new");
      break;
    case 'D':
      Version.Par1 = F("Aurora 12.0kW");
      break;
    case 'X':
      Version.Par1 = F("Aurora 10.0kW");
      break;
    default:
      Version.Par1 = F("Sconosciuto");
      break;
    }

    switch ((char)ReceiveData[3])
    {
    case 'A':
      Version.Par2 = F("UL1741");
      break;
    case 'E':
      Version.Par2 = F("VDE0126");
      break;
    case 'S':
      Version.Par2 = F("DR 1663 / 2000");
      break;
    case 'I':
      Version.Par2 = F("ENEL DK 5950");
      break;
    case 'U':
      Version.Par2 = F("UK G83");
      break;
    case 'K':
      Version.Par2 = F("AS 4777");
      break;
    default:
      Version.Par2 = F("Sconosciuto");
      break;
    }

    switch ((char)ReceiveData[4])
    {
    case 'N':
      Version.Par3 = F("Transformerless Version");
      break;
    case 'T':
      Version.Par3 = F("Transformer Version");
      break;
    default:
      Version.Par3 = F("Sconosciuto");
      break;
    }

    switch ((char)ReceiveData[5])
    {
    case 'W':
      Version.Par4 = F("Wind version");
      break;
    case 'N':
      Version.Par4 = F("PV version");
      break;
    default:
      Version.Par4 = F("Sconosciuto");
      break;
    }

    return Version.ReadState;
  }

  typedef struct {
    byte TransmissionState;
    byte GlobalState;
    float Valore;
    bool ReadState;
  } DataDSP;

  DataDSP DSP;

  bool ReadDSP(byte type, byte global) {
    if ((((int)type >= 1 && (int)type <= 9) || ((int)type >= 21 && (int)type <= 63)) && ((int)global >= 0 && (int)global <= 1)) {
      DSP.ReadState = Send(Address, (byte)59, type, global, (byte)0, (byte)0, (byte)0, (byte)0);

      if (DSP.ReadState == false) {
        ReceiveData[0] = 255;
        ReceiveData[1] = 255;
      }

    }
    else {
      DSP.ReadState = false;
      clearReceiveData();
      ReceiveData[0] = 255;
      ReceiveData[1] = 255;
    }

    DSP.TransmissionState = ReceiveData[0];
    DSP.GlobalState = ReceiveData[1];

    foo.asBytes[0] = ReceiveData[5];
    foo.asBytes[1] = ReceiveData[4];
    foo.asBytes[2] = ReceiveData[3];
    foo.asBytes[3] = ReceiveData[2];

    DSP.Valore = foo.asFloat;

    return DSP.ReadState;
  }

  typedef struct {
    byte TransmissionState;
    byte GlobalState;
    unsigned long Secondi;
    bool ReadState;
  } DataTimeDate;

  DataTimeDate TimeDate;

  bool ReadTimeDate() {
    TimeDate.ReadState = Send(Address, (byte)70, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);

    if (TimeDate.ReadState == false) {
      ReceiveData[0] = 255;
      ReceiveData[1] = 255;
    }

    TimeDate.TransmissionState = ReceiveData[0];
    TimeDate.GlobalState = ReceiveData[1];
    TimeDate.Secondi = ((unsigned long)ReceiveData[2] << 24) + ((unsigned long)ReceiveData[3] << 16) + ((unsigned long)ReceiveData[4] << 8) + (unsigned long)ReceiveData[5];
    return TimeDate.ReadState;
  }

  typedef struct {
    byte TransmissionState;
    byte GlobalState;
    byte Alarms1;
    byte Alarms2;
    byte Alarms3;
    byte Alarms4;
    bool ReadState;
  } DataLastFourAlarms;

  DataLastFourAlarms LastFourAlarms;

  bool ReadLastFourAlarms() {
    LastFourAlarms.ReadState = Send(Address, (byte)86, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);

    if (LastFourAlarms.ReadState == false) {
      ReceiveData[0] = 255;
      ReceiveData[1] = 255;
      ReceiveData[2] = 255;
      ReceiveData[3] = 255;
      ReceiveData[4] = 255;
      ReceiveData[5] = 255;
    }

    LastFourAlarms.TransmissionState = ReceiveData[0];
    LastFourAlarms.GlobalState = ReceiveData[1];
    LastFourAlarms.Alarms1 = ReceiveData[2];
    LastFourAlarms.Alarms2 = ReceiveData[3];
    LastFourAlarms.Alarms3 = ReceiveData[4];
    LastFourAlarms.Alarms4 = ReceiveData[5];

    return LastFourAlarms.ReadState;
  }

  bool ReadJunctionBoxState(byte nj) {
    return Send(Address, (byte)200, nj, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);
  }

  bool ReadJunctionBoxVal(byte nj, byte par) {
    return Send(Address, (byte)201, nj, par, (byte)0, (byte)0, (byte)0, (byte)0);
  }

  // Inverters
  typedef struct {
    String PN;
    bool ReadState;
  } DataSystemPN;

  DataSystemPN SystemPN;

  bool ReadSystemPN() {
    SystemPN.ReadState = Send(Address, (byte)52, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);

    SystemPN.PN = String(String((char)ReceiveData[0]) + String((char)ReceiveData[1]) + String((char)ReceiveData[2]) + String((char)ReceiveData[3]) + String((char)ReceiveData[4]) + String((char)ReceiveData[5]));

    return SystemPN.ReadState;
  }

  typedef struct {
    String SerialNumber;
    bool ReadState;
  } DataSystemSerialNumber;

  DataSystemSerialNumber SystemSerialNumber;

  bool ReadSystemSerialNumber() {
    SystemSerialNumber.ReadState = Send(Address, (byte)63, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);

    SystemSerialNumber.SerialNumber = String(String((char)ReceiveData[0]) + String((char)ReceiveData[1]) + String((char)ReceiveData[2]) + String((char)ReceiveData[3]) + String((char)ReceiveData[4]) + String((char)ReceiveData[5]));

    return SystemSerialNumber.ReadState;
  }

  typedef struct {
    byte TransmissionState;
    byte GlobalState;
    String Week;
    String Year;
    bool ReadState;
  } DataManufacturingWeekYear;

  DataManufacturingWeekYear ManufacturingWeekYear;

  bool ReadManufacturingWeekYear() {
    ManufacturingWeekYear.ReadState = Send(Address, (byte)65, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);

    if (ManufacturingWeekYear.ReadState == false) {
      ReceiveData[0] = 255;
      ReceiveData[1] = 255;
    }

    ManufacturingWeekYear.TransmissionState = ReceiveData[0];
    ManufacturingWeekYear.GlobalState = ReceiveData[1];
    ManufacturingWeekYear.Week = String(String((char)ReceiveData[2]) + String((char)ReceiveData[3]));
    ManufacturingWeekYear.Year = String(String((char)ReceiveData[4]) + String((char)ReceiveData[5]));

    return ManufacturingWeekYear.ReadState;
  }

  typedef struct {
    byte TransmissionState;
    byte GlobalState;
    String Release;
    bool ReadState;
  } DataFirmwareRelease;

  DataFirmwareRelease FirmwareRelease;

  bool ReadFirmwareRelease() {
    FirmwareRelease.ReadState = Send(Address, (byte)72, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);

    if (FirmwareRelease.ReadState == false) {
      ReceiveData[0] = 255;
      ReceiveData[1] = 255;
    }

    FirmwareRelease.TransmissionState = ReceiveData[0];
    FirmwareRelease.GlobalState = ReceiveData[1];
    FirmwareRelease.Release = String(String((char)ReceiveData[2]) + "." + String((char)ReceiveData[3]) + "." + String((char)ReceiveData[4]) + "." + String((char)ReceiveData[5]));

    return FirmwareRelease.ReadState;
  }

  typedef struct {
    byte TransmissionState;
    byte GlobalState;
    unsigned long Energia;
    bool ReadState;
  } DataCumulatedEnergy;

  DataCumulatedEnergy CumulatedEnergy;

  bool ReadCumulatedEnergy(byte par) {
    if ((int)par >= 0 && (int)par <= 6) {
      CumulatedEnergy.ReadState = Send(Address, (byte)78, par, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);

      if (CumulatedEnergy.ReadState == false) {
        ReceiveData[0] = 255;
        ReceiveData[1] = 255;
      }

    }
    else {
      CumulatedEnergy.ReadState = false;
      clearReceiveData();
      ReceiveData[0] = 255;
      ReceiveData[1] = 255;
    }

    CumulatedEnergy.TransmissionState = ReceiveData[0];
    CumulatedEnergy.GlobalState = ReceiveData[1];
    if (CumulatedEnergy.ReadState == true) {
            ulo.asBytes[0] = ReceiveData[5];
           ulo.asBytes[1] = ReceiveData[4];
            ulo.asBytes[2] = ReceiveData[3];
            ulo.asBytes[3] = ReceiveData[2];

           CumulatedEnergy.Energia = ulo.asUlong;
    }
    return CumulatedEnergy.ReadState;
  }

  bool WriteBaudRateSetting(byte baudcode) {
    if ((int)baudcode >= 0 && (int)baudcode <= 3) {
      return Send(Address, (byte)85, baudcode, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);
    }
    else {
      clearReceiveData();
      return false;
    }
  }

  // Central
  bool ReadFlagsSwitchCentral() {
    return Send(Address, (byte)67, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);
  }

  bool ReadCumulatedEnergyCentral(byte var, byte ndays_h, byte ndays_l, byte global) {
    return Send(Address, (byte)68, var, ndays_h, ndays_l, global, (byte)0, (byte)0);
  }

  bool ReadFirmwareReleaseCentral(byte var) {
    return Send(Address, (byte)72, var, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);
  }

  bool ReadBaudRateSettingCentral(byte baudcode, byte serialline) {
    return Send(Address, (byte)85, baudcode, serialline, (byte)0, (byte)0, (byte)0, (byte)0);
  }

  bool ReadSystemInfoCentral(byte var) {
    return Send(Address, (byte)101, var, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);
  }

  bool ReadJunctionBoxMonitoringCentral(byte cf, byte rn, byte njt, byte jal, byte jah) {
    return Send(Address, (byte)103, cf, rn, njt, jal, jah, (byte)0);
  }

  bool ReadSystemPNCentral() {
    return Send(Address, (byte)105, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);
  }

  bool ReadSystemSerialNumberCentral() {
    return Send(Address, (byte)107, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0);
  }

};

//======================================================
clsAurora Invertermtt = clsAurora(2);  //aggiornare l'id dell'inverter

volatile double Irms = 0;
byte Menu = 0;

Thread LeggiProduzione = Thread();
//Thread ScriviDebug = Thread();

String stampaDataTime(unsigned long scn)
{
  String rtn;
  if (scn > 0) {
    setTime(0, 0, 0, 1, 1, 2000);
    if (timeStatus() == timeSet) {
    adjustTime(scn);

      rtn = String(day());
      rtn += String(F("/"));
      rtn += String(month());
      rtn += String(F("/"));
      rtn += String(year());
      rtn += String(F(" "));
      rtn += String(hour());
      rtn += String(F(":"));
      rtn += String(minute());
      rtn += String(F(":"));
      rtn += String(second());
    }
  }
  return rtn;
}

void LeggiProduzioneCallback(Menu) {
  switch (Menu)
  {
  case 0:
    Inverter2.ReadCumulatedEnergy(0);
    break;
  case 1:
    Inverter2.ReadTimeDate();
    break;
  case 2:
    Inverter2.ReadLastFourAlarms();
    break;
  case 3:
    Inverter2.ReadSystemPN();
    break;
  case 4:
    Inverter2.ReadSystemSerialNumber();
    break;
  case 5:
    Inverter2.ReadManufacturingWeekYear();
    break;
  case 6:
    Inverter2.ReadFirmwareRelease();
    break;
  case 7:
    Inverter2.ReadVersion();
    break;
  case 8:
    Inverter2.ReadState();
    break;
  default:
    break;
  }
}

void setup()
{
  Serial.setTimeout(500);
  Serial.begin(19200);

  pinMode(SSerialTxControl, OUTPUT);
  digitalWrite(SSerialTxControl, RS485Receive);  // Init Transceiver

  Serial.println(LeggiProduzioneCallback(0));
  delay(50);

}

void loop()
{
  LeggiProduzione.run();
  yield();
 }

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


add src for sensor v2.1. Only work with new hardware sensor v2.1

#include <ESP8266WiFi.h>

String apiKey ="<YOUR-API-KEY>";
const char* MY_SSID = "<YOUR-SSID>";
const char* MY_PWD = "<YOUR-PASSWORD>";

const int pin_clk = 5;
const int pin_soil = A0;
const int pin_led = 7;
const char* server = "api.thingspeak.com";

int sent = 0;

#define SLEEP_TIME 1200 * 1000 * 1000

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

  pinMode(pin_clk, OUTPUT);
  pinMode(pin_soil, INPUT);
  pinMode(pin_led, OUTPUT);
  digitalWrite(pin_led, LOW);

  analogWriteFreq(40000);
  analogWrite(pin_clk, 400);
  delay(500);
  connectWifi();
}

void loop() {
  //char buffer[10];
  digitalWrite(pin_led, HIGH);
  delay(500);
  digitalWrite(pin_led, LOW);
  float hum=0,temp=0,soil_hum=0;
  Serial.println("Requesting Temperature...");

  // Read temperature as Celsius (the default)
  // TODO
  temp = 25;

  delay(1000);
  soil_hum = readSoilVal(8);
  Serial.print("Soil_Humidity:");
  Serial.println(soil_hum);
  delay(1000);

  sendData(temp, soil_hum);
  //ESP.deepSleep(SLEEP_TIME, WAKE_RF_DEFAULT);
}

void connectWifi()
{
  Serial.print("Connecting to " + *MY_SSID);
  WiFi.begin(MY_SSID, MY_PWD);
  while (WiFi.status() != WL_CONNECTED) {
      delay(1000);
      Serial.print(".");
  }

  Serial.println("");
  Serial.println("Connected");
  Serial.println("");
}//end connect

// Get average value
float readSoilVal(int n) {
  float valtemp = 0;
  float ValBuf[n];
  int i = 0;
  int j = 0;

  for(i=0;i<n;i++){
    ValBuf[i] = analogRead(pin_soil);
  }

  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      if(ValBuf[i]>ValBuf[j]){
        valtemp = ValBuf[i];
        ValBuf[i] = ValBuf[j];
        ValBuf[j] = valtemp;
      }
    }
  }

  valtemp = 0;
  for(i=1;i<n-1;i++){
    valtemp+=ValBuf[i];
  }
  valtemp/=(n-2);
  return valtemp;
}

void sendData(float temp,float soil_hum) {
   WiFiClient client;

   if (client.connect(server, 80)) { // use ip 184.106.153.149 or api.thingspeak.com
       Serial.println("WiFi Client connected ");

       String postStr = apiKey;
       postStr += "&field1=0&field2=";
       postStr += String(temp);
       postStr += "&field3=";
       postStr += String(soil_hum);
       postStr += "\r\n\r\n";

       client.print("POST /update HTTP/1.1\n");
       client.print("Host: api.thingspeak.com\n");
       client.print("Connection: close\n");
       client.print("X-THINGSPEAKAPIKEY: " + apiKey + "\n");
       client.print("Content-Type: application/x-www-form-urlencoded\n");
       client.print("Content-Length: ");
       client.print(postStr.length());
       client.print("\n\n");
       client.print(postStr);
       delay(1000);

   }//end if
   sent++;
   client.stop();
}//end send

error: pathspec 'src/esp-soil-moisture-sensor-v2.1/esp-soil-moisture-sensor-v2.1.ino' did not match any file(s) known to git


run bah

run bah

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


Main File

Main File

// This #include statement was automatically added by the Spark IDE.
#include <SparkIntervalTimer.h>

// This #include statement was automatically added by the Spark IDE.
#include <EmonLib_98b0.h>

volatile int i=0;               // Variable to use as a counter
volatile boolean zero_cross=0;  // Boolean to store a "switch" to tell us if we have crossed zero
int AC_pin = D6;                // Output to Opto Triac
int dim = 128;                    // Dimming level (0-128)  0 = on, 128 = 0ff
int inc=1;                      // counting up or down, 1=up, -1=down
int freqStep = 75;    // This is the delay-per-brightness step in microseconds.

double realPower;
double apparentPower;
double powerFactor;
double supplyVoltage;
double Irms;

IntervalTimer myTimer;
EnergyMonitor emon1;

int dimmer(String command);
void zero_cross_detect(void);
void dim_check(void);

void setup()

{

      emon1.voltage(0, 263.415, 12.398);  // Voltage: input pin, calibration, phase_shift
      emon1.current(1, .312);       // Current: input pin, calibration.
      //SPARK VARIABLES
      Spark.variable("currpow", &dim, INT);     //CHECK CURRENT POWER LEVEL
      Spark.variable("rpower", &realPower, DOUBLE);
      Spark.variable("apower", &apparentPower, DOUBLE);
      Spark.variable("pfactor", &powerFactor, DOUBLE);
      Spark.variable("Vin", &supplyVoltage, DOUBLE);
      Spark.variable("Iin", &Irms, DOUBLE);
      //SPARK FUNCTIONS
      Spark.function("powlevel", dimmer);   //SET REQUIRED POWERLEVEL

      pinMode(D0,INPUT);                                 //SET INTERRUPT PIN
      pinMode(AC_pin, OUTPUT);                          // Set the Triac pin as output

      attachInterrupt(D0, zero_cross_detect, RISING);    // Attach an Interupt to Pin 0) for Zero Cross Detection
      myTimer.begin(dim_check, freqStep, uSec);

}

void measure()
{
  emon1.calcVI(20,2000); // Calculate all. No.of half wavelengths (crossings), time-out
  emon1.serialprint();
  realPower       = emon1.realPower;        //extract Real Power into variable
  apparentPower   = emon1.apparentPower;    //extract Apparent Power into variable
  powerFactor     = emon1.powerFactor;      //extract Power Factor into Variable
  supplyVoltage   = emon1.Vrms;             //extract Vrms into Variable
  Irms            = emon1.Irms;             //extract Irms into Variable
}

void zero_cross_detect() {
  zero_cross = true;               // set the boolean to true to tell our dimming function that a zero cross has occured
  i=0;
  digitalWrite(AC_pin, LOW);       // turn off TRIAC (and AC)
}

void dim_check() {
  if(zero_cross == true) {
    if(i>=dim) {
      digitalWrite(AC_pin, HIGH); // turn on light
      i=0;  // reset time step counter
      zero_cross = false; //reset zero cross detection
    }
    else {
      i++; // increment time step counter
    }
  }
}

int dimmer(String command)  //SPARK FUNCTION DEFINITION
{
    int x;
    x=command.toInt();
    dim=128-x;
    return dim;//for checking power level set

}

void loop()
{

    if(dim<128)
    {
        measure();

    }

}

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


SerialDemo

SerialDemo

Signed-off-by: eggfly <8fdee70a717c450a70da61cd9ccac783a32c73c6@gmail.com>

int inByte = 0;         // incoming serial byte

void setup()
{
  // start serial port at 9600 bps and wait for port to open:
  // Serial.begin(9600);
  // 115200 / 10 = 11520 = 11.52KB/s
  Serial.begin(300);
  while (!Serial) {
  }
  Serial.println("initialised!");
}

void loop()
{
  int sum = 0;
  for (int i = 0; i < 256; i++){
    Serial.print("b");
  }
  sum += 256;
  Serial.println();
  Serial.println(sum);
/*
  // if we get a valid byte, read analog ins:
  if (Serial.available() > 0) {
    // get incoming byte:
    inByte = Serial.read();
    Serial.println(inByte);
  }
*/
}

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


Bug fix for incorrect door sensor logic

Bug fix for incorrect door sensor logic

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/mcrosson/arduino_safe_lighting.git/'


Folder structure

Folder structure

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <RF24_config.h>

//JOYSTICK
const int SW_pin = 2; //Digital pin connected to switch input
const int X_pin = A0; //Analog pin connected to X output
const int Y_pin = A1; //Analog pin connecte to Y output
int x_joy;            //Joystick X Output
int y_joy;            //Joystick Y Output
int sw_joy;           //Joystick SW Output

/*
This sketch sends a string to a corresponding Arduino
with nrf24 attached.  It appends a specific value
(2 in this case) to the end to signify the end of the
message.
*/

int msg[3];
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;

void setup(void)
{
  Serial.begin(9600);           //Begin serial
  radio.begin();                //Begin radio
  radio.openWritingPipe(pipe);  //Open pipe
  pinMode(SW_pin, INPUT);       //Set SW pin as input
  digitalWrite(SW_pin, HIGH);
}

void loop(void)
{
  x_joy = analogRead(X_pin);
  y_joy = analogRead(Y_pin);
  sw_joy = digitalRead(SW_pin);
  msg[0] = sw_joy;
  msg[1] = x_joy;
  msg[2] = y_joy;
  radio.write(msg,1);
/*delay sending for a short period of time.  radio.powerDown()/radio.powerupp
//with a delay in between have worked well for this purpose(just using delay seems to
//interrupt the transmission start). However, this method could still be improved
as I still get the first character 'cut-off' sometimes. I have a 'checksum' function
on the receiver to verify the message was successfully sent.
*/
  radio.powerDown();
  delay(1000);
  radio.powerUp();
}

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


Add M5stack example (keypad)

Add M5stack example (keypad)

//
// GUIslice Library Example
// - Calvin Hass
// - https://www.impulseadventure.com/elec/guislice-gui.html
// - https://github.com/ImpulseAdventure/GUIslice
// - Example 27 (M5stack):
//   - Keypad input as popup for text entry
//   - Use of EXTRA Fonts
//   - NOTE: This is the simple version of the example without
//     optimizing for memory consumption. A "minimal"
//     version is located in the "arduino_min" folder which includes
//     FLASH memory optimization for reduced memory devices.
//
// MODS from ex27_ard_alpha:
// - Add button input controls (see notes under Button control)
// - Removed EXTRA FONTS
//
// ARDUINO NOTES:
// - GUIslice_config.h must be edited to match the pinout connections
//   between the Arduino CPU and the display controller (see ADAGFX_PIN_*).
//

#include "GUIslice.h"
#include "GUIslice_drv.h"

#include "elem/XKeyPad_Alpha.h"

/*
// ------------------------------------------------
// Load specific fonts
// ------------------------------------------------

// To demonstrate additional fonts, uncomment the following line:
//#define USE_EXTRA_FONTS

// Different display drivers provide different fonts, so a few examples
// have been provided and selected here. Font files are usually
// located within the display library folder or fonts subfolder.
#ifdef USE_EXTRA_FONTS
  #if defined(DRV_DISP_TFT_ESPI) // TFT_eSPI
    #include <TFT_eSPI.h>
    #define FONT_NAME1 &FreeSansBold12pt7b
  #elif defined(DRV_DISP_ADAGFX_ILI9341_T3) // Teensy
    #include <font_Arial.h>
    #define FONT_NAME1 &Arial_12
    #define SET_FONT_MODE1 // Enable Teensy extra fonts
  #else // Arduino, etc.
    #include <Adafruit_GFX.h>
    #include "Fonts/FreeSansBold12pt7b.h"
    #define FONT_NAME1 &FreeSansBold12pt7b
  #endif
#else
  // Use the default font
  #define FONT_NAME1 NULL
#endif
// ------------------------------------------------
*/

// Ensure config settings are correct for the sketch
#if !defined(DRV_DISP_M5STACK) || !defined(DRV_TOUCH_M5STACK) || !(GSLC_FEATURE_INPUT)
  #warning "This sketch requires config: #define DRV_TOUCH_M5TACK, #define DRV_TOUCH_M5STACK, #define GSLC_FEATURE_INPUT 1"
#endif

// ------------------------------------------------
// Defines for resources
// ------------------------------------------------
//<Resources !Start!>
//<Resources !End!>

// ------------------------------------------------
// Enumerations for pages, elements, fonts, images
// ------------------------------------------------
//<Enum !Start!>
enum { E_PG_MAIN, E_POP_KEYPAD };
enum {
  E_BOX1,
  E_TXT_VAL1, E_ELEM_KEYPAD
};
enum { E_FONT_SANS2, E_FONT_TXT1, MAX_FONT }; // Use separate enum for fonts, MAX_FONT at end
//<Enum !End!>

// ------------------------------------------------
// Instantiate the GUI
// ------------------------------------------------

// Define the maximum number of elements per page
//<ElementDefines !Start!>
#define MAX_PAGE                2
#define MAX_ELEM_PG_MAIN 3
#define MAX_ELEM_PG_MAIN_RAM MAX_ELEM_PG_MAIN
#define MAX_ELEM_POP_KEYPAD 1
#define MAX_ELEM_POP_KEYPAD_RAM MAX_ELEM_POP_KEYPAD
//<ElementDefines !End!>

// GUI Elements
gslc_tsGui                      m_gui;
gslc_tsDriver                   m_drv;
gslc_tsFont                     m_asFont[MAX_FONT];
gslc_tsPage                     m_asPage[MAX_PAGE];

//<GUI_Extra_Elements !Start!>
gslc_tsElem                 m_asPage1Elem[MAX_ELEM_PG_MAIN_RAM];
gslc_tsElemRef              m_asPage1ElemRef[MAX_ELEM_PG_MAIN];
gslc_tsElem                 m_asPopKeypadElem[MAX_ELEM_POP_KEYPAD_RAM];
gslc_tsElemRef              m_asPopKeypadElemRef[MAX_ELEM_POP_KEYPAD];

gslc_tsXKeyPad              m_sKeyPadAlpha; // Keypad

//<GUI_Extra_Elements !End!>

// Pin mapping table
#define MAX_INPUT_MAP       4
gslc_tsInputMap             m_asInputMap[MAX_INPUT_MAP];

// ------------------------------------------------
// Save some element references for update loop access
// ------------------------------------------------
//<Save_References !Start!>
gslc_tsElemRef*  m_pElemVal1 = NULL;
gslc_tsElemRef*  m_pElemKeyPad = NULL;
//<Save_References !End!>

// ------------------------------------------------
// Program Globals
// ------------------------------------------------

// Define debug message function
static int16_t DebugOut(char ch) { if (ch == (char)'\n') Serial.println(""); else Serial.write(ch); return 0; }

// ------------------------------------------------
// Callback Methods
// ------------------------------------------------
// Common Button callback
bool CbBtnCommon(void* pvGui, void *pvElemRef, gslc_teTouch eTouch, int16_t nX, int16_t nY)
{
  gslc_tsElemRef* pElemRef = (gslc_tsElemRef*)(pvElemRef);
  gslc_tsGui* pGui = (gslc_tsGui*)pvGui;
  gslc_tsElem* pElem = gslc_GetElemFromRef(pGui,pElemRef);

  if (eTouch == GSLC_TOUCH_UP_IN) {
    // From the element's ID we can determine which button was pressed.
    switch (pElem->nId) {
      //<Button Enums !Start!>
    case E_TXT_VAL1:
      // Clicked on edit field, so show popup box and associate with this text field
      gslc_ElemXKeyPadInputAsk(pGui, m_pElemKeyPad, E_POP_KEYPAD, m_pElemVal1);
      break;
      //<Button Enums !End!>
    default:
      break;
    }
  }
  return true;
}

/*
// Pin Input polling callback function
bool CbPinPoll(void* pvGui, int16_t* pnPinInd, int16_t* pnPinVal)
{
  // Sample all pin inputs
  btn_prev.read();
  btn_sel.read();
  btn_next.read();

  // Determine if any pin edge events occur
  // - If multiple pin events occur, they will be handled in consecutive CbPinPoll() calls
  if      (btn_prev.wasPressed())  { *pnPinInd = PIN_PREV; *pnPinVal = 1; }
  else if (btn_prev.wasReleased()) { *pnPinInd = PIN_PREV; *pnPinVal = 0; }
  else if (btn_sel.wasPressed())   { *pnPinInd = PIN_SEL;  *pnPinVal = 1; }
  else if (btn_sel.wasReleased())  { *pnPinInd = PIN_SEL;  *pnPinVal = 0; }
  else if (btn_next.wasPressed())  { *pnPinInd = PIN_NEXT; *pnPinVal = 1; }
  else if (btn_next.wasReleased()) { *pnPinInd = PIN_NEXT; *pnPinVal = 0; }
  else return false; // No pin event detected

  // If we reach here, then a pin event was detected
  return true;
}
*/

// KeyPad Input Ready callback
bool CbInputCommon(void* pvGui, void *pvElemRef, int16_t nState, void* pvData)
{
  gslc_tsElemRef* pElemRef = (gslc_tsElemRef*)(pvElemRef);
  gslc_tsGui* pGui = (gslc_tsGui*)pvGui;
  gslc_tsElem* pElem = gslc_GetElemFromRef(pGui,pElemRef);

  // From the element's ID we can determine which element is ready.
  if (pElem->nId == E_ELEM_KEYPAD) {
    int16_t nTargetElemId = gslc_ElemXKeyPadDataTargetIdGet(pGui, pvData);
    switch (nState) {
    case XKEYPAD_CB_STATE_DONE:
      // User clicked on Enter to leave popup
      // - If we have a popup active, pass the return value directly to
      //   the corresponding value field
      if (nTargetElemId == E_TXT_VAL1) {
        gslc_ElemSetTxtStr(pGui, m_pElemVal1, gslc_ElemXKeyPadDataValGet(pGui, pvData));
        gslc_PopupHide(pGui);
      }
      else {
        // ERROR
      }
      break;
    case XKEYPAD_CB_STATE_CANCEL:
      // User escaped from popup, so don't update values
      gslc_PopupHide(pGui);
      break;

    case XKEYPAD_CB_STATE_UPDATE:
      // KeyPad was updated, so could optionally take action here
      break;

    default:
      break;
    }
  }
  return true;
}

//<Draw Callback !Start!>
//<Draw Callback !End!>
//<Slider Callback !Start!>
//<Slider Callback !End!>
//<Tick Callback !Start!>
//<Tick Callback !End!>

// ------------------------------------------------
// Create page elements
// ------------------------------------------------
bool InitGUI()
{
  gslc_tsElemRef* pElemRef = NULL;

  //<InitGUI !Start!>
  gslc_PageAdd(&m_gui, E_PG_MAIN, m_asPage1Elem, MAX_ELEM_PG_MAIN_RAM, m_asPage1ElemRef, MAX_ELEM_PG_MAIN);
  gslc_PageAdd(&m_gui, E_POP_KEYPAD, m_asPopKeypadElem, MAX_ELEM_POP_KEYPAD_RAM, m_asPopKeypadElemRef, MAX_ELEM_POP_KEYPAD);

  // Background flat color
  gslc_SetBkgndColor(&m_gui, GSLC_COL_BLACK);

  // -----------------------------------
  // PAGE: E_PG_MAIN

  // Create GSLC_ID_AUTO text label
  pElemRef = gslc_ElemCreateTxt(&m_gui, GSLC_ID_AUTO, E_PG_MAIN, (gslc_tsRect) { 90, 10, 134, 32 },
    (char*)"Alpha KeyPad", 0, E_FONT_SANS2);
  gslc_ElemSetTxtCol(&m_gui, pElemRef, GSLC_COL_BLUE_LT4);

  // Create GSLC_ID_AUTO text label
  pElemRef = gslc_ElemCreateTxt(&m_gui, GSLC_ID_AUTO, E_PG_MAIN, (gslc_tsRect) { 20, 65, 62, 17 },
    (char*)"Name:", 0, E_FONT_TXT1);

  // Create E_TXT_VAL1 modifiable text label
  static char m_strtxt5[11] = "";
  pElemRef = gslc_ElemCreateTxt(&m_gui, E_TXT_VAL1, E_PG_MAIN, (gslc_tsRect) { 90, 65, 62+10, 17 },
    (char*)m_strtxt5, 11, E_FONT_TXT1);
  gslc_ElemSetCol(&m_gui, pElemRef, GSLC_COL_BLUE_DK1, GSLC_COL_BLACK, GSLC_COL_BLUE_DK4);
  gslc_ElemSetTxtCol(&m_gui, pElemRef, GSLC_COL_WHITE);
  gslc_ElemSetFrameEn(&m_gui, pElemRef, true);
  gslc_ElemSetTxtMargin(&m_gui, pElemRef, 5);
  gslc_ElemSetClickEn(&m_gui, pElemRef, true);
  gslc_ElemSetTouchFunc(&m_gui, pElemRef, &CbBtnCommon);
  m_pElemVal1 = pElemRef; // Save for later

  // -----------------------------------
  // PAGE: E_POP_KEYPAD
  static gslc_tsXKeyPadCfg_Alpha sCfg;
  sCfg = gslc_ElemXKeyPadCfgInit_Alpha();
  //gslc_ElemXKeyPadCfgSetButtonSz((gslc_tsXKeyPadCfg*)&sCfg, 12, 25);
  m_pElemKeyPad = gslc_ElemXKeyPadCreate_Alpha(&m_gui, E_ELEM_KEYPAD, E_POP_KEYPAD,
    &m_sKeyPadAlpha, 50, 80, E_FONT_TXT1, &sCfg);
  gslc_ElemXKeyPadValSetCb(&m_gui, m_pElemKeyPad, &CbInputCommon);

  //<InitGUI !End!>

  return true;
}

void setup()
{
  // ------------------------------------------------
  // Initialize
  // ------------------------------------------------
  Serial.begin(9600);
  // Wait for USB Serial
  //delay(1000);  // NOTE: Some devices require a delay after Serial.begin() before serial port can be used

  gslc_InitDebug(&DebugOut);

  if (!gslc_Init(&m_gui, &m_drv, m_asPage, MAX_PAGE, m_asFont, MAX_FONT)) { return; }

  // Create the GUI input mapping (pin event to GUI action)
  gslc_InitInputMap(&m_gui, m_asInputMap, MAX_INPUT_MAP);
  gslc_InputMapAdd(&m_gui, GSLC_INPUT_PIN_DEASSERT, GSLC_PIN_BTN_A,      GSLC_ACTION_FOCUS_PREV, 0);
  gslc_InputMapAdd(&m_gui, GSLC_INPUT_PIN_DEASSERT, GSLC_PIN_BTN_B,      GSLC_ACTION_SELECT, 0);
  gslc_InputMapAdd(&m_gui, GSLC_INPUT_PIN_DEASSERT, GSLC_PIN_BTN_C,      GSLC_ACTION_FOCUS_NEXT, 0);
  gslc_InputMapAdd(&m_gui, GSLC_INPUT_PIN_ASSERT,   GSLC_PIN_BTN_A_LONG, GSLC_ACTION_SET_REL, -10);
  gslc_InputMapAdd(&m_gui, GSLC_INPUT_PIN_ASSERT,   GSLC_PIN_BTN_C_LONG, GSLC_ACTION_SET_REL, +10);

  // ------------------------------------------------
  // Load Fonts
  // ------------------------------------------------
  //<Load_Fonts !Start!>
  if (!gslc_FontSet(&m_gui, E_FONT_SANS2, GSLC_FONTREF_PTR, NULL, 1)) { return; }
  if (!gslc_FontSet(&m_gui,E_FONT_TXT1,GSLC_FONTREF_PTR,NULL,1)) { return; }
  //<Load_Fonts !End!>

  // ------------------------------------------------
  // Create graphic elements
  // ------------------------------------------------
  InitGUI();

  // ------------------------------------------------
  // Save some element references for quick access
  // ------------------------------------------------
  //<Quick_Access !Start!>
  //<Quick_Access !End!>

  //<Startup !Start!>
  // ------------------------------------------------
  // Start up display on first page
  // ------------------------------------------------
  gslc_SetPageCur(&m_gui, E_PG_MAIN);
  //<Startup !End!>

}

// -----------------------------------
// Main event loop
// -----------------------------------
void loop()
{

  // ------------------------------------------------
  // Update GUI Elements
  // ------------------------------------------------

  // ------------------------------------------------
  // Periodically call GUIslice update function
  // ------------------------------------------------
  gslc_Update(&m_gui);

}

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


Example file

Example file

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

// Note: Smaller Arduino boards such as the UNO should typically use SoftwareSerial
// instead. Look here for instructions https://www.arduino.cc/en/Reference/SoftwareSerial
ESPServer server = ESPServer( &Serial1 );

String WLAN_SSID = "YourSSID";        // cannot be longer than 32 characters!
String WLAN_PASS = "YourPassword";

void setup() {
  Serial.begin(115200);
  Serial1.begin(115200); // Note: ESP modules that don't have updated firmware (1.1 or higher) will fail to init at this speed

  // Test that we can communicate with the ESP8266 module
  int rez = server.test();
  if(!rez)
  {
    Serial.println("test() failed. Check your connections.");
    while(1);
  }
  Serial.println("test() was successful");

  // Setup as one of the following:
  // STANDALONE - Access your ESP from the network
  // ACCESS_POINT - Access the ESP directly and get your own IP from it
  // STANDALONE_AND_AP - Enable both ways to access the ESP module
  Serial.print("begin() success? ");
  rez = server.begin(STANDALONE_AND_AP,80);
  Serial.println(rez);

  // Connect it to a Wifi access point
  Serial.print("connectToAP() success? ");
  server.connectToAP( WLAN_SSID, WLAN_PASS );
  Serial.println(rez);

  // Check status
  /*
  0 = STATUS_UNKNOWN
  1 = STATUS_SCANNING
  2 = STATUS_CONNECTED
  3 = STATUS_CONNECTING
  4 = STATUS_DISCONNECTED
  5 = STATUS_INITIALIZING
  6 = STATUS_CONNECTED_W_IP
  7 = CIPMODE_ERROR
  8 = CIPMUX_ERROR
  9 = CIPSERVER_ERROR
  10 = CWMODE_ERROR
  11 = WIFI_CONNECT_ERROR

  0-6 indicates normal operation
  7-11 indicates what part of the init process that failed
  */
  Serial.print("getStatus(): ");
  rez = server.getStatus();
  Serial.println(rez);

  IPAddress ipAddress = {0,0,0,0};

  Serial.print("AP ip: ");
  server.getAPAddress( ipAddress );
  Serial.println(ipAddress);

  Serial.print("Standalone ip: ");
  ipAddress = {0,0,0,0};
  //while( ipAddress[0] == 0 )
  {
    server.getStandaloneAddress( ipAddress );
    Serial.println(ipAddress);
    delay(1000);
    int serverStatus = server.pollForStatus();
    Serial.print("serverStatus ");
    Serial.println(serverStatus);
    delay(1000);
  }
}

boolean parseItYourself = false;
char theURL[255] = {};

void loop(){
  while( server.available() )
  {
    int clientID = server.clientID();
    // calc time

    // to parse the request yourself, read back the buffer
    if( parseItYourself )
    {
      char ret = server.read();
      Serial.print(ret);
      // this will just read out whatever the ESP sends
    } else if( clientID == 0 ){
      // We're passing in a char array that will be filled with the URL requested
      server.pathRequested( theURL );
      // Build the return page
      String baseText = "Heya! Thanks for requesting ";
      baseText += theURL;
      baseText += "
We've been up and running for ";
      baseText += makeTimeString();
      baseText += "!";
      String page = makeBasePage("Hello world!", baseText);
      server.send( clientID, page );
    }
  }

  delay(20);
}

String makeBasePage( String title, String content){
  String page = "";
  page += "HTTP/1.1 200 OK\r\n";
  page += "Content-Type: text/html\r\n";
  page += "Connection: close\r\n";
  page += "Server: BitmartSign\r\n";
  page += "Refresh: 5\r\n";
  // Send an empty line to signal start of body.
  page += "\r\n";
  // Now send the response data.
  page += "<title>";
  page += title;
  page += "</title>\r\n";
  page += "<meta name='viewport' content='width=device-width, initial-scale=1.0'>\r\n";
  page += "\r\n";
  page += content;
  page += "\r\n\r\n";
  return page;
}

String makeTimeString(){
  int temp = 0;
  int seconds = 0;
  int minutes = 0;
  int hours = 0;
  int days = 0;

  temp = millis();
  days = temp/1000/60/60/24;
  temp -= days*1000*60*60*24;
  hours = temp/1000/60/60;
  temp -= hours*1000*60*60;
  minutes = temp/1000/60;
  temp -= minutes*1000*60;
  seconds = temp/1000;

  String baseText = "";
  if( days > 0 ){
    baseText += days;
    baseText += " days ";
  }
  if( hours > 0 ){
    baseText += hours;
    baseText += " hours ";
  }
  if( minutes > 0 ){
    baseText += minutes;
    baseText += " minutes ";
  }
  if( seconds > 0 ){
    baseText += seconds;
    baseText += " seconds ";
  }
  return baseText;
}

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


Update SparkFunMPL3115A2_Example.ino

Update SparkFunMPL3115A2_Example.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/jacealot/SparkFun_MPL3115A2_Particle_Library.git/'


Complete rewrite, having learned a lot from developing testTimerTwo and testInterrupts2. It compiles -- that means it'll work, right? Hah! I'll test later.

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


serialmotorcontrol

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/electronicplayground/ep-arduino.git/'


initial commit of the arduino code. This should be broken into different classes, but this is an example.

#include "IRremote.h"
#include <SindormirSevenSegments.h>
#include <Ultrasonic.h>

//seven segment setup
Sindormir7segs mi7S;

//ir receiver setup
int IrReceiverPin = 11;
IRrecv irrecv(IrReceiverPin);
decode_results results;

//ultrasonic range finder setup
int triggerPin =  10;
int echoPin = 9;
int maxDistance = 375;
Ultrasonic sonar(triggerPin, echoPin);

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

  irrecv.enableIRIn(); // Start the IrReceiverPin

  mi7S.commonType(CATODO);
  //2-8 are the pins this is hooked into on arduino
  mi7S.attach(2,3,4,5,6,7,8,0);//didnt setup the . so put it to 0
}

void loop()
{
    int irVal = getIrValue();
    int sonarVal = sonar.Ranging(CM);
    if(irVal != -1) {
      mi7S.print(irVal);
      Serial.println(irVal + 1);
      Serial.println(sonarVal);
    }

    delay(100);//10 times a second seems like enough
}

//get the value from the ir sensor.
int getIrValue() {
  int irVal = -1;
  if (irrecv.decode(&results)) // have we received an IR signal?
  {
    irVal = translateIR();
    irrecv.resume(); // receive the next value
  }
  return irVal;
}

// takes in the code from the remote and gives back a number
int translateIR(){

  switch(results.value)

  {
  case 0xFFE01F:
    return 10;

  case 0xFFA857:
    return 11;

  case 0xFF906F:
    return 12;

  case 0xFF6897:
    return 0;

  case 0xFF9867:
    return 13;

  case 0xFFB04F:
    return 14;

  case 0xFF30CF:
    return 1;

  case 0xFF18E7:
    return 2;

  case 0xFF7A85:
    return 3;

  case 0xFF10EF:
    return 4;

  case 0xFF38C7:
    return 5;

  case 0xFF5AA5:
    return 6;

  case 0xFF42BD:
    return 7;

  case 0xFF4AB5:
    return 8;

  case 0xFF52AD:
    return 9;

  default:
    //Serial.println(" other button   ");
    return -1;
  }

  //reset the device
  delay(25);
}

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


Initial arduino sketch

Initial arduino sketch

#define COUNT_MAX 10
int index = 0;
float values[COUNT_MAX];

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

  initialize();
  delay(3000);
}

void loop() {
  float vol;
  int sensorValue = analogRead(A0);  // read data
  values[index] = sensorValue;

  // calc average and display value
  if(index >= COUNT_MAX - 1) {
    float average = calcAverage();
    float bac = pow(((-3.757)*pow(10, -7))*average, 2) + 0.0008613*average -0.3919;

    Serial.print("a");
    Serial.print(bac, 4);
    Serial.print("z");

    index=0;
  } else {
    index++;
  }

  delay(100);  // prepare next read
}

void initialize() {
  for(int i=0; i<COUNT_MAX; i++) {
    values[i] = 0;
  }
}

float calcAverage() {
  float avg = 0;
  for(int i=0; i<COUNT_MAX; i++) {
    avg += values[i];
  }
  avg = avg / COUNT_MAX;
  return avg;
}

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


[Arduino] i2cdevlib MPU6050 example outputting readable yaw/pitch/roll.

Signed-off-by: Juri Berlanda <5bfdca9e82c53adb0603ce7083f4ba4f2da5cacf@hotmail.com>

// 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
//
// Changelog:
//      2013-05-08 - added seamless Fastwire support
//                 - added note about gyro calibration
//      2012-06-21 - added note about Arduino 1.0.1 + Leonardo compatibility error
//      2012-06-20 - improved FIFO overflow handling and simplified read process
//      2012-06-19 - completely rearranged DMP initialization code and simplification
//      2012-06-13 - pull gyro and accel data from FIFO packet instead of reading directly
//      2012-06-09 - fix broken FIFO read sequence and change interrupt detection to RISING
//      2012-06-05 - add gravity-compensated initial reference frame acceleration output
//                 - add 3D math helper file to DMP6 example sketch
//                 - add Euler output and Yaw/Pitch/Roll output formats
//      2012-06-04 - remove accel offset clearing for better results (thanks Sungon Lee)
//      2012-06-01 - fixed gyro sensitivity to be 2000 deg/sec instead of 250
//      2012-05-30 - basic DMP initialization working

/* ============================================
I2Cdev device library code is placed under the MIT license
Copyright (c) 2012 Jeff Rowberg

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
===============================================
*/

// 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
 * ========================================================================= */

// uncomment "OUTPUT_READABLE_QUATERNION" if you want to see the actual
// quaternion components in a [w, x, y, z] format (not best for parsing
// on a remote host such as Processing or something though)
//#define OUTPUT_READABLE_QUATERNION

// uncomment "OUTPUT_READABLE_EULER" if you want to see Euler angles
// (in degrees) calculated from the quaternions coming from the FIFO.
// Note that Euler angles suffer from gimbal lock (for more info, see
// http://en.wikipedia.org/wiki/Gimbal_lock)
//#define OUTPUT_READABLE_EULER

// uncomment "OUTPUT_READABLE_YAWPITCHROLL" if you want to see the yaw/
// pitch/roll angles (in degrees) calculated from the quaternions coming
// from the FIFO. Note this also requires gravity vector calculations.
// Also note that yaw/pitch/roll angles suffer from gimbal lock (for
// more info, see: http://en.wikipedia.org/wiki/Gimbal_lock)
#define OUTPUT_READABLE_YAWPITCHROLL

// uncomment "OUTPUT_READABLE_REALACCEL" if you want to see acceleration
// components with gravity removed. This acceleration reference frame is
// not compensated for orientation, so +X is always +X according to the
// sensor, just without the effects of gravity. If you want acceleration
// compensated for orientation, us OUTPUT_READABLE_WORLDACCEL instead.
//#define OUTPUT_READABLE_REALACCEL

// uncomment "OUTPUT_READABLE_WORLDACCEL" if you want to see acceleration
// components with gravity removed and adjusted for the world frame of
// reference (yaw is relative to initial orientation, since no magnetometer
// is present in this case). Could be quite handy in some cases.
//#define OUTPUT_READABLE_WORLDACCEL

// uncomment "OUTPUT_TEAPOT" if you want output that matches the
// format used for the InvenSense teapot demo
//#define OUTPUT_TEAPOT

#define LED_PIN 13 // (Arduino is 13, Teensy is 11, Teensy++ is 6)
bool blinkState = false;

// 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(115200);
    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
    while (!Serial.available());                 // wait for data
    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(digitalPinToInterrupt(2), 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);
}

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

        #ifdef OUTPUT_READABLE_QUATERNION
            // display quaternion values in easy matrix form: w x y z
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            Serial.print("quat\t");
            Serial.print(q.w);
            Serial.print("\t");
            Serial.print(q.x);
            Serial.print("\t");
            Serial.print(q.y);
            Serial.print("\t");
            Serial.println(q.z);
        #endif

        #ifdef OUTPUT_READABLE_EULER
            // display Euler angles in degrees
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetEuler(euler, &q);
            Serial.print("euler\t");
            Serial.print(euler[0] * 180/M_PI);
            Serial.print("\t");
            Serial.print(euler[1] * 180/M_PI);
            Serial.print("\t");
            Serial.println(euler[2] * 180/M_PI);
        #endif

        #ifdef OUTPUT_READABLE_YAWPITCHROLL
            // display Euler angles in degrees
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetGravity(&gravity, &q);
            mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
            Serial.print("ypr\t");
            Serial.print(ypr[0] * 180/M_PI);
            Serial.print("\t");
            Serial.print(ypr[1] * 180/M_PI);
            Serial.print("\t");
            Serial.println(ypr[2] * 180/M_PI);
        #endif

        #ifdef OUTPUT_READABLE_REALACCEL
            // 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);
        #endif

        #ifdef OUTPUT_READABLE_WORLDACCEL
            // 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);
        #endif

        #ifdef OUTPUT_TEAPOT
            // display quaternion values in InvenSense Teapot demo format:
            teapotPacket[2] = fifoBuffer[0];
            teapotPacket[3] = fifoBuffer[1];
            teapotPacket[4] = fifoBuffer[4];
            teapotPacket[5] = fifoBuffer[5];
            teapotPacket[6] = fifoBuffer[8];
            teapotPacket[7] = fifoBuffer[9];
            teapotPacket[8] = fifoBuffer[12];
            teapotPacket[9] = fifoBuffer[13];
            Serial.write(teapotPacket, 14);
            teapotPacket[11]++; // packetCount, loops at 0xFF on purpose
        #endif

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

error: pathspec 'Arduino/vj-flight-controller.ino' did not match any file(s) known to git


dht11/lcd arduino snippet, no rf24 integration yet

/*
LCD i2c library: https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library
LCD i2c module: for example http://www.aliexpress.com/item/LCD1602-I2C-LCD-1602-module-Blue-screen-IIC-I2C-for-arduino-LCD1602-Adapter-plate/32651314933.html
DHT11 library: https://github.com/RobTillaart/Arduino/tree/master/libraries/DHTlib
*/

#include <dht.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

dht DHT;
LiquidCrystal_I2C lcd(0x27, 16, 2);

#define DHT11_PIN 5
#define DHT11_POWER_PIN 6

#define TEMP_STR "Temp: "
#define HUM_STR "Hum: "

void setup()
{
  Serial.begin(115200);
  Serial.println("DHT TEST PROGRAM ");
  Serial.print("LIBRARY VERSION: ");
  Serial.println(DHT_LIB_VERSION);
  Serial.println();
  Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");

  pinMode(DHT11_POWER_PIN, OUTPUT);
  digitalWrite(DHT11_POWER_PIN, HIGH);

  lcd.begin();
  lcd.backlight();
}

void loop()
{
  // READ DATA
  Serial.print("DHT11, \t");
  int chk = DHT.read11(DHT11_PIN);
  switch (chk)
  {
    case DHTLIB_OK:
		Serial.print("OK,\t");
		break;
    case DHTLIB_ERROR_CHECKSUM:
		Serial.print("Checksum error,\t");
		break;
    case DHTLIB_ERROR_TIMEOUT:
		Serial.print("Time out error,\t");
		break;
    default:
		Serial.print("Unknown error,\t");
		break;
  }
  // DISPLAY DATA
  Serial.print(DHT.humidity, 1);
  Serial.print(",\t");
  Serial.println(DHT.temperature, 1);

  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print(TEMP_STR);
  lcd.setCursor(6,0);
  lcd.print(DHT.temperature);
  lcd.setCursor(0,1);
  lcd.print(HUM_STR);
  lcd.setCursor(6,1);
  lcd.print(DHT.humidity);

  delay(2000);
}
//
// END OF FILE
//

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


New (mostly working code

New (mostly working code

Lacks a pump activation counter

#define outputPIN P1_5
#define inPIN P1_4
#define basePIN P2_1
#define acidPIN P2_2

unsigned long int timeSend = 0;
unsigned long int timeSinceMotorRun = 1000000;
boolean shutDown = false;
boolean motorRunning = false;
int PHtarget = 1200;      // will be updated by interface
int PHmargin = 50;        //
int output = 0;
int input = 0;

void setup()
{
  Serial.begin(9600);
  Serial.setTimeout(50);
  pinMode(outputPIN, INPUT);
  pinMode(inPIN, INPUT);
  pinMode(basePIN, OUTPUT);
  pinMode(acidPIN, OUTPUT);
  digitalWrite(basePIN, LOW);
  digitalWrite(acidPIN, LOW);
}

void loop()
{

  if(millis() - timeSend > 1000)  // function to run every 0.25s
  {
  // read the input on analog pin P1.5:
  output = analogRead(outputPIN)*2.9;  // this include a gain of 11
  input = analogRead(inPIN)*2.9;

  // print out the value we have read to the interface:
  Serial.print("PHoutputex:");
  Serial.print(output);
  Serial.print("\r\n");
  Serial.print("PHinputes:");
  Serial.print(input);
  Serial.print("\r\n");
  Serial.print("PHtarget:");
  Serial.print(PHtarget);
  Serial.print("\r\n");

  PHmaintain();  // activate motors if required;

  timeSend = millis();
  }

  PHcommandListen();  // listen for commands NOTE; THIS SECTION MUST BE COMBINED WITH OTHER SUBSYSTEMS

}

  void PHmaintain(){

   int difference = PHtarget - output;
   Serial.print("difference:");
   Serial.println(difference);

   if(motorRunning && (millis() - timeSinceMotorRun > 2000))  // if we've been running the motor for more than 2s
   {
     digitalWrite(basePIN, LOW);
     digitalWrite(acidPIN, LOW);
     // turn both motors off
     motorRunning = false;
     Serial.println("Shutting motor down");
   }

   if(abs(difference) > PHmargin)  // if the PH is outside the margin
   {
     Serial.println("PH outside margin");

     if(difference > 0 && (millis() - timeSinceMotorRun) > 5000)  // if solution is too acidic and we havn't run a motor for 10s
     {
      if(!shutDown){  // if we havn't shut the motors down.
         timeSinceMotorRun = millis();
         motorRunning = true;
         digitalWrite(basePIN, HIGH);  // run base motor
         Serial.println("Runnng base motor");
       }
     }

     if(difference < 0 && (millis() - timeSinceMotorRun) > 5000)  // if solution is too alkalie and we havn't run a motor for 10s
     {
       if(!shutDown){  // if we havn't shut the motors down.
         timeSinceMotorRun = millis();
         motorRunning = true;
          digitalWrite(acidPIN, HIGH); // run acid motor;
          Serial.println("Runnng acid motor");
       }
     }
   }

  }

  void PHcommandListen()  // listen and reactor to commands from the interface
  {

       while (Serial.available() > 0) {

         String inString = Serial.readString();
         inString.trim();
         Serial.println(inString);  //DEBUG ONLY

         if(inString.equals("S")){
         Serial.println("PH is in shutdown");
         shutDown = true;
             digitalWrite(basePIN, LOW);
             digitalWrite(acidPIN, LOW);
             // turn both motors off
             motorRunning = false;
         }
         if(inString.equals("XS")){
         Serial.println("PH has resumed");
         shutDown = false;
         }
         if((inString.substring(0,11)).equals("PHcommanded"))  // if we see a command
         {
           PHtarget = inString.substring(12).toInt();  // change the target PH
         }
         }

  }

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


Start of stair sensor

Start of stair sensor

/*

 Sleep until motion is detectected,
 then turn on the two ping sensors which detect if someone goes past and in which direction.

*/

// NewPing uses timer 2 and switches pinging between sensors
// @see https://code.google.com/p/arduino-new-ping/
#include <NewPing.h>

// VirtualWire handles the RF transmission
// @see http://www.airspayce.com/mikem/arduino/
#include <VirtualWire.h>

#define SONAR_NUM     2 // Number of sensors.
#define MAX_DISTANCE 700 // Maximum distance (in cm) to ping.
#define PING_INTERVAL 33 // Milliseconds between sensor pings (29ms is about the min to avoid cross-sensor echo).

// Pins
const byte PIN_RF_TX = 9;       // Pin 12 is the default sender pin but I want 9.
const byte PIN_PING_POWER = 14; // Controls the transistor switch for both ping sensors.

const byte PIN_TRIG_LEFT = 7;   // Send the ping on the left sensor.
const byte PIN_ECHO_LEFT = 8;   // Listen for the left ping's echo.

const byte PIN_TRIG_RIGHT = 5;  // Send the ping on the right sensor.
const byte PIN_ECHO_RIGHT = 6;  // Listen for the right ping's echo.

byte pingPowerState = 1;        // 0 = sensor off, 1 = sensor on.

unsigned long msgId = 0;        // Each transmission has an id so the receiver knows if it missed something.
unsigned long lastTransmit = 0; // The last time a transmission was sent.

unsigned long pingTimer[SONAR_NUM]; // Holds the times when the next ping should happen for each sensor.
unsigned int cm[SONAR_NUM];         // Where the ping distances are stored.
uint8_t currentSensor = 0;          // Keeps track of which sensor is active.

NewPing sonar[SONAR_NUM] = {     // Sensor object array.
  NewPing(PIN_TRIG_LEFT, PIN_ECHO_LEFT, MAX_DISTANCE), // Each sensor's trigger pin, echo pin, and max distance to ping.
  NewPing(PIN_TRIG_RIGHT, PIN_ECHO_RIGHT, MAX_DISTANCE),
};

/**
 * Transmit the message.
 */
void transmit(char *buf)
{
  vw_send((uint8_t *)buf, strlen(buf));
  // NB: ping returns 0 if transmitting while vw_wait_tx() so don't use it.
  //vw_wait_tx(); // Wait until the whole message is gone
  lastTransmit = millis();
}

/**
 * ISR from timer 2 - ISR(TIMER2_COMPA_vect)
 */
void echoCheck()
{
  // If ping received, set the sensor distance to array.
  if (sonar[currentSensor].check_timer()) {
    cm[currentSensor] = sonar[currentSensor].ping_result / US_ROUNDTRIP_CM;
  }
}

/**
 * Sensor ping cycle complete, do something with the results.
 */
void oneSensorCycle()
{
  // The following code would be replaced with your code that does something with the ping results.
  for (uint8_t i = 0; i < SONAR_NUM; i++) {
    Serial.print(i);
    Serial.print("=");
    Serial.print(cm[i]);
    Serial.print("cm ");
  }
  Serial.println();

}

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

  pinMode(PIN_PING_POWER, OUTPUT);

  vw_set_tx_pin(PIN_RF_TX);
  vw_setup(2000);      // Bits per sec

  pingTimer[0] = millis() + 75;           // First ping starts at 75ms, gives time for the Arduino to chill before starting.
  for (uint8_t i = 1; i < SONAR_NUM; i++) // Set the starting time for each sensor.
    pingTimer[i] = pingTimer[i - 1] + PING_INTERVAL;

}

void loop()
{
  // PING )))
  for (uint8_t i = 0; i < SONAR_NUM; i++) { // Loop through all the sensors.
    if (millis() >= pingTimer[i]) {         // Is it this sensor's time to ping?
      pingTimer[i] += PING_INTERVAL * SONAR_NUM;  // Set next time this sensor will be pinged.
      if (i == 0 && currentSensor == SONAR_NUM - 1) oneSensorCycle(); // Sensor ping cycle complete, do something with the results.
      sonar[currentSensor].timer_stop();          // Make sure previous timer is canceled before starting a new ping (insurance).
      currentSensor = i;                          // Sensor being accessed.
      cm[currentSensor] = 0;                      // Make distance zero in case there's no ping echo for this sensor.
      sonar[currentSensor].ping_timer(echoCheck); // Do the ping (processing continues, interrupt will call echoCheck to look for echo).
    }
  }

  // Other code that *DOESN'T* analyze ping results can go here.

  if (millis() - lastTransmit > 1000) {
    // Proof of concept to power cycle the pings
    pingPowerState =!pingPowerState;
    digitalWrite(PIN_PING_POWER, pingPowerState);

    msgId++;
    char buf[50];
    sprintf(buf, "id=%lu", msgId);

    transmit(buf);
  }

}

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


added piezo buzzer

added piezo buzzer

const int buzzerPin = 9;
const int songLength = 18;

char notes[] = "cdfda ag cdfdg gf "; // a space represents a rest.
int beats[] = {1,1,1,1,1,1,4,4,2,1,1,1,1,1,1,4,4,2};

int tempo = 150;

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

void loop() {
  int i, duration;

  for(i = 0; i < songLength; i++) {
    duration = beats[i] * tempo;

    if (notes[i] == ' ') {
      delay(duration);
    } else {
      tone(buzzerPin, frequency(notes[i]), duration);
      delay(duration);
    }
    delay(tempo/10);
  }

  // while(true){} // Loop when you only want to play this once
}

int frequency(char note) {
  int i;
  const int numNotes = 8;

  char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
  int frequencies[] = {262, 294, 330, 349, 392, 440, 494, 523};

  for (i = 0; i < numNotes; i++) {
    if (names[i] == note) {
      return(frequencies[i]);
    }
  }
  return(0);
}

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


First simple Arduino programm

First simple Arduino programm

#define EEPROM_PROFILE_START 64
#define EEPROM_CURRENT_PROFILE_ID 0 //4 Byte
#define EEPROM_CURRENT_BRIGHTNESS 4 //1 Byte

#define TRANSMISSION_GET_PROFILE_ID 0
#define TRANSMISSION_SET_PROFILE 1
#define TRANSMISSION_GET_BRIGHTNESS 2
#define TRANSMISSION_SET_BRIGHTNESS 3

int led = 13;

void setup() {
  //Beginn Serial Communication
  Serial.begin(9600);

  //Init here

  //Tell host boot is complete
  Serial.println("ARDUINO BOOT COMPLETE");

}

void loop() {

}

/*
 SerialEvent occurs whenever a new data comes in the
 hardware serial RX.  This routine is run between each
 time loop() runs, so using delay inside loop can delay
 response.  Multiple bytes of data may be available.
 */
void serialEvent() {
  while (Serial.available()) {
    Serial.write(Serial.read());

  }
}

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


Added sensor code

Added sensor code

// Include
#include <Wire.h>
#include "SparkFunISL29125.h"
#include <dht.h>
#include <OneWire.h>
#include <DallasTemperature.h>

// Air temperature/humidity: DHT11
dht DHT;  // define object
#define DHT11_PIN 5

// Soil temperature: DS
// Data wire is plugged into port 6 on the Arduino
#define ONE_WIRE_BUS 6
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// arrays to hold device address
DeviceAddress soilThermometer;

// Soil humidity
#define SoilMoisturePin  0  // pin A0
#define SoilVccPin  4  // digital pin used as Vcc.  Sensor is connected from here to GND to reduce degredation of sensor

// IR
#define IRPin  1  // A1
#define IRVccPin  3 // D3 - used to power soil moisture sensor

// Light level: ISL29125
// Declare sensor object
SFE_ISL29125 RGB_sensor;

// Pin allocations
//    	- A0: soil moisture analog output
// 		- A1: IR phototransistor analog output
//    	- A4: SDA (RGB sensor)
//    	- A5: SCL (RGB sensor)
//      - D4: Soil moisture Vcc
//      - D3: IR phototransistor Vcc
//    	- D5: Air temperature/humidity digital output
// 		- D4: IR phototransistor power supply
// 		- D3: power supply for soil moisture sensor
//    	- D6: Soil temperature digital output

void setup(){
  // general setup
  Serial.begin(9600);
  // Light Sensor
  // Initialize the ISL29125 with simple configuration so it starts sampling
  if (RGB_sensor.init())
  {
    Serial.println("Light sensor Initialization Successful\n\r");
  }

  // temperature/humidity
  Serial.println("Dallas Temperature IC Control Library Demo");

  // locate devices on the bus
  Serial.print("Locating devices...");
  sensors.begin();
  Serial.print("Found ");
  Serial.print(sensors.getDeviceCount(), DEC);
  Serial.println(" devices.");

  // report parasite power requirements
  Serial.print("Parasite power is: ");
  if (sensors.isParasitePowerMode()) Serial.println("ON");
  else Serial.println("OFF");

  // Assign address manually. The addresses below will beed to be changed
  // to valid device addresses on your bus. Device address can be retrieved
  // by using either oneWire.search(deviceAddress) or individually via
  // sensors.getAddress(deviceAddress, index)
  // Note that you will need to use your specific address here
  //soilThermometer = { 0x28, 0x1D, 0x39, 0x31, 0x2, 0x0, 0x0, 0xF0 };

  // Method 1:
  // Search for devices on the bus and assign based on an index. Ideally,
  // you would do this to initially discover addresses on the bus and then
  // use those addresses and manually assign them (see above) once you know
  // the devices on your bus (and assuming they don't change).
  if (!sensors.getAddress(soilThermometer, 0)) Serial.println("Unable to find address for soil temperature sensor");

  // method 2: search()
  // search() looks for the next device. Returns 1 if a new address has been
  // returned. A zero might mean that the bus is shorted, there are no devices,
  // or you have already retrieved all of them. It might be a good idea to
  // check the CRC to make sure you didn't get garbage. The order is
  // deterministic. You will always get the same devices in the same order
  //
  // Must be called before search()
  //oneWire.reset_search();
  // assigns the first address found to soilThermometer
  //if (!oneWire.search(soilThermometer)) Serial.println("Unable to find address for soilThermometer");

  // show the addresses we found on the bus
  Serial.print("Soil temperature sensor address: ");
  printAddress(soilThermometer);
  Serial.println();

  // set the resolution to 9 bit (Each Dallas/Maxim device is capable of several different resolutions)
  sensors.setResolution(soilThermometer, 9);

  Serial.print("Soil temperature resolution: ");
  Serial.print(sensors.getResolution(soilThermometer), DEC);
  Serial.println();

  // DHT11

  // soil moisture
  pinMode(SoilVccPin, OUTPUT);  // Vcc pin for soil moisture sensor
  digitalWrite(SoilVccPin, LOW);   // disable sensor

  // IR phototransistor
  pinMode(IRVccPin, OUTPUT);  // set to out
  digitalWrite(IRVccPin, LOW);  // make sure it's off

  // complete
  Serial.println("Node setup complete.");
  Serial.println("--------------------------------------------");
  Serial.println();
  Serial.println("Sol Moisture, Light (RGB), Soil Temperature, Air Relative Humidity, Air Temperature, IR Level");
  delay(5000);
}

void loop(){
  // Soil Moisture
  digitalWrite(SoilVccPin, HIGH);   // enable sensor
  delay(50);  // allow power to settle
  Serial.print(1023-(analogRead(SoilMoisturePin)));
  Serial.print(", ");
  digitalWrite(SoilVccPin, LOW);   // disable sensor

  // Light
    // Read sensor values (16 bit integers)
  unsigned int red = RGB_sensor.readRed();
  unsigned int green = RGB_sensor.readGreen();
  unsigned int blue = RGB_sensor.readBlue();

  Serial.print(red,DEC);
  Serial.print(", ");
  Serial.print(green,DEC);
  Serial.print(", ");
  Serial.print(blue,DEC);
  Serial.print(", ");

  // soil temperature
    // call sensors.requestTemperatures() to issue a global temperature
  // request to all devices on the bus
  sensors.requestTemperatures(); // Send the command to get temperatures
  // It responds almost immediately. Let's print out the data

  printTemperature(soilThermometer); // Use a simple function to print out the data

  // temperature and moisture
   // READ DATA
  int chk = DHT.read11(DHT11_PIN);
  switch (chk)
  {
    case DHTLIB_OK:
 //               Serial.print("OK,\t");
                break;
    case DHTLIB_ERROR_CHECKSUM:
                Serial.print("Checksum error,\t");
                break;
    case DHTLIB_ERROR_TIMEOUT:
                Serial.print("Time out error,\t");
                break;
    case DHTLIB_ERROR_CONNECT:
        Serial.print("Connect error,\t");
        break;
    case DHTLIB_ERROR_ACK_L:
        Serial.print("Ack Low error,\t");
        break;
    case DHTLIB_ERROR_ACK_H:
        Serial.print("Ack High error,\t");
        break;
    default:
                Serial.print("Unknown error,\t");
                break;
  }
  // DISPLAY DATA
  Serial.print(DHT.humidity, 1);
  Serial.print(", ");
  Serial.print(DHT.temperature, 1);
  Serial.print(", ");

  //IR
  digitalWrite(IRVccPin, HIGH);   // enable sensor
  Serial.print(analogRead(IRPin));
  digitalWrite(IRVccPin, LOW);   // disable sensor

  // finish
  Serial.println();
  delay(2000);

}

// soil temperature
// function to print the temperature for a device
void printTemperature(DeviceAddress deviceAddress)
{
  // method 1 - slower
  //Serial.print("Temp C: ");
  //Serial.print(sensors.getTempC(deviceAddress));
  //Serial.print(" Temp F: ");
  //Serial.print(sensors.getTempF(deviceAddress)); // Makes a second call to getTempC and then converts to Fahrenheit

  // method 2 - faster
  float tempC = sensors.getTempC(deviceAddress);
  Serial.print(tempC);
  Serial.print(", ");
//  Serial.print(" Temp F: ");
//  Serial.println(DallasTemperature::toFahrenheit(tempC)); // Converts tempC to Fahrenheit
}

// function to print a device address
void printAddress(DeviceAddress deviceAddress)
{
  for (uint8_t i = 0; i < 8; i++)
  {
    if (deviceAddress[i] < 16) Serial.print("0");
    Serial.print(deviceAddress[i], HEX);
  }
}

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


Add example sketch for vor_humidity.

Add example sketch for vor_humidity.

#include "vor_humidity.h"
#include "vor_led.h"

VorHumidity humidity(A0);
VorLed led;

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

void loop() {
    float value = humidity.readProcessed();
    Serial.println(value);
    delay(1000);
}

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


Vibe sign

Vibe sign

#include <pixl.h>
#include <FastLED.h>
#include <Logging.h>

// Uncomment to turn off assertions
#define NDEBUG

// Weird thing I had to do to get the Logging library working with teensy
extern "C"{
  int _getpid(){ return -1;}
  int _kill(int pid, int sig){ return -1; }
  int _write(){return -1;}
}

#define LOGLEVEL LOG_LEVEL_INFOS

using namespace pixl;

Input* input;

// Triangle
LEDStrip triangle_strip = LEDStrip(165);
int triangle_points[] = {37, 0, 19};
int triangle_edges[] = {18, 19, 18};
LEDStrip* triangle_strips[] = {&triangle_strip};
LEDs triangle_led = LEDs(3, triangle_strips, triangle_points, triangle_edges);
LEDs* triangle_leds[] = {&triangle_led};
TriangleAnimation* triangle_anim;
CircleAnimation* circle_anim;

// Circle
LEDStrip circle_strip = LEDStrip(150);
LEDs circle_led = LEDs(circle_strip, 0, 150);
LEDs* circle_leds[] = {&circle_led};

Visualization* viz;

// Audio shield setup
AudioInputI2S audio;
//AudioAnalyzePeak peak;
//AudioAnalyzeNoteFrequency note;
//AudioConnection patchCord1(audio, peak);
//AudioConnection patchCord2(audio, note);
AudioControlSGTL5000 audioShield;
AudioAnalyzeFFT1024 fft;
AudioConnection patchCord1(audio, 0, fft, 0);

void setup() {
  Log.Init(LOGLEVEL, 9600);
  delay(1000);
  Log.Info("Starting setup()\n");
  Serial.flush();
  delay(1000);

  AudioMemory(12);
  audioShield.enable();
  audioShield.inputSelect(AUDIO_INPUT_LINEIN);
  audioShield.lineInLevel(15);
  //audioShield.inputSelect(AUDIO_INPUT_MIC);
  //audioShield.micGain(100);
  //note.begin(.99);

  fft.windowFunction(AudioWindowHanning1024);

  //input = new AudioShieldInput(&peak, &note);
  input = new FFTInput(&fft);

  viz = new RippleVisualization(input, 50, 1, true);
  triangle_anim = new TriangleAnimation(viz, triangle_leds, 1);
  circle_anim = new CircleAnimation(viz, circle_leds, 1);

  triangle_anim->init(1.0);
  circle_anim->init(1.0);

  FastLED.addLeds<WS2811, 2, GRB>(triangle_strip.leds, 165);
  FastLED.addLeds<WS2811, 2, GRB>(circle_strip.leds, 150);
  FastLED.setBrightness(255);

  Looper* looper = Looper::instance();
  looper->addInput(input);
  looper->addVisualization(viz);
  looper->addAnimation(triangle_anim);
  looper->addAnimation(circle_anim);
  looper->setUpdatesPerSecond(30);

  Log.Info("Finished setup()\n");
  delay(100);
}

void loop() {
  AudioNoInterrupts();
  Looper::instance()->loop();
  AudioInterrupts();
}

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


Minor refactor while failing to grok serial readline

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/meatballhat/box-o-sand.git/'