How about snowflakes, based on NanoEngine1?

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

--- examples/snowflakes8/snowflakes8.ino
+++ examples/snowflakes8/snowflakes8.ino
@@ -0,0 +1,247 @@
+/*
+    MIT License
+
+    Copyright (c) 2018, Alexey Dynda
+
+    Permission is hereby granted, free of charge, to any person obtaining a copy
+    of this software and associated documentation files (the "Software"), to deal
+    in the Software without restriction, including without limitation the rights
+    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+    copies of the Software, and to permit persons to whom the Software is
+    furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice shall be included in all
+    copies or substantial portions of the Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+    SOFTWARE.
+*/
+/**
+ *   Attiny85 PINS
+ *             ____
+ *   RESET   -|_|  |- 3V
+ *   SCL (3) -|    |- (2)
+ *   SDA (4) -|    |- (1)
+ *   GND     -|____|- (0)
+ *
+ *   Attiny85  I2C PINS: see picture above
+ *   Digispark I2C PINS: D0/D2
+ *   Atmega328 I2C PINS: connect LCD to A4/A5
+ *   ESP8266   I2C PINS: GPIO4/GPIO5
+ *   ESP32     I2C PINS: 21/22
+ */
+
+#include "ssd1306.h"
+#include "nano_engine.h"
+
+typedef struct
+{
+    const uint8_t * bitmap;
+    int16_t x;
+    int16_t y;
+    int16_t speedX;
+    int16_t speedY;
+    uint8_t timer;
+    bool    falling;
+} SnowFlake;
+
+/*
+ * Define snowflake images directly in flash memory.
+ * This reduces SRAM consumption.
+ * The image is defined from bottom to top (bits), from left to right (bytes).
+ */
+const PROGMEM uint8_t snowFlakeImage[8][8] =
+{
+    {
+        0B00111000,
+        0B01010100,
+        0B10010010,
+        0B11111110,
+        0B10010010,
+        0B01010100,
+        0B00111000,
+        0B00000000
+    },
+    {
+        0B00010000,
+        0B01010100,
+        0B00111000,
+        0B11101110,
+        0B00111000,
+        0B01010100,
+        0B00010000,
+        0B00000000
+    },
+    {
+        0B00111000,
+        0B00010000,
+        0B10111010,
+        0B11101110,
+        0B10111010,
+        0B00010000,
+        0B00111000,
+        0B00000000
+    },
+    {
+        0B00011000,
+        0B01011010,
+        0B00100100,
+        0B11011011,
+        0B11011011,
+        0B00100100,
+        0B01011010,
+        0B00011000
+    },
+    {
+        0B00010000,
+        0B00111000,
+        0B01010100,
+        0B11101110,
+        0B01010100,
+        0B00111000,
+        0B00010000,
+        0B00000000
+    },
+    {
+        0B10000010,
+        0B00101000,
+        0B01101100,
+        0B00010000,
+        0B01101100,
+        0B00101000,
+        0B10000010,
+        0B00000000
+    },
+    {
+        0B01000100,
+        0B10101010,
+        0B01101100,
+        0B00010000,
+        0B01101100,
+        0B10101010,
+        0B01000100,
+        0B00000000
+    },
+    {
+        0B00101000,
+        0B01010100,
+        0B10111010,
+        0B01101100,
+        0B10111010,
+        0B01010100,
+        0B00101000,
+        0B00000000
+    },
+};
+
+
+NanoEngine1 engine;
+
+static const uint8_t maxCount = 16;
+
+/* These are our snow flakes */
+SnowFlake snowFlakes[maxCount] = { {0} };
+
+bool onDraw()
+{
+    engine.canvas.clear();
+    for (uint8_t i=0; i<maxCount; i++)
+    {
+        if (snowFlakes[i].falling)
+        {
+            engine.canvas.drawBitmap1(snowFlakes[i].x>>3, snowFlakes[i].y>>3, 8, 8,snowFlakes[i].bitmap);
+        }
+    }
+    return true;
+}
+
+void setup()
+{
+    /* Do not init Wire library for Attiny controllers */
+    ssd1306_128x64_i2c_init();
+
+    engine.setFrameRate( 30 );
+    engine.begin();
+    engine.drawCallback( onDraw );
+
+    engine.canvas.setMode(CANVAS_MODE_TRANSPARENT);
+    engine.refresh();
+}
+
+void addSnowFlake()
+{
+    for (uint8_t i=0; i<maxCount; i++)
+    {
+        if (!snowFlakes[i].falling)
+        {
+            /* We found empty slot, use it for new snowflake */
+            /* Create new sprite with new snowflake image. Just put it for now to fixed place */
+            snowFlakes[i].bitmap = &snowFlakeImage[random(8)][0];
+            /* Select horizontal position */
+            snowFlakes[i].x = random(ssd1306_displayWidth() * 8);
+            /* Select y position. We use number multiple of 8 to make snowflake movements more smooth. *
+             * Moving snowflake by 1 point actually means movement by 1/8 of pixel on the display.     */
+            snowFlakes[i].y = -8 * 8;
+            /* Use some random X speed */
+            snowFlakes[i].speedX = random(-16, 16);
+            /* Use random vertical speed */
+            snowFlakes[i].speedY = random(4, 12);
+            snowFlakes[i].falling = true;
+            /* After countdown timer ticks to 0, change X direction */
+            snowFlakes[i].timer = random(24, 48);
+            /* And register new snowflake in spritepool */
+            engine.refresh( snowFlakes[i].x/8, snowFlakes[i].y/8, (snowFlakes[i].x/8) + 7, (snowFlakes[i].y/8) + 7);
+            break;
+        }
+    }
+}
+
+
+void moveSnowFlakes()
+{
+    for (uint8_t i=0; i<maxCount; i++)
+    {
+        if (snowFlakes[i].falling)
+        {
+            engine.refresh( snowFlakes[i].x/8, snowFlakes[i].y/8, (snowFlakes[i].x/8) + 7, (snowFlakes[i].y/8) + 7);
+            snowFlakes[i].x += snowFlakes[i].speedX;
+            snowFlakes[i].y += snowFlakes[i].speedY;
+            snowFlakes[i].timer--;
+            if (0 == snowFlakes[i].timer)
+            {
+                /* Change movement direction */
+                snowFlakes[i].speedX = random(-16, 16);
+                snowFlakes[i].timer = random(24, 48);
+            }
+            engine.refresh( snowFlakes[i].x/8, snowFlakes[i].y/8, (snowFlakes[i].x/8) + 7, (snowFlakes[i].y/8) + 7);
+            if (snowFlakes[i].y >= ssd1306_displayHeight() * 8)
+            {
+                snowFlakes[i].falling = false;
+            }
+        }
+    }
+}
+
+
+static uint8_t globalTimer=3;
+
+void loop()
+{
+    if (!engine.nextFrame()) return;
+    if (0 == (--globalTimer))
+    {
+        /* Try to add new snowflake every ~ 90ms */
+        globalTimer = 3;
+        addSnowFlake();
+    }
+    moveSnowFlakes();
+    engine.display();
+}
+
+
+


changed the boot, so it uses less bytes

changed the boot, so it uses less bytes

--- MYBL_AB/MYBL_AB.ino
+++ MYBL_AB/MYBL_AB.ino
@@ -1,15 +1,15 @@
 /*
- Mystic Balloon: http://www.team-arg.org/mybl-manual.html
+  Mystic Balloon: http://www.team-arg.org/mybl-manual.html

- Arduboy version 1.6:  http://www.team-arg.org/mybl-downloads.html
+  Arduboy version 1.6:  http://www.team-arg.org/mybl-downloads.html

- MADE by TEAM a.r.g. : http://www.team-arg.org/more-about.html
+  MADE by TEAM a.r.g. : http://www.team-arg.org/more-about.html

- 2016 - GAVENO - CastPixel -JO3RI
+  2016 - GAVENO - CastPixel -JO3RI

- Game License: MIT : https://opensource.org/licenses/MIT
+  Game License: MIT : https://opensource.org/licenses/MIT

- */
+*/

 //determine the game
 #define GAME_ID 34
@@ -43,7 +43,9 @@

 void setup()
 {
-  arduboy.begin();
+  arduboy.boot();                                           // begin with the boot logo en setting up the device to work
+  arduboy.audio.begin();
+  arduboy.bootLogoSpritesSelfMasked();
   arduboy.setFrameRate(60);                                 // set the frame rate of the game at 60 fps
   loadSetEEPROM();
 }


arduino code

arduino code

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

--- Arduino/Development/sketch_nov16a/sketch_nov16a.ino
+++ Arduino/Development/sketch_nov16a/sketch_nov16a.ino
@@ -0,0 +1,132 @@
+#include <OneWire.h>
+
+// OneWire DS18S20, DS18B20, DS1822 Temperature Example
+//
+// http://www.pjrc.com/teensy/td_libs_OneWire.html
+//
+// The DallasTemperature library can do all this work for you!
+// http://milesburton.com/Dallas_Temperature_Control_Library
+
+#define WATER_SENSOR A0
+OneWire  ds(3);  // on pin 10 (a 4.7K resistor is necessary)
+
+void setup(void) {
+  Serial.begin(9600);
+  pinMode(WATER_SENSOR, INPUT);
+}
+
+void loop(void) {
+  byte i;
+  byte present = 0;
+  byte type_s;
+  byte data[12];
+  byte addr[8];
+  float celsius, fahrenheit;
+  bool water;
+  while(Serial.available() == 0);
+
+  char incomingByte = (char)Serial.read();
+  Serial.println(incomingByte);
+
+
+  switch(incomingByte){
+
+    case('0'): {
+      if ( !ds.search(addr)) {
+      //Serial.println("No more addresses.");
+      //Serial.println();
+        ds.reset_search();
+        delay(250);
+      }
+      //Serial.print("ROM =");
+      for( i = 0; i < 8; i++) {
+       // Serial.write(' ');
+        //Serial.print(addr[i], HEX);
+      }
+
+      if (OneWire::crc8(addr, 7) != addr[7]) {
+          Serial.println("bad-2");
+          return;
+      }
+      //Serial.println();
+
+      // the first ROM byte indicates which chip
+      switch (addr[0]) {
+        case 0x10:
+          //Serial.println("  Chip = DS18S20");  // or old DS1820
+          type_s = 1;
+          break;
+        case 0x28:
+          //Serial.println("  Chip = DS18B20");
+          type_s = 0;
+          break;
+        case 0x22:
+          //Serial.println("  Chip = DS1822");
+          type_s = 0;
+          break;
+        default:
+          //Serial.println("Device is not a DS18x20 family device.");
+          return;
+      }
+
+      ds.reset();
+      ds.select(addr);
+      ds.write(0x44, 1);        // start conversion, with parasite power on at the end
+
+      //delay(1000);     // maybe 750ms is enough, maybe not
+      // we might do a ds.depower() here, but the reset will take care of it.
+
+      present = ds.reset();
+      ds.select(addr);
+      ds.write(0xBE);         // Read Scratchpad
+
+      //Serial.print("  Data = ");
+      //Serial.print(present, HEX);
+      //Serial.print(" ");
+      for ( i = 0; i < 9; i++) {           // we need 9 bytes
+        data[i] = ds.read();
+        //Serial.print(data[i], HEX);
+        //Serial.print(" ");
+      }
+      //Serial.print(" CRC=");
+      //Serial.print(OneWire::crc8(data, 8), HEX);
+      //Serial.println();
+
+      // Convert the data to actual temperature
+      // because the result is a 16 bit signed integer, it should
+      // be stored to an "int16_t" type, which is always 16 bits
+      // even when compiled on a 32 bit processor.
+      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
+      }
+      celsius = (float)raw / 16.0;
+      fahrenheit = celsius * 1.8 + 32.0;
+      Serial.println(fahrenheit);
+      break;
+    }
+    case('1'): {
+      if(analogRead(WATER_SENSOR) < 200) {
+        water = true;
+        Serial.println("True");
+      }
+      else {
+        water = false;
+        Serial.println("False");
+      }
+      break;
+    }
+
+  }
+}


fixed everything

fixed everything

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


add WebSocketServerAllFunctionsDemo (WIP)

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

--- examples/esp8266/WebSocketServerAllFunctionsDemo/WebSocketServerAllFunctionsDemo.ino
+++ examples/esp8266/WebSocketServerAllFunctionsDemo/WebSocketServerAllFunctionsDemo.ino
@@ -0,0 +1,133 @@
+/*
+ * WebSocketServerAllFunctionsDemo.ino
+ *
+ *  Created on: 10.05.2018
+ *
+ */
+
+#include <Arduino.h>
+
+#include <ESP8266WiFi.h>
+#include <ESP8266WiFiMulti.h>
+#include <WebSocketsServer.h>
+#include <ESP8266WebServer.h>
+#include <ESP8266mDNS.h>
+#include <Hash.h>
+
+#define LED_RED     15
+#define LED_GREEN   12
+#define LED_BLUE    13
+
+#define USE_SERIAL Serial
+
+
+ESP8266WiFiMulti WiFiMulti;
+
+ESP8266WebServer server(80);
+WebSocketsServer webSocket = WebSocketsServer(81);
+
+void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length) {
+
+    switch(type) {
+        case WStype_DISCONNECTED:
+            USE_SERIAL.printf("[%u] Disconnected!\n", num);
+            break;
+        case WStype_CONNECTED: {
+            IPAddress ip = webSocket.remoteIP(num);
+            USE_SERIAL.printf("[%u] Connected from %d.%d.%d.%d url: %s\n", num, ip[0], ip[1], ip[2], ip[3], payload);
+
+            // send message to client
+            webSocket.sendTXT(num, "Connected");
+        }
+            break;
+        case WStype_TEXT:
+            USE_SERIAL.printf("[%u] get Text: %s\n", num, payload);
+
+            if(payload[0] == '#') {
+                // we get RGB data
+
+                // decode rgb data
+                uint32_t rgb = (uint32_t) strtol((const char *) &payload[1], NULL, 16);
+
+                analogWrite(LED_RED,    ((rgb >> 16) & 0xFF));
+                analogWrite(LED_GREEN,  ((rgb >> 8) & 0xFF));
+                analogWrite(LED_BLUE,   ((rgb >> 0) & 0xFF));
+            }
+
+            break;
+    }
+
+}
+
+void setup() {
+    //USE_SERIAL.begin(921600);
+    USE_SERIAL.begin(115200);
+
+    //USE_SERIAL.setDebugOutput(true);
+
+    USE_SERIAL.println();
+    USE_SERIAL.println();
+    USE_SERIAL.println();
+
+    for(uint8_t t = 4; t > 0; t--) {
+        USE_SERIAL.printf("[SETUP] BOOT WAIT %d...\n", t);
+        USE_SERIAL.flush();
+        delay(1000);
+    }
+
+    pinMode(LED_RED, OUTPUT);
+    pinMode(LED_GREEN, OUTPUT);
+    pinMode(LED_BLUE, OUTPUT);
+
+    digitalWrite(LED_RED, 1);
+    digitalWrite(LED_GREEN, 1);
+    digitalWrite(LED_BLUE, 1);
+
+    WiFiMulti.addAP("SSID", "passpasspass");
+
+    while(WiFiMulti.run() != WL_CONNECTED) {
+        delay(100);
+    }
+
+    // start webSocket server
+    webSocket.begin();
+    webSocket.onEvent(webSocketEvent);
+
+    if(MDNS.begin("esp8266")) {
+        USE_SERIAL.println("MDNS responder started");
+    }
+
+    // handle index
+    server.on("/", []() {
+        // send index.html
+        server.send(200, "text/html", "LED Control:

R: <input id=\"r\" type=\"range\" min=\"0\" max=\"255\" step=\"1\" oninput=\"sendRGB();\" />
G: <input id=\"g\" type=\"range\" min=\"0\" max=\"255\" step=\"1\" oninput=\"sendRGB();\" />
B: <input id=\"b\" type=\"range\" min=\"0\" max=\"255\" step=\"1\" oninput=\"sendRGB();\" />
");
+    });
+
+    server.begin();
+
+    // Add service to MDNS
+    MDNS.addService("http", "tcp", 80);
+    MDNS.addService("ws", "tcp", 81);
+
+    digitalWrite(LED_RED, 0);
+    digitalWrite(LED_GREEN, 0);
+    digitalWrite(LED_BLUE, 0);
+
+}
+
+unsigned long last_10sec = 0;
+unsigned int counter = 0;
+
+void loop() {
+	unsigned long t = millis();
+	webSocket.loop();
+	server.handleClient();
+
+	if((t - last_10sec) > 10 * 1000) {
+		counter++;
+		bool ping = (counter % 2);
+		int i = webSocket.connectedClients(ping);
+		USE_SERIAL.printf("%d Connected websocket clients ping: %d", i, ping);
+		last_10sec = millis();
+	}
+}


Adding a tiny shell for CFFS; cat, cd, echo, ls, od, time.

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

--- examples/Sandbox/CosaCFFSshell/CosaCFFSshell.ino
+++ examples/Sandbox/CosaCFFSshell/CosaCFFSshell.ino
@@ -0,0 +1,111 @@
+/**
+ * @file CosaCFFSshell.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.
+ *
+ * @section Description
+ * Tiny command shell to demonstration the S25FL127S SPI Flash Memory
+ * device driver and file system.
+ *
+ * This file is part of the Arduino Che Cosa project.
+ */
+
+#include "Cosa/FS/CFFS.hh"
+#include "Cosa/Time.hh"
+#include "Cosa/IOStream/Driver/UART.hh"
+#include "Cosa/Watchdog.hh"
+#include "Cosa/RTC.hh"
+
+#if defined(ANARDUINO_MINIWIRELESS)
+OutputPin rf_cs(Board::D10, 1);
+#endif
+
+S25FL127S flash;
+IOStream cout;
+
+void setup()
+{
+  Watchdog::begin();
+  RTC::begin();
+  uart.begin(9600);
+  uart.set_blocking(SLEEP_MODE_IDLE);
+  cout.set_device(&uart);
+  flash.begin();
+  CFFS::begin(&flash);
+}
+
+void loop()
+{
+  static bool echo = false;
+  const size_t BUF_MAX = 256;
+  char buf[BUF_MAX];
+  char* filename;
+  int res = 0;
+
+  cout << PSTR("arduino:$ ");
+  if (uart.gets(buf, sizeof(buf)) == NULL) return;
+  if (echo) cout << buf << endl;
+
+  if (strncmp_P(buf, PSTR("cat"), 3) == 0) {
+    CFFS::File file;
+    filename = buf + 4;
+    res = file.open(filename, O_READ);
+    if (res == 0) {
+      IOStream::Device* dev = cout.get_device();
+      int res;
+      while ((res = file.read(buf, sizeof(buf))) > 0)
+	dev->write(buf, res);
+    }
+    else {
+      cout << PSTR("cat");
+    }
+  }
+
+  else if (strncmp_P(buf, PSTR("cd"), 2) == 0) {
+    filename = buf + 3;
+    res = CFFS::cd(filename);
+    if (res != 0) {
+      cout << PSTR("cd");
+    }
+  }
+
+  else if (strncmp_P(buf, PSTR("echo"), 4) == 0) {
+    echo = strcmp_P(buf + 5, PSTR("off"));
+  }
+
+  else if (strcmp_P(buf, PSTR("ls")) == 0) {
+    CFFS::ls(cout);
+  }
+
+  else if (strncmp_P(buf, PSTR("od"), 2) == 0) {
+    CFFS::File file;
+    filename = buf + 3;
+    res = file.open(filename, O_READ);
+    if (res == 0) {
+      while (file.read(buf, sizeof(buf)) > 0)
+	cout.print(buf, sizeof(buf), IOStream::hex, 128 + 16);
+    }
+    else {
+      cout << PSTR("od");
+    }
+  }
+  else if (strcmp_P(buf, PSTR("time")) == 0) {
+    time_t now(RTC::seconds());
+    cout << now << endl;
+  }
+
+  if (res == 0) return;
+  cout << PSTR(": ") << filename << PSTR(": No such file or directory") << endl;
+}


Added Sequencer example

Added Sequencer example

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

--- examples/Sequencer_example/Sequencer_example.ino
+++ examples/Sequencer_example/Sequencer_example.ino
@@ -0,0 +1,40 @@
+#define V 32
+#define LED 5
+#define POT 0
+#define GATEOUT 13
+
+byte bpm = 120;
+int stepTime;
+byte curStep = 0;
+int playhead = 1;
+byte dur[] = {50, 50, 50, 50};
+byte numSteps = 4;
+
+void setup(){
+  stepTime = 60000.f / bpm;
+  pinMode(LED, OUTPUT);
+  pinMode(13, OUTPUT);
+}
+
+void loop(){
+  runSequence();
+  delayMicroseconds(750); // in a genuine Arduino with a 16MHz crystal oscillator the delay should be 1ms
+  // but on fake Arduinos with 12MHz oscillator the delay should be 0.75ms to have an accurrate clock running once every millisecond
+}
+
+void runSequence(){
+  playhead++;
+  if(playhead > numSteps * stepTime) playhead = 1; // reset playhead
+  curStep = playhead / stepTime; // increment current step
+  // Gate CV output
+ if(playhead % stepTime < stepTime * dur[curStep] / 100.f){
+   digitalWrite(GATEOUT, HIGH);
+   analogWrite(curStep+LED, 255-V);
+ }
+ else{
+   digitalWrite(GATEOUT, LOW);
+   analogWrite(curStep+LED, 255-LOW);
+ }
+
+ dur[0] = analogRead(0) / 1024.f * 100;
+}


update examples for rdm

update examples for rdm

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

--- examples/rdmControllerTest/rdmControllerTest.ino
+++ examples/rdmControllerTest/rdmControllerTest.ino
@@ -0,0 +1,239 @@
+/**************************************************************************/
+/*!
+    @file     rdmTest.ino
+    @author   Claude Heintz
+    @license  BSD (see LXTeensy3DMX LICENSE)
+    @copyright 2017 by Claude Heintz
+
+        Test of LXTeensy3DMX RDM functions
+        Changes output level of some DMX Addresses while building RDM
+        table of devices.  Turns identify on and off for found RDM devices.
+
+    @section  HISTORY
+
+    v1.00 - First release
+*/
+/**************************************************************************/
+
+#include <LXTeensy3DMX.h>
+#include <rdm/rdm_utility.h>
+#include <rdm/UID.h>
+#include <rdm/TOD.h>
+
+
+uint8_t testLevel = 0;
+uint8_t loopDivider = 0;
+uint8_t identifyFlag = 1;
+uint8_t tableChangedFlag = 0;
+
+TOD tableOfDevices;
+TOD discoveryTree;
+
+UID lower(0,0,0,0,0,0);
+UID upper(0,0,0,0,0,0);
+UID mid(0,0,0,0,0,0);
+UID found(0,0,0,0,0,0);
+
+#define DIRECTION_PIN 3
+#define DISC_STATE_SEARCH 0
+#define DISC_STATE_TBL_CK 1
+uint8_t discovery_state = DISC_STATE_TBL_CK;
+uint8_t discovery_tbl_ck_index = 0;
+
+
+//***************** discovery functions
+
+void checkDeviceFound(UID found) {
+  if ( testMute(found) ) {
+    tableOfDevices.add(found);
+    tableChangedFlag = 1;
+  }
+}
+
+uint8_t testMute(UID u) {
+   // try three times to get response when sending a mute message
+   if ( Teensy3DMX.sendRDMDiscoveryMute(u, RDM_DISC_MUTE) ) {
+     return 1;
+   }
+   if ( Teensy3DMX.sendRDMDiscoveryMute(u, RDM_DISC_MUTE) ) {
+     return 1;
+   }
+   if ( Teensy3DMX.sendRDMDiscoveryMute(u, RDM_DISC_MUTE) ) {
+     return 1;
+   }
+   return 0;
+}
+
+uint8_t checkTable(uint8_t ck_index) {
+  if ( ck_index == 0 ) {
+    Teensy3DMX.sendRDMDiscoveryMute(BROADCAST_ALL_DEVICES_ID, RDM_DISC_UNMUTE);
+  }
+
+  if ( tableOfDevices.getUIDAt(ck_index, &found) )  {
+    if ( testMute(found) ) {
+      // device confirmed
+      return ck_index += 6;
+    }
+
+    // device not found
+    tableOfDevices.removeUIDAt(ck_index);
+    tableChangedFlag = 1;
+    return ck_index;
+  }
+  // index invalid
+  return 0;
+}
+
+void identifyEach() {
+  int i = 0;
+  uint8_t notDone = 1;
+  while ( notDone ) {
+    i = tableOfDevices.getNextUID(i, &found);
+    if ( i < 0 ) {
+      notDone = 0;
+    } else {
+      //uint16_t data;  //for DMX address and identify device on/off
+      uint8_t data[2];
+      if ( Teensy3DMX.sendRDMGetCommand(found, RDM_DEVICE_START_ADDR, data, 2) ) {
+        uint16_t addr = (data[0] << 8) | data[1];
+
+        if ( addr == 0x0F ) {
+          data[0] = 0x00;
+          data[1] = 0x01;
+          Teensy3DMX.sendRDMSetCommand(found, RDM_DEVICE_START_ADDR, (uint8_t*)data, 2);
+        }
+
+        data[0] = 0x01;
+        Teensy3DMX.sendRDMSetCommand(found, RDM_IDENTIFY_DEVICE, (uint8_t*)data, 1);
+        delay(2000);
+        data[0] = 0x00;
+        Teensy3DMX.sendRDMSetCommand(found, RDM_IDENTIFY_DEVICE, (uint8_t*)data, 1);
+      }
+    }
+  }
+}
+
+//called when range responded, so divide into sub ranges push them on stack to be further checked
+void pushActiveBranch(UID lower, UID upper) {
+  if ( mid.becomeMidpoint(lower, upper) ) {
+    discoveryTree.push(lower);
+    discoveryTree.push(mid);
+    discoveryTree.push(mid);
+    discoveryTree.push(upper);
+  } else {
+    // No midpoint possible:  lower and upper are equal or a 1 apart
+    checkDeviceFound(lower);
+    checkDeviceFound(upper);
+  }
+}
+
+void pushInitialBranch() {
+  lower.setBytes(0);
+  upper.setBytes(BROADCAST_ALL_DEVICES_ID);
+  discoveryTree.push(lower);
+  discoveryTree.push(upper);
+
+  //ETC devices seem to only respond with wildcard or exact manufacturer ID
+  lower.setBytes(0x657400000000);
+  upper.setBytes(0x6574FFFFFFFF);
+  discoveryTree.push(lower);
+  discoveryTree.push(upper);
+}
+
+uint8_t checkNextRange() {
+  if ( discoveryTree.pop(&upper) ) {
+    if ( discoveryTree.pop(&lower) ) {
+      if ( lower == upper ) {
+        checkDeviceFound(lower);
+      } else {        //not leaf so, check range lower->upper
+        uint8_t result = Teensy3DMX.sendRDMDiscoveryPacket(lower, upper, &found);
+        if ( result ) {
+          //this range responded, so divide into sub ranges push them on stack to be further checked
+          pushActiveBranch(lower, upper);
+
+        } else if ( Teensy3DMX.sendRDMDiscoveryPacket(lower, upper, &found) ) {
+            pushActiveBranch(lower, upper); //if discovery fails, try a second time
+        }
+      }         // end check range
+      return 1; // UID ranges may be remaining to test
+    }           // end valid pop
+  }             // end valid pop
+  return 0;     // none left to pop
+}
+
+
+
+void testRDMDiscovery() {
+  if ( discovery_state ) {
+    // check the table of devices
+    discovery_tbl_ck_index = checkTable(discovery_tbl_ck_index);
+    if ( discovery_tbl_ck_index == 0 ) {
+      // done with table check
+      discovery_state = DISC_STATE_SEARCH;
+      pushInitialBranch();
+
+      if ( identifyFlag ) {   //once per cycle identify each device
+        identifyEach();       //this is just to demonstrate GET device address
+        identifyFlag = 0;     //and SET identify device
+      }
+
+      //if ( tableChangedFlag ) {   //if the table has changed...
+        tableChangedFlag = 0;
+
+        // if this were an Art-Net application, you would send an
+        // ArtTOD packet here, because the device table has changed.
+        // for this test, we just print the list of devices
+         Serial.println("_______________ Table Of Devices _______________");
+         tableOfDevices.printTOD();
+      //}
+    }
+  } else {    // search for devices in range popped from discoveryTree
+    if ( checkNextRange() == 0 ) {
+      // done with search
+      discovery_tbl_ck_index = 0;
+      discovery_state = DISC_STATE_TBL_CK;
+    }
+  }
+}
+
+/************************************************************************
+	setup
+*************************************************************************/
+void setup() {
+  Serial.begin(115200);
+  Serial.print("setup... ");
+
+  pinMode(4, OUTPUT);            // used for testing
+
+  pinMode(DIRECTION_PIN, OUTPUT);
+  Teensy3DMX.startRDM(DIRECTION_PIN, RDM_DIRECTION_OUTPUT, RX_SIGNAL_INVERTED);
+  Serial.println("setup complete");
+}
+
+
+/************************************************************************
+
+  The main loop checks to see if the level of the designated slot has changed
+  and prints the new level to the serial monitor.  If a PWM channel is assigned,
+  it also sets the output level.
+
+*************************************************************************/
+
+void loop() {
+  delay(2);
+  testRDMDiscovery();
+
+  Teensy3DMX.setSlot(7,testLevel);
+  Teensy3DMX.setSlot(8,255);
+  Teensy3DMX.setSlot(371,testLevel);
+  Teensy3DMX.setSlot(22,255);
+  loopDivider++;
+  if ( loopDivider == 4 ) {
+    testLevel++;
+    loopDivider = 0;
+  }
+  if ( testLevel == 1 ) {
+    delay(500);
+    identifyFlag = 1;
+  }
+}


easy callibration

easy callibration

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

--- Otto_easycal/Otto_easycal.ino
+++ Otto_easycal/Otto_easycal.ino
@@ -0,0 +1,29 @@
+/**************************************************************************************
+*   Easy calibration for Otto DIY
+*   Javier Isabel, 02/06/2015
+*   VERY IMPORTANT only calibrate one time per board!to avoid damage EEPROM memory
+**************************************************************************************/
+#include <Otto.h>
+#include <Servo.h>
+#include <Oscillator.h>
+#include <EEPROM.h>
+Otto Otto;
+
+void setup()
+{
+  Otto.init(2, 3, 4, 5, false);
+  Otto.setTrims(-7,-4,-4,7); //change Trim "offset values" gradually until Otto is completely straight (90º)
+ // Otto.saveTrimsOnEEPROM(); //use only after completely straight(90º), delete this line after for further programming
+}
+int posiciones[] = {90, 90, 90, 90};
+
+void loop()  //test comparing before & after function
+{
+  Otto.home();
+ // delay(4000);
+ // Otto.updown(6, 500, BIG);
+ // delay(2000);
+ //
+ // Otto.walk(4,1800);
+ //delay(2000);
+}


initial sketch

initial sketch

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

--- arduino/arduino.ino
+++ arduino/arduino.ino
@@ -0,0 +1,34 @@
+#include <Servo.h>
+Servo myservo;
+
+void setup()
+{
+  Serial.begin(38400);
+  myservo.attach(11);
+}
+
+void loop()
+{
+  if (Serial.available() > 0)
+  {
+    //Read buffer
+    char inputByte = Serial.read();
+
+    if (inputByte == 'w')
+    {
+        int angle=0;
+        while (angle <=90)
+        {
+            myservo.write(angle);
+            delay(10);
+            angle++;
+        }
+        while (angle > 0)
+        {
+            myservo.write(angle);
+            delay(10);
+            angle--;
+        }
+     }
+  }
+}


display working, beginning to structure UI

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

--- display/display.ino
+++ display/display.ino
@@ -0,0 +1,125 @@
+#include <stdint.h>
+#include <SPI.h>
+#include <Adafruit_GFX.h>
+#include <Adafruit_ILI9341.h>
+#include <Adafruit_STMPE610.h>
+#include <Wire.h>
+
+#define CS_TOUCH 8
+#define CS_SCREEN  10
+#define DC 9
+#define RST 7
+
+// This is calibration data for the raw touch data to the screen coordinates
+//#define TS_MINX 150
+//#define TS_MINY 130
+#define TS_MINX 150
+#define TS_MINY 130
+#define TS_MAXX 3800
+#define TS_MAXY 4000
+
+#define BOXSIZE 60
+
+Adafruit_ILI9341 tft = Adafruit_ILI9341(CS_SCREEN, DC);
+Adafruit_STMPE610 ts = Adafruit_STMPE610(CS_TOUCH);
+
+void setup(void){
+  Serial.begin(9600);
+  tft.begin();
+  if (!ts.begin()){
+    Serial.println("Unable to start touchscreen");
+  }
+  else {
+    Serial.println("Touchscreen started.");
+  }
+
+  tft.fillScreen(ILI9341_BLACK);
+  tft.setRotation(1);
+
+
+  // Make submenu selection boxes
+  tft.fillRect(0,0,BOXSIZE,BOXSIZE,ILI9341_RED);
+  tft.fillRect(0, BOXSIZE,BOXSIZE,BOXSIZE, ILI9341_GREEN);
+  tft.fillRect(0,BOXSIZE*2, BOXSIZE, BOXSIZE, ILI9341_BLUE);
+  tft.fillRect(0, BOXSIZE*3, BOXSIZE, BOXSIZE, ILI9341_MAGENTA);
+  tft.setCursor(BOXSIZE + 20, 0);
+  tft.setTextSize(1);
+  tft.println("Texas Engineering World Health");
+  tft.setCursor(BOXSIZE + 40, 10);
+  tft.println("Patient Monitor v1.0");
+
+}
+
+int currentMode = 0; // Change mode
+int timeout = 0;
+
+void loop(void) {
+  timeout ++;
+  // After timeout, wipe message from screen
+  if (timeout > 50000) {
+     tft.fillRect(BOXSIZE, 50, tft.width()-BOXSIZE, tft.height(), ILI9341_BLACK);
+  }
+
+  // Touch screen interfacing taken from touchpaint.ino example
+  // in the ILI9341 examples directory
+
+  // Check if there is touch data
+  if (ts.bufferEmpty()){
+    return;
+  }
+  // Retrieve the touch point
+  TS_Point p = ts.getPoint();
+  // Scale from 0-4000 to tft.width() using calibration numbers
+  p.x = map(p.x, TS_MINX, TS_MAXX, 0, tft.height());
+  p.y = map(p.y, TS_MINY, TS_MAXY, 0, tft.width());
+
+  // Do stuff with the coordinates of the touch
+
+  if (p.y < BOXSIZE){
+   if (p.x < BOXSIZE) {
+     if (currentMode != 1){
+      tft.fillRect(BOXSIZE, 50, tft.width()-BOXSIZE, tft.height(), ILI9341_BLACK);
+     tft.setCursor((tft.width()/2) -50, tft.height()/2);
+     tft.setTextSize(2);
+     tft.setTextColor(ILI9341_MAGENTA);
+     tft.println("Alarm Settings");
+     currentMode = 1;
+     timeout = 0;
+     }
+   } else if (p.x < BOXSIZE*2) {
+     if (currentMode != 2) {
+     tft.fillRect(BOXSIZE, 50, tft.width()-BOXSIZE, tft.height(), ILI9341_BLACK);
+     tft.setCursor((tft.width()/2) -50, tft.height()/2);
+     tft.setTextSize(2);
+     tft.setTextColor(ILI9341_BLUE);
+     tft.println("Temperature");
+     currentMode = 2;
+     timeout = 0;
+     }
+   } else if (p.x < BOXSIZE*3){
+     if (currentMode != 3) {
+     tft.fillRect(BOXSIZE, 50, tft.width()-BOXSIZE, tft.height(), ILI9341_BLACK);
+     tft.setCursor((tft.width()/2) -50, tft.height()/2);
+     tft.setTextSize(2);
+     tft.setTextColor(ILI9341_GREEN);
+     tft.println("SpO2");
+     currentMode = 3;
+     timeout = 0;
+     }
+   } else if (p.x < BOXSIZE*4){
+     if (currentMode != 4){
+     tft.fillRect(BOXSIZE, 50, tft.width()-BOXSIZE, tft.height(), ILI9341_BLACK);
+     tft.setCursor((tft.width()/2) -50, tft.height()/2);
+     tft.setTextSize(2);
+     tft.setTextColor(ILI9341_RED);
+     tft.println("Heart Rate");
+     currentMode = 4;
+     timeout = 0;
+     }
+   }
+
+
+  }
+
+}
+


Add ArduCAM Mini 2MP Time Elapse Caputure to SD Card Demo

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

--- ArduCAM/examples/mini/ArduCAM_Mini_2MP_TimeElapse2SD/ArduCAM_Mini_2MP_TimeElapse2SD.ino
+++ ArduCAM/examples/mini/ArduCAM_Mini_2MP_TimeElapse2SD/ArduCAM_Mini_2MP_TimeElapse2SD.ino
@@ -0,0 +1,175 @@
+// ArduCAM demo (C)2015 Lee
+// web: http://www.ArduCAM.com
+// This program is a demo of how to use most of the functions
+// of the library with a supported camera modules, and can run on any Arduino platform.
+//
+// This demo was made for Omnivision OV2640 2MP sensor.
+// It will run the ArduCAM Mini 2MP as a real 2MP digital camera, provide both JPEG capture.
+// The demo sketch will do the following tasks:
+// 1. Set the sensor to JPEG mode.
+// 2. Capture and buffer the image to FIFO every 5 seconds
+// 3. Store the image to Micro SD/TF card with JPEG format in sequential.
+// 4. Resolution can be changed by myCAM.set_JPEG_size() function.
+// This program requires the ArduCAM V3.4.0 (or later) library and ArduCAM Mini 2MP shield
+// and use Arduino IDE 1.5.2 compiler or above
+
+#include <UTFT_SPI.h>
+#include <SD.h>
+#include <Wire.h>
+#include <ArduCAM.h>
+#include <SPI.h>
+#include "memorysaver.h"
+
+#if defined(__arm__)
+#include <itoa.h>
+#endif
+
+#define SD_CS 9
+// set pin 4 as the slave select for SPI:
+const int SPI_CS = 4;
+
+ArduCAM myCAM(OV2640, SPI_CS);
+UTFT myGLCD(SPI_CS);
+
+
+void setup()
+{
+  uint8_t vid, pid;
+  uint8_t temp;
+#if defined (__AVR__)
+  Wire.begin();
+#endif
+#if defined(__arm__)
+  Wire1.begin();
+#endif
+  Serial.begin(115200);
+  Serial.println("ArduCAM Start!");
+  // set the SPI_CS as an output:
+  pinMode(SPI_CS, OUTPUT);
+
+  // initialize SPI:
+  SPI.begin();
+  //Check if the ArduCAM SPI bus is OK
+  myCAM.write_reg(ARDUCHIP_TEST1, 0x55);
+  temp = myCAM.read_reg(ARDUCHIP_TEST1);
+  if (temp != 0x55)
+  {
+    Serial.println("SPI interface Error!");
+    while (1);
+  }
+
+  //Check if the camera module type is OV2640
+  myCAM.rdSensorReg8_8(OV2640_CHIPID_HIGH, &vid);
+  myCAM.rdSensorReg8_8(OV2640_CHIPID_LOW, &pid);
+  if ((vid != 0x26) || (pid != 0x42))
+    Serial.println("Can't find OV2640 module!");
+  else
+    Serial.println("OV2640 detected");
+
+  //Change to BMP capture mode and initialize the OV2640 module
+  myCAM.set_format(JPEG);
+
+  myCAM.InitCAM();
+  //myCAM.OV2640_set_JPEG_size(OV2640_640x480);
+  //myCAM.OV2640_set_JPEG_size(OV2640_1600x1200);
+
+  //Initialize SD Card
+  if (!SD.begin(SD_CS))
+  {
+    //while (1);		//If failed, stop here
+    Serial.println("SD Card Error");
+  }
+  else
+    Serial.println("SD Card detected!");
+}
+
+void loop()
+{
+  char str[8];
+  File outFile;
+  byte buf[256];
+  static int i = 0;
+  static int k = 0;
+  static int n = 0;
+  uint8_t temp, temp_last;
+  uint8_t start_capture = 0;
+  int total_time = 0;
+  ////////////////////////////////
+
+  start_capture = 1;
+  delay(5000);
+
+  if (start_capture)
+  {
+    //Flush the FIFO
+    myCAM.flush_fifo();
+    //Clear the capture done flag
+    myCAM.clear_fifo_flag();
+    //Start capture
+    myCAM.start_capture();
+    Serial.println("Start Capture");
+  }
+
+  while (!myCAM.get_bit(ARDUCHIP_TRIG , CAP_DONE_MASK));
+
+
+  Serial.println("Capture Done!");
+
+  //Construct a file name
+  k = k + 1;
+  itoa(k, str, 10);
+  strcat(str, ".jpg");
+  //Open the new file
+  outFile = SD.open(str, O_WRITE | O_CREAT | O_TRUNC);
+  if (! outFile)
+  {
+    Serial.println("open file failed");
+    return;
+  }
+  total_time = millis();
+  i = 0;
+  myCAM.CS_LOW();
+  myCAM.set_fifo_burst();
+  temp = SPI.transfer(0x00);
+  //
+  //Read JPEG data from FIFO
+  while ( (temp != 0xD9) | (temp_last != 0xFF))
+  {
+    temp_last = temp;
+    temp = SPI.transfer(0x00);
+
+    //Write image data to buffer if not full
+    if (i < 256)
+      buf[i++] = temp;
+    else
+    {
+      //Write 256 bytes image data to file
+      myCAM.CS_HIGH();
+      outFile.write(buf, 256);
+      i = 0;
+      buf[i++] = temp;
+      myCAM.CS_LOW();
+      myCAM.set_fifo_burst();
+    }
+  }
+  //Write the remain bytes in the buffer
+  if (i > 0)
+  {
+    myCAM.CS_HIGH();
+    outFile.write(buf, i);
+  }
+  //Close the file
+  outFile.close();
+  total_time = millis() - total_time;
+  Serial.print("Total time used:");
+  Serial.print(total_time, DEC);
+  Serial.println(" millisecond");
+  //Clear the capture done flag
+  myCAM.clear_fifo_flag();
+  //Clear the start capture flag
+  start_capture = 0;
+}
+
+
+
+


Fixed example for new uart transmission style.

error: pathspec 'arduino/opencr_arduino/opencr/libraries/OpenCR/examples/10.' did not match any file(s) known to git
error: pathspec 'Etc/usb_to_dxl/usb_to_dxl.ino' did not match any file(s) known to git


Update mainhrm.ino

Update mainhrm.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/jeremywrnr/wampum.git/'


Create dht.ino

Create dht.ino

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

--- dht.ino
+++ dht.ino
@@ -0,0 +1,30 @@
+#include <DHT11.h>
+#define DHTPIN 7
+#define DHTTYPE DHT11
+DHT dht(DHTPIN, DHTTYPE);
+/*it's important that we set these variable per DHT sensor on our project*/
+
+void setup() {
+  Serial.begin(9600);
+
+  dht.begin();
+}
+
+void loop() {
+  /*reading the sensor will be slow, (about 1.4 of a second, and the data might be old
+ (up to 8x that time)*/
+  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)) {
+    Serial.println("Failed to read from DHT");
+  } else {
+    Serial.print("Humidity: ");
+    Serial.print(h);
+    Serial.print(" %\t");
+    Serial.print("Temperature: ");
+    Serial.print(t);
+    Serial.println(" *C");
+  }
+}


Polished code

Polished code

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


add Sonoff example, with config mode, standalone http mode, and mqtt mode. Also supports manual button toggle in both user modes

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

--- examples/SONOFF.ino
+++ examples/SONOFF.ino
@@ -0,0 +1,475 @@
+#include <EEPROM.h>
+#include "MqttConnection.h"
+#include <ESP8266WebServer.h>
+
+
+MqttConnection * myMqtt;
+ESP8266WebServer server(80);
+
+#define BOOT_MODE_CONFIG   1
+#define BOOT_MODE_MQTT     2
+#define BOOT_MODE_DEFAULT  3
+#define RELAY_STATE_OFF '1'
+#define RELAY_STATE_ON '2'
+
+int bootMode = BOOT_MODE_DEFAULT;
+bool statusGiven = false;
+int pressCount = 0;
+int currentRelayState = RELAY_STATE_OFF;
+
+String sensorName;
+char tmpS[32];
+
+/************************* WiFi Access Point *********************************/
+
+IPAddress    apIP(10, 10, 10, 10);
+
+#define BUTTON 0
+#define RELAY 12
+#define LED 13
+#define SPARE 14
+
+
+#define EEPROM_FIELD_SIZE 32
+#define EEPROM_NB_FIELD   5
+char  eepromArray[EEPROM_NB_FIELD][EEPROM_FIELD_SIZE];
+
+
+const char INDEX_RELAY_HTML[] =
+"<!DOCTYPE HTML>"
+""
+""
+"<meta name = \"viewport\" content = \"width = device-width, initial-scale = 1.0, maximum-scale = 1.0, user-scalable=0\">"
+"<title>ESP8266 Web Form Demo</title>"
+""
+""
+""
+"
RELAY Control
"
+"<FORM action=\"/\" method=\"post\">"
+"
"
+"RELAY
"
+"<INPUT type=\"radio\" name=\"RELAY\" value=\"1\">On
"
+"<INPUT type=\"radio\" name=\"RELAY\" value=\"0\">Off
"
+"<INPUT type=\"submit\" value=\"Send\"> <INPUT type=\"reset\">"
+"
"
+"</FORM>"
+""
+"";
+
+
+const char INDEX_HTML[] =
+"<!DOCTYPE HTML>"
+""
+""
+"<meta name = \"viewport\" content = \"width = device-width, initial-scale = 1.0, maximum-scale = 1.0, user-scalable=0\">"
+"<title>ESP8266 Web Form Demo</title>"
+""
+""
+""
+"
ESP8266 Web Form Demo
"
+"<FORM action=\"/\" method=\"post\">"
+"
"
+"Sensor name : "
+"<INPUT type=\"text\" name=\"SENSOR_NAME\"
"
+"WIFI access point :"
+"<INPUT type=\"text\" name=\"WIFI_NAME\"
"
+"WIFI password :"
+"<INPUT type=\"text\" name=\"WIFI_PWD\"
"
+"MQTT broker IP address : "
+"<INPUT type=\"text\" name=\"MQTT_IP\"
"
+"MQTT port : "
+"<INPUT type=\"text\" name=\"MQTT_PORT\"
"
+"<INPUT type=\"submit\" value=\"Send\"> <INPUT type=\"reset\">"
+"
"
+"</FORM>"
+""
+"";
+
+
+void returnOK()
+{
+  server.sendHeader("Connection", "close");
+  server.sendHeader("Access-Control-Allow-Origin", "*");
+  server.send(200, "text/plain", "Configuration updated. Rebooting in 10 seconds...\r\n");
+  delay (10000);
+  ESP.restart();
+}
+
+void returnFail(String msg)
+{
+  server.sendHeader("Connection", "close");
+  server.sendHeader("Access-Control-Allow-Origin", "*");
+  server.send(500, "text/plain", msg + "\r\n");
+}
+
+void handleSubmitRelay()
+{
+  String relayValue;
+
+  if (!server.hasArg("RELAY")) return returnFail("BAD ARGS");
+  relayValue = server.arg("RELAY");
+  if (relayValue == "1") {
+    digitalWrite(LED, LOW);
+
+    server.send(200, "text/html", INDEX_RELAY_HTML);
+  }
+  else if (relayValue == "0") {
+    digitalWrite(LED, HIGH);
+    server.send(200, "text/html", INDEX_RELAY_HTML);
+  }
+  else {
+    returnFail("Bad RELAY value");
+  }
+}
+
+void handleRootDefault()
+{
+  if (server.hasArg("RELAY")) {
+    handleSubmitRelay();
+  }
+  else {
+    server.send(200, "text/html", INDEX_RELAY_HTML);
+  }
+}
+
+
+
+void handleRoot()
+{
+   if (server.args() > 1){
+      Serial.println("Field update requested");
+      sensorName = server.arg("SENSOR_NAME");
+      String wifiName   = server.arg("WIFI_NAME");
+      String wifiPwd    = server.arg("WIFI_PWD");
+      String mqttIp     = server.arg("MQTT_IP");
+      String mqttPort   = server.arg("MQTT_PORT");
+
+      Serial.print("sensorName :");
+      Serial.println(sensorName);
+      Serial.print("wifiName :");
+      Serial.println(wifiName);
+      Serial.print("wifiPwd :");
+      Serial.println(wifiPwd);
+      Serial.print("mqttIp :");
+      Serial.println(mqttIp);
+      Serial.print("mqttPort :");
+      Serial.println(mqttPort);
+
+      strcpy(&eepromArray[0][0], sensorName.c_str());
+      strcpy(&eepromArray[1][0], wifiName.c_str());
+      strcpy(&eepromArray[2][0], wifiPwd.c_str());
+      strcpy(&eepromArray[3][0], mqttIp.c_str());
+      strcpy(&eepromArray[4][0], mqttPort.c_str());
+
+      for (int addr = 0; addr < sizeof(eepromArray); addr++){
+          EEPROM.write(addr, ((char*)eepromArray)[addr]);
+      }
+      EEPROM.commit();
+      Serial.println("EEPROM updated");
+      returnOK();
+
+  }
+  else {
+    Serial.println("no  arg");
+    server.send(200, "text/html", INDEX_HTML);
+  }
+
+}
+
+
+
+
+void handleSubmit()
+{
+  String LEDvalue;
+
+  if (!server.hasArg("LED")) return returnFail("BAD ARGS");
+  LEDvalue = server.arg("LED");
+  if (LEDvalue == "1") {
+
+    server.send(200, "text/html", INDEX_HTML);
+  }
+  else if (LEDvalue == "0") {
+
+    server.send(200, "text/html", INDEX_HTML);
+  }
+  else {
+    returnFail("Bad LED value");
+  }
+}
+
+
+
+void blinkFast(int nbRepeat){
+    for (int i = 0; i < nbRepeat; i++){
+        digitalWrite(LED, LOW);
+        delay(70);
+        digitalWrite(LED, HIGH);
+        delay(70);
+    }
+}
+
+
+void blinkSlow(int nbRepeat){
+    for (int i = 0; i < nbRepeat; i++){
+        digitalWrite(LED, LOW);
+        delay(500);
+        digitalWrite(LED, HIGH);
+        delay(500);
+    }
+}
+
+void blinkLedConfigMode(){
+    blinkFast(1);
+}
+
+void deviceReadyBlink(){
+    blinkSlow(3);
+}
+
+void deviceMqttReadyBlink(){
+       blinkSlow(3);
+       blinkFast(3);
+       blinkSlow(3);
+}
+
+
+void processCommandMsg(char* topic, byte* payload, unsigned int length)
+{
+
+  Serial.print("Checking if state topic");
+  String commandTopic = sensorName + "/" + "command";
+  if(String(topic) == commandTopic){
+     Serial.println("Received state topic change");
+       if ((char)payload[0] == RELAY_STATE_ON) {
+          Serial.println("RELAY STATE ON received");
+          currentRelayState= RELAY_STATE_ON;
+
+          digitalWrite(LED, HIGH);
+          digitalWrite(RELAY, HIGH);
+          char tmpChar = RELAY_STATE_ON;
+          myMqtt->publishValue("state", &tmpChar);
+       }
+       else if ((char)payload[0] == RELAY_STATE_OFF){
+        Serial.println("RELAY STATE OFF received");
+          currentRelayState= RELAY_STATE_OFF;
+
+          digitalWrite(LED, LOW);
+          digitalWrite(RELAY, LOW);
+          char tmpChar = RELAY_STATE_OFF;
+          myMqtt->publishValue("state", &tmpChar);
+       }
+     else {
+        Serial.print("Unknown payload : ");
+      Serial.println((char)payload[0]);
+     }
+
+  }
+}
+
+
+
+
+void setup() {
+  Serial.begin(115200);
+  pinMode(BUTTON, INPUT);
+  pinMode(RELAY, OUTPUT);
+  pinMode(LED, OUTPUT);
+  pinMode(SPARE, INPUT);
+
+  EEPROM.begin(512);
+
+  digitalWrite(LED, LOW);
+  delay(3000);
+  digitalWrite(LED, HIGH);
+
+    for (int addr = 0; addr < sizeof(eepromArray); addr++){
+          char tmpChar = (char)EEPROM.read(addr);
+          ((char*)eepromArray)[addr] = tmpChar;
+    }
+
+      sensorName = eepromArray[0];
+      String wifiName   = eepromArray[1];
+      String wifiPwd    = eepromArray[2];
+      String mqttIp     = eepromArray[3];
+      String mqttPort   = eepromArray[4];
+
+  //If button pressed at boot
+
+  if(digitalRead(BUTTON) == 0){
+        Serial.println("a bitch");
+      bootMode = BOOT_MODE_CONFIG;
+      Serial.println("starting config server");
+
+      WiFi.mode(WIFI_AP);
+      WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
+      int result = WiFi.softAP("ESP_CONFIG");
+      if(result == true)
+      {
+        Serial.println("Config server ready");
+      }
+      else
+      {
+        Serial.println("Config server failed to start!");
+      }
+
+
+      server.on("/", handleRoot);
+      server.begin();
+
+  }
+  else{
+      Serial.println("Starting with config :");
+      Serial.print("\tObject Name :");
+      Serial.println(sensorName);
+      Serial.print("\tWifi Access point :");
+      Serial.println(wifiName);
+      Serial.print("\tWifi pwd :");
+      Serial.println(wifiPwd);
+      Serial.print("\tMQTT address :");
+      Serial.println(mqttIp.c_str());
+      Serial.print("\tMQTT port :");
+      Serial.println(mqttPort);
+
+      if(mqttPort != ""){
+          bootMode = BOOT_MODE_MQTT;
+
+          strcpy(tmpS, mqttIp.c_str());
+          myMqtt = new MqttConnection(sensorName.c_str(), wifiName.c_str(), wifiPwd.c_str(), tmpS, mqttPort.toInt());
+
+          myMqtt->registerCustomProcessing(&processCommandMsg);
+          myMqtt->addSubscription("command");
+
+          if(myMqtt->connected()){
+              deviceMqttReadyBlink();
+          }
+          else
+          {
+            Serial.println("could not connect to MQTT server");
+           }
+      }
+      else{
+          WiFi.mode(WIFI_STA);
+          WiFi.begin(wifiName.c_str(), wifiPwd.c_str());
+
+          while (WiFi.status() != WL_CONNECTED) {
+              delay(500);
+              Serial.print(".");
+           }
+           Serial.println("");
+           Serial.print("Connected to ");
+           Serial.println(wifiName);
+           Serial.print("IP address: ");
+           Serial.println(WiFi.localIP());
+
+            server.on("/", handleRootDefault);
+            server.begin();
+
+            Serial.print("Connect to http://xxxxxx.local or http://");
+            Serial.println(WiFi.localIP());
+            Serial.println("last number : ");
+            int addressNumber = WiFi.localIP()[3];
+            Serial.println(addressNumber);
+            delay(1000);
+
+            //Blink to indicate last digit of IP address
+            int unit = addressNumber % 10;
+            int dec = addressNumber / 10;
+            blinkSlow(dec);
+            delay(2000);
+            blinkSlow(unit);
+
+
+
+
+      }
+
+ }
+
+}
+
+void toggleRelayState(){
+    if(currentRelayState == RELAY_STATE_OFF)
+    {
+       currentRelayState= RELAY_STATE_ON;
+
+       digitalWrite(LED, HIGH);
+       digitalWrite(RELAY, HIGH);
+       if(bootMode == BOOT_MODE_MQTT){
+           char tmpChar = RELAY_STATE_ON;
+           myMqtt->publishValue("state", &tmpChar);
+       }
+    }
+    else
+    {
+       currentRelayState = RELAY_STATE_OFF;
+
+       digitalWrite(LED, LOW);
+       digitalWrite(RELAY, LOW);
+       if(bootMode == BOOT_MODE_MQTT){
+           char tmpChar = RELAY_STATE_OFF;
+           myMqtt->publishValue("state", &tmpChar);
+       }
+    }
+
+
+}
+
+
+void loop() {
+  // put your main code here, to run repeatedly:
+ if(bootMode == BOOT_MODE_CONFIG){
+    server.handleClient();
+    blinkLedConfigMode();
+
+}
+else
+{
+
+
+  if(bootMode == BOOT_MODE_MQTT){
+      if (!myMqtt->connected()) {
+         myMqtt->reconnect();
+         statusGiven = false;
+      }
+      if (myMqtt->connected() & !statusGiven) {
+         deviceMqttReadyBlink();
+         statusGiven = true;
+      }
+      myMqtt->loop();
+
+
+  }
+  else{
+    server.handleClient();
+
+  }
+
+  //In all case monitor HW button
+  if(digitalRead(BUTTON) == 0){
+       pressCount +=1;
+       Serial.print("count :");
+       Serial.println(pressCount);
+       if(pressCount == 2){
+           Serial.println("Toggling state");
+           toggleRelayState();
+       }
+  }
+  else{
+        pressCount = 0;
+  }
+
+
+
+}
+
+
+
+delay(100);
+
+}
+


radar sketch

radar sketch

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

--- testing/arduino/radar3-ros.ino
+++ testing/arduino/radar3-ros.ino
@@ -0,0 +1,68 @@
+#include <ros.h>
+#include <ros/time.h>
+#include <sensor_msgs/Range.h>
+
+ros::NodeHandle  nh;
+
+sensor_msgs::Range range_msg;
+ros::Publisher pub_range1("/ultrasound1", &range_msg);
+ros::Publisher pub_range2("/ultrasound2", &range_msg);
+// "/arduino_ultrasound"
+
+char frameid[] = "/ultrasound";
+
+long duration;
+float getRange_Ultrasound(int pin_num)
+{
+  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
+  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
+  pinMode(pin_num, OUTPUT);
+  digitalWrite(pin_num, LOW);
+  delayMicroseconds(2);
+  digitalWrite(pin_num, HIGH);
+  delayMicroseconds(10);
+  digitalWrite(pin_num, LOW);
+
+  // The same pin is used to read the signal from the PING))): a HIGH
+  // pulse whose duration is the time (in microseconds) from the sending
+  // of the ping to the reception of its echo off of an object.
+  pinMode(pin_num, INPUT);
+  duration = pulseIn(pin_num, HIGH);
+
+  // convert the time into a distance
+  return duration/58; //    duration/29/2, return centimeters
+}
+
+void setup()
+{
+  nh.initNode();
+  nh.advertise(pub_range1);
+  nh.advertise(pub_range2);
+
+  range_msg.radiation_type = sensor_msgs::Range::ULTRASOUND;
+  range_msg.header.frame_id =  frameid;
+  range_msg.field_of_view = 0.1;  // fake
+  range_msg.min_range = 0.0;
+  range_msg.max_range = 2.0;
+}
+
+long range_time;
+
+void loop()
+{
+  //publish the adc value every 50 milliseconds
+  //since it takes that long for the sensor to stabilize
+  if ( millis() >= range_time ){
+    range_msg.range = getRange_Ultrasound(5);
+    range_msg.header.stamp = nh.now();
+    pub_range1.publish(&range_msg);
+
+    range_msg.range = getRange_Ultrasound(6);
+    range_msg.header.stamp = nh.now();
+    pub_range2.publish(&range_msg);
+
+    range_time =  millis() + 50;
+  }
+
+  nh.spinOnce();
+}


add poe version

add poe version

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

--- sketches/EnerginoPOE/EnerginoPOE.ino
+++ sketches/EnerginoPOE/EnerginoPOE.ino
@@ -0,0 +1,435 @@
+/*
+ * Energino
+ *
+ * Energino POE is a energy consumption meter for DC loads
+ *
+ * This sketch connects an Arduino equipped with the Energino
+ * shield and with an Ethernet shield with a web service
+ * implementing the COSM (formely Pachube) REST API. It also
+ * implements a serial interface.
+ *
+ * Circuit:
+ *  Analog inputs attached to pins A0 (Current), A1 (Voltage)
+ *  Digital output attached to pin D2 (Relay)
+ *
+ * Supported commands from the serial:
+ *  #P<integer>, sets the period between two updates (in ms) [default is 2000]
+ *  #S<0/1>, sets the relay configuration, 0 load on, 1 load off [default is 0]
+ *  #A<integer>, sets the value in ohms of the R1 resistor [default is 100000]
+ *  #B<integer>, sets the value in ohms of the R2 resistor [default is 10000]
+ *  #C<integer>, sets the offset in mV of the current sensor [default is 2500]
+ *  #D<integer>, sets the sensitivity in mV of the current sensor [default is 185]
+ *  #R, resest the configuration to the defaults
+ *  #F<feed>, sets the feed id [default is 0]
+ *  #K<key>, sets the Xively authentication key [default is -]
+ *  #U<url>, sets the Xively URL [default is https://api.xively.com/v2/feeds/]
+ *
+ * No updates are sent over the Ethernet interface if the feed id is set to 0
+ *
+ * Serial putput:
+ *   #Energino,0,<voltage>,<current>,<power>,<relay>,<period>,<samples>,<feed>,<url>,<key>
+ *
+ * RESTful interface:
+ *   Reading:
+ *     GET http://<ipaddress>/arduino/datastreams
+ *     GET http://<ipaddress>/arduino/datastreams/voltage
+ *     GET http://<ipaddress>/arduino/datastreams/current
+ *     GET http://<ipaddress>/arduino/datastreams/power
+ *     GET http://<ipaddress>/arduino/datastreams/switch
+ *   Switching on:
+ *     GET http://<ipaddress>/arduino/datastreams/switch/0
+ *   Switching off:
+ *     GET http://<ipaddress>/arduino/datastreams/switch/1
+ *
+ * created 9 November 2013
+ * by Roberto Riggio
+ *
+ * This code is released under the BSD Licence
+ *
+ */
+
+#include <Process.h>
+#include <Bridge.h>
+#include <YunServer.h>
+#include <YunClient.h>
+#include <avr/eeprom.h>
+
+#define APIKEY        "foo"                               // replace your Xively api key here
+#define FEEDID        0                                   // replace your feed ID
+#define FEEDSURL      "https://api.xively.com/v2/feeds/"  // replace your remote service IP address
+
+#define RELAYPIN      2
+#define CURRENTPIN    A0
+#define VOLTAGEPIN    A1
+
+// Energino parameters
+int R1 = 390;
+int R2 = 100;
+int OFFSET = 2500;
+int SENSITIVITY = 185;
+int PERIOD = 2000;
+
+// Control loop paramters
+long sleep = 0;
+long delta = 0;
+
+// Last computed values
+float VFinal = 0.0;
+float IFinal = 0.0;
+
+// magic string
+const char MAGIC[] = "EnerginoPOE";
+const int REVISION = 1;
+
+// Permanent configuration
+struct settings_t {
+  char magic[12];
+  long period;
+  int r1;
+  int r2;
+  int offset;
+  int sensitivity;
+  char apikey[49];
+  long feedid;
+  char feedsurl[60];
+}
+settings;
+
+void reset() {
+  strcpy (settings.magic,MAGIC);
+  settings.period = PERIOD;
+  settings.r1 = R1;
+  settings.r2 = R2;
+  settings.offset = OFFSET;
+  settings.sensitivity = SENSITIVITY;
+  strcpy (settings.apikey,APIKEY);
+  settings.feedid = FEEDID;
+  strcpy (settings.feedsurl,FEEDSURL);
+}
+
+// rest server
+YunServer server;
+
+void setup() {
+  // Set serial port
+  Serial.begin(115200);
+  // Set external vref
+  analogReference(EXTERNAL);
+  // Default on
+  pinMode(RELAYPIN, OUTPUT);
+  digitalWrite(RELAYPIN, LOW);
+  // Init bridge library
+  Bridge.begin();
+  // Loading setting
+  eeprom_read_block((void*)&settings, (void*)0, sizeof(settings));
+  if (strcmp(settings.magic, MAGIC) != 0) {
+    reset();
+    eeprom_write_block((const void*)&settings, (void*)0, sizeof(settings));
+  }
+  // set sleep counter
+  resetSleep(settings.period);
+  // listen on port
+  server.listenOnLocalhost();
+  server.begin();
+  // Use the led 13 to notify that the
+  // setup completed
+  pinMode(13,OUTPUT);
+  digitalWrite(13, HIGH);
+}
+
+void loop() {
+  // Make sure that update period is not too high
+  // when pushing data to Xively (one sample every
+  // 5 seconds should be a reasonable lower boud)
+  if ((settings.feedid != 0) && (settings.period < 2000)) {
+    resetSleep(2000);
+  }
+
+  // Start profiling
+  long started = millis();
+
+  // Get clients coming from server
+  YunClient client = server.accept();
+
+  // There is a new client?
+  if (client) {
+    // Process request
+    process(client);
+    // Close connection and free resources.
+    client.stop();
+  }
+
+  // Parse incoming commands
+  serParseCommand();
+
+  // Instant values are too floating,
+  // let's smooth them up
+  long VRaw = 0;
+  long IRaw = 0;
+
+  for(long i = 0; i < sleep; i++) {
+    VRaw += analogRead(VOLTAGEPIN);
+    IRaw += analogRead(CURRENTPIN);
+  }
+
+  // Conversion
+  VFinal = scaleVoltage((float)VRaw/sleep);
+  IFinal = scaleCurrent((float)IRaw/sleep);
+
+  // dump to serial
+  dumpToSerial();
+
+  // send data to remote host
+  sendData();
+
+  // profiling
+  delta = abs(millis() - started);
+
+  // Control loop
+  sleep -= 5 * (delta - settings.period);
+  if (sleep < 5) {
+    sleep = 5;
+  }
+
+}
+
+// this method makes a HTTP connection to the server:
+void sendData() {
+
+  if (settings.feedid == 0) {
+    return;
+  }
+
+  // form the string for the API header parameter:
+  String apiString = "X-ApiKey: ";
+  apiString += settings.apikey;
+
+  // form the string for the URL parameter:
+  String url = settings.feedsurl;
+  url += settings.feedid;
+  url += ".csv";
+
+  // Send the HTTP PUT request
+
+  // Is better to declare the Process here, so when the
+  // sendData function finishes the resources are immediately
+  // released. Declaring it global works too, BTW.
+  Process xively;
+
+  xively.begin("curl");
+  xively.addParameter("-k");
+  xively.addParameter("--silent");
+  xively.addParameter("--request");
+  xively.addParameter("PUT");
+  xively.addParameter("--data");
+
+  String dataString = "current,";
+  dataString += IFinal;
+  dataString += "\nvoltage,";
+  dataString += VFinal;
+  dataString += "\npower,";
+  dataString += VFinal*IFinal;
+  dataString += "\nswitch,";
+  dataString += digitalRead(RELAYPIN);
+
+  xively.addParameter(dataString);
+  xively.addParameter("--header");
+  xively.addParameter(apiString);
+  xively.addParameter(url);
+  xively.run();
+
+}
+
+void serParseCommand()
+{
+  // if serial is not available there is no point in continuing
+  if (!Serial.available()) {
+    return;
+  }
+  // working vars
+  char cmd = '\0';
+  int i, serAva;
+  char inputBytes[60] = {
+    '\0'                             };
+  char * inputBytesPtr = &inputBytes[0];
+  // read command from serial
+  serAva = Serial.available();
+  for (i = 0; i < serAva; i++) {
+    char chr = Serial.read();
+    if (i == 0) {
+      if (chr != '#') {
+        return;
+      }
+      else {
+        continue;
+      }
+    }
+    else if (i == 1) {
+      cmd = chr;
+    }
+    else{
+      inputBytes[i-2] = chr;
+    }
+  }
+  // null-terminate input buffer
+  inputBytes[i] = '\0';
+  // execute command
+  if (cmd == 'R') {
+    reset();
+  }
+  else if (cmd == 'F') {
+    long value = atol(inputBytesPtr);
+    if (value >= 0) {
+      settings.feedid = value;
+    }
+  }
+  else if (cmd == 'K') {
+    strncpy(settings.apikey, inputBytes,49);
+    settings.apikey[48] = '\0';
+  }
+  else if (cmd == 'U') {
+    strncpy(settings.feedsurl, inputBytes,60);
+    settings.feedsurl[59] = '\0';
+  }
+  else {
+    int value = atoi(inputBytesPtr);
+    if (value < 0) {
+      return;
+    }
+    if (cmd == 'P') {
+      resetSleep(value);
+    }
+    else if (cmd == 'A') {
+      settings.r1 = value;
+    }
+    else if (cmd == 'B') {
+      settings.r2 = value;
+    }
+    else if (cmd == 'C') {
+      settings.offset = value;
+    }
+    else if (cmd == 'D') {
+      settings.sensitivity = value;
+    }
+    else if (cmd == 'S') {
+      if (value > 0) {
+        Serial.println("@switch: high");
+        digitalWrite(RELAYPIN, HIGH);
+      }
+      else {
+        Serial.println("@switch: low");
+        digitalWrite(RELAYPIN, LOW);
+      }
+    }
+  }
+  eeprom_write_block((const void*)&settings, (void*)0, sizeof(settings));
+}
+
+void dumpToSerial() {
+  // Print data also on the serial
+  Serial.print("#");
+  Serial.print(MAGIC);
+  Serial.print(",");
+  Serial.print(REVISION);
+  Serial.print(",");
+  Serial.print(VFinal,3);
+  Serial.print(",");
+  Serial.print(IFinal,3);
+  Serial.print(",");
+  Serial.print(VFinal * IFinal,3);
+  Serial.print(",");
+  Serial.print(digitalRead(RELAYPIN));
+  Serial.print(",");
+  Serial.print(delta);
+  Serial.print(",");
+  Serial.print(sleep);
+  Serial.print(",");
+  Serial.print(settings.feedid);
+  Serial.print(",");
+  Serial.print(settings.feedsurl);
+  Serial.print(",");
+  Serial.println(settings.apikey);
+}
+
+float scaleVoltage(float voltage) {
+  float tmp = ( voltage * 5 * (settings.r1 + settings.r2)) / ( settings.r2 * 1024 );
+  return (tmp > 0) ? tmp : 0.0;
+}
+
+float scaleCurrent(float current) {
+  float tmp = ( current * 5000 / 1024  - settings.offset) / settings.sensitivity;
+  return (tmp > 0) ? tmp : 0.0;
+}
+
+void resetSleep(long value) {
+  sleep = (value * 4400) / 1000;
+  settings.period = value;
+}
+
+void process(YunClient client) {
+
+  String command = client.readStringUntil('/');
+  command.trim();
+
+  if (command == "datastreams") {
+
+    String subCommand = client.readStringUntil('/');
+    subCommand.trim();
+
+    if (subCommand == "current") {
+      sendReply(client,subCommand,IFinal);
+      return;
+    }
+
+    if (subCommand == "voltage") {
+      sendReply(client,subCommand,VFinal);
+      return;
+    }
+
+    if (subCommand == "power") {
+      sendReply(client,subCommand,VFinal*IFinal);
+      return;
+    }
+
+    if (subCommand == "switch") {
+      char c = client.read();
+      if (c == '0') {
+        digitalWrite(RELAYPIN, LOW);
+      }
+      if (c == '1') {
+        digitalWrite(RELAYPIN, HIGH);
+      }
+      sendReply(client,subCommand,digitalRead(RELAYPIN));
+      return;
+    }
+
+    client.print(F("{\"version\":\"1.0.0\","));
+    client.print(F("\"datastreams\":["));
+    client.print(F("{\"id\":\"voltage\",\"current_value\":"));
+    client.print(VFinal);
+    client.println(F("},"));
+    client.print(F("{\"id\":\"current\",\"current_value\":"));
+    client.print(IFinal);
+    client.println(F("},"));
+    client.print(F("{\"id\":\"power\",\"current_value\":"));
+    client.print(VFinal * IFinal);
+    client.println(F("},"));
+    client.print(F("{\"id\":\"switch\",\"current_value\":"));
+    client.print(digitalRead(RELAYPIN));
+    client.println(F("}"));
+    client.println(F("]"));
+    client.println(F("}"));
+  }
+
+}
+
+void sendReply(YunClient client, String cmd, float value) {
+  client.print(F("{\"version\":\"1.0.0\","));
+  client.print(F("\"id\":\""));
+  client.print(cmd);
+  client.print(F("\",\"current_value\":"));
+  client.print(value);
+  client.println(F("}"));
+}
+
+


add config variables

add config variables

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/cwilkens/helioscope-lamp.git/'


Improves bike arduino code after testing it in the room.

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/bassjansson/vera.git/'


arduino code for sending notes to diff channels

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

--- src/channels_ard_midi/channels_ard_midi.ino
+++ src/channels_ard_midi/channels_ard_midi.ino
@@ -0,0 +1,43 @@
+#define C4 0x30
+#define Cs4 0x31
+#define D4 0x32
+#define E4 0x34
+#define F4 0x35
+#define G4 0x37
+#define A4a 0x39
+#define B4 0x3B
+
+#define C5 0x3C
+#define D5 0x3E
+#define E5 0x40
+#define F5 0x41
+#define G5 0x43
+#define A5a 0x45
+#define As5 0x46
+#define B5 0x47
+#define C6 0x48
+#define Cs6 0x49
+void midi(int cmd, int data1, int data2);
+void setup() {
+  // put your setup code here, to run once:
+Serial.begin(9600);
+}
+int val=0;
+void loop() {
+  // put your main code here, to run repeatedly:
+int i=0;
+  midi(0x90,C5,0x55);
+  midi(0xB0,12,val=val+5);
+   delay(200);
+   midi(0x80,C5,0x55);
+   delay(100);
+   if(val>127)
+   val=0;
+
+}
+void midi(int cmd, int data1, int data2)
+{
+Serial.write(cmd);
+Serial.write(data1);
+Serial.write(data2);
+}


hc06-acc

hc06-acc

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

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

--- HC06_slave_accelerator/HC06_slave_accelerator.ino
+++ HC06_slave_accelerator/HC06_slave_accelerator.ino
@@ -0,0 +1,52 @@
+#include <SoftwareSerial.h>   //Software Serial Port
+#include <Wire.h>
+#include <I2Cdev.h>
+#include <MPU6050.h>
+
+#define RxD 2  //for Leonardo：10, bluetooth tx
+#define TxD 3  //for Leonardo：11, bluetooth rx
+
+MPU6050 accelgyro;
+int16_t ax, ay, az;
+int16_t gx, gy, gz;
+#define PARAMS 6
+#define STR_LENGTH (PARAMS*6+PARAMS-1)
+char accStr[STR_LENGTH];
+
+char incomingByte;  // incoming data
+int LED = 13;      // LED pin
+byte led_digital = 0;
+
+SoftwareSerial blueToothSerial(RxD,TxD);
+
+void setup() {
+  accelgyro.initialize();
+  Serial.begin(9600); // initialization
+  pinMode(LED, OUTPUT);
+  Serial.println("Hello remote control!");
+  blueToothSerial.begin(9600);
+}
+
+void loop() {
+  if (blueToothSerial.available() > 0) {  // if the data came
+    incomingByte = blueToothSerial.read(); // read byte
+    if(incomingByte == '0') {
+      digitalWrite(LED, LOW);  // if 1, switch LED Off
+      //      blueToothSerial.println("LED OFF. Press 1 to LED ON!");  // print message
+    }
+    if(incomingByte == '1') {
+      digitalWrite(LED, HIGH); // if 0, switch LED on
+      //      blueToothSerial.println("LED ON. Press 0 to LED OFF!");
+    }
+  }
+  // toggle led
+  digitalWrite(LED, led_digital);
+  led_digital = !led_digital;
+  accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
+  sprintf(accStr, "%d,%d,%d,%d,%d,%d", ax, ay, az, gx, gy, gz);
+  blueToothSerial.println(accStr);
+  delay(100);
+}
+
+
+


Added initial button demo code.

Added initial button demo code.

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

--- arduboy-game/arduboy-game.ino
+++ arduboy-game/arduboy-game.ino
@@ -0,0 +1,106 @@
+/*
+Buttons example
+June 11, 2015
+Copyright (C) 2015 David Martinez
+All rights reserved.
+This code is the most basic barebones code for showing how to use buttons in
+Arduboy.
+
+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.
+*/
+
+#include "Arduboy.h"
+
+// Make an instance of arduboy used for many functions
+Arduboy arduboy;
+
+// Variables for your game go here.
+char text[] = "Press Buttons!";
+byte x;
+byte y;
+
+// Width of each charcter including inter-character space
+#define CHAR_WIDTH 6
+
+// Height of each charater
+#define CHAR_HEIGHT 8
+
+// To get the number of characters, we subtract 1 from the length of
+// the array because there will be a NULL terminator at the end.
+#define NUM_CHARS (sizeof(text) - 1)
+
+// This is the highest value that x can be without the end of the text
+// going farther than the right side of the screen. We add one because
+// there will be a 1 pixel space at the end of the last character.
+// WIDTH and HEIGHT are defined in the Arduboy library.
+#define X_MAX (WIDTH - (NUM_CHARS * CHAR_WIDTH) + 1)
+
+// This is the highest value that y can be without the text going below
+// the bottom of the screen.
+#define Y_MAX (HEIGHT - CHAR_HEIGHT)
+
+
+// This function runs once in your game.
+// use it for anything that needs to be set only once in your game.
+void setup() {
+  //initiate arduboy instance
+  arduboy.begin();
+
+  // here we set the framerate to 30, we do not need to run at default 60 and
+  // it saves us battery life.
+  arduboy.setFrameRate(30);
+
+  // set x and y to the middle of the screen
+  x = (WIDTH / 2) - (NUM_CHARS * CHAR_WIDTH / 2);
+  y = (HEIGHT / 2) - (CHAR_HEIGHT / 2);
+}
+
+
+// our main game loop, this runs once every cycle/frame.
+// this is where our game logic goes.
+void loop() {
+  // pause render until it's time for the next frame
+  if (!(arduboy.nextFrame()))
+    return;
+
+  // the next couple of lines will deal with checking if the D-pad buttons
+  // are pressed and move our text accordingly.
+  // We check to make sure that x and y stay within a range that keeps the
+  // text on the screen.
+
+  // if the right button is pressed move 1 pixel to the right every frame
+  if(arduboy.pressed(RIGHT_BUTTON) && (x < X_MAX)) {
+    x++;
+  }
+
+  // if the left button is pressed move 1 pixel to the left every frame
+  if(arduboy.pressed(LEFT_BUTTON) && (x > 0)) {
+    x--;
+  }
+
+  // if the up button or B button is pressed move 1 pixel up every frame
+  if((arduboy.pressed(UP_BUTTON) || arduboy.pressed(B_BUTTON)) && (y > 0)) {
+    y--;
+  }
+
+  // if the down button or A button is pressed move 1 pixel down every frame
+  if((arduboy.pressed(DOWN_BUTTON) || arduboy.pressed(A_BUTTON)) && (y < Y_MAX)) {
+    y++;
+  }
+
+
+  // we clear our screen to black
+  arduboy.clear();
+
+  // we set our cursor x pixels to the right and y down from the top
+  arduboy.setCursor(x, y);
+
+  // then we print to screen what is stored in our text variable we declared earlier
+  arduboy.print(text);
+
+  // then we finaly we tell the arduboy to display what we just wrote to the display.
+  arduboy.display();
+}


Implement brightness handling

Implement brightness handling

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


First version of Gutter-Sense

First version of Gutter-Sense

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


Cleaning up server code

Cleaning up server code

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


Config file by Open Energy Monitor

Config file by Open Energy Monitor

See sketch for details of where to put this file.

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

--- OpenEnergyMonitor/emonTX/config.ino
+++ OpenEnergyMonitor/emonTX/config.ino
@@ -0,0 +1,124 @@
+// create as a tab in emontx3-30.ino or as config.ino in same folder
+
+#include <EEPROM.h>
+
+byte value;
+
+static void load_config(){
+
+  byte flag=0;
+  // Read nodeID
+  if (EEPROM.read(0) != 255){                                // 255 = EEPROM default (blank) value
+    nodeID = EEPROM.read(0);
+    flag++;
+  }
+  if (EEPROM.read(1) != 255){
+    RF_freq = EEPROM.read(1);
+    flag++;
+  }
+  if (EEPROM.read(2) != 255){
+    networkGroup = EEPROM.read(2);
+    flag++;
+  }
+
+  if (flag > 0){
+    Serial.println("Loaded EEPROM RF config >");
+  }
+  else {
+    Serial.println("No EEPROM config");
+  }
+
+  }
+
+static void config (char c) {
+
+  if ('0' <= c && c <= '9') {
+    value = 10 * value + c - '0';
+    return;
+  }
+
+  if (c > ' ') {
+
+    switch (c) {
+
+      case 'i': //set node ID
+        if (value){
+          nodeID = value;
+        break;
+      }
+
+      case 'b': // set band: 4 = 433, 8 = 868, 9 = 915
+        value = bandToFreq(value);
+        if (value){
+          RF_freq = value;
+        }
+        break;
+
+      case 'g': // set network group
+        if (value>=0){
+          networkGroup = value;
+        }
+        break;
+
+      case 's': // Save to EEPROM. Atemga328p has 1kb  EEPROM
+        save_config();
+        break;
+
+      case 'v': // print firmware version
+        Serial.print(F("[emonTx FW: V")); Serial.print(version*0.1); Serial.print(F("]"));
+        break;
+
+      default:
+        showString(helpText1);
+      } //end case
+
+    //Print Current RF config
+    if (RF_STATUS==1) {
+      Serial.print(F(" "));
+      // Serial.print((char) ('@' + (nodeID & RF12_HDR_MASK)));
+      Serial.print(F(" i"));
+      Serial.print(nodeID & RF12_HDR_MASK);
+      Serial.print(F(" g"));
+      Serial.print(networkGroup);
+      Serial.print(F(" @ "));
+      Serial.print(RF_freq == RF12_433MHZ ? 433 :
+                   RF_freq == RF12_868MHZ ? 868 :
+                   RF_freq == RF12_915MHZ ? 915 : 0);
+      Serial.print(F(" MHz"));
+    }
+
+    Serial.print(F(" USA ")); Serial.print(USA);
+    Serial.println(F(" "));
+
+  } // end c > ' '
+  value = 0;
+
+}
+
+static void save_config(){
+  Serial.println("Saving...");
+  // Clear any old EEPROM settings
+  for (int i = 0 ; i < EEPROM.length() ; i++) {
+    EEPROM.write(i, 0);
+  }
+  //Save new settings
+  EEPROM.write(0, nodeID);
+  EEPROM.write(1, RF_freq);
+  EEPROM.write(2, networkGroup);
+  Serial.println("Done. New config saved to EEPROM");
+}
+
+static byte bandToFreq (byte band) {
+  return band == 4 ? RF12_433MHZ : band == 8 ? RF12_868MHZ : band == 9 ? RF12_915MHZ : 0;
+}
+
+static void showString (PGM_P s) {
+  for (;;) {
+    char c = pgm_read_byte(s++);
+    if (c == 0)
+      break;
+    if (c == '\n')
+      Serial.print('\r');
+    Serial.print(c);
+  }
+}


new (broken) tests

new (broken) tests

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

--- tests/NdefMessageTest/NdefMessageTest.ino
+++ tests/NdefMessageTest/NdefMessageTest.ino
@@ -0,0 +1,167 @@
+#include <Wire.h>
+#include <Adafruit_NFCShield_I2C.h>
+#include <Ndef.h>
+#include <ArduinoUnit.h>
+
+TestSuite suite;
+
+// Custom Assertion
+void assertNoLeak(Test& __test__, void (*callback)())
+{
+  int start = freeMemory();
+  (*callback)();
+  int end = freeMemory();
+  assertEquals(0, (start - end));
+}
+
+void assertBytesEqual(Test& __test__, const uint8_t* expected, const uint8_t* actual, int size) {
+  for (int i = 0; i < size; i++) {
+    Serial.print("> ");Serial.print(expected[i]);Serial.print(" ");Serial.println(actual[i]);
+    assertEquals(expected[i], actual[i]);
+  }
+}
+
+void setup() {
+  Serial.begin(9600);
+  Serial.println("\n");
+  Serial.println(F("========="));
+  Serial.println(freeMemory());
+  Serial.println(F("========="));
+}
+
+test(memoryKludgeEnd)
+{
+  // TODO ensure the output matches start
+  Serial.println(F("========="));
+  Serial.print("End ");Serial.println(freeMemory());
+  Serial.println(F("========="));
+}
+
+test(messageDelete)
+{
+  int start = freeMemory();
+
+  NdefMessage* m1 = new NdefMessage();
+  m1->addTextRecord("Foo");
+  delete m1;
+
+  int end = freeMemory();
+//  Serial.print("Start ");Serial.println(start);
+//  Serial.print("End ");Serial.println(end);
+  assertEquals(0, (start-end));
+}
+
+
+test(assign)
+{
+  int start = freeMemory();
+
+  NdefMessage* m1 = new NdefMessage();
+  m1->addTextRecord("We the People of the United States, in Order to form a more perfect Union...");
+
+  NdefMessage* m2 = new NdefMessage();
+
+  *m2 = *m1;
+
+  NdefRecord r1 = m1->get(0);
+  NdefRecord r2 = m2->get(0);
+
+  assertEquals(r1.getTnf(), r2.getTnf());
+  assertEquals(r1.getTypeLength(), r2.getTypeLength());
+  assertEquals(r1.getPayloadLength(), r2.getPayloadLength());
+  assertEquals(r1.getIdLength(), r2.getIdLength());
+
+  uint8_t* p1 = r1.getPayload();
+  uint8_t* p2 = r2.getPayload();
+  int size = r1.getPayloadLength();
+  assertBytesEqual(__test__, p1, p2, size);
+  free(p1);
+  free(p2);
+
+  delete m2;
+  delete m1;
+
+  int end = freeMemory();
+  assertEquals(0, (start-end));
+}
+
+test(assign2)
+{
+  int start = freeMemory();
+
+  NdefMessage m1 = NdefMessage();
+  m1.addTextRecord("We the People of the United States, in Order to form a more perfect Union...");
+
+  NdefMessage m2 = NdefMessage();
+
+  m2 = m1;
+
+  NdefRecord r1 = m1.get(0);
+  NdefRecord r2 = m2.get(0);
+
+  assertEquals(r1.getTnf(), r2.getTnf());
+  assertEquals(r1.getTypeLength(), r2.getTypeLength());
+  assertEquals(r1.getPayloadLength(), r2.getPayloadLength());
+  assertEquals(r1.getIdLength(), r2.getIdLength());
+
+  // TODO check type
+
+  uint8_t* p1 = r1.getPayload();
+  uint8_t* p2 = r2.getPayload();
+  int size = r1.getPayloadLength();
+  assertBytesEqual(__test__, p1, p2, size);
+  free(p1);
+  free(p2);
+
+  int end = freeMemory();
+  //assertEquals(0, (start-end));
+}
+
+// TODO fix this
+// NdefMessage copy constructor and assignment
+test(assign3)
+{
+  int start = freeMemory();
+
+  NdefMessage* m1 = new NdefMessage();
+  m1->addTextRecord("We the People of the United States, in Order to form a more perfect Union...");
+
+  NdefMessage* m2 = new NdefMessage();
+
+  *m2 = *m1;
+
+  delete m1;
+
+  NdefRecord r2 = m2->get(0);
+
+  assertEquals(TNF_WELL_KNOWN, r2.getTnf());
+  assertEquals(1, r2.getTypeLength());
+  assertEquals(79, r2.getPayloadLength());
+  assertEquals(0, r2.getIdLength());
+
+  String s = "We the People of the United States, in Order to form a more perfect Union...";
+  byte payload[s.length() + 1];
+  s.getBytes(payload, sizeof(payload));
+
+  uint8_t* p2 = r2.getPayload();
+  int size = r2.getPayloadLength();
+  assertBytesEqual(__test__, payload, p2+3, s.length());
+  free(p2);
+
+  delete m2;
+
+  int end = freeMemory();
+  assertEquals(0, (start-end));
+}
+
+
+test(memoryKludgeStart)
+{
+  Serial.println(F("---------"));
+  Serial.print("Start ");Serial.println(freeMemory());
+  Serial.println(F("---------"));
+}
+
+void loop() {
+  suite.run();
+}


new files added

new files added

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

--- device/hcsr04.ino
+++ device/hcsr04.ino
@@ -0,0 +1,205 @@
+/*********************************************************************************
+SMART PARKING LOT SYSTEM
+*********************************************************************************/
+//Reference Value to Get The Status of Parking
+#define g_parked 100
+#define g_fault 4500
+
+//Pin Setting for the 3 Ultrasonic Sensors
+#define g_trigPin 13
+#define g_echoPin 12
+#define g_trigPin2 4
+#define g_echoPin2 5
+#define g_trigPin3 8
+#define g_echoPin3 9
+
+/**************************************************************************************
+Function Name 		:	setup
+Description		    :	Initialize the Sensor Trigger Pin as Output and
+                    echo pin as Input and begin the serial communication
+                    with 9600 BAUD
+Parameters 		    :	void
+Return 			      :	void
+**************************************************************************************/
+//Initialize the Pins and BAUD rate
+void setup(void) {
+        Serial1.begin (9600);
+        Serial.begin(9600);
+        pinMode(g_trigPin, OUTPUT);
+        pinMode(g_echoPin, INPUT);
+        pinMode(g_trigPin2, OUTPUT);
+        pinMode(g_echoPin2, INPUT);
+        pinMode(g_trigPin3, OUTPUT);
+        pinMode(g_echoPin3, INPUT);
+}
+
+/**************************************************************************************
+Function Name 		:	loop
+Description		    :	Generate a Trigger signal and wait for the echo on
+                    HC-SR04 Ultrasonic Sensor and calculate the distance.
+Parameters 		    :	void
+Return 			      :	void
+**************************************************************************************/
+void loop(void) {
+  //Variables to calculate the distance using the duration taken for 1 cycle of trigger and echo
+  long l_duration,l_distance,l_duration2,l_distance2,l_duration3,l_distance3;
+  //Distance form the Ultrasonic Sensor 1
+  //Generate a high pulse on Trigger Pin with 10 micro seconds delay and wait for the echo
+  digitalWrite(g_trigPin, LOW);
+  delayMicroseconds(2);
+  digitalWrite(g_trigPin, HIGH);
+  delayMicroseconds(10);
+  digitalWrite(g_trigPin, LOW);
+  //Once received the Echo calculate the distance from the duration
+  l_duration = pulseIn(g_echoPin, HIGH);
+  l_distance = (l_duration/2) / 29.1;
+  delay(300);
+
+  //Distance form the Ultrasonic Sensor 2
+  digitalWrite(g_trigPin2, LOW);
+  delayMicroseconds(2);
+  digitalWrite(g_trigPin2, HIGH);
+  delayMicroseconds(10);
+  digitalWrite(g_trigPin2, LOW);
+  l_duration2 = pulseIn(g_echoPin2, HIGH);
+  l_distance2 = (l_duration2/2) / 29.1;
+  delay(300);
+
+  //Distance form the Ultrasonic Sensor 3
+  digitalWrite(g_trigPin3, LOW);
+  delayMicroseconds(2);
+  digitalWrite(g_trigPin3, HIGH);
+  delayMicroseconds(10);
+  digitalWrite(g_trigPin3, LOW);
+  l_duration3 = pulseIn(g_echoPin3, HIGH);
+  l_distance3 = (l_duration3/2) / 29.1;
+  delay(300);
+  Serial.println(l_distance);
+  Serial.println(l_distance2);
+  Serial.println(l_distance3);
+  Serial.println("\n\n\n");
+  //Check if the Sensor has any fault
+  /*DATA SENT by UART to RPi is  1,2,3
+		1	-	Parking LOT is Free
+		2	-	Parking LOT is Filled
+		3	-	Fault in the Sensor	*/
+  if(l_distance < g_fault && l_distance2 < g_fault && l_distance3 < g_fault)
+  {
+        if(l_distance <= g_parked && l_distance2 <= g_parked && l_distance3 <= g_parked)
+        {
+                Serial1.write("222");
+        }
+        else if(l_distance <= g_parked && l_distance2 <= g_parked && l_distance3 > g_parked)
+        {
+                Serial1.write("221");
+        }
+        else if(l_distance <= g_parked && l_distance2 > g_parked && l_distance3 <= g_parked)
+        {
+                Serial1.write("212");
+        }
+        else if(l_distance <= g_parked && l_distance2 > g_parked && l_distance3 > g_parked)
+        {
+                Serial1.write("211");
+        }
+        else if(l_distance > g_parked && l_distance2 <= g_parked && l_distance3 <= g_parked)
+        {
+                Serial1.write("122");
+        }
+        else if(l_distance > g_parked && l_distance2 <= g_parked && l_distance3 > g_parked)
+        {
+                Serial1.write("121");
+        }
+        else if(l_distance > g_parked && l_distance2 > g_parked && l_distance3 <= g_parked)
+        {
+                Serial1.write("112");
+        }
+        else if(l_distance > g_parked && l_distance2 > g_parked && l_distance3 > g_parked)
+        {
+                Serial1.write("111");
+        }
+  }
+  else
+  {
+        if(l_distance > g_fault && l_distance2 <= g_parked && l_distance3 <= g_parked)
+        {
+                Serial1.write("322");
+        }
+        else if(l_distance > g_fault && l_distance2 <= g_parked && l_distance3 > g_parked)
+        {
+                Serial1.write("321");
+        }
+        else if(l_distance > g_fault && l_distance2 > g_parked && l_distance3 <= g_parked)
+        {
+                Serial1.write("312");
+        }
+        else if(l_distance > g_fault && l_distance2 > g_parked && l_distance3 > g_parked)
+        {
+                Serial1.write("311");
+        }
+        else if(l_distance <= g_parked && l_distance2 > g_fault && l_distance3 <= g_parked)
+        {
+                Serial1.write("232");
+        }
+        else if(l_distance <= g_parked && l_distance2 > g_fault && l_distance3 > g_parked)
+        {
+                Serial1.write("231");
+        }
+        else if(l_distance > g_parked && l_distance2 > g_fault && l_distance3 <= g_parked)
+        {
+                Serial1.write("132");
+        }
+        else if(l_distance > g_parked && l_distance2 > g_fault && l_distance3 > g_parked)
+        {
+                Serial1.write("131");
+        }
+        else if(l_distance <= g_parked && l_distance2 <= g_parked && l_distance3 > g_fault)
+        {
+                Serial1.write("223");
+        }
+        else if(l_distance <= g_parked && l_distance2 > g_parked && l_distance3 > g_fault)
+        {
+                Serial1.write("213");
+        }
+        else if(l_distance > g_parked && l_distance2 <= g_parked && l_distance3 > g_fault)
+        {
+                Serial1.write("123");
+        }
+        else if(l_distance > g_parked && l_distance2 > g_parked && l_distance3 > g_fault)
+        {
+                Serial1.write("113");
+        }
+        else if(l_distance > g_fault && l_distance2 > g_fault && l_distance3 <= g_parked)
+        {
+                Serial1.write("332");
+        }
+        else if(l_distance > g_fault && l_distance2 > g_fault && l_distance3 > g_parked)
+        {
+                Serial1.write("331");
+        }
+        else if(l_distance <= g_parked && l_distance2 > g_fault && l_distance3 > g_fault)
+        {
+                Serial1.write("233");
+        }
+        else if(l_distance > g_parked && l_distance2 > g_fault && l_distance3 > g_fault)
+        {
+                Serial1.write("133");
+        }
+        else if(l_distance > g_fault && l_distance2 <= g_parked && l_distance3 > g_fault)
+        {
+                Serial1.write("323");
+        }
+        else if(l_distance > g_fault && l_distance2 > g_parked && l_distance3 > g_fault)
+        {
+                Serial1.write("313");
+        }
+        else if(l_distance > g_fault && l_distance2 > g_fault && l_distance3 > g_fault)
+        {
+                Serial1.write("333");
+        }
+  }
+  //Provide a Delay for every 5 Seconds once data sent to the RPi
+  delay(500);
+}
+
+//End of the Program
+/***************************************************************************************************/


application with static RGB Led addressing mode

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


perhaps it just did not move because it accelerated too slow …

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


ok, we theoretically know how to configure the tmc260


Create TX Test.ino

Create TX Test.ino

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


Added scrolling wave demo

Added scrolling wave demo

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/TFTLibraries/TFT.git/'


Putting the Light module up in the main source.

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

--- src/Light/Light.ino
+++ src/Light/Light.ino
@@ -0,0 +1,252 @@
+#include <Adafruit_NeoPixel.h>
+#include <Streaming.h>
+#include <Metro.h>
+
+// RIM of LEDs
+#define RIM_PIN 6 // wire to rim DI pin.  Include a 330 Ohm resistor in series.
+#define RIM_N 85 // best if divisible by 4
+#define RIM_DECAY_RATE -1 // reduce intensity at each update
+#define RIM_UPDATE 1000UL // update the automata on the rim at this interval
+
+// 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 rim = Adafruit_NeoPixel(RIM_N, RIM_PIN, NEO_GRB + NEO_KHZ800);
+
+// define some colors.
+const uint32_t Red = rim.Color(255, 0, 0);
+const uint32_t Grn = rim.Color(0, 255, 0);
+const uint32_t Blu = rim.Color(0, 0, 255);
+const uint32_t Yel = rim.Color(128, 128, 0);
+const uint32_t Dead = rim.Color(0, 0, 0);
+
+// each button press controls a segment of the rim
+uint16_t segLength = floor(RIM_N/4);
+
+// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
+// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
+// and minimize distance between Arduino and first pixel.  Avoid connecting
+// on a live circuit...if you must, connect GND first.
+
+void setup() {
+  Serial.begin(115200);
+
+  randomSeed(analogRead(0));
+
+  rim.begin();
+  rim.show(); // Initialize all pixels to 'off'
+  test(rim); // run through some tests
+}
+
+void loop() {
+  const uint16_t rimSegLength = floor((float)RIM_N / 4);
+
+  // simulate button presses.  replace this with Button library to 4x GPIO pins.
+  static Metro buttonUpdate(10000UL);
+  if ( buttonUpdate.check() ) {
+    uint8_t button = random(0,4); // pick a button
+    switch(button) {
+      case 0: buttonPressToRim(Red, 0, rimSegLength); break;
+      case 2: buttonPressToRim(Blu, segLength, rimSegLength); break;
+      case 3: buttonPressToRim(Yel, segLength*2, rimSegLength); break;
+      case 1: buttonPressToRim(Grn, segLength*3, rimSegLength); break;
+    }
+    rim.show();
+    buttonUpdate.reset();
+  }
+
+  // update the rim
+  static Metro rimUpdate(RIM_UPDATE);
+  if ( rimUpdate.check() ) {
+    updateRule90(rim, RIM_DECAY_RATE);
+    rim.show();
+    rimUpdate.reset();
+  }
+
+}
+
+void buttonPressToRim(const uint32_t color, uint16_t segStart, uint16_t segLength) {
+  // put down the color every other pixel
+  for( uint16_t i=segStart; i<(segStart+segLength-1); i+2 ) {
+    rim.setPixelColor(i, color);
+  }
+  // interlace Dead
+  for( uint16_t i=segStart+1; i<(segStart+segLength-1); i+2 ) {
+    rim.setPixelColor(i, Dead);
+  }
+}
+
+// adjust color with a decrement
+uint32_t adjustColor(uint32_t c, uint8_t adj) {
+  uint8_t red = constrain(((c << 8 ) >> 24) + adj, 0, 255);
+  uint8_t grn = constrain(((c << 16) >> 24) + adj, 0, 255);
+  uint8_t blu = constrain(((c << 24) >> 24) + adj, 0, 255);
+
+  return( rim.Color(red, grn, blu) );
+}
+
+// merge colors with some kind of XOR
+uint32_t mergeColor(uint32_t c1, uint32_t c2) {
+  // use bitwise operations to get at packed color vector contents
+  const uint8_t bitIndex[3] = {8, 16, 24};
+  // store the color vector result
+  uint8_t cv[3];
+
+  // for each color
+  for( uint8_t i=0; i<3; i++ ) {
+    // extract the color elements.
+    uint8_t chanc1 = (c1 << bitIndex[i] ) >> 24;
+    uint8_t chanc2 = (c2 << bitIndex[i] ) >> 24;
+
+    // xor by color channel
+    if( chanc1>0 && chanc2>0 ) {
+      // alive in both cells, so drop this channel.
+      cv[i]=0;
+    } else {
+      // dead in one, so sum them.
+      cv[i]=chanc1 + chanc2;
+    }
+  }
+  return( rim.Color(cv[0], cv[1], cv[2]) );
+}
+
+// updates the automata using a modified Rule 90
+void updateRule90(Adafruit_NeoPixel &strip, uint8_t decay) {
+  // intialize first cell
+  uint32_t cs = strip.getPixelColor(0);
+  uint32_t ps = strip.getPixelColor(strip.numPixels() - 1);
+  uint32_t ns;
+
+  // loop to update
+  for (uint16_t i = 0; i < strip.numPixels(); i++) {
+    // get next state
+    if (i < strip.numPixels() - 1) {
+      ns = strip.getPixelColor(i + 1);
+    }
+    else { // wrapping back around
+      ns = strip.getPixelColor(0);
+    }
+
+    // apply Rule 90
+    if( ps == Dead ) {
+      cs = adjustColor(ns, decay);
+    } else if( ns == Dead ) {
+      cs = adjustColor(ps, decay);
+    } else {
+      cs = mergeColor(ps, ns);
+    }
+
+    // set the pixel
+    strip.setPixelColor(i, cs);
+
+    // next iteration setting
+    ps = cs;
+    cs = ns;
+  }
+}
+
+void test(Adafruit_NeoPixel &strip) {
+  // Some example procedures showing how to display to the pixels:
+  colorWipe(strip, strip.Color(255, 0, 0), 50); // Red
+  colorWipe(strip, strip.Color(0, 255, 0), 50); // Green
+  colorWipe(strip, strip.Color(0, 0, 255), 50); // Blue
+
+  // Send a theater pixel chase in...
+  theaterChase(strip, strip.Color(127, 127, 127), 50); // White
+  theaterChase(strip, strip.Color(127,   0,   0), 50); // Red
+  theaterChase(strip, strip.Color(  0,   0, 127), 50); // Blue
+
+  rainbow(strip, 20);
+  rainbowCycle(strip, 20);
+  theaterChaseRainbow(strip, 50);
+}
+
+// Fill the dots one after the other with a color
+void colorWipe(Adafruit_NeoPixel &strip, uint32_t c, uint8_t wait) {
+  for (uint16_t i = 0; i < strip.numPixels(); i++) {
+    strip.setPixelColor(i, c);
+    strip.show();
+    delay(wait);
+  }
+}
+
+void rainbow(Adafruit_NeoPixel &strip, uint8_t wait) {
+  uint16_t i, j;
+
+  for (j = 0; j < 256; j++) {
+    for (i = 0; i < strip.numPixels(); i++) {
+      strip.setPixelColor(i, Wheel(strip, (i + j) & 255));
+    }
+    strip.show();
+    delay(wait);
+  }
+}
+
+// Slightly different, this makes the rainbow equally distributed throughout
+void rainbowCycle(Adafruit_NeoPixel &strip, uint8_t wait) {
+  uint16_t i, j;
+
+  for (j = 0; j < 256 * 5; j++) { // 5 cycles of all colors on wheel
+    for (i = 0; i < strip.numPixels(); i++) {
+      strip.setPixelColor(i, Wheel(strip, ((i * 256 / strip.numPixels()) + j) & 255));
+    }
+    strip.show();
+    delay(wait);
+  }
+}
+
+//Theatre-style crawling lights.
+void theaterChase(Adafruit_NeoPixel &strip, uint32_t c, uint8_t wait) {
+  for (int j = 0; j < 10; j++) { //do 10 cycles of chasing
+    for (int q = 0; q < 3; q++) {
+      for (int i = 0; i < strip.numPixels(); i = i + 3) {
+        strip.setPixelColor(i + q, c);  //turn every third pixel on
+      }
+      strip.show();
+
+      delay(wait);
+
+      for (int i = 0; i < strip.numPixels(); i = i + 3) {
+        strip.setPixelColor(i + q, 0);      //turn every third pixel off
+      }
+    }
+  }
+}
+
+//Theatre-style crawling lights with rainbow effect
+void theaterChaseRainbow(Adafruit_NeoPixel &strip, uint8_t wait) {
+  for (int j = 0; j < 256; j++) {   // cycle all 256 colors in the wheel
+    for (int q = 0; q < 3; q++) {
+      for (int i = 0; i < strip.numPixels(); i = i + 3) {
+        strip.setPixelColor(i + q, Wheel(strip, (i + j) % 255)); //turn every third pixel on
+      }
+      strip.show();
+
+      delay(wait);
+
+      for (int i = 0; i < strip.numPixels(); i = i + 3) {
+        strip.setPixelColor(i + q, 0);      //turn every third pixel off
+      }
+    }
+  }
+}
+
+// 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(Adafruit_NeoPixel &strip, byte WheelPos) {
+  WheelPos = 255 - WheelPos;
+  if (WheelPos < 85) {
+    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
+  } else if (WheelPos < 170) {
+    WheelPos -= 85;
+    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
+  } else {
+    WheelPos -= 170;
+    return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
+  }
+}
+


added an example project for sample usage with the OPT3001 als sensor.

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

--- examples/OPT3001_w_SWire/OPT3001_w_SWire.ino
+++ examples/OPT3001_w_SWire/OPT3001_w_SWire.ino
@@ -0,0 +1,31 @@
+//Example to show SWire usage with the OPT3001 ALS
+#include <SWire.h>
+
+void setup() {
+  Serial.begin(115200);
+  //Setup my sensor
+  SWire.begin(4, 5); // Use Pin 4 for SDA & Pin 5 for SCL
+  SWire.beginTransmission(0x45);
+  SWire.write(0x01);
+  SWire.write(0xC6);
+  SWire.write(0x10);
+  Serial.println(SWire.endTransmission());
+}
+
+void loop() {
+  //Read Sensor results
+  uint16_t result = 0;
+  SWire.beginTransmission(0x45);
+  SWire.write(0x00);
+  int error = SWire.endTransmission(false);
+  if (error == 0) {
+    SWire.requestFrom(0x45, 2);
+    Serial.println(SWire.available());
+    result = (uint16_t)SWire.read() << 8;
+    result |= (uint16_t)SWire.read();
+    uint16_t exponent = result >> 12;
+    uint16_t fractionalResult = result & (uint16_t)0x0FFF;
+    Serial.println(0.01*pow(2, exponent)*fractionalResult);
+  }
+  delay(100);
+}