Create Harp_firmware.ino

Create Harp_firmware.ino

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

--- Harp_firmware.ino
+++ Harp_firmware.ino
@@ -0,0 +1,79 @@
+//První oktáva
+int laser1 = 26;
+int laser2 = 27;
+int laser3 = 28;
+int laser4 = 29;
+int laser5 = 30;
+int laser6 = 31;
+int laser7 = 32;
+int laser8 = 33;
+int oktava1[8] = {laser1, laser2, laser3, laser4, laser5, laser6, laser7, laser8};
+
+//Druhá oktáva
+int laser9 = 34;
+int laser10 = 35;
+int laser11 = 36;
+int laser12 = 37;
+int laser13 = 38;
+int laser14 = 39;
+int laser15 = 40;
+int laser16 = 41;
+int oktava2[8] = (laser9, laser10, laser11, laser12, laser13, laser14, laser15, laser16);
+
+//druhá oktáva
+int laser9 = 34;
+int laser10 = 35;
+int laser11 = 36;
+int laser12 = 37;
+int laser13 = 38;
+int laser14 = 39;
+int laser15 = 40;
+int laser16 = 41;
+int oktava2[8] = {laser9, laser10, laser11, laser12, laser13, laser14, laser15, laser16};
+
+//Třetí oktáva
+int laser17 = 42;
+int laser18 = 43;
+int laser19 = 44;
+int laser20 = 45;
+int laser21 = 46;
+int laser22 = 47;
+int laser23 = 48;
+int laser24 = 49;
+int oktava3[8] = {laser17, laser18, laser19, laser20, laser21, laser22, laser23, laser24};
+
+
+void setup() {
+  Serial.begin(9600);
+  pinMode(laser1, OUTPUT);
+  pinMode(laser2, OUTPUT);
+  pinMode(laser3, OUTPUT);
+  pinMode(laser4, OUTPUT);
+  pinMode(laser5, OUTPUT);
+  pinMode(laser6, OUTPUT);
+  pinMode(laser7, OUTPUT);
+  pinMode(laser8, OUTPUT);
+
+  pinMode(laser9, OUTPUT);
+  pinMode(laser10, OUTPUT);
+  pinMode(laser11, OUTPUT);
+  pinMode(laser12, OUTPUT);
+  pinMode(laser13, OUTPUT);
+  pinMode(laser14, OUTPUT);
+  pinMode(laser15, OUTPUT);
+  pinMode(laser1, OUTPUT);
+
+  pinMode(laser17, OUTPUT);
+  pinMode(laser18, OUTPUT);
+  pinMode(laser19, OUTPUT);
+  pinMode(laser20, OUTPUT);
+  pinMode(laser21, OUTPUT);
+  pinMode(laser22, OUTPUT);
+  pinMode(laser23, OUTPUT);
+
+
+}
+
+void loop() {
+
+}


version which send sms with gps position

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

--- SIM808_GetGPS_test.ino
+++ SIM808_GetGPS_test.ino
@@ -0,0 +1,147 @@
+/*
+### Get GPS data
+1. This example is used to test SIM808 GPS/GPRS/GSM Shield's reading GPS data.
+2. Open the SIM808_GetGPS example or copy these code to your project
+3. Download and dial the function switch to Arduino
+4. open serial helper
+4. Place it outside, waiting for a few minutes and then it will send GPS data to serial
+
+create on 2016/09/23, version: 1.0
+by jason
+
+*/
+#include <DFRobot_sim808.h>
+#include <sim808.h>
+#include <SoftwareSerial.h>
+#include <SimpleTimer.h>
+
+//#define PIN_TX    10
+//#define PIN_RX    11
+//SoftwareSerial mySerial(PIN_TX,PIN_RX);
+//DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,
+
+#define rxPin 2
+#define txPin 3
+SoftwareSerial GPRS(rxPin, txPin); // RX, TX
+DFRobot_SIM808 sim808(&GPRS);
+
+int Powerkey=6;                 //Power pin for SIM808
+SimpleTimer timer;
+
+void setup() {
+  GPRS.begin(9600);
+  Serial.begin(9600);
+
+  GPRS.println("AT+CPOWD=1");
+  delay(5000);
+  pinMode(Powerkey, OUTPUT);   // initialize the digital pin as an output.
+  power();                     // power on the sim808 or power down the sim808
+
+  Serial.println("reseting");
+  delay(10000);
+
+    //GNSS power control
+  GPRS.println("AT+CGNSPWR=1");
+  delay(290);
+  //GNSS navitation, GEO-Fence and speed alarm URC report control
+  GPRS.println("AT+CGNSURC=0");
+  delay(300);
+
+
+
+
+  //******** Initialize sim808 module *************
+  while(!sim808.init()) {
+      delay(1000);
+      Serial.print("Sim808 init error\r\n");
+  }
+
+  //sim808_init(&GPRS,9600);
+
+  if( sim808.attachGPS())
+      Serial.println("Open the GPS power success");
+  else
+      Serial.println("Open the GPS power failure");
+
+
+  delay(5000);
+  if(!sim808_check_with_cmd("AT+CGPSINF=2\r\n","OK\r\n",CMD)){
+    Serial.println("AT+CGPSINF => FAIL");
+  }else Serial.println("AT+CGPSINF => OK");
+  //************* Turn on the GPS power************
+
+
+
+  GPRS.println("AT+CGPSRST=1");  //1 = HOT start of GPS or COLD start = 0
+  //SerialSim808_Read();
+  delay(50);
+
+  timer.setInterval(60000, GetGPSLocation);
+}
+
+void loop() {
+   timer.run();
+   /*if(GPRS.available())
+      Serial.write(GPRS.read());
+   if(Serial.available())
+      GPRS.write(Serial.read());
+   */
+}
+
+/****************************************************************************************
+ * power()
+ * Function power on or power of SIM808.
+ ****************************************************************************************/
+void power(void)
+{
+  digitalWrite(Powerkey, LOW);
+  delay(1000);               // wait for 1 second
+  digitalWrite(Powerkey, HIGH);
+}
+
+void GetGPSLocation(){
+     //************** Get GPS data *******************
+  if( sim808.attachGPS())
+      Serial.println("Open the GPS power success");
+  else
+      Serial.println("Open the GPS power failure");
+
+   delay(20000);
+
+   sim808_flush_serial();
+   //GPRS.println("AT+CGPSINF=2");
+   if(!sim808_check_with_cmd("AT+CGPSINF=2\r\n","OK\r\n",CMD)){
+     Serial.println("AT+CGPSINF => FAIL");
+   }else Serial.println("AT+CGPSINF => OK");
+
+   if (sim808.getGPS()) {
+    Serial.print(sim808.GPSdata.year);
+    Serial.print("/");
+    Serial.print(sim808.GPSdata.month);
+    Serial.print("/");
+    Serial.print(sim808.GPSdata.day);
+    Serial.print(" ");
+    Serial.print(sim808.GPSdata.hour);
+    Serial.print(":");
+    Serial.print(sim808.GPSdata.minute);
+    Serial.print(":");
+    Serial.print(sim808.GPSdata.second);
+    Serial.print(":");
+    Serial.println(sim808.GPSdata.centisecond);
+    Serial.print("latitude :");
+    Serial.println(sim808.GPSdata.lat);
+    Serial.print("longitude :");
+    Serial.println(sim808.GPSdata.lon);
+    Serial.print("speed_kph :");
+    Serial.println(sim808.GPSdata.speed_kph);
+    Serial.print("heading :");
+    Serial.println(sim808.GPSdata.heading);
+    Serial.println();
+
+    //************* Turn off the GPS power ************
+
+  }
+  else Serial.print(".");
+  sim808.detachGPS();
+}
+


Initial code commit

Initial code commit

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

--- src/teensy_sketch.ino
+++ src/teensy_sketch.ino
@@ -0,0 +1,80 @@
+/*
+  Metis-2 launch onboard sketch
+  This sketch contains logic to read sensor values via I2C and SPI and dump data to an SD card
+  for further analysis on landing. It also communicates basic data over the 433MHz radio band,
+  as well as 2.4GHz WiFi
+  This sketch is written for use on a Teensy 3.1/3.2
+  The circuit:
+  * Components supplying input:
+    - 9-Axis motion sensor MPU9250 Shield
+      * Connected to the SMT pads on the underside of the Teensy
+    - L3G4200D Gyro breakout
+      * SCL - pin 14
+      * SDA - pin 7
+      * SDO - pin 8
+      * CS  - as defined in gyroChipSelect field
+      * INT1 - pin 2
+      * INT2 - pin 3
+      * Other pins connected to independent power supplies
+  * Components Outputted to:
+    - ESP8266-01 WiFi Module
+      * TXD - pin 9
+      * RXD - pin 10
+    - BOB-00544 microSD card SPI breakout
+      * MOSI   - pin 11
+      * MISO   - pin 12
+      * CLK    - pin 13
+      * CS     - as defined in sdChipSelect field
+    - RFM22B-S2 434MHz radio tranciever
+      * SDI    - pin 11
+      * SDO    - pin 12
+      * CLK    - pin 13
+      * CS     - as defined in radioChipSelect field
+    - Piezo buzzer
+      * +ve - pin 16
+
+  Created 28 August 2016
+  By Jamie Sanson
+
+  Modified 28 August 2016
+  By Jamie Sanson
+
+*/
+
+// region includes
+#include <i2c_t3.h>
+#include <SD.h>
+#include <SPI.h>
+// end region
+
+// region macro definitions
+#define espSerial Serial2
+// end region
+
+// region pin definitions
+int8_t gyroChipSelect = 4;
+int8_t radioChipSelect = 5;
+int8_t radioIntPin = 15;
+int8_t sdChipSelect = 6;
+// end region
+
+// region flags
+boolean serialDebugMode = true;
+// end region
+
+void setup() {
+  if (serialDebugMode) {
+    // block until serial sent to micro
+    Serial.begin(115200);
+
+    while(!Serial.available()){}
+  }
+
+  // TODO: Sensor setup, SD setup, ESP handshaking and blocking to wait on commands
+}
+
+void loop() {
+  // TODO: Read sensors, detect apogee, send radio, activate buzzer
+}
+
+


add Gemtek Lora verify sample

add Gemtek Lora verify sample

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

--- Device_Ameba/Example/GemtekLoRa/GemtekLoRa.ino
+++ Device_Ameba/Example/GemtekLoRa/GemtekLoRa.ino
@@ -0,0 +1,31 @@
+#include <SoftwareSerial.h>
+#define BUFF_LENGTH 30
+
+SoftwareSerial lora(0, 1); // RX, TX
+
+char readBuffer[BUFF_LENGTH];
+char input;
+void setup() {
+  // put your setup code here, to run once:
+  Serial.begin(38400);
+  lora.begin(9600); // lora
+}
+
+void loop() {
+  int wordCount = 0;
+  // put your main code here, to run repeatedly:
+  Serial.println("Ready for some LoRa?");
+  lora.println("AT");
+  for(wordCount = 0;lora.available() > 0;wordCount++){
+    input = lora.read();
+    readBuffer[wordCount] = input;
+  }
+  if(readBuffer[0] == 'O' && readBuffer[1] == 'K'){
+    Serial.println("Yes, let's push some data!");
+  }
+  else{
+    Serial.println("No, LoRa is not ready.");
+  }
+  memset(readBuffer, 0, sizeof(readBuffer));
+  delay(5000);
+}


Initial commit

Initial commit

--- Bike/Bike.ino
+++ Bike/Bike.ino
@@ -0,0 +1,371 @@
+
+/*
+ * Bike
+ *
+ *  https://github.com/reefab/CyclingPusher
+ *
+ *  CyclingPusher is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  CyclingPusher is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *  You should have received a copy of the GNU General Public License
+ *  along with CyclingPusher.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *  Created on: 25.02.2012
+ *      Author: reefab
+ */
+
+#include <LiquidCrystal.h>
+#include <SPI.h>
+#include <Ethernet.h>
+#include <EthernetUdp.h>
+#include <Time.h>
+#include <HTTPClient.h>
+// MAC address
+static uint8_t mac[6] = {
+  0x90, 0xA2, 0xDA, 0x05, 0x00, 0x43 };
+// For NTP init
+unsigned int localPort = 8888;      // local port to listen for UDP packets
+IPAddress timeServer(192, 43, 244, 18); // time.nist.gov NTP server
+const int NTP_PACKET_SIZE= 48; // NTP time stamp is in the first 48 bytes of the message
+byte packetBuffer[ NTP_PACKET_SIZE]; //buffer to hold incoming and outgoing packets
+
+// A UDP instance to let us send and receive packets over UDP
+EthernetUDP Udp;
+EthernetClient client;
+
+// initialize the library with the numbers of the interface pins
+LiquidCrystal lcd(7, 6, 5, 4, 9, 8);
+// This needs to be pin 2 to use interrupt 0
+int reedPin = 2;
+int buttonPin = 3;
+unsigned int rotationCount = 0;
+unsigned int updateCount = 0;
+// Distance per 'wheel' turn
+float meterPerTurn = 6.66;
+// Number of 'wheel' turns needed to recalculate speed/total distance
+int interval = 5;
+// Minimal number of millisecond between reed switch changes to prevent bounce
+int reedRes = 50;
+// Timeout in seconds, if the reed switch is not activated during this time, pause everything
+int timeOut = 15;
+// Distance in meters
+unsigned int totalDistance = 0;
+float currentSpeed = 0;
+boolean screen = true;
+boolean done = false;
+unsigned long lastReedPress = millis();
+unsigned long lastButtonPress = millis();
+unsigned long lastUpdate = millis();
+unsigned long currentTime = millis();
+unsigned long startTime = millis();
+unsigned long totalTime = 0;
+unsigned long time_elasped = 0;
+unsigned long timestamp = 0;
+unsigned long effectiveTime = 0;
+//unsigned long lastTimeUpdate = 0;
+// For display during init and sending to HealthGraph
+String startTimeStr;
+byte serverIp[] = {
+  74,50,63,142};
+char apiServer[] = "api.runkeeper.com";
+char apiUri[] = "/fitnessActivities";
+char accessToken[] = "Bearer XXX";
+String json_start = "{\"type\": \"Cycling\",\"start_time\": \"";
+String json_middle_1 = "\",\"notes\": \"Arduino powered stationary bike\",\"total_distance\": ";
+String json_middle_2 = ",\"duration\": ";
+String json_end = "}";
+boolean lastConnected = false;
+
+
+void setup() {
+  pinMode(reedPin, INPUT);
+  pinMode(buttonPin, INPUT);
+  // set up the LCD's number of columns and rows:
+  lcd.begin(16, 2);
+
+  // Reed switch handling by interrupt
+  attachInterrupt(0, turnCounter, FALLING);
+
+  attachInterrupt(1, changeScreen, FALLING);
+  Serial.begin(9600);
+
+  // start Ethernet and UDP
+  if (Ethernet.begin(mac) == 0) {
+    lcd.print("Failed to configure");
+    lcd.setCursor(0, 1);
+    lcd.print("Ethernet using DHCP");
+    delay(5000);
+  }
+  else {
+    Udp.begin(localPort);
+    timestamp = getTimeStamp();
+    setTime(timestamp);
+    startTimeStr = getTimeString();
+    displayInitScreen();
+  }
+
+  lcd.clear();
+}
+
+void loop() {
+  // Activity finished & api push
+  if (done == true && !client.connected()) {
+    delay(1000);
+    lcd.clear();
+    String data = json_start;
+    data += startTimeStr;
+    data += json_middle_1;
+    data += totalDistance;
+    data += json_middle_2;
+    data += (int) (effectiveTime / 1000);
+    data += json_end;
+    unsigned int bufSize = data.length() +1;
+    char apiData[bufSize];
+    data.toCharArray(apiData, bufSize);
+
+    HTTPClient client(apiServer, serverIp);
+    http_client_parameter apiHeaders[] = {
+      {
+        "Authorization", accessToken      }
+      ,
+      {
+        "Content-Type", "application/vnd.com.runkeeper.NewFitnessActivity+json"      }
+      ,
+      {
+        NULL, NULL      }
+    };
+    lcd.print("Uploading result");
+    delay(500);
+    FILE* result = client.postURI(apiUri, NULL, apiData, apiHeaders);
+    int returnCode = client.getLastReturnCode();
+    lcd.clear();
+    if (result!=NULL) {
+      client.closeStream(result);  // this is very important -- be sure to close the STREAM
+    }
+    else {
+      lcd.print("failed to connect");
+    }
+    if (returnCode==201) {
+      lcd.print("Data uploaded");
+      lcd.setCursor(0, 1);
+      lcd.print("Session Created");
+      // Hang on success
+      for(;;);
+    }
+    else {
+      lcd.print("ERROR: Server returned ");
+      lcd.setCursor(0, 1);
+      lcd.print(returnCode);
+    }
+    // Hang if finished
+    if (lastConnected) for(;;);
+  }
+  else {
+    // Activity in progres
+    unsigned long enterLoop = millis();
+    // Update turns and distance
+    int nbRotation = rotationCount - updateCount;
+    if (nbRotation >= interval)
+    {
+      currentTime = millis();
+      time_elasped = currentTime - lastUpdate;
+      float distance = nbRotation * meterPerTurn;
+      currentSpeed = ((float) distance / (float) time_elasped) * 3600;
+      totalDistance = rotationCount * meterPerTurn;
+      updateCount = rotationCount;
+      lastUpdate = currentTime;
+    }
+    // Update time
+    if(millis() - lastReedPress < (1000 * timeOut))
+    {
+      // Display
+      lcd.setCursor(0,0);
+      if (screen == true) {
+        displayCurrentScreen();
+      }
+      else {
+        displayGlobalScreen();
+      }
+      delay(500);
+      unsigned long exitLoop = millis();
+      effectiveTime = effectiveTime + (exitLoop - enterLoop);
+      // Automatic activity pause
+    }
+    else {
+      // Deactivate the "Change Screen Button"
+      detachInterrupt(1);
+      // Activate the finish function instead at button press
+      attachInterrupt(1, finishActivity, FALLING);
+      displayPauseScreen();
+      detachInterrupt(1);
+      attachInterrupt(1, changeScreen, FALLING);
+    }
+  }
+  lastConnected = client.connected();
+}
+
+void turnCounter() {
+  if (millis() - lastReedPress > reedRes)
+  {
+    rotationCount++;
+  }
+  lastReedPress = millis();
+}
+
+void changeScreen() {
+  if (millis() - lastButtonPress > 200)
+  {
+    screen = !screen;
+    lcd.clear();
+  }
+  lastButtonPress = millis();
+}
+
+float getAverageSpeed() {
+  totalTime = getTotalTime();
+  return ((float) totalDistance / (float) totalTime) * 3600;
+}
+
+unsigned long getTotalTime() {
+  return effectiveTime;
+}
+
+void displayCurrentScreen() {
+  lcd.print("Speed: ");
+  lcd.print(currentSpeed);
+  lcd.print("km/h");
+  lcd.setCursor(0, 1);
+  lcd.print("Distance: ");
+  if (totalDistance < 1000) {
+    lcd.print(totalDistance);
+    lcd.print("m");
+  }
+  else {
+    lcd.print((float) totalDistance / 1000);
+    lcd.print("km");
+  }
+}
+
+void displayGlobalScreen() {
+  // FIXME: minutes display > 60
+  lcd.print("Avg: ");
+  lcd.print(getAverageSpeed());
+  lcd.print("km/h");
+  lcd.setCursor(0, 1);
+  totalTime = getTotalTime();
+  int hours = totalTime / 3600000;
+  int minutes = totalTime / 60000;
+  long seconds = (totalTime % 60000);
+  seconds = (long) seconds / 1000;
+  String time = "Time: "
+    + String(hours)
+    + prettyDigits(minutes)
+      + prettyDigits(seconds);
+  lcd.print(time);
+}
+
+// send an NTP request to the time server at the given address
+unsigned long sendNTPpacket(IPAddress& address)
+{
+  // set all bytes in the buffer to 0
+  memset(packetBuffer, 0, NTP_PACKET_SIZE);
+  // Initialize values needed to form NTP request
+  // (see URL above for details on the packets)
+  packetBuffer[0] = 0b11100011;   // LI, Version, Mode
+  packetBuffer[1] = 0;     // Stratum, or type of clock
+  packetBuffer[2] = 6;     // Polling Interval
+  packetBuffer[3] = 0xEC;  // Peer Clock Precision
+  // 8 bytes of zero for Root Delay & Root Dispersion
+  packetBuffer[12]  = 49;
+  packetBuffer[13]  = 0x4E;
+  packetBuffer[14]  = 49;
+  packetBuffer[15]  = 52;
+
+  // all NTP fields have been given values, now
+  // you can send a packet requesting a timestamp:
+  Udp.beginPacket(address, 123); //NTP requests are to port 123
+  Udp.write(packetBuffer,NTP_PACKET_SIZE);
+  Udp.endPacket();
+}
+
+unsigned long getTimeStamp() {
+  sendNTPpacket(timeServer); // send an NTP packet to a time server
+  // wait to see if a reply is available
+  delay(1000);
+  if ( Udp.parsePacket() ) {
+    // We've received a packet, read the data from it
+    Udp.read(packetBuffer,NTP_PACKET_SIZE);  // read the packet into the buffer
+    //the timestamp starts at byte 40 of the received packet and is four bytes,
+    // or two words, long. First, esxtract the two words:
+    unsigned long highWord = word(packetBuffer[40], packetBuffer[41]);
+    unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]);
+    // combine the four bytes (two words) into a long integer
+    // this is NTP time (seconds since Jan 1 1900):
+    unsigned long secsSince1900 = highWord << 16 | lowWord;
+    // now convert NTP time into Unix timestamp:
+    const unsigned long seventyYears = 2208988800UL;
+    unsigned long epoch = secsSince1900 - seventyYears;
+    return epoch;
+  }
+}
+
+String prettyDigits(int digits){
+  // utility function for digital clock display: prints preceding colon and leading 0
+  String output = ":";
+  if(digits < 10)
+    output += '0';
+  output += digits;
+  return output;
+}
+
+String getTimeString() {
+  String str_time;
+  str_time += String(dayShortStr(weekday())) + ", "
+    + String(day()) + " "
+    + String(monthShortStr(month())) + " "
+    + String(year())
+    + " "
+      + String(hour())
+      + prettyDigits(minute())
+        + prettyDigits(second());
+  return str_time;
+}
+
+void displayPauseScreen() {
+  lcd.clear();
+  lcd.print("Activity paused.");
+  delay(1000);
+  lcd.clear();
+  lcd.print("Press button ");
+  lcd.setCursor(0, 1);
+  lcd.print("to finish");
+  delay(1000);
+}
+
+void displayInitScreen() {
+  lcd.print("IP: ");
+  lcd.print(Ethernet.localIP());
+  lcd.setCursor(0, 1);
+  for (int i = 0;i < 16;i++) lcd.print(startTimeStr.charAt(i));
+  delay(2500);
+  lcd.setCursor(0, 1);
+  for (int i = 1;i < 32;i++) lcd.print(" ");
+  lcd.setCursor(0, 1);
+  for (int i = 16;i < startTimeStr.length();i++) lcd.print(startTimeStr.charAt(i));
+  delay(2500);
+}
+
+void finishActivity() {
+  lcd.clear();
+  lcd.print("Activity");
+  lcd.setCursor(0, 1);
+  lcd.print("finished");
+  done = true;
+}
+


was still wrong

was still wrong

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


Create bulldozer_8275.ino

Create bulldozer_8275.ino

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

--- examples/bulldozer_8275/bulldozer_8275.ino
+++ examples/bulldozer_8275/bulldozer_8275.ino
@@ -0,0 +1,47 @@
+/*
+  buldozer_8275.ino
+  example for the 8275 bulldozer
+    Not modified by Mateusz Jaros / The JarOS.
+
+    04.06.2015
+*/
+#include <legopowerfunctions.h>
+
+// IR led on port 13
+LEGOPowerFunctions lego(13);
+
+int timeout, count;
+
+void setup()
+{
+}
+
+void loop()
+{
+  timeout = 5; // 5 secs
+  count = 0;
+  while(timeout > 0)
+  {
+    lego.ComboPWM(PWM_REV4, PWM_FWD4, CH1); // 50% speed
+    delay(100);
+    if (count++ == 10)
+    {
+      timeout--;
+      count = 0;
+    }
+  }
+  lego.ComboPWM(PWM_FLT, PWM_FLT, CH1); // stop
+  delay(1000);
+  timeout = 3; // 5 secs
+  count = 0;
+  while(timeout > 0)
+  {
+    lego.ComboMode(RED_FWD, BLUE_FWD, CH1);  // turn
+    delay(100);
+    if (count++ == 10)
+    {
+      timeout--;
+      count = 0;
+    }
+  }
+}


Create spark-as-client.ino

Create spark-as-client.ino

error: pathspec 'spark-as-client/spark-as-client.ino' did not match any file(s) known to git

--- spark-as-client/spark-as-client.ino
+++ spark-as-client/spark-as-client.ino
@@ -0,0 +1,41 @@
+TCPClient client;
+byte server[] = { 74, 125, 224, 72 }; // Google
+void setup()
+{
+  // Make sure your Serial Terminal app is closed before powering your Core
+  Serial.begin(9600);
+  // Now open your Serial Terminal, and hit any key to continue!
+  while(!Serial.available()) SPARK_WLAN_Loop();
+
+  Serial.println("connecting...");
+
+  if (client.connect(server, 80))
+  {
+    Serial.println("connected");
+    client.println("GET /search?q=unicorn HTTP/1.0");
+    client.println("Host: www.google.com");
+    client.println("Content-Length: 0");
+    client.println();
+  }
+  else
+  {
+    Serial.println("connection failed");
+  }
+}
+
+void loop()
+{
+  if (client.available())
+  {
+    char c = client.read();
+    Serial.print(c);
+  }
+
+  if (!client.connected())
+  {
+    Serial.println();
+    Serial.println("disconnecting.");
+    client.stop();
+    for(;;);
+  }
+}


PID speed test

PID speed test

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

--- PID_test/PID_test.ino
+++ PID_test/PID_test.ino
@@ -0,0 +1,113 @@
+#include <ESP8266WiFi.h>
+extern "C" {
+#include "user_interface.h"
+}
+
+int lpwm=0;
+int rpwm=0;
+int len=300;    // period in ms
+int lmc=0;      // left motor counter
+int rmc=0;
+int lmc0=0;     // last encoder value
+int rmc0=0;
+int ldir=1;     // left motor direction
+int rdir=1;
+int lv=0;       // left motor actual speed
+int rv=0;       // measured in n tics/timer period
+int ltp=0;      // left motor target position
+float av, th;   // average & angular velocity
+int ti=0;
+
+
+os_timer_t myTimer;
+
+// start of timerCallback
+void tic(void *pArg) {
+  lv=lmc-lmc0;            // lv left instant velocity
+  lmc0=lmc;
+  rv=rmc-rmc0;            // rv right install velocity
+  rmc0=rmc;
+  th=rv-lv;               // angular speed coef. (*pi()/rstep(180))
+  av=(lv+rv)/2.;          // center forward velocity
+  ti+=1;                  // tic counter
+}
+
+void stop(void){      // Stop both motors
+    analogWrite(D1, 0);
+    analogWrite(D2, 0);
+}
+
+void motion(int lpwm, int rpwm, int llevel, int rlevel) {
+    if (llevel==HIGH) {
+      ldir=1;
+    } else {
+      ldir=-1;
+    }
+    if (rlevel==HIGH) {
+      rdir=1;
+    } else {
+      rdir=-1;
+    }
+    analogWrite(D1, lpwm);
+    analogWrite(D2, rpwm);
+    digitalWrite(D3, llevel);
+    digitalWrite(D4, rlevel);
+}
+void lencode() {          // GPIO ISR Interrupt service routines for encoder changes
+  lmc=lmc+ldir;
+}
+void rencode(){
+  rmc=rmc+rdir;
+}
+
+
+void setup() {
+  pinMode(D1, OUTPUT); // 1,2EN aka D1 pwm left
+  pinMode(D2, OUTPUT); // 3,4EN aka D2 pwm right
+  pinMode(D3, OUTPUT); // 1A,2A aka D3
+  pinMode(D4, OUTPUT); // 3A,4A aka D4
+  pinMode(D5, INPUT); //  Left encoder
+  pinMode(D6, INPUT); //  Right encoder
+  attachInterrupt(D5, lencode, RISING); // Setup Interrupt
+  attachInterrupt(D6, rencode, RISING); // Setup Interrupt
+  sei();                                // Enable interrupts
+  int currentTime = millis();
+  int cloopTime = currentTime;
+
+  os_timer_setfn(&myTimer, tic, NULL);
+  os_timer_arm(&myTimer, 500, true);   // timer in ms
+
+  Serial.begin(115200);
+  Serial.println("Ready");
+}
+
+void loop(){
+  //waiting for input
+  if (Serial.available() != 0) {
+    lpwm = Serial.parseInt();
+    rpwm = lpwm;
+    motion(lpwm,rpwm,HIGH,HIGH);
+  }
+  Serial.print(lv);
+  Serial.print(":");
+  Serial.print(rv);
+  Serial.print("<");
+  Serial.print(lpwm);
+  Serial.print(":");
+  Serial.print(rpwm);
+  Serial.print(">");
+  Serial.print(lmc);
+  Serial.print(":");
+  Serial.print(rmc);
+  Serial.print("#");
+  Serial.print(ti);
+  Serial.print(" th: ");
+  Serial.print(th);
+  Serial.print(" av: ");
+  Serial.println(av);
+  if(th>0){ rpwm-=10; lpwm+=10; }
+  if(th<0){ rpwm+=10; lpwm-=10; }
+  motion(lpwm,rpwm,HIGH,HIGH);
+  delay(1000);
+}//read int or parseFloat for ..float...
+


Added empty test sketch for KeenClient.

Added empty test sketch for KeenClient.

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

--- tests/KeenClientTest.ino
+++ tests/KeenClientTest.ino
@@ -0,0 +1,28 @@
+#line 2 "KeenClientTest.ino"
+#define private public
+#define OFFLINE
+#include <Arduino.h>
+#include <ArduinoUnit.h>
+#include <Bridge.h>
+#include <ApiClient.h>
+#include <KeenClient.h>
+
+KeenClient keen;
+
+void setup()
+{
+  pinMode(13, OUTPUT);
+  digitalWrite(13, LOW);
+  Bridge.begin();
+  digitalWrite(13, HIGH);
+
+  Serial.begin(115200);
+
+  while (!Serial); // wait for a serial connection
+}
+
+void loop()
+{
+  Test::run();
+}
+


Initial commit of repeater controller code.

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

--- RepeaterController.ino
+++ RepeaterController.ino
@@ -0,0 +1,138 @@
+/*
+
+An Arduino-based repeater controller.
+
+Author: David Andrzejewski
+
+
+*/
+
+
+const int pinPtt = 2;
+const int pinCor = 3;
+
+int currentPttStatus = LOW;
+int currentCorStatus = LOW;
+
+// How often do we need to ID? A good value would probably be about 9.5 minutes.
+const unsigned long idTimerInterval = 30000;
+
+// Track the last keyup time
+unsigned long lastPttKeyupTime = 0;
+
+// Track the ID timer
+unsigned long idTimerStartTime = 0;
+boolean pendingId = false;
+
+// Timeout timer values
+const unsigned long timeoutTimer = 30000;
+unsigned long timeoutTimerStartTime = 0;
+
+// Morse code ID values
+/*
+According to http://www.nu-ware.com/NuCode%20Help/index.html?morse_code_structure_and_timing_.htm,
+
+Dash Length = Dot length * 3
+Pause between elements = dot length
+Pause between characters = dot length * 3
+Pause between words = dot length * 7
+
+Speed (wpm = 2.4 * dots per second
+
+*/
+
+// All lengths in millis - 100ms = 24wpm
+const int dotLength = 100;
+const int pauseBetweenElements = dotLength;
+const int pauseBetweenCharacters = dotLength * 3;
+const int pauseBetweenWords = dotLength * 7;
+
+void setup() {
+  // Set up the PTT pin as an output
+  pinMode(pinPtt, OUTPUT);
+
+  // Ensure we start with the PTT pin low.
+  digitalWrite(pinPtt, LOW);
+
+  // Set up the COR pin as an input
+  pinMode(pinCor, INPUT);
+
+}
+
+void loop() {
+  // When COR goes high, PTT needs to go high.
+  if (digitalRead(pinCor) == HIGH && currentPttStatus == LOW) {
+    setPtt(HIGH);
+  }
+
+  // When COR goes low, PTT needs to go low.
+  if (digitalRead(pinCor) == LOW && currentPttStatus == HIGH) {
+    setPtt(LOW);
+  }
+
+  doIdIfNeeded();
+
+  doTimeoutIfNeeded();
+
+}
+
+// Sets the PTT pin and sets up timers related to PTT (ID and Timeout)
+void setPtt(int argPttHighLow) {
+
+  // If we are just starting PTT, start the timeout timer.
+  if (argPttHighLow == HIGH && currentPttStatus == LOW) {
+    startTimeoutTimer();
+  }
+
+  // If we are stopping PTT, shut off the timtout timer.
+  else if (argPttHighLow == LOW && currentPttStatus == HIGH) {
+    stopTimeoutTimer();
+  }
+
+  // Start the ID timer - this does not get stopped or reset until ID happens.
+  if (argPttHighLow == HIGH) {
+    startIdTimerIfNeeded();
+  }
+
+  // Track current PTT status
+  currentPttStatus = argPttHighLow;
+
+  // Set the PTT pin.
+  digitalWrite(pinPtt, argPttHighLow);
+
+}
+
+// If the ID timer hasn't been started, start it.
+void startIdTimerIfNeeded() {
+  if (idTimerStartTime == 0 && digitalRead(pinPtt) == HIGH) {
+    idTimerStartTime = millis();
+  }
+}
+
+// If it's time to do an ID, do it.
+void doIdIfNeeded() {
+  if (millis() - idTimerStartTime > idTimerInterval) {
+    // Do the ID
+
+    // Reset the timer
+    idTimerStartTime = 0;
+
+  }
+}
+
+// Start the timeout timer.
+void startTimeoutTimer() {
+  timeoutTimerStartTime = millis();
+}
+
+// Stop the timeout timer.
+void stopTimeoutTimer() {
+  timeoutTimerStartTime = 0;
+}
+
+// Time out if needed.
+void doTimeoutIfNeeded() {
+  if (millis() - timeoutTimerStartTime > timeoutTimer) {
+    setPtt(LOW);
+  }
+}


silly temp code

silly temp code

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

--- arduino/central_board/src/cboard.ino
+++ arduino/central_board/src/cboard.ino
@@ -0,0 +1,51 @@
+/*
+  Blink
+  Turns on an LED on for one second, then off for one second, repeatedly.
+
+  Most Arduinos have an on-board LED you can control. On the Uno and
+  Leonardo, it is attached to digital pin 13. If you're unsure what
+  pin the on-board LED is connected to on your Arduino model, check
+  the documentation at http://www.arduino.cc
+
+  This example code is in the public domain.
+
+  modified 8 May 2014
+  by Scott Fitzgerald
+ */
+
+
+// the setup function runs once when you press reset or power the board
+
+int led_strip_state = 0;
+int light_state = 1;
+void setup() {
+  // initialize digital pin 13 as an output.
+  pinMode(42, OUTPUT);
+  digitalWrite(42, light_state);
+
+  pinMode(47, OUTPUT);
+  digitalWrite(47, led_strip_state);
+  Serial.begin(9600);
+}
+
+
+int inByte = 0;         // incoming serial byte
+
+void loop() {
+  // if we get a valid byte, read analog ins:
+  if (Serial.available() > 0) {
+    // get incoming byte:
+    inByte = Serial.read();
+    // read first analog input, divide by 4 to make the range 0-255:
+    if(inByte == 'l') {
+      light_state = ! light_state;
+      digitalWrite(42, light_state);
+    }
+
+    if(inByte == 'o') {
+      led_strip_state = ! led_strip_state;
+      digitalWrite(47, led_strip_state);
+    }
+
+  }
+}


ON/Off actuator point code

ON/Off actuator point code

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

--- mqttHA_Point_OnOff.ino
+++ mqttHA_Point_OnOff.ino
@@ -0,0 +1,379 @@
+#include <dummy.h>
+#include <ESP8266WiFi.h>
+#include <PubSubClient.h>
+#include <ESP8266WebServer.h>
+#include <EEPROM.h>
+
+// Update these with values suitable for your network.
+ESP8266WebServer server(80);
+IPAddress mqtt_server(192,168,0,106);
+
+String pointID;
+char red[5];
+const char* mqttUser = "mqttUser";
+const char* mqttPw = "mqttuser";
+const char* ssid = "MQTT_HA_SetUp";
+const char* passphrase = "testpassword";
+String esid;
+String epass = "";
+
+String st;
+String content;
+int statusCode;
+
+
+WiFiClient espClient;
+void callback(char* topic, byte* payload, unsigned int lent);
+PubSubClient client(mqtt_server, 1883, callback, espClient);
+long lastMsg = 0;
+char msg[50];
+int value = 0;
+unsigned long startTime;
+long timeHeld;
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+void setup_wifi() {
+
+  delay(10);
+  WiFi.begin();
+
+  Serial.println("Reading EEPROM ssid");
+
+  for (int i = 32; i < 64; ++i)
+    {
+      esid += char(EEPROM.read(i));
+    }
+  Serial.print("SSID: ");
+  Serial.println(esid);
+  Serial.println("Reading EEPROM pass");
+
+  for (int i = 64; i < 128; ++i)
+    {
+      epass += char(EEPROM.read(i));
+    }
+  Serial.print("PASS: ");
+  Serial.println(epass);
+         if (testWifi()) {
+          Serial.println("");
+          Serial.println("Connected to wifi network :/ ");
+          return;
+        }
+
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+bool testWifi(void) {
+  WiFi.mode(WIFI_STA);
+  int c = 0;
+  if ( esid.length() > 1 ) {
+        Serial.println("Trying to connect to wifi net..");
+        WiFi.begin(esid.c_str(), epass.c_str());
+        while (WiFi.status() != WL_CONNECTED&&c<20) {
+          delay(500);
+          Serial.print(".");
+          c++;
+        }
+        if (WiFi.status() == WL_CONNECTED) {
+          Serial.println("Connected to wifi network :/ ");
+          return true;
+        }
+
+
+  }
+  Serial.println("");
+  Serial.println("Connect timed out, opening AP");
+  return false;
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+void launchWeb(int webtype) {
+  Serial.println("");
+  Serial.println("WiFi connected");
+  Serial.print("Local IP: ");
+  Serial.println(WiFi.localIP());
+  Serial.print("SoftAP IP: ");
+  Serial.println(WiFi.softAPIP());
+  createWebServer(webtype);
+  // Start the server
+  server.begin();
+  Serial.println("Server started");
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+void setupAP(void) {
+  WiFi.mode(WIFI_STA);
+  WiFi.disconnect();
+  delay(100);
+  int n = WiFi.scanNetworks();
+  Serial.println("scan done");
+  if (n == 0)
+    Serial.println("no networks found");
+  else
+  {
+    Serial.print(n);
+    Serial.println(" networks found");
+    for (int i = 0; i < n; ++i)
+     {
+      // Print SSID and RSSI for each network found
+      Serial.print(i + 1);
+      Serial.print(": ");
+      Serial.print(WiFi.SSID(i));
+      Serial.print(" (");
+      Serial.print(WiFi.RSSI(i));
+      Serial.print(")");
+      Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*");
+      delay(10);
+     }
+  }
+  Serial.println("");
+  st = "
";
+  for (int i = 0; i < n; ++i)
+    {
+      // Print SSID and RSSI for each network found
+      st += "
";
+      st += WiFi.SSID(i);
+      st += " (";
+      st += WiFi.RSSI(i);
+      st += ")";
+      st += (WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*";
+      st += "
";
+    }
+  st += "
";
+  delay(100);
+  WiFi.softAP(ssid, passphrase, 6);
+  Serial.println("softap");
+  launchWeb(1);
+  Serial.println("over");
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+void createWebServer(int webtype)
+{
+  if ( webtype == 1 ) {
+    Serial.println("");
+    Serial.println("webtype 1 selected");
+    server.on("/", []() {
+        Serial.println("");
+        Serial.println("server received /");
+        IPAddress ip = WiFi.softAPIP();
+        String ipStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]);
+        content = "<!DOCTYPE HTML>\r\nHello from ESP8266 at ";
+        content += ipStr;
+        content += "
";
+        content += st;
+        content += "
<form method='get' action='setting'>SSID: <input name='ssid' length=32><input name='pass' length=64><input type='submit'></form>";
+        content += "";
+        server.send(200, "text/html", content);
+    });
+    server.on("/setting", []() {
+        String qsid = server.arg("ssid");
+        String qpass = server.arg("pass");
+        if (qsid.length() > 0 && qpass.length() > 0) {
+          Serial.println("clearing eeprom");
+          for (int i = 0; i < 128; ++i) { EEPROM.write(i, 0); }
+          Serial.println(qsid);
+          Serial.println("");
+          Serial.println(qpass);
+          Serial.println("");
+
+          Serial.println("writing eeprom ssid:");
+          for (int i = 0; i < qsid.length(); ++i)
+            {
+              EEPROM.write(32+i, qsid[i]);
+              Serial.print("Wrote: ");
+              Serial.println(qsid[i]);
+            }
+          Serial.println("writing eeprom pass:");
+          for (int i = 0; i < qpass.length(); ++i)
+            {
+              EEPROM.write(64+i, qpass[i]);
+              Serial.print("Wrote: ");
+              Serial.println(qpass[i]);
+            }
+          EEPROM.commit();
+          content = "{\"Success\":\"saved to eeprom... reset to boot into new wifi\"}";
+          statusCode = 200;
+        } else {
+          content = "{\"Error\":\"404 not found\"}";
+          statusCode = 404;
+          Serial.println("Sending 404");
+        }
+        server.send(statusCode, "application/json", content);
+    });
+  } else if (webtype == 0) {
+    Serial.println("");
+    Serial.println("webtype 0 selected");
+    server.on("/", []() {
+      IPAddress ip = WiFi.localIP();
+      String ipStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]);
+      server.send(200, "application/json", "{\"IP\":\"" + ipStr + "\"}");
+    });
+    server.on("/cleareeprom", []() {
+      content = "<!DOCTYPE HTML>\r\n";
+      content += "
Clearing the EEPROM
";
+      server.send(200, "text/html", content);
+      Serial.println("clearing eeprom");
+      for (int i = 0; i < 128; ++i) { EEPROM.write(i, 0); }
+      EEPROM.commit();
+    });
+  }
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+void callback(char* topic, byte* payload, unsigned int lent) {
+  client.disconnect();
+  Serial.print("Message arrived [");
+  Serial.print(topic);
+  Serial.print("] ");
+  for (int i = 0; i < lent; i++) {
+    Serial.print((char)payload[i]);
+  }
+  Serial.println();
+  Serial.print("Message length is: ");
+  Serial.println(lent);
+
+  char payloadString[lent];
+  if (String(topic)=="newDeviceAdd") {
+    for (int i = 0; i < lent; i++) {
+      Serial.print((char)payload[i]);
+      payloadString[i]=(char)payload[i];
+    }
+    Serial.println("");
+    Serial. println("new device message recvd");
+    redEEPromWrite(String(payloadString));
+    Serial. println("Point ID written to EEPROM");
+    while (1){}
+
+  }
+
+  // Switch on the LED if an 1 was received as first character
+  if ((char)payload[0] == '1') {
+    digitalWrite(BUILTIN_LED, LOW);   // Turn the LED on (Note that LOW is the voltage level
+    // but actually the LED is on; this is because
+    // it is acive low on the ESP-01)
+  } else {
+    digitalWrite(BUILTIN_LED, HIGH);  // Turn the LED off by making the voltage HIGH
+  }
+ reconnect();
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+void joinControlNet(){
+ //
+  char pnt[pointID.length()];
+  pointID.toCharArray(pnt,pointID.length()+1);
+  client.unsubscribe(pnt);
+  String payload = "lamp/";
+  redEEPromWrite(pointID);
+
+  byte payloadBytes[payload.length()];
+  payload.getBytes(payloadBytes,payload.length()+1);
+  client.publish("newDevice",payloadBytes ,payload.length() );
+  Serial.print("Point ID is: ");
+  Serial.println(pointID);
+  Serial.println(client.subscribe("newDeviceAdd"));
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+void redEEPromWrite(String x){
+  for (int i=0; i<4;i++){
+    EEPROM.write(i, x[i]);
+  }
+
+  EEPROM.commit();
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+void redEEPromRead(){
+  for (int i=0; i<4;i++){
+    red[i] = EEPROM.read(i);
+  }
+
+  EEPROM.commit();
+  pointID=red;
+  Serial.print("ID read from EEPROM is: ");
+  Serial.println(red);
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void reconnect() {
+  // Loop until we're reconnected
+  Serial.println("Reconnecting MQTT...");
+  while (!client.connected()) {
+    Serial.print("Attempting MQTT connection...");
+    char pnt[4];
+    if (pointID.length()==0){
+        pointID = "Test";
+      }
+      else{
+        pointID.toCharArray(pnt,pointID.length()+1);
+        //client.subscribe(pnt);
+      }
+    // Create a random client ID
+    String clientId = String(pointID);
+    // Attempt to connect
+    if (client.connect(clientId.c_str(),mqttUser, mqttPw)) {
+      client.subscribe(pnt);
+      Serial.println("connected");
+      Serial.print("subscribed to: ");
+      Serial.println(pnt);
+      Serial.print("with client ID: ");
+      Serial.println(clientId);
+      client.loop();
+      Serial.print("MQTT Connection status:  ");
+      Serial.println(client.connected());
+      delay(500);
+    } else {
+      Serial.print("failed, rc=");
+      Serial.print(client.state());
+      Serial.println(" try again in 5 seconds");
+      // Wait 5 seconds before retrying
+      delay(5000);
+    }
+  }
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+void setup() {
+  Serial.begin(115200);
+  EEPROM.begin(512);
+  //pinMode(0, INPUT);
+  pinMode(4, INPUT);
+  WiFi.begin();
+  delay(1000);
+  Serial.println("");
+  Serial.println("delay done");
+  Serial.println(digitalRead(4));
+   if (digitalRead(4)==false)
+  {
+    Serial.println("button pressed at beginning");
+    delay(250);
+     if (digitalRead(4)==false)setupAP();
+     while(1){server.handleClient();delay(10);}
+
+  }
+  else{
+  Serial.println("");
+  redEEPromRead();
+  Serial.println("");
+  Serial.print("point ID is: ");
+  Serial.println(pointID);
+  pinMode(BUILTIN_LED, OUTPUT);     // Initialize the BUILTIN_LED pin as an output
+  setup_wifi();
+  client.setServer(mqtt_server, 1883);
+  client.setCallback(callback);
+  pinMode(0, INPUT);
+  delay(1000);
+  reconnect();}
+
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+void loop() {
+
+  if (!client.connected() && (WiFi.status() == WL_CONNECTED)) {
+    Serial.println("rwwwiaiau");
+    reconnect();
+  }
+
+  client.loop();
+
+   if (digitalRead(0)==false)
+  {
+    Serial.println("button pressed");
+    delay(250);
+     if (digitalRead(0)==false)joinControlNet();
+
+  }
+
+
+}


commented out Serial.print() commands

commented out Serial.print() commands

error: pathspec 'Embedded-Arduino/Testing' did not match any file(s) known to git
error: pathspec 'Programs/_14_03_19_RecVelCmds/_14_03_19_RecVelCmds.ino' did not match any file(s) known to git


it is spread cycle, stupid

it is spread cycle, stupid

--- examples/TMC262MotorTester/Motor.ino
+++ examples/TMC262MotorTester/Motor.ino
@@ -7,15 +7,15 @@
 char chopperMode = 0; //0 for spread, 1 for constant off
 char t_off = 2;
 char t_blank = 24;
-char fast_decay = 8;
-char wave_offset = 6;
-char comparator = 0;
+char h_start = 8;
+char h_end = 6;
+char h_decrement = 0;

 void startMotor() {
   Serial.println("Configuring stepper driver");
   //char constant_off_time, char blank_time, char hysteresis_start, char hysteresis_end, char hysteresis_decrement
-  tmc262Stepper.setSpreadCycleChopper(t_off,t_blank,fast_decay,wave_offset,comparator);
+  tmc262Stepper.setSpreadCycleChopper(t_off,t_blank,h_start,h_end,h_decrement);
   tmc262Stepper.setRandomOffTime(0);

   tmc262Stepper.setMicrosteps(32);


Create Templete.ino

Create Templete.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/SirenCreatorTeam/Siren_Zwei.git/'


Example with two DHT11 Sensors

Example with two DHT11 Sensors

Examples with two DHT11 Sensors. Wiring is also documented here:

https://github.com/santosomar/arduinoTempHumidity

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

--- examples/TwoSensorsDefault/santosomarTwoSensors.ino
+++ examples/TwoSensorsDefault/santosomarTwoSensors.ino
@@ -0,0 +1,67 @@
+#include <SimpleDHT.h>
+
+// Created by santosomar Ωr using SimpleDHT library to read data from two DHT11 sensors
+// for DHT11,
+//      VCC: 5V or 3V
+//      GND: GND
+//      SENSOR 1 is in Digital Data pin: 2
+//      SENSOR 1 is in Digital Data pin: 2
+
+int dataPinSensor1 = 2;
+int dataPinSensor2 = 4;
+SimpleDHT11 dht11;
+
+void setup() {
+  Serial.begin(9600);
+}
+
+void loop() {
+  // Reading data from sensor 1...
+  Serial.println("=================================");
+
+  // Reading data from sensor 1...
+  Serial.println("Getting data from sensor 1...");
+
+  // read without samples.
+  byte temperature = 0;
+  byte humidity = 0;
+  if (dht11.read(dataPinSensor1, &temperature, &humidity, NULL)) {
+    Serial.print("Communication error with Sensor 1");
+    return;
+  }
+
+   // converting Celsius to Fahrenheit
+
+  byte f = temperature * 1.8 + 32;
+  Serial.print("Sample OK: ");
+  Serial.print((int)temperature); Serial.print(" *C, ");
+  Serial.print((int)f); Serial.print(" *F, ");
+  Serial.print((int)humidity); Serial.println(" % humidity");
+
+
+  // Reading data from sensor 2...
+  // ============================
+
+  Serial.println("Getting data from sensor 2...");
+
+  byte temperature2 = 0;
+  byte humidity2 = 0;
+  if (dht11.read(dataPinSensor2, &temperature2, &humidity2, NULL)) {
+    Serial.print("Communication error with sensor 2");
+    return;
+  }
+
+     // converting Celsius to Fahrenheit
+
+  byte fb = temperature2 * 1.8 + 32;
+
+  Serial.print("Sample OK: ");
+  Serial.print((int)temperature); Serial.print(" *C, ");
+  Serial.print((int)fb); Serial.print(" *F, ");
+  Serial.print((int)humidity2); Serial.println(" % humidity");
+
+
+
+  // DHT11 sampling rate is 1HZ.
+  delay(1500);
+}


Testing the MD5 library

Testing the MD5 library

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

--- src/md5_test/md5_test.ino
+++ src/md5_test/md5_test.ino
@@ -0,0 +1,98 @@
+#include <MD5.h>
+
+
+char *key = "sharedkey";
+int keyLen;
+int32_t id = 0xa0;
+int8_t dlc = 2;
+char *data = "a1f2";
+int dataLen;
+
+void setup()
+{
+    Serial.begin(115200);
+    uint8_t *newKey = CStringToUInt8(key, keyLen);
+    uint8_t *newMessage = HexToUInt8(data, dataLen);
+
+    SendAuthMessages();
+}
+
+void loop()
+{
+
+}
+
+
+void SendAuthMessages()
+{
+    // Convert to uint8_t
+    uint8_t *theKey = CStringToUInt8(key, keyLen);
+    uint8_t *theMessage = HexToUInt8(data, dataLen);
+
+    // Concatenate into one full message
+    uint8_t *fullMessage = new uint8_t[keyLen + dataLen + 1];
+    for(int i = 0; i < dataLen; i++)
+        fullMessage[i] = theMessage[i];
+    for(int i = 0; i < keyLen; i++)
+        fullMessage[i + dataLen] = theKey[i];
+
+    // Print the whole, unhashsed message
+    for(int i = 0; i < (keyLen + dataLen); i++)
+    {
+        if (fullMessage[i] < 0x10)
+            Serial.print('0');
+        Serial.print(fullMessage[i], HEX);
+        Serial.print(' ');
+    }
+    Serial.println();
+}
+
+
+uint8_t *HexToUInt8(char *hexStr, int &len)
+{
+    len = strlen(hexStr);
+    uint8_t *buf = new uint8_t[len];
+    int bufIndex = 0;
+
+    // Convert each pair of chars (a byte)
+    for (int i = 0; i < len; i+=2)
+    {
+        buf[bufIndex] = CharToUInt8(hexStr[i]) * 16;
+        buf[bufIndex] += CharToUInt8(hexStr[i+1]);
+        bufIndex++;
+    }
+    len = len / 2;
+
+    return buf;
+}
+
+
+uint8_t *CStringToUInt8(char *str, int &len)
+{
+    len = strlen(str);
+    uint8_t *buf = new uint8_t[len];
+
+    for(int i = 0; i < len; i++)
+    {
+        // store and convert from ASCII to integer value
+        buf[i] = (uint8_t)str[i];
+    }
+
+    return buf;
+}
+
+uint8_t CharToUInt8(char ch)
+{
+    uint8_t value = ch;
+    if (ch >= '0' && ch <= '9')
+        value -= '0';
+    else if (ch >= 'a' && ch <= 'f')
+        value = (ch - 'a') + 10;
+    else
+        value = (ch - 'A') + 10;
+    return value;
+}
+
+
+
+


test of WifiMgr library - AP mode is flakey :(

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

--- SimpleClientDHTSSLWIFIMGR.ino
+++ SimpleClientDHTSSLWIFIMGR.ino
@@ -0,0 +1,351 @@
+
+/* WeMos DHT Server
+ *
+ * Connect to WiFi and respond to http requests with temperature and humidity
+ *
+ * Based on Adafruit ESP8266 Temperature / Humidity Webserver
+ * https://learn.adafruit.com/esp8266-temperature-slash-humidity-webserver
+ *
+ * Depends on Adafruit DHT Arduino library
+ * https://github.com/adafruit/DHT-sensor-library
+ */
+
+#include <ESP8266WiFi.h>
+#include <WiFiClientSecure.h>
+#include <DHT.h>
+
+//WiFiManager
+#include <DNSServer.h>
+#include <ESP8266WebServer.h>
+#include <WiFiManager.h>
+#include <Ticker.h>
+Ticker ticker;
+
+
+#define DHTTYPE DHT22   // DHT Shield uses DHT 11
+#define DHTPIN D4       // DHT Shield uses pin D4
+
+const char* DEVNAME = ""; const char* ISSUEID  = ""; const char* ssid = ""; const char* password = ""; //
+
+
+void tick()
+{
+  //toggle state
+  int state = digitalRead(BUILTIN_LED);  // get the current state of GPIO1 pin
+  digitalWrite(BUILTIN_LED, !state);     // set pin to the opposite state
+}
+
+//gets called when WiFiManager enters configuration mode
+void configModeCallback (WiFiManager *myWiFiManager) {
+  Serial.println("Entered config mode");
+  Serial.println(WiFi.softAPIP());
+  //if you used auto generated SSID, print it
+  Serial.println(myWiFiManager->getConfigPortalSSID());
+  //entered config mode, make led toggle faster
+  ticker.attach(0.2, tick);
+}
+
+
+
+
+
+IPAddress server(120,138,27,109);
+
+// Initialize DHT sensor
+// Note that older versions of this library took an optional third parameter to
+// tweak the timings for faster processors.  This parameter is no longer needed
+// as the current DHT reading algorithm adjusts itself to work on faster procs.
+DHT dht(DHTPIN, DHTTYPE);
+
+float humidity, temperature;                 // Raw float values from the sensor
+char str_humidity[10], str_temperature[10];  // Rounded sensor values and as strings
+
+// Generally, you should use "unsigned long" for variables that hold time
+unsigned long previousMillis = 0;            // When the sensor was last read
+const long interval = 5000;                  // Wait this long until reading again
+unsigned long lastConnectionTime = 0;             // last time you connected to the server, in milliseconds
+enum WiFiStateEnum { DOWN, STARTING, UP }    ;
+WiFiStateEnum WiFiState = DOWN;
+unsigned long WiFiStartTime = 0;
+
+void read_sensor() {
+  // Wait at least 2 seconds seconds between measurements.
+  // If the difference between the current time and last time you read
+  // the sensor is bigger than the interval you set, read the sensor.
+  // Works better than delay for things happening elsewhere also.
+  unsigned long currentMillis = millis();
+
+  if (currentMillis - previousMillis >= interval) {
+    // Save the last time you read the sensor
+    previousMillis = currentMillis;
+
+    // Reading temperature and humidity takes about 250 milliseconds!
+    // Sensor readings may also be up to 2 seconds 'old' (it's a very slow sensor)
+    humidity = dht.readHumidity();        // Read humidity as a percent
+    temperature = dht.readTemperature();  // Read temperature as Celsius
+
+    // Check if any reads failed and exit early (to try again).
+    if (isnan(humidity) || isnan(temperature)) {
+      Serial.println("Failed to read from DHT sensor!");
+      return;
+    }
+
+    // Convert the floats to strings and round to 2 decimal places
+    dtostrf(humidity, 1, 2, str_humidity);
+    dtostrf(temperature, 1, 2, str_temperature);
+
+    Serial.print("Humidity: ");
+    Serial.print(str_humidity);
+    Serial.print(" %\t");
+    Serial.print("Temperature: ");
+    Serial.print(str_temperature);
+    Serial.println(" °C");
+  }
+}
+
+void WiFiEvent(WiFiEvent_t event) {
+    Serial.printf("[WiFi-event] event: %d\n", event);
+
+    switch(event) {
+        case WIFI_EVENT_STAMODE_GOT_IP:
+            Serial.println("WiFi connected");
+            Serial.println("IP address: ");
+            Serial.println(WiFi.localIP());
+            WiFiState = UP;
+            break;
+        case WIFI_EVENT_STAMODE_DISCONNECTED:
+            WiFiState = DOWN;
+            Serial.println("WiFi lost connection");
+            break;
+    }
+}
+
+void WifiTryUp() {
+    // delete old config
+
+    WiFi.disconnect(true);
+
+    delay(1000);
+
+
+
+    WiFi.begin(ssid, password);
+
+    Serial.println();
+    Serial.println();
+    Serial.println("Wait for WiFi... ");
+
+}
+
+
+unsigned long _ESP_id;
+void setup(void)
+{
+  // Open the Arduino IDE Serial Monitor to see what the code is doing
+  Serial.begin(115200);
+  dht.begin();
+
+  Serial.println("WeMos DHT Server");
+  _ESP_id = ESP.getChipId();  // uint32 -> unsigned long on arduino
+  Serial.println(_ESP_id,HEX);
+  Serial.println("");
+
+  WiFi.onEvent(WiFiEvent);
+
+  // Initial read
+  read_sensor();
+
+}
+
+void loop(void)
+{
+  delay(1000);
+  read_sensor();
+
+  if (WiFiState == UP) { httpsRequest(temperature,humidity); }
+
+  // Connect to your WiFi network
+  if (WiFiState == DOWN) {
+    WifiTryUp();
+    WiFiState = STARTING;
+    WiFiStartTime = millis();
+  }
+  if (WiFiState == STARTING) {
+    if (millis() - WiFiStartTime > 30000) { WiFiState = DOWN; Serial.println("WiFi Connect Timeout"); }
+  }
+
+
+}
+
+
+
+
+// this method makes a HTTP connection to the server:
+void httpRequest(float temp, float humid) {
+
+  // Use WiFiClient class to create TCP connections
+  WiFiClient client;
+  const int httpPort = 80;
+  if (!client.connect(server, httpPort)) {
+    Serial.println("connection failed");
+    return;
+  }
+
+  String url = "/updateweatherstation.php?action=updateraw";
+  url += "&devid=";
+  url += String(_ESP_id,HEX);
+  url += "&devname=";
+  url += DEVNAME;
+  url += "&issueid=";
+  url += ISSUEID;
+  url += "&dateutc=now&indoortemp=";
+  url += temp;
+  url += "&indoorhumidity=";
+  url += humid;
+
+
+  Serial.print("Requesting URL: ");
+  Serial.println(url);
+
+  // This will send the request to the server
+  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
+               "Host: " + "www.shac.org.nz" + "\r\n" +
+               "Connection: close\r\n\r\n");
+  unsigned long timeout = millis();
+  while (client.available() == 0) {
+    delay(10);
+    if (millis() - timeout > 5000) {
+      Serial.println(">>> Client Timeout !");
+      client.stop();
+      return;
+    }
+  }
+
+  // Read all the lines of the reply from server and print them to Serial
+  while(client.available()){
+    String line = client.readStringUntil('\r');
+    Serial.print(line);
+  }
+
+  Serial.println();
+  Serial.println("closing connection");
+
+    // note the time that the connection was made:
+  lastConnectionTime = millis();
+
+}
+
+
+
+// Use web browser to view and copy
+// SHA1 fingerprint of the certificate
+const char* fingerprint = "CF 05 98 89 CA FF 8E D8 5E 5C E0 C2 E4 F7 E6 C3 C7 50 DD 5C";
+
+// this method makes a HTTP connection to the server:
+void httpsRequest(float temp, float humid) {
+
+  // Use WiFiClientSecure class to create TLS connection
+  WiFiClientSecure client;
+  Serial.print("connecting HTTPS ");
+  Serial.println(server);
+  if (!client.connect(server, 443)) {
+    Serial.println("connection failed");
+    return;
+  }
+
+  if (client.verify(fingerprint, "www.shac.org.nz")) {
+    Serial.println("certificate matches");
+  } else {
+    Serial.println("certificate doesn't match");
+  }
+
+ // We now create a URI for the request
+  String url = "/updateweatherstation.php?action=updateraw";
+  url += "&devid=";
+  url += String(_ESP_id,HEX);
+  url += "&devname=";
+  url += DEVNAME;
+  url += "&issueid=";
+  url += ISSUEID;
+  url += "&dateutc=now&indoortemp=";
+  url += temp;
+  url += "&indoorhumidity=";
+  url += humid;
+
+
+
+  Serial.print("Requesting URL: ");
+  Serial.println(url);
+
+  // This will send the request to the server
+  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
+               "Host: " + "www.shac.org.nz" + "\r\n" +
+               "User-Agent: indoor-wx-v0.1" + "\r\n" +
+               "Connection: close\r\n\r\n");
+
+  Serial.println("request sent");
+
+  //delay(100);
+
+/*
+  Serial.print("01"); Serial.println(client.readStringUntil('\n'));
+  Serial.print("02"); Serial.println(client.readStringUntil('\n'));
+  Serial.print("03"); Serial.println(client.readStringUntil('\n'));
+  Serial.print("04"); Serial.println(client.readStringUntil('\n'));
+  Serial.print("05"); Serial.println(client.readStringUntil('\n'));
+  Serial.print("06"); Serial.println(client.readStringUntil('\n'));
+  Serial.print("07"); Serial.println(client.readStringUntil('\n'));
+  Serial.print("08"); Serial.println(client.readStringUntil('\n'));
+  Serial.print("09"); Serial.println(client.readStringUntil('\n'));
+  Serial.print("10"); Serial.println(client.readStringUntil('\n'));
+  Serial.print("11"); Serial.println(client.readStringUntil('\n'));
+  Serial.print("12"); Serial.println(client.readStringUntil('\n'));
+  Serial.print("13"); Serial.println(client.readStringUntil('\n'));
+  Serial.print("14"); Serial.println(client.readStringUntil('\n'));
+  Serial.print("15"); Serial.println(client.readStringUntil('\n'));
+  Serial.print("16"); Serial.println(client.readStringUntil('\n'));
+*/
+
+
+
+  unsigned long _timeout = 1000;
+  unsigned long _startMillis = millis();
+  //while (client.connected()) {     // client.connected seems to not always work! - returns FALSE at this point sometimes.
+
+  while (millis() - _startMillis < _timeout) {
+    String line = client.readStringUntil('\n');
+    yield();
+    Serial.print("Header Line: ");
+    Serial.println(line);
+    if (line == String("\r") ) {
+      Serial.println("headers received");
+      break;
+    }
+  }
+
+  while (client.connected()) {
+    String line = client.readStringUntil('\n');
+    yield();
+    if (line.startsWith("GMT:")) {
+      Serial.print("Got GMT: ");
+      Serial.println(line);
+    } else {
+      Serial.print("Body Line: ");
+      Serial.println(line);
+    }
+  }
+
+
+  Serial.println("Finished");
+  // read until return -1?????
+  //while (client.read() >= 0) {Serial.print("."); }
+
+  //Serial.println("reply was:");
+  //Serial.println("==========");
+  //Serial.println(line);
+  //Serial.println("==========");
+  //Serial.println("closing connection");
+
+
+}
+


Examples: add another AIC Shield example: TrebleBoost_wComp_Quad

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

--- examples/09-AIC_Shield/TrebleBoost_wComp_Quad/TrebleBoost_wComp_Quad.ino
+++ examples/09-AIC_Shield/TrebleBoost_wComp_Quad/TrebleBoost_wComp_Quad.ino
@@ -0,0 +1,218 @@
+/*
+*   TrebleBoost_wComp
+*
+*   Created: Chip Audette, OpenAudio, Apr 2017 (updated August 2021 for Quad)
+*   Purpose: Process audio by applying a high-pass filter followed by gain followed
+*            by a dynamic range compressor.
+*
+*   Uses a Tympan RevD or RevE along with an AICShield (or earpiece shield).  Defaults
+*   to using the microphones built into the Tympan's circuit board.  It applies the
+*   Treble Boost and Compression to these two channels.  It sends the processed audio
+*   to the stereo headphone output of both the Tympan board and the AIC Shield.
+*
+*   Blue potentiometer adjusts the digital gain applied to the filtered audio signal.
+*
+*   No USB Serial control nor any Bluetooth control.  There is information sent to the
+*   USB Serial Monitor, however, so you can see what is happening.
+*
+*   MIT License.  use at your own risk.
+*/
+
+//here are the libraries that we need
+#include <Tympan_Library.h>  //include the Tympan Library
+
+//set the sample rate and block size
+const float sample_rate_Hz = 24000.0f ; //24000 or 44100 (or other frequencies in the table in AudioOutputI2S_F32)
+const int audio_block_samples = 32;     //do not make bigger than AUDIO_BLOCK_SAMPLES from AudioStream.h (which is 128)
+AudioSettings_F32 audio_settings(sample_rate_Hz, audio_block_samples);
+
+//create audio library objects for handling the audio
+Tympan       myTympan(TympanRev::E, audio_settings);   //do TympanRev::D or TympanRev::E
+AICShield    aicShield(TympanRev::E, AICShieldRev::A); //do TympanRev::D or TympanRev::E
+
+
+AudioInputI2SQuad_F32     i2s_in(audio_settings);     //Digital audio in *from* the Teensy Audio Board ADC.
+AudioFilterBiquad_F32     hp_filt1(audio_settings);   //IIR filter doing a highpass filter.  Left.
+AudioFilterBiquad_F32     hp_filt2(audio_settings);   //IIR filter doing a highpass filter.  Right.
+AudioEffectCompWDRC_F32   comp1(audio_settings);      //Compresses the dynamic range of the audio.  Left.
+AudioEffectCompWDRC_F32   comp2(audio_settings);      //Compresses the dynamic range of the audio.  Right.
+AudioOutputI2SQuad_F32    i2s_out(audio_settings);    //Digital audio out *to* the Teensy Audio Board DAC.
+
+//Make all of the audio connections
+#if 1
+  //Use the inputs on the Tympan board
+  AudioConnection_F32       patchCord1(i2s_in, 0, hp_filt1, 0);   //connect the Left input to the left highpass filter
+  AudioConnection_F32       patchCord2(i2s_in, 1, hp_filt2, 0);   //connect the Right input to the right highpass filter
+#else
+  //Use the inputs on the AIC Shield
+  AudioConnection_F32       patchCord1(i2s_in, 2, hp_filt1, 0);   //connect the Left input to the left highpass filter
+  AudioConnection_F32       patchCord2(i2s_in, 3, hp_filt2, 0);   //connect the Right input to the right highpass filter
+#endif
+
+//connect the compressors
+AudioConnection_F32       patchCord3(hp_filt1, 0, comp1, 0);    //connect to the left gain/compressor/limiter
+AudioConnection_F32       patchCord4(hp_filt2, 0, comp2, 0);    //connect to the right gain/compressor/limiter
+
+//connect to the Tympan headphone outputs
+AudioConnection_F32       patchCord5(comp1, 0, i2s_out, 0);     //connect to the Left output
+AudioConnection_F32       patchCord6(comp2, 0, i2s_out, 1);     //connect to the Right output
+
+//connect to the AIC Shield headphone outputs
+AudioConnection_F32       patchCord7(comp1, 0, i2s_out, 2);     //copy to left output on AIC Shield
+AudioConnection_F32       patchCord8(comp2, 0, i2s_out, 3);     //copy to right output on AIC Shield
+
+//define a function to configure the left and right compressors
+void setupMyCompressors(void) {
+  //set the speed of the compressor's response
+  float attack_msec = 5.0;
+  float release_msec = 300.0;
+  comp1.setAttackRelease_msec(attack_msec, release_msec); //left channel
+  comp2.setAttackRelease_msec(attack_msec, release_msec); //right channel
+
+  //Single point system calibration.  what is the SPL of a full scale input (including effect of input_gain_dB)?
+  float SPL_of_full_scale_input = 115.0;
+  comp1.setMaxdB(SPL_of_full_scale_input);  //left channel
+  comp2.setMaxdB(SPL_of_full_scale_input);  //right channel
+
+  //now define the compression parameters
+  float knee_compressor_dBSPL = 55.0;  //follows setMaxdB() above
+  float comp_ratio = 1.5;
+  comp1.setKneeCompressor_dBSPL(knee_compressor_dBSPL);  //left channel
+  comp2.setKneeCompressor_dBSPL(knee_compressor_dBSPL);  //right channel
+  comp1.setCompRatio(comp_ratio); //left channel
+  comp2.setCompRatio(comp_ratio);
+
+  //finally, the WDRC module includes a limiter at the end.  set its parameters
+  float knee_limiter_dBSPL = SPL_of_full_scale_input - 20.0;  //follows setMaxdB() above
+  //note: the WDRC limiter is hard-wired to a compression ratio of 10:1
+  comp1.setKneeLimiter_dBSPL(knee_limiter_dBSPL);  //left channel
+  comp2.setKneeLimiter_dBSPL(knee_limiter_dBSPL);  //right channel
+
+}
+
+
+// define the setup() function, the function that is called once when the device is booting
+const float input_gain_dB = 20.0f; //gain on the microphone
+float vol_knob_gain_dB = 0.0;      //will be overridden by volume knob
+void setup() {
+  //begin the serial comms (for debugging)
+  myTympan.beginBothSerial(); delay(1000); //let's use the print functions in "myTympan" so it goes to BT, too!
+  myTympan.println("TrebleBoost_wComp_Quad: Starting setup()...");
+
+  //allocate the dynamic memory for audio processing blocks
+  AudioMemory_F32(20,audio_settings);
+
+  //Enable the Tympan to start the audio flowing!
+  myTympan.enable(); // activate AIC
+  aicShield.enable();
+
+  //Choose the desired input on main Tympan board
+  myTympan.inputSelect(TYMPAN_INPUT_ON_BOARD_MIC);     // use the on board microphones
+  //myTympan.inputSelect(TYMPAN_INPUT_JACK_AS_MIC);    // use the microphone jack - defaults to mic bias 2.5V
+  //myTympan.inputSelect(TYMPAN_INPUT_JACK_AS_LINEIN); // use the microphone jack - defaults to mic bias OFF
+
+  //Choose the desired input on the AIC shield (though there are no software AudioConnections to it)
+  //aicShield.inputSelect(TYMPAN_INPUT_JACK_AS_MIC);    // use the microphone jack - defaults to mic bias 2.5V
+  aicShield.inputSelect(TYMPAN_INPUT_JACK_AS_LINEIN); // use the microphone jack - defaults to mic bias OFF
+
+
+  //Set the desired volume levels
+  myTympan.volume_dB(0);                    // headphone amplifier.  -63.6 to +24 dB in 0.5dB steps.
+  aicShield.volume_dB(0);                   // headphone amplifier.  -63.6 to +24 dB in 0.5dB steps.
+  myTympan.setInputGain_dB(input_gain_dB);  // set input volume, 0-47.5dB in 0.5dB setps
+  aicShield.setInputGain_dB(input_gain_dB); // set input volume, 0-47.5dB in 0.5dB setps (not being used
+
+
+  //Set the cutoff frequency for the highpassfilter
+  float cutoff_Hz = 1000.f;  //frequencies below this will be attenuated
+  myTympan.print("Highpass filter cutoff at ");myTympan.print(cutoff_Hz);myTympan.println(" Hz");
+  hp_filt1.setHighpass(0, cutoff_Hz); //biquad IIR filter.  left channel
+  hp_filt2.setHighpass(0, cutoff_Hz); //biquad IIR filter.  right channel
+
+  //configure the left and right compressors with the desired settings
+  setupMyCompressors();
+
+  // check the setting on the potentiometer
+  servicePotentiometer(millis(),0);
+
+  myTympan.println("Setup complete.");
+} //end setup()
+
+
+// define the loop() function, the function that is repeated over and over for the life of the device
+void loop() {
+
+  //periodically check the potentiometer
+  servicePotentiometer(millis(),100); //update every 100 msec
+
+  //periodically  print the CPU and Memory Usage
+  myTympan.printCPUandMemory(millis(),3000); //print every 3000 msec
+
+  //periodically print the gain status
+  printGainStatus(millis(),2000); //update every 4000 msec
+
+} //end loop();
+
+
+// ///////////////// Servicing routines
+
+//servicePotentiometer: listens to the blue potentiometer and sends the new pot value
+//  to the audio processing algorithm as a control parameter
+void servicePotentiometer(unsigned long curTime_millis, unsigned long updatePeriod_millis) {
+  //static unsigned long updatePeriod_millis = 100; //how many milliseconds between updating the potentiometer reading?
+  static unsigned long lastUpdate_millis = 0;
+  static float prev_val = -1.0;
+
+  //has enough time passed to update everything?
+  if (curTime_millis < lastUpdate_millis) lastUpdate_millis = 0; //handle wrap-around of the clock
+  if ((curTime_millis - lastUpdate_millis) > updatePeriod_millis) { //is it time to update the user interface?
+
+    //read potentiometer
+    float val = float(myTympan.readPotentiometer()) / 1023.0; //0.0 to 1.0
+    val = (1.0/9.0) * (float)((int)(9.0 * val + 0.5)); //quantize so that it doesn't chatter...0 to 1.0
+
+    //send the potentiometer value to your algorithm as a control parameter
+    if (abs(val - prev_val) > 0.05) { //is it different than before?
+      prev_val = val;  //save the value for comparison for the next time around
+
+      //choose the desired gain value based on the knob setting
+      const float min_gain_dB = -20.0, max_gain_dB = 40.0; //set desired gain range
+      vol_knob_gain_dB = min_gain_dB + (max_gain_dB - min_gain_dB)*val; //computed desired gain value in dB
+
+      //command the new gain setting
+      comp1.setGain_dB(vol_knob_gain_dB);  //set the gain of the Left-channel linear gain at start of compression
+      comp2.setGain_dB(vol_knob_gain_dB);  //set the gain of the Right-channel linear gain at start of compression
+      myTympan.print("servicePotentiometer: linear gain dB = "); myTympan.println(vol_knob_gain_dB); //print text to Serial port for debugging
+    }
+    lastUpdate_millis = curTime_millis;
+  } // end if
+} //end servicePotentiometer();
+
+
+
+//This routine plots the current gain settings, including the dynamically changing gains
+//of the compressors
+void printGainStatus(unsigned long curTime_millis, unsigned long updatePeriod_millis) {
+  //static unsigned long updatePeriod_millis = 2000; //how many milliseconds between updating the potentiometer reading?
+  static unsigned long lastUpdate_millis = 0;
+
+  //has enough time passed to update everything?
+  if (curTime_millis < lastUpdate_millis) lastUpdate_millis = 0; //handle wrap-around of the clock
+  if ((curTime_millis - lastUpdate_millis) > updatePeriod_millis) { //is it time to update the user interface?
+    myTympan.print("printGainStatus: ");
+
+    myTympan.print("Input PGA = ");
+    myTympan.print(input_gain_dB,1);
+    myTympan.print(" dB.");
+
+    myTympan.print(" Compressor Gain (L/R) = ");
+    myTympan.print(comp1.getCurrentGain_dB(),1);
+    myTympan.print(", ");
+    myTympan.print(comp2.getCurrentGain_dB(),1);
+    myTympan.print(" dB.");
+
+    myTympan.println();
+
+    lastUpdate_millis = curTime_millis;
+  } // end if
+} //end servicePotentiometer();


form pt2

form pt2

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

--- hardware/docs/form.ino
+++ hardware/docs/form.ino
@@ -0,0 +1,9 @@
+client.print(\r\n);
+client.print(\r\n);
+client.print(<form action='/submit' method='post'>\r\n);
+client.print(SSID: <input name='ssid' type='text' value=''>
\r\n);
+client.print(Password: <input name='pw' type='password' value=''>
\r\n);
+client.print(<button type='submit'>Submit</button>\r\n);
+client.print(</form>\r\n);
+client.print(\r\n);
+client.print(\r\n);


Code initialized

Code initialized

--- CarController.ino
+++ CarController.ino
@@ -0,0 +1,73 @@
+#include <DigiUSB.h>
+
+#define CAR_FORWARD_PIN 0
+#define CAR_BACKWARD_PIN 1
+#define CAR_RIGHT_PIN 5
+#define CAR_LEFT_PIN 2
+
+#define ARMING_CODE 0xAA;
+
+uint8_t speed_forward=0, speed_backward=0, speed_left=0, speed_right=0;
+
+void setup() {
+  DigiUSB.begin();
+  pinMode(CAR_FORWARD_PIN, OUTPUT);
+  pinMode(CAR_BACKWARD_PIN, OUTPUT);
+  pinMode(CAR_RIGHT_PIN, OUTPUT);
+  pinMode(CAR_LEFT_PIN, OUTPUT);
+}
+
+uint8_t get_input() {
+  uint8_t current_key, last_key, counter=0;
+  // when there are no characters to read, or the character isn't a newline
+  while (counter < 10) { // loop forever
+    if (DigiUSB.available()) {
+      // something to read
+      current_key = DigiUSB.read();
+      DigiUSB.write(current_key);
+
+      if (current_key == '\n') {
+        //break; // when we get a newline, break out of loop
+        return last_key;
+      }
+      else {
+        last_key = current_key;
+      }
+    }
+
+    // refresh the usb port for 10 milliseconds
+    DigiUSB.delay(5);
+    counter += 1;
+  }
+}
+
+void control_car(uint8_t command)
+{
+  uint8_t forward_motion = command >> 4;
+  uint8_t left_motion = command & 0x0f;
+
+  for(uint8_t i=0;i<128; i++)
+  {
+    if(i<forward_motion)
+    {
+      digitalWrite(CAR_FORWARD_PIN, HIGH);
+    }
+  }
+}
+
+void loop() {
+  uint8_t command = 0xAA;
+  DigiUSB.println("Ready");
+  while(command != 0xAA)
+  {
+    DigiUSB.println("Send 0xAA to arm the controller.");
+    command = get_input();
+    delay(100);
+  }
+  command = get_input();
+  while(command != 0xBB)
+  {
+    control_car(command);
+    command = get_input();
+  }
+}


another 1bit music example

another 1bit music example

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


Add Arduino code for reporting temperature sensor data.

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

--- arduino/tempsens/tempsens.ino
+++ arduino/tempsens/tempsens.ino
@@ -0,0 +1,58 @@
+#include <OneWire.h>
+#include <DallasTemperature.h>
+
+// Change these if appropriate
+// The pin that sensors are connected to
+#define ONE_WIRE_BUS 2
+// What precision to set the sensor to
+#define TEMPERATURE_PRECISION 11
+
+OneWire one_wire(ONE_WIRE_BUS);
+DallasTemperature sensors(&one_wire);
+
+// We will store an array of probes we find on initial startup. If you have
+// more than 20 probes, feel free to bump this number and see if it'll actually
+// work at all.
+DeviceAddress probes[20];
+int num_probes = 0;
+
+void setup() {
+  Serial.begin(9600);
+  sensors.begin();
+
+  // Set all devices to the same resolution
+  sensors.setResolution(TEMPERATURE_PRECISION);
+
+  // Find our sensors, use num_probes as a handy counter.
+  one_wire.reset_search();
+  while (one_wire.search(probes[num_probes])) {
+    num_probes++;
+  }
+}
+
+void print_address(DeviceAddress device_address) {
+  // Device address is 8 bytes, iterate over them.
+  for (byte i = 0; i < 8; i++) {
+    if (device_address[i] < 16) {
+      Serial.print("0");
+    }
+    Serial.print(device_address[i], HEX);
+  }
+}
+
+void print_reading(DeviceAddress device_address) {
+  // Print out data in the form of ADDRESS:TEMPERATURE
+  // This bit's annoying enough to get its own function
+  print_address(device_address);
+  Serial.print(":");
+  Serial.print(sensors.getTempC(device_address));
+  Serial.print('\n');
+}
+
+void loop() {
+  // Make sure we're not just spitting out some constant meaningless numbers
+  sensors.requestTemperatures();
+  for (int i = 0; i < num_probes; i++) {
+    print_reading(probes[i]);
+  }
+}


Button test with internal pullup

Button test with internal pullup

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

--- utils/button/button.ino
+++ utils/button/button.ino
@@ -0,0 +1,55 @@
+/*
+ Button debounce / test
+ */
+
+// constants won't change. They're used here to set pin numbers
+#define BUTTON_PIN 8    // the number of the pushbutton pin
+#define LED_PIN 13      // the number of the LED pin
+
+// Variables will change:
+int ledState = HIGH;         // the current state of the output pin
+int buttonState;             // the current reading from the input pin
+int lastButtonState = LOW;   // the previous reading from the input pin
+
+// the following variables are long's because the time, measured in miliseconds,
+// will quickly become a bigger number than can be stored in an int.
+unsigned long lastDebounceTime = 0;  // the last time the output pin was toggled
+unsigned long debounceDelay = 50;    // the debounce time; increase if the output flickers
+
+void setup()
+{
+    pinMode(BUTTON_PIN, INPUT_PULLUP);
+    pinMode(LED_PIN, OUTPUT);
+}
+
+void loop()
+{
+    // read the state of the switch into a local variable:
+    int reading = digitalRead(BUTTON_PIN);
+
+    // check to see if you just pressed the button
+    // (i.e. the input went from LOW to HIGH),  and you've waited
+    // long enough since the last press to ignore any noise:
+
+    // If the switch changed, due to noise or pressing:
+    if (reading != lastButtonState)
+    {
+        // reset the debouncing timer
+        lastDebounceTime = millis();
+    }
+
+    if ((millis() - lastDebounceTime) > debounceDelay)
+    {
+        // whatever the reading is at, it's been there for longer
+        // than the debounce delay, so take it as the actual current state:
+        buttonState = reading;
+    }
+
+    // set the LED using the state of the button:
+    digitalWrite(LED_PIN, buttonState);
+
+    // save the reading.  Next time through the loop,
+    // it'll be the lastButtonState:
+    lastButtonState = reading;
+}
+


Create sensorflare-relayboard.ino

Create sensorflare-relayboard.ino

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

--- sensorflare-relayboard.ino
+++ sensorflare-relayboard.ino
@@ -0,0 +1,26 @@
+//Include the SensorFlare library
+#include "sensorflare.h"
+
+//Initialize objects from the library
+//One object of the class "DigitalOut" is initialized for
+//every digital output that will be remote control
+SensorFlare::DigitalOut outputPin1(D7);
+SensorFlare::DigitalOut outputPin2(D6);
+SensorFlare::DigitalOut outputPin3(D5);
+SensorFlare::DigitalOut outputPin4(D4);
+
+void setup() {
+
+// Call the begin() functions for every object of the classes "DigitalOut" and
+//"PWMout" to be wired up correct and available.
+    outputPin1.begin();
+    outputPin2.begin();
+    outputPin3.begin();
+    outputPin4.begin();
+
+}
+
+void loop() {
+
+
+}


Code sorting and remote GPIO control thru serial commands

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/jadalqui/ha_arduino.git/'


REV14 hardware test

REV14 hardware test

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

--- hardware/REV14/rn2483test/rn2483test.ino
+++ hardware/REV14/rn2483test/rn2483test.ino
@@ -0,0 +1,56 @@
+uint8_t ch = 0;
+
+void setup() {
+  // put your setup code here, to run once:
+  Serial.begin(19200);
+  Serial.println("start");
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  uint8_t inBuf[64];
+  uint8_t outBuf[128];
+
+  for(uint8_t i = 0; i < sizeof(inBuf); i++) {
+    inBuf[i] = i + (ch * sizeof(inBuf));
+  }
+
+  Serial.print("ReturnVal: ");
+  Serial.println(getHex(inBuf, outBuf, sizeof(outBuf)));
+  for(uint8_t i = 0; i < sizeof(inBuf); i++) {
+    Serial.print(inBuf[i], HEX);
+  }
+  Serial.println();
+  Serial.write(outBuf, sizeof(outBuf));
+  Serial.println();
+  Serial.println();
+  ch++;
+  while (ch == 4) {}
+  delay(500);
+}
+
+bool getHex(const uint8_t *string, uint8_t *output, uint8_t outputLen)
+{
+  if((string || output) == NULL) return false; // check for null pointer
+    uint8_t counter = outputLen;
+    // convert to hex
+  while(counter) {
+    uint8_t highValue = *string >> 4;
+    uint8_t lowValue  = *string & 0x0f;
+    uint8_t temp;
+
+    temp = highValue;
+    if(temp <= 9) temp += '0';
+    else temp += ('A' - 10);
+    *output++ = temp;
+
+    temp = lowValue;
+    if(temp <= 9) temp += '0';
+    else temp += ('A'-10);
+    *output++ = temp;
+
+    string++;
+    counter -= 2;
+  }
+  return true;
+}


not all the motion must happen in the interrupt routines

it takes too long

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, setting the start signeals for the motors


Initial version

Initial version

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

--- knot/arduino/bedlight.ino
+++ knot/arduino/bedlight.ino
@@ -0,0 +1,272 @@
+#include "FastLED.h"
+
+#define OVERHEAD                  0
+#define NUM_LEDS_OVERHEAD        20
+#define PIN_OVERHEAD              2
+
+#define SLEEP                     1
+#define NUM_LEDS_SLEEP          144
+#define PIN_SLEEP                 3
+
+#define BED_LEFT_CENTER           2
+#define NUM_LEDS_BED_LEFT_CENTER 32
+#define PIN_BED_LEFT_CENTER       4
+
+#define BED_RIGHT                 3
+#define NUM_LEDS_BED_RIGHT       18
+#define PIN_BED_RIGHT             5
+
+#define COOLING                  80
+#define SPARKING                120
+#define INTENSITYDIFF            95
+
+#define SECOND                 1000
+#define MINUTE        (60 * SECOND)
+#define HOUR          (60 * MINUTE)
+
+#define PLANT_MEASURE_PIN        A0
+#define PLANT_ENABLE_PIN         10
+#define PLANT_ENABLE_DELTA       23
+#define PLANT_UPDATE_VALUE     1000
+#define PLANT_ENABLE_COUNTER   (PLANT_UPDATE_VALUE - PLANT_ENABLE_DELTA)
+
+#define COMMAND_RGB               0
+#define COMMAND_HSV               1
+#define COMMAND_FIRE              2
+
+#define DATA_SIZE            (50*3)
+
+CRGB     OverheadLeds      [NUM_LEDS_OVERHEAD        ];
+CRGB     SleepLeds         [NUM_LEDS_SLEEP           ];
+CRGB     BedLedsLeftCenter [NUM_LEDS_BED_LEFT_CENTER ];
+CRGB     BedLedsRight      [NUM_LEDS_BED_RIGHT       ];
+
+         uint16_t PlantCounter    = 0;
+
+volatile bool     newCommand      = false;
+volatile uint8_t  DataIndex       = 0;
+volatile uint8_t  Command         = 0;
+volatile uint8_t  Device          = 0;
+volatile uint8_t  data[DATA_SIZE];
+volatile uint8_t  SleepFireActive = 0;
+volatile uint8_t  BedFireActive   = 0;
+
+void setup() {
+
+  Serial.begin(9600);
+
+  pinMode(PLANT_ENABLE_PIN, OUTPUT);
+
+  FastLED.addLeds<WS2811,  PIN_OVERHEAD,        RBG>(OverheadLeds,      NUM_LEDS_OVERHEAD        ).setCorrection( TypicalLEDStrip );
+  FastLED.addLeds<WS2812B, PIN_SLEEP,           GRB>(SleepLeds,         NUM_LEDS_SLEEP           ).setCorrection( TypicalLEDStrip );
+  FastLED.addLeds<WS2811,  PIN_BED_LEFT_CENTER, BRG>(BedLedsLeftCenter, NUM_LEDS_BED_LEFT_CENTER ).setCorrection( TypicalLEDStrip );
+  FastLED.addLeds<WS2811,  PIN_BED_RIGHT,       BRG>(BedLedsRight,      NUM_LEDS_BED_RIGHT       ).setCorrection( TypicalLEDStrip );
+
+  FastLED.clear(true);
+  FastLED.show();
+
+  PlantCounter = 0;
+
+}
+
+void serialEvent() {
+
+  while (Serial.available()) {
+
+    uint8_t c = (uint8_t)Serial.read();
+
+    if (c == ';') {
+      newCommand  = true;
+      DataIndex       = 0;
+    } else {
+      switch(DataIndex){
+        case 0:
+          Command = c;
+          break;
+        case 1:
+          Device = c;
+          break;
+        default:
+          data[(DataIndex - 2)] = c;
+          if(Command == COMMAND_FIRE && Device == SLEEP){
+            SleepFireActive  = c;
+          }
+          if(Command == COMMAND_FIRE && Device == BED_LEFT_CENTER){
+            BedFireActive    = c;
+          }
+          break;
+      }
+      DataIndex++;
+    }
+  }
+}
+
+void processCommand(){
+  if(Command == COMMAND_HSV){
+    if(Device == OVERHEAD){
+      for(uint8_t i = 0; i < NUM_LEDS_OVERHEAD; i++){
+        OverheadLeds[i] = CHSV(data[(i*3) + 0], data[(i*3) + 1], data[(i*3) + 2]);
+      }
+    }
+    if(Device == SLEEP){
+      for(uint8_t i = 0; i < NUM_LEDS_SLEEP; i++){
+        SleepLeds[i] = CHSV(data[0], data[1], data[2]);
+      }
+    }
+    if(Device == BED_LEFT_CENTER){
+      for(uint8_t i = 0; i < NUM_LEDS_BED_LEFT_CENTER; i++){
+        BedLedsLeftCenter[i] = CHSV(data[(i*3) + 0], data[(i*3) + 1], data[(i*3) + 2]);
+      }
+    }
+    if(Device == BED_RIGHT){
+      for(uint8_t i = 0; i < NUM_LEDS_BED_RIGHT; i++){
+        BedLedsRight[i] = CHSV(data[(i*3) + 0], data[(i*3) + 1], data[(i*3) + 2]);
+      }
+    }
+  }
+  if(Command == COMMAND_RGB){
+    if(Device == OVERHEAD){
+      for(uint8_t i = 0; i < NUM_LEDS_OVERHEAD; i++){
+        OverheadLeds[i] = CRGB(data[(i*3) + 0], data[(i*3) + 1], data[(i*3) + 2]);
+      }
+    }
+    if(Device == SLEEP){
+      for(uint8_t i = 0; i < NUM_LEDS_SLEEP; i++){
+        SleepLeds[i] = CRGB(data[0], data[1], data[2]);
+      }
+    }
+    if(Device == BED_LEFT_CENTER){
+      for(uint8_t i = 0; i < NUM_LEDS_BED_LEFT_CENTER; i++){
+        BedLedsLeftCenter[i] = CRGB(data[(i*3) + 0], data[(i*3) + 1], data[(i*3) + 2]);
+      }
+    }
+    if(Device == BED_RIGHT){
+      for(uint8_t i = 0; i < NUM_LEDS_BED_RIGHT; i++){
+        BedLedsRight[i] = CRGB(data[(i*3) + 0], data[(i*3) + 1], data[(i*3) + 2]);
+      }
+    }
+  }
+  for(uint8_t i = 0; i < DATA_SIZE; i++){
+    data[i] = 0;
+  }
+  newCommand = false;
+}
+
+void plantCheck(){
+
+  PlantCounter++;
+
+  if (PlantCounter > PLANT_ENABLE_COUNTER){
+    digitalWrite(PLANT_ENABLE_PIN, HIGH);
+  }else{
+    digitalWrite(PLANT_ENABLE_PIN, LOW);
+  }
+
+  if (PlantCounter > PLANT_UPDATE_VALUE){
+    Serial.println(analogRead(PLANT_MEASURE_PIN));
+    digitalWrite(PLANT_ENABLE_PIN, LOW);
+    PlantCounter = 0;
+  }
+
+}
+
+void loop() {
+
+  plantCheck();
+
+  if(SleepFireActive > 0){
+     SleepFire(SleepFireActive);
+  }
+
+  if(BedFireActive > 0){
+     BedFire(BedFireActive);
+  }
+
+  if(newCommand){
+    processCommand();
+  }
+
+  FastLED.show();
+}
+
+void BedFire(uint8_t intensity){
+  // Array of temperature readings at each simulation cell
+  static uint8_t heat  [25];
+         uint8_t num  = 25;
+         uint8_t low  = 0;
+         uint8_t high = intensity;
+
+  if (intensity < INTENSITYDIFF) {
+    low  = 0;
+  } else {
+    low  = intensity - INTENSITYDIFF;
+  }
+
+  // Step 1.  Cool down every cell a little
+  for (uint8_t i = 0; i < num; i++) {
+    heat[i] = qsub8( heat[i],  random8(0, ((COOLING * 10) / num) + 2));
+  }
+
+  // Step 2.  Heat from each cell drifts 'up' and diffuses a little
+  for (uint8_t k = num - 1; k >= 2; k--) {
+    heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
+  }
+
+  // Step 3.  Randomly ignite new 'sparks' of heat near the bottom
+  if ( random8() < SPARKING ) {
+    int y = random8(7); //160 255
+    heat[y] = qadd8( heat[y], random8(low, high) );
+  }
+
+  // Step 4.  Map from heat cells to LED colors
+  for ( int j = 0; j < num; j++) {
+    CRGB color = HeatColor(heat[j]);
+      BedLedsLeftCenter[7 + j] = color;
+      if(j < 7){
+        BedLedsLeftCenter[6 - j] = color;
+      }else{
+        BedLedsRight     [j - 7] = color;
+      }
+      if(j < 10){
+        OverheadLeds[10 - 1 - j] = color;
+        OverheadLeds[10     + j] = color;
+      }
+  }
+}
+
+void SleepFire(uint8_t intensity){
+  // Array of temperature readings at each simulation cell
+  static uint8_t heat  [NUM_LEDS_SLEEP / 2];
+         uint8_t num  = NUM_LEDS_SLEEP / 2;
+         uint8_t low  = 0;
+         uint8_t high = intensity;
+
+  if (intensity < INTENSITYDIFF) {
+    low  = 0;
+  } else {
+    low  = intensity - INTENSITYDIFF;
+  }
+
+  // Step 1.  Cool down every cell a little
+  for (uint8_t i = 0; i < num; i++) {
+    heat[i] = qsub8( heat[i],  random8(0, ((COOLING * 10) / num) + 2));
+  }
+
+  // Step 2.  Heat from each cell drifts 'up' and diffuses a little
+  for (uint8_t k = num - 1; k >= 2; k--) {
+    heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
+  }
+
+  // Step 3.  Randomly ignite new 'sparks' of heat near the bottom
+  if ( random8() < SPARKING ) {
+    int y = random8(7); //160 255
+    heat[y] = qadd8( heat[y], random8(low, high) );
+  }
+
+  // Step 4.  Map from heat cells to LED colors
+  for ( int j = 0; j < num; j++) {
+    CRGB color = HeatColor(heat[j]);
+      SleepLeds[num - 1 - j] = color;
+      SleepLeds[num     + j] = color;
+  }
+}


Add simple throughput measurement program

error: pathspec 'serial/samd21-throughput/samd21-throughput.ino' did not match any file(s) known to git

--- serial/samd21-throughput/samd21-throughput.ino
+++ serial/samd21-throughput/samd21-throughput.ino
@@ -0,0 +1,86 @@
+#include "wiring_private.h"
+
+//#define USE_BINARY
+
+//           DIAGNOSTICS
+//              no    yes
+// UART bin  20000  17000
+// UART txt   4400   3000
+
+const int  sampleRate     = 3000;
+const long serialRate     = 2000000;
+const int NWORDS          = 4;
+const int WSIZE           = sizeof(uint16_t);
+const int NBYTES          = NWORDS * WSIZE;
+
+bool pushData = false;
+typedef union { uint16_t words[NWORDS]; uint8_t bytes[NBYTES]; } MODEL;
+MODEL m;
+
+TcCount16* TC = (TcCount16*) TC3;
+
+//https://forum.arduino.cc/index.php?topic=332275.15
+void setupTimer(int freqHz) {
+  const long CPU_HZ         = 48000000;
+  const long PRESCALER_CTRL = TC_CTRLA_PRESCALER_DIV16;
+  const long PRESCALER_VAL  = 16;
+  const long matchValue     = CPU_HZ / PRESCALER_VAL / freqHz;
+
+  REG_GCLK_CLKCTRL = (uint16_t) (
+    GCLK_CLKCTRL_CLKEN
+      | GCLK_CLKCTRL_GEN_GCLK0
+      | GCLK_CLKCTRL_ID (GCM_TCC2_TC3)
+  );
+  while (GCLK->STATUS.bit.SYNCBUSY);
+
+  TC->CTRLA.bit.ENABLE = false;
+  TC->CTRLA.reg |= (
+    TC_CTRLA_MODE_COUNT16
+    | TC_CTRLA_WAVEGEN_MFRQ  // Use match mode, that resets when match hit
+    | PRESCALER_CTRL
+  );
+  TC->CC[0].reg = matchValue - 1;          // 0 is counted as well, thus -1
+
+  TC->INTENSET.reg = 0;                    // Disable all interrupts
+  TC->INTENSET.bit.MC0 = true;             // Enable the compare interrupt
+
+  NVIC_EnableIRQ(TC3_IRQn);
+
+  TC->CTRLA.bit.ENABLE = true;
+  while (TC->STATUS.bit.SYNCBUSY);
+}
+
+void TC3_Handler (void) {
+  if (TC->INTFLAG.bit.MC0) {
+    TC->INTFLAG.bit.MC0 = true;
+    pushData = true;
+  }
+}
+
+void setup() {
+  pinMode(LED_BUILTIN, OUTPUT);
+  SerialUSB.begin(serialRate);
+  setupTimer(sampleRate);
+  for (int i = 0; i < NWORDS; i++)
+    m.words[i] = i+1000;
+}
+
+void loop() {
+  static int counter = 0;
+  bool state = (counter++ >> 12) % 2;
+  digitalWrite(LED_BUILTIN, state ? HIGH : LOW);
+  int t = SerialUSB.availableForWrite();
+  if (pushData && t > NBYTES) {
+    pushData = false;
+    #ifdef USE_BINARY
+    SerialUSB.write(m.bytes, NBYTES);
+    #else
+    SerialUSB.print(t, DEC);
+    for (int i = 0; i < NWORDS; i++) {
+      SerialUSB.print('\t');
+      SerialUSB.print(m.words[i], DEC);
+    }
+    #endif
+    SerialUSB.write('\n');
+  }
+}


old AVR firmware

old AVR firmware

fatal: remote error: upload-pack: not our ref 90e2544ba470ef1d2c917325c5fd26f47fa5a8d0
fatal: the remote end hung up unexpectedly