Adding an example for DC Motor Driver

Adding an example for DC Motor Driver

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

--- libraries/BackSeatDriver_DCMotorAdapter/examples/Racer/Racer.ino
+++ libraries/BackSeatDriver_DCMotorAdapter/examples/Racer/Racer.ino
@@ -0,0 +1,187 @@
+/*
+ * This example uses HC-SR04 distance sensor to detect obstacles and change course.
+ *
+ * Dependencies:
+ *    Wire
+ *    Adafruit_Motor_Shield_V2_Library
+ *    BackSeatDriver
+ *    BackSeatDriver_DCMotorAdapter
+ *    NewPing
+ *
+ * Created on: Jul 17, 2014
+ *
+ * Author: Konstantin Gredeskoul
+ *
+ * © 2014 All rights reserved.  Please see LICENSE.
+ *
+ */
+
+#include <NewPing.h>
+
+#define TRIGGER_PIN  13   // Arduino pin tied to trigger pin on the ultrasonic sensor.
+#define ECHO_PIN     12   // Arduino pin tied to echo pin on the ultrasonic sensor.
+#define MAX_DISTANCE 100  // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
+
+NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
+
+#include <BackSeatDriver_DCMotorAdapter.h>
+#include <BackSeatDriver.h>
+
+signed short motorLayout[] = { 1, -2, -3, 4};
+uint8_t ledPin1 = 4, ledPin2 = 11, ledPin3 = 8;
+
+#define OBSTACLE_DISTANCE_TURN 40
+#define OBSTACLE_DISTANCE_SLOWDOWN 70
+
+
+BackSeatDriver_DCMotorAdapter *adapter;
+BackSeatDriver *bot;
+
+bool running = true, led1 = false, led2 = false, led3 = false;
+
+static uint8_t speed = 100;
+static unsigned int spaceAfterTurn;
+static unsigned int lastSpaceAhead = 0, x = 0, maneuverSpaceAhead;
+static const uint8_t sonarCheckPeriodMs = 30; // don't check more often than that
+static unsigned short lastSonarAtMs = 0;
+
+// speed can go up to 255
+static uint32_t startMs = 0;
+static const bool debug = true;
+
+char buffer[128];
+
+// blinky shit
+
+void light1(bool on) {
+	led1 = on;
+	led1 ? digitalWrite(ledPin1, HIGH) : digitalWrite(ledPin1, LOW);
+}
+void light2(bool on) {
+	led2 = on;
+	led2 ? digitalWrite(ledPin2, HIGH) : digitalWrite(ledPin2, LOW);
+}
+void light3(bool on) {
+	led3 = on;
+	led3 ? digitalWrite(ledPin3, HIGH) : digitalWrite(ledPin3, LOW);
+}
+
+void blink1() {
+	light1(!led1);
+}
+
+void blink2() {
+	light2(!led2);
+}
+
+void blink3() {
+	light3(!led3);
+}
+
+//_______________________________________________________________________
+//
+// Sonar Navigation
+
+unsigned int spaceAhead() {
+	if (millis() > sonarCheckPeriodMs + lastSonarAtMs) {
+		lastSonarAtMs = millis();
+		unsigned int value = sonar.ping() / US_ROUNDTRIP_CM;
+		if (debug && value > 0 && value < OBSTACLE_DISTANCE_SLOWDOWN) {
+			sprintf(buffer, "spaceAhead is %d", value);
+			bot->log(buffer);
+		}
+		lastSpaceAhead = (value == 0) ? MAX_DISTANCE : value;
+	}
+	return lastSpaceAhead;
+}
+
+bool navigateWithSonar() {
+	int distance = spaceAhead();
+	maneuverSpaceAhead = 0;
+	if (distance <= OBSTACLE_DISTANCE_TURN) {
+		turnAndCheck();
+		maneuverSpaceAhead = distance;
+		light1(true);
+		light2(true);
+		light3(false);
+		return true;
+	} else if (distance > OBSTACLE_DISTANCE_TURN
+			&& distance < OBSTACLE_DISTANCE_SLOWDOWN) {
+		// reduce speed
+		speed = 100 - (OBSTACLE_DISTANCE_SLOWDOWN - distance) / 2;
+		light1(true);
+		light2(false);
+		light3(false);
+	} else if (distance >= OBSTACLE_DISTANCE_SLOWDOWN) {
+		speed = 100;
+		light1(false);
+		light2(false);
+	}
+	return false;
+}
+
+void turnAndCheck() {
+	signed short angle = (rand() % 2 == 1) ? 45 : -45;
+	bot->turn(angle, &checkOnce);
+}
+
+void checkOnce(uint8_t type, signed short parameter) {
+	signed short angle = (parameter == -45) ? 90 : -90;
+	spaceAfterTurn = spaceAhead();
+	if (spaceAfterTurn < maneuverSpaceAhead)
+		bot->turn(angle, &checkTwice);
+}
+
+void checkTwice(uint8_t type, signed short parameter) {
+	signed short angle = (parameter == -90) ? -135 : 135;
+	spaceAfterTurn = spaceAhead();
+	if (spaceAfterTurn < maneuverSpaceAhead)
+		bot->turn(angle, NULL);
+}
+
+void leftTurn90(uint8_t type, signed short parameter) 	{
+	delay(1000); bot->turn(-90,  &rightTurn90);
+}
+void rightTurn90(uint8_t type, signed short parameter)	{
+	delay(1000); bot->turn( 90, &leftTurn90);
+}
+void goBack() {
+	bot->goBackward(70, 600, &turnAround);
+}
+void turnAround(uint8_t type, signed short parameter) {
+	bot->turn(180, NULL);
+}
+
+//______________________________________________________________
+
+void setup() {
+	Serial.begin(9600);
+	Serial.println("Racer Starting...");
+	srand(millis());
+
+	pinMode(ledPin1, OUTPUT);
+	pinMode(ledPin2, OUTPUT);
+	pinMode(ledPin3, OUTPUT);
+
+	adapter = new BackSeatDriver_DCMotorAdapter(4, motorLayout);
+
+	bot = new BackSeatDriver(adapter);
+	bot->attach();
+	bot->debug(true);
+	bot->setMovingSpeedPercent(70);
+	bot->setTurningDelayCoefficient(6);
+	bot->setTurningSpeedPercent(70);
+
+	startMs = millis();
+
+}
+
+void loop() {
+	if (!bot->isManeuvering() && running) {
+		light3(true);
+		bot->goForward(speed);
+		navigateWithSonar();
+	}
+
+}
+


reverted to original arduino controller

reverted to original arduino controller

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/ekwoodrich/nirha.git/'


DateTime tests

DateTime tests

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

--- jeenode/tests/dt/dt.ino
+++ jeenode/tests/dt/dt.ino
@@ -0,0 +1,82 @@
+/**
+ * Modified version of jcw "datecalc" example sketch in the RTClib directory.
+ * Used to test various date calculations.
+ *
+ * Original sketch:
+ * 2010-02-04 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php
+ * Modifications
+ * 2015-08-15 <bill@jamimi.com> http://opensource.org/licenses/mit-license.php
+ */
+
+#include <Wire.h>
+#include <RTClib.h>
+
+void showDate(const char* txt, const DateTime& dt) {
+    Serial.print(txt);
+    Serial.print(' ');
+    Serial.print(dt.year(), DEC);
+    Serial.print('/');
+    Serial.print(dt.month(), DEC);
+    Serial.print('/');
+    Serial.print(dt.day(), DEC);
+    Serial.print(' ');
+    Serial.print(dt.hour(), DEC);
+    Serial.print(':');
+    Serial.print(dt.minute(), DEC);
+    Serial.print(':');
+    Serial.print(dt.second(), DEC);
+
+    Serial.print(" = ");
+    Serial.print(dt.get());
+    Serial.print("s / ");
+    Serial.print(dt.get() / 86400L);
+    Serial.print("d since 2000");
+
+    Serial.println();
+}
+
+void setup () {
+    Serial.begin(57600);
+
+    DateTime dtn (__DATE__, __TIME__);
+    showDate("dtn", dtn);
+
+    DateTime dtn1 (dtn.year(), dtn.month(), dtn.day(), dtn.hour(), dtn.minute() + 1, 0);
+    showDate("dtn1", dtn1);
+
+    DateTime dtn2 (dtn.get() + 30);
+    showDate("dtn2", dtn2);
+
+    DateTime dt0 (0, 1, 1);
+    showDate("dt0", dt0);
+
+    DateTime dt1 (1, 1, 1);
+    showDate("dt1", dt1);
+
+    DateTime dt2 (2009, 1, 1, 0, 0, 0);
+    showDate("dt2", dt2);
+
+    DateTime dt3 (2009, 1, 2, 0, 0, 0);
+    showDate("dt3", dt3);
+
+    DateTime dt4 (2009, 1, 27, 0, 0, 0);
+    showDate("dt4", dt4);
+
+    DateTime dt5 (2009, 2, 27, 0, 0, 0);
+    showDate("dt5", dt5);
+
+    DateTime dt6 (2009, 12, 27, 0, 0, 0);
+    showDate("dt6", dt6);
+
+    DateTime dt7 = dt6.get() + 3600; // one hour later
+    showDate("dt7", dt7);
+
+    DateTime dt8 = dt6.get() + 86400L; // one day later
+    showDate("dt8", dt8);
+
+    DateTime dt9 = dt6.get() + 7 * 86400L; // one week later
+    showDate("dt9", dt9);
+}
+
+void loop () {
+}


first commit

first commit

--- Temp_probe.ino
+++ Temp_probe.ino
@@ -0,0 +1,151 @@
+#include <DHT.h>
+#include <avr/sleep.h>
+#include <avr/power.h>
+#include <avr/wdt.h>
+
+#define DHTPIN 2
+#define DHTTYPE DHT11
+#define DHTALIM 3
+#define TRANSCEIVERALIM 4
+
+DHT dht(DHTPIN, DHTTYPE);
+
+int f_wdt=1;
+int sleep_count=0;
+int ack=0;
+
+void setup() {
+  Serial.begin(9600);
+  dht.begin();
+  pinMode(DHTALIM, OUTPUT);
+  pinMode(TRANSCEIVERALIM, OUTPUT);
+
+  /* Clear the reset flag. */
+  MCUSR &= ~(1<<WDRF);
+
+  /* In order to change WDE or the prescaler, we need to
+   * set WDCE (This will allow updates for 4 clock cycles).
+   */
+  WDTCSR |= (1<<WDCE) | (1<<WDE);
+
+  /* set new watchdog timeout prescaler value */
+  WDTCSR = 1<<WDP0 | 1<<WDP3; /* 8.0 seconds */
+
+  /* Enable the WD interrupt (note no reset). */
+  WDTCSR |= _BV(WDIE);
+}
+
+void loop() {
+  if((f_wdt == 1) && (sleep_count >= 0))
+  {
+
+    Serial.println("UP!");
+
+    digitalWrite(DHTALIM, HIGH);
+    digitalWrite(TRANSCEIVERALIM, HIGH);
+    delay(3000);
+
+    float h = dht.readHumidity();
+    float t = dht.readTemperature();
+    byte h_b;
+    byte t_b;
+    h_b = (byte) h;
+    t_b = (byte) t;
+
+    digitalWrite(DHTALIM, LOW);
+
+    if (isnan(h) || isnan(t)) {
+      Serial.println("Failed to read from DHT sensor!");
+    }
+    else {
+      while (sendData(t_b, h_b) != 69)
+      {
+        delay(50);
+      }
+    }
+    digitalWrite(TRANSCEIVERALIM, LOW);
+
+    /* Don't forget to clear the flag. */
+    f_wdt = 0;
+
+    sleep_count = 0;
+
+    /* Re-enter sleep mode. */
+    Serial.println("go back to sleep");
+    delay(50);
+    enterSleep();
+  }
+  else if(f_wdt == 1)
+  {
+    sleep_count++;
+    f_wdt = 0;
+    enterSleep();
+  }
+  else
+  {
+    /* Do nothing. */
+  }
+}
+
+ISR(WDT_vect)
+{
+  if(f_wdt == 0)
+  {
+    f_wdt=1;
+  }
+  else
+  {
+    Serial.println("WDT Overrun!!!");
+  }
+}
+
+void enterSleep(void)
+{
+  Serial.println("zzzzzz");
+  delay(50);
+  set_sleep_mode(SLEEP_MODE_PWR_DOWN);   /* EDIT: could also use SLEEP_MODE_PWR_DOWN for lowest power consumption. */
+  sleep_enable();
+
+  /* Now enter sleep mode. */
+  sleep_mode();
+
+  /* The program will continue from here after the WDT timeout*/
+  sleep_disable(); /* First thing to do is disable sleep. */
+
+  /* Re-enable the peripherals. */
+  power_all_enable();
+}
+
+int sendData(int temp, int hum)
+{
+  ack = 0;
+  //dummy bytes
+  Serial.write(169);
+  Serial.write(244);
+  Serial.write(190);
+  //humidity
+  Serial.write(hum);
+  //255 - humidity
+  Serial.write(255-hum);
+  //temperature + 25
+  //(temperature can be negative)
+  Serial.write(temp+25);
+  //230 - temperature
+  Serial.write(255-temp);
+  //for redunduncy, temperature + humidity
+  Serial.write(hum+temp);
+  //temperature + humidity - 255
+  Serial.write(hum+temp);
+  //dummy bytes
+  Serial.write(190);
+  Serial.write(244);
+  Serial.write(169);
+  delay(200);
+  if (Serial.available() > 0) {
+    ack=Serial.read();
+  }
+  else {
+    ack=0;
+  }
+  return ack;
+}


Initial commit: basic Arduino firmware with identification command

--- firmware/firmware.ino
+++ firmware/firmware.ino
@@ -0,0 +1,71 @@
+/*
+  MAX1464 library for Arduino
+  Copyright (C) 2016 Giacomo Mazzamuto <gmazzamuto@gmail.com>
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Lesser General Public
+  License as published by the Free Software Foundation; either
+  version 2.1 of the License, or (at your option) any later version.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+String inputString = "";         // a string to hold incoming data
+boolean stringComplete = false;  // whether the string is complete
+
+void printIden() {
+    Serial.println("Arduino MAX1464 Serial Terminal");
+}
+
+void setup() {
+  // initialize serial:
+  Serial.begin(115200);
+  printIden();
+  // reserve 200 bytes for the inputString:
+  inputString.reserve(200);
+}
+
+/*
+  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()) {
+    // get the new byte:
+    char inChar = (char)Serial.read();
+    // if the incoming character is a newline, set a flag
+    // so the main loop can do something about it:
+    if (inChar == '\n') {
+      stringComplete = true;
+    }
+    else {
+      // add it to the inputString:
+      inputString += inChar;
+    }
+  }
+}
+
+void loop() {
+  if (stringComplete) {
+    inputString.toUpperCase();
+    if(String("IDEN").startsWith(inputString)) {
+      printIden();
+    }
+    else {
+      Serial.print("Unknown input string: ");
+      Serial.println(inputString);
+    }
+
+ // clear the string:
+    inputString = "";
+    stringComplete = false;
+  }
+}


Arduino code. Run before the Python file.

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

--- readFromSerial.ino
+++ readFromSerial.ino
@@ -0,0 +1,109 @@
+void setup() {
+  // initialize serial communication:
+  Serial.begin(9600);
+   // initialize the LED pins:
+      for (int thisPin = 2; thisPin < 6; thisPin++) {
+        pinMode(thisPin, OUTPUT);
+      }
+
+      for (int thisPin = 2; thisPin < 6; thisPin++) {
+        digitalWrite(thisPin, HIGH);
+      }
+
+}
+
+void loop() {
+  // read the sensor:
+  if (Serial.available() > 0) {
+    int inByte = Serial.read();
+    // do something different depending on the character received.
+    // The switch statement expects single number values for each case;
+    // in this exmaple, though, you're using single quotes to tell
+    // the controller to get the ASCII value for the character.  For
+    // example 'a' = 97, 'b' = 98, and so forth:
+
+   // car controls
+   // 2 = forward
+   // 3 = backward
+   // 4 = left
+   // 5 = right
+
+    switch (inByte) {
+
+    case 'a':    //forward
+      // turn all the LEDs off:
+//      for (int thisPin = 2; thisPin < 6; thisPin++) {
+//        digitalWrite(thisPin, HIGH);
+//      }
+      for (int thisPin = 4; thisPin < 6; thisPin++) {
+        digitalWrite(thisPin, HIGH);
+      }
+      digitalWrite(2, LOW);
+      break;
+
+    case 'b':    //backward
+//      for (int thisPin = 2; thisPin < 6; thisPin++) {
+//        digitalWrite(thisPin, HIGH);
+//      }
+      for (int thisPin = 4; thisPin < 6; thisPin++) {
+        digitalWrite(thisPin, HIGH);
+      }
+      digitalWrite(3, LOW);
+      break;
+
+    case 'c':    //forward left
+//      for (int thisPin = 2; thisPin < 6; thisPin++) {
+//        digitalWrite(thisPin, HIGH);
+//      }
+      digitalWrite(5, HIGH);
+//      delay(50);
+      digitalWrite(4, LOW);
+      delay(100);
+      digitalWrite(2, LOW);
+      break;
+
+    case 'd':    //forward right
+//      for (int thisPin = 2; thisPin < 6; thisPin++) {
+//        digitalWrite(thisPin, HIGH);
+//      }
+      digitalWrite(4, HIGH);
+//      delay(50);
+      digitalWrite(5, LOW);
+      delay(100);
+      digitalWrite(2, LOW);
+      break;
+    case 'e':    //backward left
+//      for (int thisPin = 2; thisPin < 6; thisPin++) {
+//        digitalWrite(thisPin, HIGH);
+//      }
+      digitalWrite(5, HIGH);
+      digitalWrite(4, LOW);
+      delay(100);
+      digitalWrite(3, LOW);
+      break;
+
+    case 'f':    //backward right
+//      for (int thisPin = 2; thisPin < 6; thisPin++) {
+//        digitalWrite(thisPin, HIGH);
+//      }
+      digitalWrite(4, HIGH);
+      digitalWrite(5, LOW);
+      delay(100);
+      digitalWrite(3, LOW);
+      break;
+    default:
+      // turn all the LEDs off:
+      for (int thisPin = 2; thisPin < 6; thisPin++) {
+        digitalWrite(thisPin, HIGH);
+      }
+     }
+     delay(400);
+     for (int thisPin = 2; thisPin < 4; thisPin++) {
+       digitalWrite(thisPin, HIGH);
+//     for (int thisPin = 2; thisPin < 6; thisPin++) {
+//       digitalWrite(thisPin, HIGH);
+     //delay(100);
+    }
+  }
+}
+


Correção de bugs Gateway

Correção de bugs Gateway

Gateway deveria jogar na saída serial 7 valores, porém estava com apenas 6

error: pathspec 'Arduino' did not match any file(s) known to git
error: pathspec 'sketchs/Reformulação/gateway/gateway.ino' did not match any file(s) known to git


Json decode's test in Arduino

Json decode's test in Arduino

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

--- arduino/sketch.ino
+++ arduino/sketch.ino
@@ -0,0 +1,41 @@
+#include <ArduinoJson.h>
+
+#define REDPIN 5
+#define GREENPIN 6
+#define BLUEPIN 3
+#define BUFFER_SIZE 500
+#define BAUD_RATE 9600
+
+void setup() {
+	initSerial();
+	pinMode(REDPIN, OUTPUT);
+	pinMode(GREENPIN, OUTPUT);
+	pinMode(BLUEPIN, OUTPUT);
+}
+
+void loop() {
+	StaticJsonBuffer<200> jsonBuffer;
+
+	char json[] = "{\"round\": {\"phase\": \"live\",\"bomb\": \"planted\"}}";
+	JsonObject& root = jsonBuffer.parseObject(json);
+
+	if (!root.success()) {
+		Serial.println("parseObject() failed");
+		return;
+	}
+
+	const char* bombStatus = root["round"]["bomb"];
+	if(bombStatus == "planted") {
+
+	}
+
+	Serial.println(bombStatus);
+}
+
+void initSerial() {
+	Serial.begin(BAUD_RATE);
+	while (!Serial) {
+	  ;
+	}
+	Serial.println("Serial ready");
+}


Transmit Updated

Transmit Updated

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

--- transmit/transmit.ino
+++ transmit/transmit.ino
@@ -0,0 +1,207 @@
+#include <Adafruit_TCS34725.h>
+
+Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_2_4MS, TCS34725_GAIN_4X);
+uint16_t red, green, blue, c, ered, egreen, eblue;
+int r = 2;
+int g = 3;
+int b = 4;
+int ledState = LOW;
+int initDelay = 500;
+int i = 0;
+
+
+
+void setup() {
+  // put your setup code here, to run once:
+
+  pinMode(r, OUTPUT);
+  pinMode(g, OUTPUT);
+  pinMode(b, OUTPUT);
+  Serial.begin(250000);
+
+    if (tcs.begin()) {
+    Serial.println("Found sensor");
+  } else {
+    Serial.println("Cannot find sensor");
+    while (1);
+  }
+  tcs.getRawData(&ered, &egreen, &eblue, &c); //store environment values
+
+}
+
+void loop()
+{
+  // put your main code here, to run repeatedly:
+
+  String str;
+  if (Serial.available() > 0)
+  {
+    str = Serial.readString(); // read a single letter if (ch >= 'a' && ch <= 'z')
+
+    if(str == "sync")
+      synchronization();
+    else
+    {
+    for(int j=0; j<str.length(); ++j)
+    {
+      Serial.print(str[j] + ": ");
+      flashSequence(str[j]);
+      i = 0;
+    }
+    }
+    digitalWrite(r, LOW);
+    digitalWrite(g, LOW);
+    digitalWrite(b, LOW);
+//delay(dotDelay * 4);
+
+    }
+}
+
+void flashSequence(char sequence)
+{
+  bool out[8], parity[4];
+
+  encodeASCII(sequence, out);
+  addParity(out, parity);
+  bool buff[12] = {parity[0], parity[1], out[0], parity[2], out[1], out[2], out[3], parity[3],
+          out[4], out[5], out[6], out[7]};
+
+  Serial.print(sequence);
+  Serial.print(": ");
+
+  tcs.getRawData(&red, &green, &blue, &c); //store environment values
+  while(green < egreen*2)
+  {
+    tcs.getRawData(&red, &green, &blue, &c); //store environment values
+  }
+  bool first = true;
+  while(i<12)
+  {
+    if(!first)
+    {
+      tcs.getRawData(&red, &green, &blue, &c); //store environment values
+      while(blue < eblue*2)
+      {
+        tcs.getRawData(&red, &green, &blue, &c); //store environment values
+      }
+      while(blue < eblue*2)
+      {
+        tcs.getRawData(&red, &green, &blue, &c); //store environment values
+      }
+    }
+
+    first = false;
+    if(i % 3 == 0)
+    {
+      flashDotOrDash(2, buff[i]);
+      i++;
+    }
+    if(i % 3 == 1)
+    {
+      flashDotOrDash(3, buff[i]);
+      i++;
+    }
+    if(i % 3 == 2)
+    {
+      flashDotOrDash(4, buff[i]);
+      i++;
+    }
+    delay(1000);
+  }
+  Serial.println();
+
+}
+
+
+void flashDotOrDash(int color, bool dotOrDash)
+{
+  Serial.print(dotOrDash);
+  if(dotOrDash)
+    digitalWrite(color, HIGH);
+  else
+   digitalWrite(color, LOW);
+}
+
+void synchronization(void)
+{
+  digitalWrite(r, HIGH);
+  delay(initDelay);
+  digitalWrite(r, LOW);
+
+  digitalWrite(g, HIGH);
+  delay(initDelay);
+  digitalWrite(g, LOW);
+
+  digitalWrite(b, HIGH);
+  delay(initDelay);
+  digitalWrite(b, LOW);
+
+
+  digitalWrite(r, HIGH);
+  digitalWrite(g, HIGH);
+  delay(initDelay);
+  digitalWrite(r, LOW);
+  digitalWrite(g, LOW);
+
+  digitalWrite(r, HIGH);
+  digitalWrite(b, HIGH);
+  delay(initDelay);
+  digitalWrite(r, LOW);
+  digitalWrite(b, LOW);
+
+  digitalWrite(g, HIGH);
+  digitalWrite(b, HIGH);
+  delay(initDelay);
+  digitalWrite(g, LOW);
+  digitalWrite(b, LOW);
+
+
+  digitalWrite(r, HIGH);
+  digitalWrite(g, HIGH);
+  digitalWrite(b, HIGH);
+  delay(initDelay);
+  digitalWrite(r, LOW);
+  digitalWrite(g, LOW);
+  digitalWrite(b, LOW);
+  delay(initDelay);
+}
+
+
+void encodeASCII(char in, bool out[])
+{
+    for(int j = 0; j < 8; j++)
+        out[j] = 0;
+
+    out[0] = 0;
+    if(in % 2)
+        out[7] = 1;
+    in = in / 2;
+    if(in % 2)
+        out[6] = 1;
+    in = in / 2;
+    if(in % 2)
+        out[5] = 1;
+    in = in / 2;
+    if(in % 2)
+        out[4] = 1;
+    in = in / 2;
+    if(in % 2)
+        out[3] = 1;
+    in = in / 2;
+    if(in % 2)
+        out[2] = 1;
+    in = in / 2;
+    if(in % 2)
+        out[1] = 1;
+    in = in / 2;
+}
+
+void addParity(bool data[], bool parity[])
+{
+
+  parity[0]=data[0]^data[1]^data[3]^data[4]^data[6];
+  parity[1]=data[0]^data[2]^data[3]^data[5]^data[6];
+  parity[2]=data[1]^data[2]^data[3]^data[7];
+  parity[3]=data[4]^data[5]^data[6]^data[7];
+}
+


Integration of the sound sensor and rfid

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

--- Arduino/mod_rifd_sound.ino
+++ Arduino/mod_rifd_sound.ino
@@ -0,0 +1,101 @@
+
+#include <MFRC522.h>
+
+#define SS_PIN 10
+#define RST_PIN 9
+
+#define LIMIT 10
+
+// Definicoes pino modulo RC522
+MFRC522 mfrc522(SS_PIN, RST_PIN);
+
+//Led para liberacao do rfid
+int led_rfid = 5;
+
+//Led para debug de ruido
+int led_sound_sensor = 4;
+
+//Definicao dos pinos do sensor de ruido
+int pino_analogico = A5;
+int pino_digital = 7;
+
+int valor_A0 = 0;
+int valor_D = 0;
+
+int control_sound_sensor = 0;
+
+int op = 0;
+
+void getSoundSensor(){
+	if(control_sound_sensor > LIMIT){
+		op = 1;
+		return;
+	}
+	// put your main code here, to run repeatedly:
+  	valor_A0 = analogRead(pino_analogico);
+ 	valor_D = digitalRead(pino_digital);
+ 	Serial.print(valor_A0);
+ 	Serial.print(" ");
+ 	Serial.println(valor_D);
+ 	control_sound_sensor++;
+}
+
+void getRFID(){
+	//Reset sound sensor
+	op = 0;
+	control_sound_sensor = 0;
+
+	// Aguarda a aproximacao do cartao
+  	if ( ! mfrc522.PICC_IsNewCardPresent())
+  	{
+   	 	return;
+  	}
+  	// Seleciona um dos cartoes
+  	if ( ! mfrc522.PICC_ReadCardSerial())
+  	{
+   	 	return;
+  	}
+
+  	String conteudo = "";
+  	byte letra;
+
+  	for (byte i = 0; i < mfrc522.uid.size; i++)
+  	{
+     	conteudo.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
+     	conteudo.concat(String(mfrc522.uid.uidByte[i], HEX));
+  	}
+
+  	conteudo.toUpperCase();
+  	//Enviar conteudo.substring(1) via serial
+  	Serial.println(conteudo.substring(1));
+
+  	digitalWrite(led_rfid, HIGH);
+  	delay(200);
+  	digitalWrite(led_rfid, LOW);
+  	delay(200);
+}
+
+void setup(){
+	// Inicia a serial
+  	Serial.begin(9600);
+  	//Led rifd sensor
+	pinMode(led_rfid, OUTPUT);
+	//Led sound sensor
+	pinMode(led_sound_sensor, OUTPUT);
+  	//inicia RFID
+  	mfrc522.PCD_Init();
+  	//Define pinos sensor como entrada
+  	pinMode(pino_analogico, INPUT);
+  	pinMode(pino_digital, INPUT);
+}
+
+void loop(){
+	switch(op){
+		case 0:
+			getSoundSensor();
+			break;
+		case 1:
+			getRFID();
+			break;
+	}
+}


Create arduino.ino

Create arduino.ino

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

--- BlueToothFiles/arduino.ino
+++ BlueToothFiles/arduino.ino
@@ -0,0 +1,33 @@
+char incomingByte;  // incoming data
+int  LED = 13;      // LED pin
+int i = 0;
+
+void setup() {
+  Serial.begin(9600); // initialization
+  pinMode(LED, OUTPUT);
+  Serial.println("Press 1 to LED ON or 0 to LED OFF...");
+}
+
+void loop() {
+  if (Serial.available() > 0) {  // if the data came
+    incomingByte = Serial.read(); // read byte
+    if(incomingByte == '0') {
+       digitalWrite(LED, LOW);  // if 1, switch LED Off
+       Serial.println("LED OFF. Press 1 to LED ON!");  // print message
+    }
+    if(incomingByte == '1') {
+       digitalWrite(LED, HIGH); // if 0, switch LED on
+       Serial.println("LED ON. Press 0 to LED OFF!");
+    }
+
+    if(incomingByte == '2') {
+      Serial.println("LED ON. Press 0 to LED OFF!");
+      for(i=0;i<10;i++){
+       digitalWrite(LED, HIGH); // if 0, switch LED on
+       delay(300);
+       digitalWrite(LED, LOW); // if 0, switch LED on
+       delay(300);
+      }
+    }
+  }
+}


Create wemos_remote.ino

Create wemos_remote.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/vaskovasilev/webcontrol.git/'


arduino code updates

arduino code updates

error: pathspec 'src/arduino' did not match any file(s) known to git
error: pathspec 'code/delta5-race-timer-node/delta5-race-timer-node.ino' did not match any file(s) known to git


Update esp8266_remote.ino

Update esp8266_remote.ino


minor change

minor change

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


Create Arduino.ino

Create Arduino.ino

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

--- Arduino/Arduino.ino
+++ Arduino/Arduino.ino
@@ -0,0 +1,5 @@
+/*
+*An Arduino Sketch...
+*Waiting to be uploaded
+*...
+*/


Added rpm and torque formulas that use measured motor datapoints (#define's). Un-broke loop due to missing flag. Added duty_cycle bump at the end of its while() loop so it could get back into it.

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


Added arduino firmware for single LED

Added arduino firmware for single LED

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/Annath/bamboo-monitor.git/'


add arduino code

add arduino code

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

--- control/control.ino
+++ control/control.ino
@@ -0,0 +1,19 @@
+long int cnt = 0;
+
+void setup() {
+  for(int i=0; i<=13; i++)
+    pinMode(i, OUTPUT);
+
+  Serial.begin(9600);
+}
+
+void loop() {
+  int tl = 500;
+  cnt++;
+
+  int d = cnt % 14;
+  for(int i=0; i<=13; i++)
+    digitalWrite(i, d==i ? HIGH : LOW);
+  Serial.println(d);
+  delay(tl);
+}


Create AuroraInverter3.ino

Create AuroraInverter3.ino

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

--- AuroraInverter3.ino
+++ AuroraInverter3.ino
@@ -0,0 +1,1213 @@
+#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();
+ }


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

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

--- src/esp-soil-moisture-sensor-v2.1/esp-soil-moisture-sensor-v2.1.ino
+++ src/esp-soil-moisture-sensor-v2.1/esp-soil-moisture-sensor-v2.1.ino
@@ -0,0 +1,123 @@
+#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


run bah

run bah

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

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

--- firmware/jiyocorefinal.ino
+++ firmware/jiyocorefinal.ino
@@ -0,0 +1,108 @@
+// 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();
+
+    }
+
+}


SerialDemo

SerialDemo

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

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

--- SerialDemo/SerialDemo.ino
+++ SerialDemo/SerialDemo.ino
@@ -0,0 +1,32 @@
+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);
+  }
+*/
+}
+


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

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

--- BitRadioTransmit/BitRadioTransmit.ino
+++ BitRadioTransmit/BitRadioTransmit.ino
@@ -0,0 +1,53 @@
+#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();
+}


Add M5stack example (keypad)

Add M5stack example (keypad)

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

--- examples/m5stack/ex27_m5_alpha/ex27_m5_alpha.ino
+++ examples/m5stack/ex27_m5_alpha/ex27_m5_alpha.ino
@@ -0,0 +1,349 @@
+//
+// 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);
+
+}
+


Example file

Example file

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

--- examples/ESPServerTest/ESPServerTest.ino
+++ examples/ESPServerTest/ESPServerTest.ino
@@ -0,0 +1,167 @@
+#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;
+}


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.


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.

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

--- SevenSegment_UltrasonicRangeFinder_IR.ino
+++ SevenSegment_UltrasonicRangeFinder_IR.ino
@@ -0,0 +1,114 @@
+#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);
+}


Initial arduino sketch

Initial arduino sketch

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

--- Arduino/alcohol_sensor/alcohol_sensor.ino
+++ Arduino/alcohol_sensor/alcohol_sensor.ino
@@ -0,0 +1,48 @@
+#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;
+}
+