Adding Arduino version of GPIO logic analyzer based benchmark.

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

--- examples/Analyzer/ArduinoAnalyzerDigitalPin/ArduinoAnalyzerDigitalPin.ino
+++ examples/Analyzer/ArduinoAnalyzerDigitalPin/ArduinoAnalyzerDigitalPin.ino
@@ -0,0 +1,168 @@
+/**
+ * @file ArduinoAnalyzerDigitalPin.ino
+ * @version 1.0
+ *
+ * @section License
+ * Copyright (C) 2015, 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
+ * Logic Analyzer based performance measurement of Arduino Digital
+ * Pin. Trigger on rising edge transition on ledPin. Measurements are
+ * for Arduino Uno/Nano.
+ *
+ * This file is part of the Arduino Che Cosa project.
+ */
+
+const uint8_t outPin = 8;
+const uint8_t dataPin = 9;
+const uint8_t clockPin = 10;
+const uint8_t ledPin = 13;
+uint8_t data;
+
+void setup()
+{
+  // Initial pin mode and state
+  pinMode(outPin, OUTPUT);
+  digitalWrite(outPin, 0);
+  pinMode(dataPin, OUTPUT);
+  digitalWrite(dataPin, 0);
+  pinMode(clockPin, OUTPUT);
+  digitalWrite(clockPin, 0);
+  pinMode(ledPin, OUTPUT);
+  digitalWrite(ledPin, 0);
+
+  // Initial data
+  data = random(255);
+
+  // Allow some time to start logic analyzer trigger
+  delay(2000);
+
+  // Trigger sampling
+  digitalWrite(ledPin, 1);
+  digitalWrite(ledPin, 0);
+  delayMicroseconds(50);
+  digitalWrite(ledPin, 1);
+  digitalWrite(ledPin, 0);
+  delayMicroseconds(50);
+}
+
+void loop()
+{
+  // Measure overhead of test case marker;
+  // 5.125 us per pulse
+  digitalWrite(ledPin, 1);
+  digitalWrite(ledPin, 0);
+  delayMicroseconds(10);
+
+  // Measure four pulses;
+  // 45.6250 us (10.125 us per pulse)
+  digitalWrite(ledPin, 1);
+  digitalWrite(outPin, 1);
+  digitalWrite(outPin, 0);
+  digitalWrite(outPin, 1);
+  digitalWrite(outPin, 0);
+  digitalWrite(outPin, 1);
+  digitalWrite(outPin, 0);
+  digitalWrite(outPin, 1);
+  digitalWrite(outPin, 0);
+  digitalWrite(ledPin, 0);
+  delayMicroseconds(10);
+
+  // Measure clocked serial transfer of a byte;
+  // 167.5625 us (20.30 us per bit)
+  digitalWrite(ledPin, 1);
+  for(uint8_t bit = 0x80; bit != 0; bit >>= 1) {
+    digitalWrite(dataPin, data & bit);
+    digitalWrite(clockPin, 1);
+    digitalWrite(clockPin, 0);
+  }
+  digitalWrite(ledPin, 0);
+  delayMicroseconds(10);
+
+  // Measure clocked serial transfer of a byte with const value;
+  // 169.370 us (21.11 us per bit)
+  digitalWrite(ledPin, 1);
+  for(uint8_t bit = 0x80; bit != 0; bit >>= 1) {
+    if (data & bit) digitalWrite(dataPin, 1); else digitalWrite(dataPin, 0);
+    digitalWrite(clockPin, 1);
+    digitalWrite(clockPin, 0);
+  }
+  digitalWrite(ledPin, 0);
+  delayMicroseconds(10);
+
+  // Measure clocked serial transfer of a byte fully unrolled;
+  // 165.0 us (19.98 us per bit)
+  digitalWrite(ledPin, 1);
+  digitalWrite(dataPin, data & 0x80);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  digitalWrite(dataPin, data & 0x40);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  digitalWrite(dataPin, data & 0x20);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  digitalWrite(dataPin, data & 0x10);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  digitalWrite(dataPin, data & 0x08);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  digitalWrite(dataPin, data & 0x04);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  digitalWrite(dataPin, data & 0x02);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  digitalWrite(dataPin, data & 0x01);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  digitalWrite(ledPin, 0);
+  delayMicroseconds(10);
+
+  // Measure clocked serial transfer of a byte with const value,
+  // fully unrolled;
+  // 172.9375 us (20.98 us per bit)
+  digitalWrite(ledPin, 1);
+  if (data & 0x80) digitalWrite(dataPin, 1); else digitalWrite(dataPin, 0);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  if (data & 0x40) digitalWrite(dataPin, 1); else digitalWrite(dataPin, 0);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  if (data & 0x20) digitalWrite(dataPin, 1); else digitalWrite(dataPin, 0);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  if (data & 0x10) digitalWrite(dataPin, 1); else digitalWrite(dataPin, 0);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  if (data & 0x08) digitalWrite(dataPin, 1); else digitalWrite(dataPin, 0);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  if (data & 0x04) digitalWrite(dataPin, 1); else digitalWrite(dataPin, 0);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  if (data & 0x02) digitalWrite(dataPin, 1); else digitalWrite(dataPin, 0);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  if (data & 0x01) digitalWrite(dataPin, 1); else digitalWrite(dataPin, 0);
+  digitalWrite(clockPin, 1);
+  digitalWrite(clockPin, 0);
+  digitalWrite(ledPin, 0);
+  delayMicroseconds(10);
+
+  // New data value
+  data = random(255);
+  delay(1000);
+}
+


FEED ID, API and M2X Master Key!

FEED ID, API and M2X Master Key!

error: pathspec 'SmartKitchen-Emdebbed' did not match any file(s) known to git
error: pathspec 'System/Software/Arduino/Wifi' did not match any file(s) known to git
error: pathspec 'CC3000/Wifi_testcoding/Wifi_testcoding.ino' did not match any file(s) known to git


Piano Tone off-notes fixed

Piano Tone off-notes fixed

Used to jump from B to E, fixed it to jump from B to C

error: pathspec 'Action' did not match any file(s) known to git
error: pathspec 'Modules/Piano' did not match any file(s) known to git
error: pathspec 'Synthesizer/PianoSynthesizerATtiny/PianoSynthesizerATtiny.ino' did not match any file(s) known to git


Asservissement: résolution des couilles dans l'asservissement

error: pathspec 'Module' did not match any file(s) known to git
error: pathspec 'Moteur/Software/Asservissement/Asservissement' did not match any file(s) known to git
error: pathspec 'vitesse/Asservissement' did not match any file(s) known to git
error: pathspec 'vitesse/asservissementVitesse.ino' did not match any file(s) known to git


add arduino code

add arduino code

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

--- slushiesensor.ino
+++ slushiesensor.ino
@@ -0,0 +1,104 @@
+
+// Get 1-wire Library here: http://www.pjrc.com/teensy/td_libs_OneWire.html
+#include <OneWire.h>
+
+#include <TM1638.h>
+
+TM1638 module(5, 3, 4 );
+
+int current = 0;
+
+
+#define ONE_WIRE_BUS_PIN 2
+
+OneWire ds(ONE_WIRE_BUS_PIN);
+
+// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html
+
+byte probe01[8] = { 0x28, 0x09, 0xD9, 0xDD, 0x04, 0x00, 0x00, 0x27 };
+byte probe02[8] = { 0x28, 0x5D, 0x78, 0xDE, 0x04, 0x00, 0x00, 0xA3 };
+byte probe03[8] = { 0x28, 0x50, 0x05, 0xDE, 0x04, 0x00, 0x00, 0x68 };
+
+void setup() {
+  // start serial port to show results
+  Serial.begin(9600);
+}
+
+void loop() {
+  checkButtons();
+  updateDisplay();
+  delay(100);
+}
+
+void checkButtons(void) {
+  int buttons = module.getButtons();
+  if (buttons != 0) {
+    Serial.println(buttons);
+    if (buttons == 0b00000001) {
+      current = 0;
+      module.setLEDs(0x0100);
+    } else if (buttons == 0b00000010) {
+      current = 1;
+      module.setLEDs(0x0200);
+    } else if (buttons == 0b00000100) {
+      current = 2;
+      module.setLEDs(0x0400);
+    }
+  }
+}
+
+void updateDisplay(void) {
+  byte (*currAdd)[8];
+  if (current == 0) {
+    currAdd = &probe01;
+  } else if (current == 1) {
+    currAdd = &probe02;
+  } else if (current == 2) {
+    currAdd = &probe03;
+  }
+  float temperature = getTemp(*currAdd);
+  module.setDisplayToSignedDecNumber(temperature*10,2,false);
+}
+
+
+// Getting the temperature from a specific sensor.
+// Modified version of http://bildr.org/2011/07/ds18b20-arduino/
+
+float getTemp(byte addr[8]){
+	//returns the temperature from one DS18S20 in DEG Celsius
+	byte data[12];
+
+	if ( OneWire::crc8( addr, 7) != addr[7]) {
+		Serial.println("CRC is not valid!");
+		return -1000;
+	}
+
+	if ( addr[0] != 0x10 && addr[0] != 0x28) {
+		Serial.print("Device is not recognized");
+		return -1000;
+	}
+
+	ds.reset();
+	ds.select(addr);
+	ds.write(0x44,1); // start conversion, with parasite power on at the end
+
+	byte present = ds.reset();
+	ds.select(addr);
+	ds.write(0xBE); // Read Scratchpad
+
+
+	for (int i = 0; i < 9; i++) { // we need 9 bytes
+		data[i] = ds.read();
+	}
+
+	ds.reset_search();
+
+	byte MSB = data[1];
+	byte LSB = data[0];
+
+	float tempRead = ((MSB << 8) | LSB); //using two's compliment
+	float TemperatureSum = tempRead / 16;
+
+	return TemperatureSum;
+
+}


Create NeoPixel_my_matrix_sprite.ino

Create NeoPixel_my_matrix_sprite.ino

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


Add ESP8266 bootstrap sketch with WPS, WiFiManager, and OTA support

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

--- OTABootstrap/OTABootstrap.ino
+++ OTABootstrap/OTABootstrap.ino
@@ -0,0 +1,110 @@
+/*
+ *  Bootstrap OTA for ESP8266
+ *
+ *  Starts up using WPS to auto configure Wifi network, if WPS unsuccesful then try WifiManager.
+ *  Once connected to Wifi it runs Over-The-Air (OTA) to enable remote program uploads to add further function.
+ *
+ *  For WPS, press the WPS button on the WiFi Access Point and then within 2 minutes power on the ESP8266 running
+ *  this sketch and it should automaticaly set the SSID and password.
+ *
+ *  Author: Anthony Elder
+ *  License: Apache License v2
+ *  https://github.com/HarringayMakerSpace/IoT/
+ */
+#include <ESP8266WiFi.h>
+
+// these for WiFiManager
+#include <DNSServer.h>
+#include <ESP8266WebServer.h>
+#include <WiFiManager.h>
+
+// these for OTA upport
+#include <ESP8266mDNS.h>
+#include <WiFiUdp.h>
+#include <ArduinoOTA.h>
+
+const String THIS_NAME = String("ESP-") + ESP.getChipId();
+
+int heartBeatInterval = 15000; // 15 seconds
+
+void setup(void) {
+    Serial.begin(115200); Serial.println();
+    Serial.print(THIS_NAME); Serial.print(__DATE__);Serial.println(__TIME__);
+
+    initWifi();
+    Serial.print("WiFi connected to "); Serial.print(WiFi.SSID()); Serial.print(", IP address: "); Serial.println(WiFi.localIP());
+
+    initOTA();
+}
+
+unsigned long lastHeartBeat;
+
+void loop() {
+    ArduinoOTA.handle();
+
+    if (millis() - lastHeartBeat > heartBeatInterval) {
+      Serial.println("loop running");
+      lastHeartBeat = millis();
+    }
+}
+
+void initWifi() {
+  WiFi.mode(WIFI_STA);
+  wifi_station_set_auto_connect(true);
+
+  // wait 10 seconds to see if auto connect to previous network
+  Serial.println("Connecting to previous Wifi network...");
+  unsigned long startMs = millis();
+  while (millis() - startMs < 10000) {
+    if (WiFi.status() == WL_CONNECTED) {
+       return;
+    }
+    delay(1);
+  }
+
+  Serial.println("Trying WPS connection...");
+  bool wpsSuccess = WiFi.beginWPSConfig();
+  if(wpsSuccess && WiFi.SSID().length() > 0) {
+      // wait for connect...
+      int startMs = millis();
+      while (millis() - startMs < 10000) {
+        if (WiFi.status() == WL_CONNECTED) {
+          return;
+        }
+        delay(1);
+      }
+  }
+
+  // still no connection so try WifiManager
+  WiFiManager wifiManager;
+  wifiManager.setTimeout(240);
+  if(!wifiManager.autoConnect(THIS_NAME.c_str())) {
+    Serial.println("*** failed to connect to Wifi. Restarting...");
+    // restart and try connecting again (WiFi AP might have been down - power cut, etc)
+    ESP.reset();
+  }
+}
+
+void initOTA() {
+  ArduinoOTA.setHostname(THIS_NAME.c_str());
+
+  ArduinoOTA.onStart([]() {
+    Serial.println("Start");
+  });
+  ArduinoOTA.onEnd([]() {
+    Serial.println("\nEnd");
+  });
+  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
+    Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
+  });
+  ArduinoOTA.onError([](ota_error_t error) {
+    Serial.printf("Error[%u]: ", error);
+    if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
+    else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
+    else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
+    else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
+    else if (error == OTA_END_ERROR) Serial.println("End Failed");
+  });
+  ArduinoOTA.begin();
+}
+


arduinoMega

arduinoMega

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

--- arduinoMega/arduinoMega.ino
+++ arduinoMega/arduinoMega.ino
@@ -0,0 +1,9 @@
+void setup() {
+  // put your setup code here, to run once:
+
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+
+}


Add digitalWrit, blinking led code

Add digitalWrit, blinking led 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/jaredkotoff/CSUFIEEECS.git/'


Zoals currently in duurtest aan het runnen is -- luister met:

 mosquitto_sub  -h space.vijn.org -t duurtest

error: pathspec 'test/PoE-test/ETH-LAN8720-OTA-MFRC522-callback-mqtt/ETH-LAN8720-OTA-MFRC522-callback-mqtt.ino' did not match any file(s) known to git

--- test/PoE-test/ETH-LAN8720-OTA-MFRC522-callback-mqtt/ETH-LAN8720-OTA-MFRC522-callback-mqtt.ino
+++ test/PoE-test/ETH-LAN8720-OTA-MFRC522-callback-mqtt/ETH-LAN8720-OTA-MFRC522-callback-mqtt.ino
@@ -0,0 +1,343 @@
+/*
+    This sketch shows the Ethernet event usage
+    First light Aart 10-12-2017
+
+*/
+
+#define ETH_PHY_ADDR      1
+#define ETH_PHY_MDC       23
+#define ETH_PHY_MDIO      18
+#define ETH_PHY_POWER     17
+#define ETH_PHY_TYPE      ETH_PHY_LAN8720
+
+#if 0
+// Labeling as on the 'red' RFID MFRC522 boards and numbers
+// as per labels on the back of PoE board v1.00.
+//
+// See also page 525 of https://pc7x.net/archive/misc/ESP32_Programming.pdf
+//
+#define MFRC522_SCK     (14)
+#define MFRC522_MISO    (12)
+#define MFRC522_MOSI    (13)
+#define MFRC522_SS      (15)
+#define MFRC522_3V3     /* 3v3 */
+#define MFRC522_GND     /* gnd pin */
+#define MFRC522_IRQ     (33)
+#define MFRC522_RSTO    (32)
+#endif
+
+// Labeleing as per `blue' RFID MFRC522 - MSL 1471 'fixed'
+//
+#define MFRC522_SDA      (15)
+#define MFRC522_SCK     (14)
+#define MFRC522_MOSI    (13)
+#define MFRC522_MISO    (12)
+#define MFRC522_IRQ     (33)
+#define MFRC522_GND     /* gnd pin */
+#define MFRC522_RSTO    (32)
+#define MFRC522_3V3     /* 3v3 */
+
+#define MFRC522_SS MFRC522_SDA
+
+#include <ETH.h>
+#include <SPI.h>
+
+#include <ArduinoOTA.h>
+
+#include <PubSubClient.h>
+#include <MFRC522.h>    // Requires modifed MFRC522 (see pull rq) or the -master branch as of late DEC 2017.
+                        // https://github.com/miguelbalboa/rfid.git
+
+SPIClass spirfid = SPIClass(VSPI);
+const SPISettings spiSettings = SPISettings(SPI_CLOCK_DIV4, MSBFIRST, SPI_MODE0);
+MFRC522 mfrc522(MFRC522_SS, MFRC522_RSTO, &spirfid, spiSettings);
+
+const char mqtt_host[] = "space.vijn.org";
+const unsigned short mqtt_port = 1883;
+const char topic[] = "duurtest";
+
+static bool eth_connected = false;
+
+static bool ota = false;
+void enableOTA() {
+  if (ota)
+    return;
+
+  // Port defaults to 3232
+  // ArduinoOTA.setPort(3232);
+
+  // Hostname defaults to esp3232-[MAC]
+  // ArduinoOTA.setHostname("myesp32");
+
+  // No authentication by default
+  // ArduinoOTA.setPassword("admin");
+
+  // Password can be set with it's md5 value as well
+  // MD5(admin) = 21232f297a57a5a743894a0e4a801fc3
+  // ArduinoOTA.setPasswordHash("21232f297a57a5a743894a0e4a801fc3");
+
+
+  ArduinoOTA.onStart([]() {
+    String type;
+    if (ArduinoOTA.getCommand() == U_FLASH)
+      type = "sketch";
+    else // U_SPIFFS
+      type = "filesystem";
+
+    // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
+    Serial.println("Start updating " + type);
+  });
+
+  ArduinoOTA.onEnd([]() {
+    Serial.println("\nEnd");
+  });
+
+  ArduinoOTA.onError([](ota_error_t error) {
+    Serial.printf("Error[%u]: ", error);
+    if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
+    else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
+    else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
+    else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
+    else if (error == OTA_END_ERROR) Serial.println("End Failed");
+  });
+
+  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
+    static int lp = -1 ;
+    int p = progress / (total / 10);
+    if (p != lp) Serial.printf("Progress: %u%%\n", p * 10);
+    lp = p;
+  });
+
+  // Unfortunately - deep in OTA it auto defaults to Wifi. So we
+  // force it to ETH -- requires pull RQ https://github.com/espressif/arduino-esp32/issues/944
+  // and https://github.com/espressif/esp-idf/issues/1431.
+  //
+  ArduinoOTA.begin(TCPIP_ADAPTER_IF_ETH);
+
+  Serial.println("\nOTA enabled.\n");
+  ota = true;
+}
+
+void WiFiEvent(WiFiEvent_t event)
+{
+  switch (event) {
+    case SYSTEM_EVENT_ETH_START:
+      Serial.println("ETH Started");
+      //set eth hostname here
+      ETH.setHostname("esp32-ethernet");
+      break;
+    case SYSTEM_EVENT_ETH_CONNECTED:
+      Serial.println("ETH Connected");
+      break;
+    case SYSTEM_EVENT_ETH_GOT_IP:
+    case SYSTEM_EVENT_STA_GOT_IP:
+      Serial.print("ETH MAC: ");
+      Serial.print(ETH.macAddress());
+      Serial.print(", IPv4: ");
+      Serial.print(ETH.localIP());
+      if (ETH.fullDuplex()) {
+        Serial.print(", FULL_DUPLEX");
+      }
+      Serial.print(", ");
+      Serial.print(ETH.linkSpeed());
+      Serial.printf("Mbps (event %d)\n", event);
+      eth_connected = true;
+      break;
+    case SYSTEM_EVENT_ETH_DISCONNECTED:
+      Serial.printf("ETH Disconnected (event %d)\n", event);
+      eth_connected = false;
+      break;
+    case SYSTEM_EVENT_ETH_STOP:
+      Serial.println("ETH Stopped");
+      eth_connected = false;
+      break;
+    default:
+      Serial.printf("Unknown event %d\n", event);
+      break;
+  }
+}
+
+void testClient(const char * host, uint16_t port)
+{
+  Serial.print("\nconnecting to ");
+  Serial.println(host);
+
+  WiFiClient client;
+  if (!client.connect(host, port)) {
+    Serial.println("connection failed");
+    return;
+  }
+  client.printf("GET / HTTP/1.1\r\nHost: %s\r\n\r\n", host);
+  while (client.connected() && !client.available());
+  while (client.available()) {
+    Serial.write(client.read());
+  }
+
+  Serial.println("closing connection\n");
+  client.stop();
+}
+
+volatile boolean irqCardSeen = false;
+
+void readCard() {
+  irqCardSeen = true;
+}
+
+/* The function sending to the MFRC522 the needed commands to activate the reception
+*/
+void activateRec(MFRC522 mfrc522) {
+  mfrc522.PCD_WriteRegister(mfrc522.FIFODataReg, mfrc522.PICC_CMD_REQA);
+  mfrc522.PCD_WriteRegister(mfrc522.CommandReg, mfrc522.PCD_Transceive);
+  mfrc522.PCD_WriteRegister(mfrc522.BitFramingReg, 0x87);
+}
+
+/*  The function to clear the pending interrupt bits after interrupt serving routine
+*/
+void clearInt(MFRC522 mfrc522) {
+  mfrc522.PCD_WriteRegister(mfrc522.ComIrqReg, 0x7F);
+}
+
+void callback(char* topic, byte* payload, unsigned int length) {
+  // handle message arrived
+}
+
+
+WiFiClient wifiClient;
+PubSubClient client(wifiClient);
+
+static long lastReconnectAttempt = 0;
+const char * pname;
+
+boolean reconnect() {
+  if (client.connect(pname ? pname : "test-unit")) {
+    client.publish(topic, "reconnected");
+    // client.subscribe("inTopic");
+  }
+  return client.connected();
+}
+
+void setup()
+{
+  pname = rindex(__FILE__, '/');
+
+  Serial.begin(115200);
+  Serial.print("\n\n\nStart ");
+  Serial.print(pname);
+  Serial.println(" " __DATE__ " " __TIME__);
+
+  WiFi.onEvent(WiFiEvent);
+
+  ETH.begin();
+
+  Serial.println("SPI init");
+  spirfid.begin(MFRC522_SCK, MFRC522_MISO, MFRC522_MOSI, MFRC522_SS);
+
+  Serial.printf("MFRC522 init SPI=%p spi=%p setting=%d/%d/%d\n", &SPI, &spirfid, spiSettings._clock, spiSettings._bitOrder, spiSettings._dataMode);
+  mfrc522.PCD_Init();   // Init MFRC522
+
+  Serial.println("MFRC522 dump version");
+  mfrc522.PCD_DumpVersionToSerial();  // Show details of PCD - MFRC522 Card Reader details
+
+  Serial.println("MFRC522 IRQ and callback setup.");
+
+  pinMode(MFRC522_IRQ, INPUT_PULLUP);
+  attachInterrupt(digitalPinToInterrupt(MFRC522_IRQ), readCard, FALLING);
+
+  byte regVal = 0xA0; //rx irq
+  mfrc522.PCD_WriteRegister(mfrc522.ComIEnReg, regVal);
+
+  Serial.println("Setting up MQTT\n");
+  client.setServer(mqtt_host, mqtt_port);
+  client.setCallback(callback);
+
+  Serial.println("setup() done");
+}
+
+
+long cardcount = 0;
+
+void loop()
+{
+  if (eth_connected) {
+    if (ota)
+      ArduinoOTA.handle();
+    else
+      enableOTA();
+
+    if (!client.connected()) {
+      long now = millis();
+      if (now - lastReconnectAttempt > 5000) {
+        lastReconnectAttempt = now;
+        if (reconnect()) {
+          lastReconnectAttempt = 0;
+        }
+      }
+    } else {
+      client.loop();
+    }
+  }
+  static unsigned long tock = 0;
+  if (millis() - tock  > 30 * 1000) {
+    Serial.println("Tock - 30 seconds");
+    tock = millis();
+  }
+
+#if 0
+  static unsigned long google = 0;
+  if (eth_connected && millis() - google > 60 * 1000) {
+    testClient("google.com", 80);
+    google = millis();
+  }
+#endif
+  //
+#if 0
+  static byte i;
+  pinMode(MFRC522_SS, OUTPUT);
+  spirfid.beginTransaction(spiSettings);
+  digitalWrite(MFRC522_SS, LOW);
+  spirfid.transfer(i++);
+  digitalWrite(MFRC522_SS, HIGH);
+  spirfid.endTransaction();
+  return;
+#endif
+
+  if (irqCardSeen) {
+    if (mfrc522.PICC_ReadCardSerial()) {
+      MFRC522::Uid uid = mfrc522.uid;
+      cardcount++;
+
+      Serial.print("Card detected: len=(");
+      Serial.print(uid.size);
+      Serial.print(") ");
+
+      String uidStr = "";
+      for (int i = 0; i < uid.size; i++) {
+        if (i) uidStr += "-";
+        uidStr += String(uid.uidByte[i], DEC);
+      };
+
+      uidStr += " -- counted ";
+      uidStr += String(cardcount, DEC);
+      uidStr += " cards sofar";
+
+      Serial.println(uidStr.c_str());
+
+      client.publish(topic,uidStr.c_str());
+    };
+    mfrc522.PICC_HaltA(); // Stop reading
+
+    clearInt(mfrc522);
+    irqCardSeen = false;
+  };
+
+  // Re-arm/retrigger the scanning regularly.
+  {
+    static unsigned long reminderToRead = 0;
+    if (millis() - reminderToRead > 100) {
+      activateRec(mfrc522);
+      reminderToRead = millis();
+    }
+  }
+  // Dump debug info about the card; PICC_HaltA() is automatically called
+  // mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
+}


Added external trigger to start capture demo

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

--- ArduCAM/examples/mini/ArduCAM_Mini_PIR_Trig_Capture2SD.ino/ArduCAM_Mini_PIR_Trig_Capture2SD.ino
+++ ArduCAM/examples/mini/ArduCAM_Mini_PIR_Trig_Capture2SD.ino/ArduCAM_Mini_PIR_Trig_Capture2SD.ino
@@ -0,0 +1,232 @@
+// ArduCAM demo (C)2019 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 2MP/5MP sensor.
+// It will run the ArduCAM 2MP/5MP as a real 2MP/5MP 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 When the PIR sensor detects the rising edge signal
+// 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 V4.0.0 (or later) library and ArduCAM 2MP/5MP shield
+// and use Arduino IDE 1.6.8 compiler or above
+
+/***************Hardware Connection******************/
+/*
+		UNO         PIR
+		VCC         VCC
+		7            S
+		GND         GND
+***************************************************/
+
+
+#include <ArduCAM.h>
+#include <Wire.h>
+#include <SPI.h>
+#include <SD.h>
+#include "memorysaver.h"
+//This demo can only work on OV2640_MINI_2MP or OV5642_MINI_5MP or OV5642_MINI_5MP_BIT_ROTATION_FIXED platform.
+#if !(defined OV5642_MINI_5MP || defined OV5642_MINI_5MP_BIT_ROTATION_FIXED || defined OV2640_MINI_2MP || defined OV3640_MINI_3MP)
+  #error Please select the hardware platform and camera module in the ../libraries/ArduCAM/memorysaver.h file
+#endif
+#define SD_CS 9
+#define HCSR 7
+const int SPI_CS = 5;
+#if defined (OV2640_MINI_2MP)
+  ArduCAM myCAM( OV2640, SPI_CS );
+#elif defined (OV3640_MINI_3MP)
+  ArduCAM myCAM( OV3640, SPI_CS );
+#else
+  ArduCAM myCAM( OV5642, SPI_CS );
+#endif
+int read_HCSR501()
+{
+  static int val;
+  pinMode(HCSR, INPUT);
+  return( digitalRead(HCSR));
+}
+void myCAMSaveToSDFile(){
+char str[8];
+byte buf[256];
+static int i = 0;
+static int k = 0;
+uint8_t temp = 0,temp_last=0;
+uint32_t length = 0;
+bool is_header = false;
+File outFile;
+//Flush the FIFO
+myCAM.flush_fifo();
+//Clear the capture done flag
+myCAM.clear_fifo_flag();
+//Start capture
+myCAM.start_capture();
+Serial.println(F("start Capture"));
+while(!myCAM.get_bit(ARDUCHIP_TRIG , CAP_DONE_MASK));
+Serial.println(F("Capture Done."));
+length = myCAM.read_fifo_length();
+Serial.print(F("The fifo length is :"));
+Serial.println(length, DEC);
+if (length >= MAX_FIFO_SIZE) //384K
+{
+  Serial.println(F("Over size."));
+  return ;
+}
+if (length == 0 ) //0 kb
+{
+  Serial.println(F("Size is 0."));
+  return ;
+}
+//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(F("File open faild"));
+  return;
+}
+myCAM.CS_LOW();
+myCAM.set_fifo_burst();
+while ( length-- )
+{
+  temp_last = temp;
+  temp =  SPI.transfer(0x00);
+  //Read JPEG data from FIFO
+  if ( (temp == 0xD9) && (temp_last == 0xFF) ) //If find the end ,break while,
+  {
+    buf[i++] = temp;  //save the last  0XD9
+    //Write the remain bytes in the buffer
+    myCAM.CS_HIGH();
+    outFile.write(buf, i);
+    //Close the file
+    outFile.close();
+    Serial.println(F("Image save OK."));
+    is_header = false;
+    i = 0;
+  }
+  if (is_header == true)
+  {
+    //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();
+    }
+  }
+  else if ((temp == 0xD8) & (temp_last == 0xFF))
+  {
+    is_header = true;
+    buf[i++] = temp_last;
+    buf[i++] = temp;
+  }
+}
+}
+
+void setup(){
+uint8_t vid, pid;
+uint8_t temp;
+Wire.begin();
+Serial.begin(115200);
+Serial.println(F("ArduCAM Start!"));
+//set the CS as an output:
+pinMode(SPI_CS,OUTPUT);
+// initialize SPI:
+SPI.begin();
+while(1){
+  //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(F("SPI interface Error!"));
+    delay(1000);continue;
+  }else{
+    Serial.println(F("SPI interface OK."));break;
+  }
+}
+//Initialize SD Card
+while(!SD.begin(SD_CS)){
+  Serial.println(F("SD Card Error!"));delay(1000);
+}
+Serial.println(F("SD Card detected."));
+
+#if defined (OV2640_MINI_2MP)
+  while(1){
+    //Check if the camera module type is OV2640
+    myCAM.wrSensorReg8_8(0xff, 0x01);
+    myCAM.rdSensorReg8_8(OV2640_CHIPID_HIGH, &vid);
+    myCAM.rdSensorReg8_8(OV2640_CHIPID_LOW, &pid);
+    if ((vid != 0x26 ) && (( pid != 0x41 ) || ( pid != 0x42 ))){
+      Serial.println(F("Can't find OV2640 module!"));
+      delay(1000);continue;
+    }
+    else{
+      Serial.println(F("OV2640 detected."));break;
+    }
+  }
+#elif defined (OV3640_MINI_3MP)
+  while(1){
+    //Check if the camera module type is OV3640
+    myCAM.rdSensorReg16_8(OV3640_CHIPID_HIGH, &vid);
+    myCAM.rdSensorReg16_8(OV3640_CHIPID_LOW, &pid);
+    if ((vid != 0x36) || (pid != 0x4C)){
+      Serial.println(F("Can't find OV3640 module!"));
+      delay(1000);continue;
+    }else{
+      Serial.println(F("OV3640 detected."));break;
+    }
+ }
+#else
+  while(1){
+    //Check if the camera module type is OV5642
+    myCAM.wrSensorReg16_8(0xff, 0x01);
+    myCAM.rdSensorReg16_8(OV5642_CHIPID_HIGH, &vid);
+    myCAM.rdSensorReg16_8(OV5642_CHIPID_LOW, &pid);
+    if((vid != 0x56) || (pid != 0x42)){
+      Serial.println(F("Can't find OV5642 module!"));
+      delay(1000);continue;
+    }
+    else{
+      Serial.println(F("OV5642 detected."));break;
+    }
+  }
+#endif
+myCAM.set_format(JPEG);
+myCAM.InitCAM();
+#if defined (OV2640_MINI_2MP)
+  myCAM.OV2640_set_JPEG_size(OV2640_320x240);
+#elif defined (OV3640_MINI_3MP)
+  myCAM.OV3640_set_JPEG_size(OV3640_320x240);
+#else
+  myCAM.write_reg(ARDUCHIP_TIM, VSYNC_LEVEL_MASK);   //VSYNC is active HIGH
+  myCAM.OV5642_set_JPEG_size(OV5642_320x240);
+#endif
+delay(1000);
+Serial.println("Detecting...");
+}
+void loop(){
+    int now_val = read_HCSR501();
+    if(now_val == 1)
+    {
+	  Serial.println("Rising edge is detected!");
+      Serial.println(F("Start snapping..."));
+      myCAMSaveToSDFile();
+      Serial.println("Detecting...");
+    }
+      while(now_val)
+      {
+        now_val = read_HCSR501();
+      }
+}
+
+


Add files via upload

Add files via upload

Infineon Shield current sensing

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

--- telemetry_board/Profet_2_Current_Sensing/Profet_2_Current_Sensing.ino
+++ telemetry_board/Profet_2_Current_Sensing/Profet_2_Current_Sensing.ino
@@ -0,0 +1,23 @@
+int analogValue = A2;
+//IS-2 Current sense of PROFET 2
+void setup() {
+pinMode(9, OUTPUT);
+//DEN_1 DIAGNOSIS enable
+pinMode(A2, INPUT);
+
+pinMode(8, OUTPUT);
+//OUT2_0
+Serial.begin(9600);
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+digitalWrite(9, HIGH);
+digitalWrite(8, HIGH);
+
+analogValue = analogRead(A2);
+float voltage = analogValue * (21/ 1023.0);
+//for 8 volts use 35
+Serial.println(voltage);
+delay(750);
+}


Changed Tx Rx

Changed Tx Rx

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


added random server IP

added random server IP

error: pathspec 'EU_Con_Hackathon/SenseBot/Step' did not match any file(s) known to git
error: pathspec '6/EUHackathonRobot/EUHackathonRobot.ino' did not match any file(s) known to git


Example:

Example:

- Added
- Tested

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/Azrrael-exe/Ard-MSG.git/'


Added WeatherStation.ino file which Hannah Dalgliesch and Josh Walawender wrote in June 2013.

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

--- WeatherStation.ino
+++ WeatherStation.ino
@@ -0,0 +1,207 @@
+// This script is for a Weather Station that contains two RG-11 Rain Gauges,
+// a DHT22 Humidity and Temperature Sensor, two TMP36 Temperature Sensors,
+// a TSL235R Light to Frequency Sensor, and an MLX90614 Infrared Thermometer.
+//
+// Program will read sensors and periodically print out a line of text via
+// serial with the readings.
+
+
+#include <i2cmaster.h>
+#include <DHT.h>
+
+
+// Pin Constants
+const int WarningLEDpin = 13; // This LED turns on when the weather conditions are not good for observing.
+const int RainSensor1 = 7; // The Rain Gauges can be connected to any of the digital pins.
+const int RainSensor2 = 8;
+const int TMP36pin1 = 2; // The TMP36 sensors must be connected to analogue pins.
+const int TMP36pin2 = 3;
+#define DHTPIN 5 // The DHT22 is connected to a digital pin.
+#define DHTTYPE DHT22
+DHT dht(DHTPIN, DHTTYPE);
+
+
+// Thresholds for Warnings
+// --> These need to be modified after experience in the field
+const float Threshold_VeryCloudy = -20.0;
+const float Threshold_Cloudy     = -40.0;
+const float Threshold_Humidity   = 80.0;
+
+
+// Constants for TSL235R
+volatile unsigned long cnt = 0;
+unsigned long oldcnt = 0;
+unsigned long t = 0;
+unsigned long last;
+
+void irq1()
+{
+  cnt++;
+}
+
+
+void setup() {
+    Serial.begin(9600);
+
+    Serial.print("Setup LED Pin...");
+    pinMode(WarningLEDpin, OUTPUT);
+    Serial.println("done!");
+
+    Serial.print("Setup DHT22...");
+    dht.begin();
+    Serial.println("done!");
+
+    Serial.print("Setup I2C...");
+    i2c_init(); // Initialise the i2c bus
+    PORTC = (1 << PORTC4) | (1 << PORTC5); // Enable pullups
+    Serial.println("done!");
+
+    Serial.print("Setup TSL235R...");
+    pinMode(2, INPUT); // TSL235R must use digital pin 2.
+    digitalWrite(2, HIGH);
+    attachInterrupt(0, irq1, RISING);
+    Serial.println("done!");
+
+    Serial.print("Setup first RG-11...");
+    pinMode(RainSensor1, INPUT);
+    Serial.println("done!");
+
+    Serial.print("Setup second RG-11...");
+    pinMode(RainSensor2, INPUT);
+    Serial.println("done!");
+
+
+  // print header to Serial
+    Serial.print("Light       ");
+    Serial.print("SkyTemp   ");
+    Serial.print("AmbTemp   ");
+    Serial.print("Humidity  ");
+    Serial.print("HW    ");
+    Serial.print("TempDiff  ");
+    Serial.print("CW    ");
+    Serial.print("CaseTemp 1 ");
+    Serial.print("CaseTemp 2 ");
+    Serial.print("Rain1?  ");
+    Serial.print("Rain2?  ");
+    Serial.print("Safe?  ");
+    Serial.println("");
+}
+
+void loop() {
+
+    // Read light level TSL235R in mW/m2
+    last = millis();
+    t = cnt;
+    unsigned long hz = t - oldcnt;
+    oldcnt = t;
+    float Light = (hz+50)/100; // +50 == rounding last digit
+    // print output to Serial
+    Serial.print(Light);
+    Serial.print(" mW/m2 ");
+
+    // Read sky temperature MLX90614 in Celsius
+    float SkyTemp_C = readMLX90614() - 273.15; // Converting from Kelvin to Celsius
+    // print output to Serial
+    Serial.print(SkyTemp_C);
+    Serial.print(" C   ");
+
+    // Read ambient temperature and humidity DHT22
+    float Humidity = dht.readHumidity();
+    float AmbTemp_C = dht.readTemperature();
+    // check if returns are valid, if they are NaN (not a number) then something went wrong!
+    if (isnan(AmbTemp_C) || isnan(Humidity)) {
+        Serial.println("Failed to read from DHT");
+    }
+    int HumidityWarning = 0;
+    if (Humidity > Threshold_Humidity) { HumidityWarning = 1; }
+    // print output to Serial
+    Serial.print(AmbTemp_C);
+    Serial.print(" C   ");
+    Serial.print(Humidity);
+    Serial.print(" %   ");
+    Serial.print(HumidityWarning);
+    Serial.print("     ");
+
+    // Determine Sky / Ambient Temperature Difference
+    float TempDiff = SkyTemp_C - AmbTemp_C;
+    int Cloudiness;
+    // print output to Serial
+    Serial.print(TempDiff);
+    Serial.print(" C    ");
+    if (TempDiff >= Threshold_VeryCloudy) { Cloudiness = 2; }
+    if (TempDiff >= Threshold_Cloudy && TempDiff < Threshold_VeryCloudy) { Cloudiness = 1; }
+    if (TempDiff < Threshold_Cloudy) { Cloudiness = 0; }
+    // print output to Serial
+    Serial.print(Cloudiness);
+    Serial.print("     ");
+
+    // Read case temperature from TMP36 primary
+    int TMP36reading1 = analogRead(TMP36pin1);
+    float TMP36voltage1 = (TMP36reading1 / 1024.0) * 5000;
+    float CaseTemp_C1 = (TMP36voltage1 -500) / 10.0;
+    // print output to Serial
+    Serial.print(CaseTemp_C1);
+    Serial.print(" C    ");
+
+    // Read case temperature from TMP36 secondary
+    int TMP36reading2 = analogRead(TMP36pin2);
+    float TMP36voltage2 = (TMP36reading2 / 1024.0) * 5000;
+    float CaseTemp_C2 = (TMP36voltage2 -500) / 10.0;
+    // print output to Serial
+    Serial.print(CaseTemp_C2);
+    Serial.print(" C    ");
+
+    // Are the RG-11 Rain Gauges on?
+    int rain1;
+    rain1 = digitalRead(RainSensor1);   // read the input pin
+    // print output to Serial
+    Serial.print(rain1);
+    Serial.print("      ");
+
+    int rain2;
+    rain2 = digitalRead(RainSensor2);   // read the input pin
+    // print output to Serial
+    Serial.print(rain2);
+    Serial.print("      ");
+
+    // Are conditions safe?
+    bool Safe = false;
+    if (HumidityWarning == 0 && Cloudiness <= 1) { Safe = true; }
+    if (Safe) { digitalWrite(WarningLEDpin, LOW); }
+    else { digitalWrite(WarningLEDpin, HIGH); }
+    // print output to Serial
+    Serial.print(Safe);
+    Serial.print("      ");
+
+    Serial.println("");
+}
+
+// Read MLX90614 IR thermometer and return temperature in Kelvin
+float readMLX90614(void){
+    int dev = 0x5A<<1;
+    int data_low = 0;
+    int data_high = 0;
+    int pec = 0;
+
+    i2c_start_wait(dev+I2C_WRITE);
+    i2c_write(0x07);
+
+    i2c_rep_start(dev+I2C_READ);
+    data_low = i2c_readAck(); // Read 1 byte and then send ack
+    data_high = i2c_readAck(); // Read 1 byte and then send ack
+    pec = i2c_readNak();
+    i2c_stop();
+
+    // This converts high and low bytes together and processes temperature, MSB is an error bit and is ignored for temps
+    double tempFactor = 0.02; // 0.02 degrees per LSB (measurement resolution of the MLX90614)
+    double tempData = 0x0000; // Zero out the data
+    int frac; // Data past the decimal point
+
+    // This masks off the error bit of the high byte, then moves it left 8 bits and adds the low byte.
+    tempData = (double)(((data_high & 0x007F) << 8) + data_low);
+    tempData = (tempData * tempFactor) - 0.01;
+
+    float kelvin = tempData;
+
+    return kelvin;
+}


Nibe heat pump binding: Added Arduino gateway sources.

error: pathspec 'bundles/binding/org.openhab.binding.nibeheatpump/NibeGW/NibeGW.ino' did not match any file(s) known to git

--- bundles/binding/org.openhab.binding.nibeheatpump/NibeGW/NibeGW.ino
+++ bundles/binding/org.openhab.binding.nibeheatpump/NibeGW/NibeGW.ino
@@ -0,0 +1,378 @@
+/**
+ * openHAB, the open Home Automation Bus.
+ * Copyright (C) 2010-2013, openHAB.org <admin@openhab.org>
+ *
+ * See the contributors.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, see <http://www.gnu.org/licenses>.
+ *
+ * Additional permission under GNU GPL version 3 section 7
+ *
+ * If you modify this Program, or any covered work, by linking or
+ * combining it with Eclipse (or a modified version of that library),
+ * containing parts covered by the terms of the Eclipse Public License
+ * (EPL), the licensors of this Program grant you additional permission
+ * to convey the resulting work.
+ *
+ * ----------------------------------------------------------------------------
+ *
+ *  This ARDUINO application listening data from Nibe F1145/F1245 heat pumps (RS485 bus)
+ *  and send valid frames to configurable IP/port address by UDP packets.
+ *  Application also acknowledge the valid packets to heat pump.
+ *
+ *  Ethernet and RS-485 arduino shields are required.
+ *
+ *  Serial settings: 9600 baud, 8 bits, Parity: none, Stop bits 1
+ *
+ *  MODBUS module support should be turned ON from the heat pump.
+ *
+ *  Frame format:
+ *  +----+----+----+-----+-----+----+----+-----+
+ *  | 5C | 00 | 20 | CMD | LEN |  DATA   | CHK |
+ *  +----+----+----+-----+-----+----+----+-----+
+ *
+ *  Checksum: XOR
+ *
+ *  When valid data is received (checksum ok),
+ *   ACK (0x06) should be sent to the heat pump.
+ *  When checksum mismatch,
+ *   NAK (0x15) should be sent to the heat pump.
+ *
+ *  If heat pump does not receive acknowledge in certain time period,
+ *  pump will raise an alarm and alarm mode is activated.
+ *  Actions on alarm mode can be configured. The different alternatives
+ *  are that the Heat pump stops producing hot water (default setting)
+ *  and/or reduces the room temperature.
+ *
+ *  Author: pauli.anttila@gmail.com
+ *
+ *
+ *  2.11.2013	v1.00	Initial version.
+ *  3.11.2013   v1.01
+ */
+
+#include <SPI.h>
+#include <Ethernet.h>
+#include <EthernetUdp.h>
+#include <avr/wdt.h>
+
+// ######### CONFIGURATION #######################
+
+// enable debug printouts, listen printouts e.g. via netcat (nc -l -u 50000)
+#define ENABLE_DEBUG
+
+// the media access control (ethernet hardware) address for the shield
+byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
+
+//the IP address for the shield
+byte ip[] = { 192, 168, 1, 50 };
+
+// target IP address and port where UDP packats are send
+IPAddress target_ip(192, 168, 1, 28);
+unsigned int udp_port = 9999;
+
+
+// ######### VARIABLES #######################
+
+// direction change pin for RS-485 port
+#define directionPin  2
+
+#ifdef ENABLE_DEBUG
+char verbose = 0;
+char debug_buf[100];
+#endif
+
+// state machine states
+enum e_state {
+  STATE_WAIT_START,
+  STATE_WAIT_DATA,
+  STATE_OK_MESSAGE_RECEIVED,
+  STATE_CRC_FAILURE,
+};
+
+e_state state = STATE_WAIT_START;
+
+EthernetUDP udp;
+
+// message buffer for RS-485 communication
+#define MAX_DATA_LEN 255
+byte buffer[MAX_DATA_LEN];
+
+byte index = 0;
+
+// ######### SETUP #######################
+
+void setup()  {
+  wdt_enable (WDTO_1S);
+
+  pinMode(directionPin, OUTPUT);
+  digitalWrite(directionPin, LOW);
+
+  Serial.begin(9600, SERIAL_8N1);
+
+  Ethernet.begin(mac,ip);
+  udp.begin(udp_port);
+
+  #ifdef ENABLE_DEBUG
+  if (verbose) {
+    debugPrint("\nstarted\n");
+  }
+  #endif
+}
+
+// ######### MAIN LOOP #######################
+
+void loop() {
+
+  wdt_reset ();
+
+  #ifdef ENABLE_DEBUG
+  int packetSize = udp.parsePacket();
+  if(packetSize)
+  {
+    verbose = udp.read();
+  }
+  #endif
+
+  switch(state) {
+
+    case STATE_WAIT_START:
+      if (Serial.available() > 0) {
+        byte b = Serial.read();
+
+        #ifdef ENABLE_DEBUG
+        if (verbose > 2) {
+          sprintf(debug_buf, "%02x", b);
+          debugPrint(debug_buf);
+        }
+        #endif
+
+        if (b == 0x5C) {
+          buffer[0] = b;
+          index = 1;
+          state = STATE_WAIT_DATA;
+
+          #ifdef ENABLE_DEBUG
+          if (verbose > 1) {
+            debugPrint("Frame start found\n");
+          }
+          #endif
+        }
+      }
+      break;
+
+    case STATE_WAIT_DATA:
+      if (Serial.available() > 0) {
+        byte b = Serial.read();
+
+        #ifdef ENABLE_DEBUG
+        if (verbose > 2) {
+          sprintf(debug_buf, "%02x", b);
+          debugPrint(debug_buf);
+        }
+        #endif
+
+        if (index >= MAX_DATA_LEN)
+        {
+          // too long message
+          state = STATE_WAIT_START;
+        }
+        else
+        {
+          buffer[index++] = b;
+
+          int msglen = checkNibeMessage(buffer, index);
+
+          #ifdef ENABLE_DEBUG
+          if (verbose > 1) {
+            sprintf(debug_buf, "\ncheckMsg=%d\n", msglen);
+            debugPrint(debug_buf);
+          }
+          #endif
+
+          switch (msglen)
+          {
+            case 0:   break; // Ok, but not ready
+            case -1:  state = STATE_WAIT_START; break; // Invalid message
+            case -2:  state = STATE_CRC_FAILURE; break; // Checksum error
+            default:  state = STATE_OK_MESSAGE_RECEIVED; break;
+          }
+        }
+      }
+      break;
+
+    case STATE_CRC_FAILURE:
+      #ifdef ENABLE_DEBUG
+      if (verbose) {
+        debugPrint("CRC failure\n");
+      }
+      #endif
+
+      sendNak();
+      state = STATE_WAIT_START;
+      break;
+
+    case STATE_OK_MESSAGE_RECEIVED:
+      #ifdef ENABLE_DEBUG
+      if (verbose) {
+        debugPrint("Message received\n");
+      }
+      #endif
+
+      sendAck();
+
+      // send UDP packet if message is a data packet
+      // if data contains 0x5C (start character), message len can be bigger than 0x50
+      if (buffer[0] == 0x5C && buffer[1] == 0x00 && buffer[2] == 0x20 && buffer[3] == 0x68 && buffer[4] >= 0x50)
+        sendUdpPacket(buffer, index);
+      state = STATE_WAIT_START;
+      break;
+  }
+
+}
+
+
+// ######### FUNCTIONS #######################
+
+/*
+ * Return:
+ *  >0 if valid message received (return message len)
+ *   0 if ok, but message not ready
+ *  -1 if invalid message
+ *  -2 if checksum fails
+ */
+int checkNibeMessage(const byte* const data, byte len)
+{
+    #ifdef ENABLE_DEBUG
+    if (verbose > 2) {
+      sprintf(debug_buf, "\nlen=%u\n", len);
+      debugPrint(debug_buf);
+    }
+    #endif
+
+    if (len <= 0)
+        return 0;
+
+    if (len >= 1)
+    {
+        if (data[0] != 0x5C)
+            return -1;
+
+        if (len >= 3)
+        {
+            if (data[1] != 0x00 && data[2] != 0x20)
+                return -1;
+        }
+
+        if (len >= 6)
+        {
+            int datalen = data[4];
+
+            if (len < datalen + 6)
+                return 0;
+
+            byte checksum = 0;
+
+            // calculate XOR checksum
+            for(int i = 2; i < (datalen + 5); i++)
+                checksum ^= data[i];
+
+            byte msg_checksum = data[datalen + 5];
+
+            #ifdef ENABLE_DEBUG
+            if (verbose > 1) {
+              sprintf(debug_buf, "\nchecksum=%02x, msg_checksum=%02x\n", checksum, msg_checksum);
+              debugPrint(debug_buf);
+            }
+            #endif
+
+            if (checksum != msg_checksum) {
+
+              // check special case, if checksum is 0x5C (start character),
+              // heat pump seems to send 0xC5 checksum
+              if (checksum != 0x5C && msg_checksum != 0xC5
+                return -2;
+            }
+
+            return datalen + 6;
+        }
+
+    }
+
+    return 0;
+
+}
+
+void sendAck()
+{
+  #ifdef ENABLE_DEBUG
+  if (verbose) {
+    debugPrint("Send ACK\n");
+  }
+  #endif
+
+  digitalWrite(directionPin, HIGH);
+  delay(1);
+  Serial.write(0x06);
+  Serial.flush();
+  delay(1);
+  digitalWrite(directionPin, LOW);
+}
+
+void sendNak()
+{
+  #ifdef ENABLE_DEBUG
+  if (verbose) {
+    debugPrint("Send NAK\n");
+  }
+  #endif
+
+  digitalWrite(directionPin, HIGH);
+  delay(1);
+  Serial.write(0x15);
+  Serial.flush();
+  delay(1);
+  digitalWrite(directionPin, LOW);
+}
+
+void sendUdpPacket(const byte* const data, int len) {
+
+  #ifdef ENABLE_DEBUG
+  if (verbose) {
+    sprintf(debug_buf, "Sending UDP packet, len=%d\n", len);
+    debugPrint(debug_buf);
+    if (verbose > 2) {
+      int i;
+      for (i=0; i<len; i++) {
+        sprintf(debug_buf, "%02x", data[i]);
+        debugPrint(debug_buf);
+      }
+      debugPrint("\n");
+    }
+  }
+  #endif
+
+  udp.beginPacket(target_ip, udp_port);
+  udp.write(data, len);
+  udp.endPacket();
+}
+
+#ifdef ENABLE_DEBUG
+void debugPrint(char* data) {
+  udp.beginPacket(target_ip, 50000);
+  udp.write(data);
+  udp.endPacket();
+}
+#endif


Files for Arduino Stepper Motors

Files for Arduino Stepper Motors

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

--- Ard-StepperMotors/Stepper/Stepper.ino
+++ Ard-StepperMotors/Stepper/Stepper.ino
@@ -0,0 +1,28 @@
+#include <AccelStepper.h>
+#define HALFSTEP 8
+
+// Motor pin definitions
+#define motorPin1  8     // IN1 on the ULN2003 driver 1
+#define motorPin2  9     // IN2 on the ULN2003 driver 1
+#define motorPin3  10    // IN3 on the ULN2003 driver 1
+#define motorPin4  11    // IN4 on the ULN2003 driver 1
+
+// Initialize with pin sequence IN1-IN3-IN2-IN4 for using the AccelStepper with 28BYJ-48
+AccelStepper stepper1(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);
+
+void setup() {
+  stepper1.setMaxSpeed(1000.0);
+  stepper1.setAcceleration(100.0);
+  stepper1.setSpeed(200);
+  stepper1.moveTo(2048);
+
+}//--(end setup )---
+
+void loop() {
+
+  //Change direction when the stepper reaches the target position
+  if (stepper1.distanceToGo() == 0) {
+    stepper1.moveTo(-stepper1.currentPosition());
+  }
+  stepper1.run();
+}


Create Neutrino_Wand_With_Graph_And_ECig_Relay.ino

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

--- Arduino/Neutrino_Wand_With_Graph_And_ECig_Relay/Neutrino_Wand_With_Graph_And_ECig_Relay.ino
+++ Arduino/Neutrino_Wand_With_Graph_And_ECig_Relay/Neutrino_Wand_With_Graph_And_ECig_Relay.ino
@@ -0,0 +1,1182 @@
+#include <QueueArray.h>
+
+#include <Wire.h> // Include the I2C library (required)
+#include <SparkFunSX1509.h> // Include SX1509 library
+
+// for the sound board
+#include <SoftwareSerial.h>
+#include "Adafruit_Soundboard.h"
+
+#include <Adafruit_NeoPixel.h>
+
+// for led triggers
+#define HIGH 0x1
+#define LOW  0x0
+
+// SX1509 I2C address (set by ADDR1 and ADDR0 (00 by default):
+const byte SX1509_ADDRESS = 0x3E;  // SX1509 I2C address
+SX1509 io; // Create an SX1509 object to be used throughout
+
+// bargraph helper variables
+int seq_1_current = 0;  // current led in sequence 1
+const int num_led = 15; // total number of leds in bar graph
+
+// SX1509 pin definitions for the leds on the graph:
+const byte SX1509_BAR_01 = 0;
+const byte SX1509_BAR_02 = 1;
+const byte SX1509_BAR_03 = 2;
+const byte SX1509_BAR_04 = 3;
+const byte SX1509_BAR_05 = 4;
+const byte SX1509_BAR_06 = 5;
+const byte SX1509_BAR_07 = 6;
+const byte SX1509_BAR_08 = 7;
+const byte SX1509_BAR_09 = 8;
+const byte SX1509_BAR_10 = 9;
+const byte SX1509_BAR_11 = 10;
+const byte SX1509_BAR_12 = 11;
+const byte SX1509_BAR_13 = 12;
+const byte SX1509_BAR_14 = 13;
+const byte SX1509_BAR_15 = 14;
+
+// Relay Pin for ECig
+int relayPin = 13;
+
+// neopixel pins / setup
+#define NEO_POWER 2 // for cyclotron and powercell
+Adafruit_NeoPixel powerStick = Adafruit_NeoPixel(48, NEO_POWER, NEO_GRB + NEO_KHZ800);
+
+#define NEO_NOSE 3 // for nose of wand
+Adafruit_NeoPixel noseJewel = Adafruit_NeoPixel(7, NEO_NOSE, NEO_GRB + NEO_KHZ800);
+
+#define NEO_WAND 4 // for nose of wand
+Adafruit_NeoPixel wandLights = Adafruit_NeoPixel(4, NEO_WAND, NEO_GRB + NEO_KHZ800);
+
+// LED indexes into the neopixel powerstick chain for the cyclotron. Each stick has 8 neopixels for a total of
+// 16 with an index starting at 0. These offsets are because my powercell window only shows 13 leds. If you can show more
+// change the offset index and powercell count to get more or less lit.
+const int powercellLedCount = 14;                                         // total number of led's in the animation
+const int powercellIndexOffset = 1;                                       // first led offset into the led chain for the animation
+
+// These are the indexes for the led's on the chain. Each jewel has 7 LEDs. If you are using a single neopixel or
+// some other neopixel configuration you will need to update these indexes to match where things are in the chain
+int c1Start = 16;
+int c1End = 22;
+int c2Start = 23;
+int c2End = 29;
+int c3Start = 30;
+int c3End = 36;
+int c4Start = 37;
+int c4End = 43;
+int ventStart = 44;
+int ventEnd = 47;
+
+// inputs for switches and buttons
+const int THEME_SWITCH = 5;
+const int STARTUP_SWITCH = 6;
+const int SAFETY_SWITCH = 7;
+const int FIRE_BUTTON = 8;
+
+// soundboard pins and setup
+#define SFX_RST 9
+#define SFX_RX 10
+#define SFX_TX 11
+const int ACT = 12;    // this allows us to know if the audio is playing
+
+SoftwareSerial ss = SoftwareSerial(SFX_TX, SFX_RX);
+Adafruit_Soundboard sfx = Adafruit_Soundboard( &ss, NULL, SFX_RST);
+
+// ##############################
+// available options
+// ##############################
+const bool useGameCyclotronEffect = true;   // set this to true to get the fading previous cyclotron light in the idle sequence
+const bool useCyclotronFadeInEffect = false; // Instead of the yellow alternate flashing on boot/vent this fades the cyclotron in from off to red
+const bool useDialogTracks = true;          // set to true if you want the dialog tracks to play after firing for 5 seconds
+
+// Possible Pack states
+bool powerBooted = false;   // has the pack booted up
+bool isFiring = false;      // keeps track of the firing state
+bool shouldWarn = false;    // track the warning state for alert audio
+bool shuttingDown = false;  // is the pack in the process of shutting down
+bool poweredDown = true;    // is the pack powered down
+bool venting = false;       // is the pack venting
+
+// physical switch states
+bool startup = false;
+bool theme = false;
+bool safety = false;
+bool fire = false;
+bool warning = false;
+
+// audio track names on soundboard
+char startupTrack[] =   "T00     WAV";
+char blastTrack[] =     "T01     WAV";
+char endTrack[] =       "T02     WAV";
+char idleTrack[] =      "T03     WAV";
+char shutdownTrack[] =  "T04     WAV";
+char clickTrack[] =     "T05     WAV";
+char chargeTrack[] =    "T06     WAV";
+char warnTrack[] =      "T07     WAV";
+char ventTrack[] =      "T08     WAV";
+char texTrack[] =       "T09     WAV";
+char choreTrack[] =     "T10     WAV";
+char toolsTrack[] =     "T11     WAV";
+char listenTrack[] =    "T12     WAV";
+char thatTrack[] =      "T13     WAV";
+char neutronizedTrack[]="T14     WAV";
+char boxTrack[] =       "T15     WAV";
+char themeTrack[] =     "T16     OGG";
+
+// this queue holds a shuffled list of dialog tracks we can pull from so we don't
+// play the same ones twice
+QueueArray <int> dialogQueue;
+int numDialog = 7;
+
+// timer trigger times/states
+unsigned long firingStateMillis;
+const unsigned long firingWarmWaitTime = 5000;  // how long to hold down fire for lights to speed up
+const unsigned long firingWarnWaitTime = 10000;  // how long to hold down fire before warning sounds
+
+// Arduino setup function
+void setup() {
+  // softwareserial at 9600 baud for the audio board
+  ss.begin(9600);
+
+  // set act modes for the fx board
+  pinMode(ACT, INPUT);
+
+  // Depending on your relay this may need to be updated.
+  pinMode(relayPin, OUTPUT);
+  // If relay defaults to on set the pin HIGH on init
+  digitalWrite(relayPin, LOW);
+
+  // configure nose jewel
+  noseJewel.begin();
+  noseJewel.setBrightness(100);
+  noseJewel.show(); // Initialize all pixels to 'off'
+
+  // configure powercell/cyclotron
+  powerStick.begin();
+  powerStick.setBrightness(75);
+  powerStick.show(); // Initialize all pixels to 'off'
+
+  // configure wand lights
+  wandLights.begin();
+  wandLights.setBrightness(75);
+  wandLights.show();
+
+  // set the modes for the switches/buttons
+  pinMode(THEME_SWITCH, INPUT);
+  digitalWrite(THEME_SWITCH, HIGH);
+  pinMode(STARTUP_SWITCH, INPUT);
+  digitalWrite(STARTUP_SWITCH, HIGH);
+  pinMode(SAFETY_SWITCH, INPUT);
+  digitalWrite(SAFETY_SWITCH, HIGH);
+  pinMode(FIRE_BUTTON, INPUT);
+  digitalWrite(FIRE_BUTTON, HIGH);
+  // Call io.begin(<address>) to initialize the SX1509. If it
+  // successfully communicates, it'll return 1.
+  if (!io.begin(SX1509_ADDRESS)) {
+    while (1) ; // If we fail to communicate, loop forever for now but it would be nice to warn the user somehow
+  }
+
+  // configuration for the bargraph LED's
+  io.pinMode(SX1509_BAR_01, OUTPUT);
+  io.pinMode(SX1509_BAR_02, OUTPUT);
+  io.pinMode(SX1509_BAR_03, OUTPUT);
+  io.pinMode(SX1509_BAR_04, OUTPUT);
+  io.pinMode(SX1509_BAR_05, OUTPUT);
+  io.pinMode(SX1509_BAR_06, OUTPUT);
+  io.pinMode(SX1509_BAR_07, OUTPUT);
+  io.pinMode(SX1509_BAR_08, OUTPUT);
+  io.pinMode(SX1509_BAR_09, OUTPUT);
+  io.pinMode(SX1509_BAR_10, OUTPUT);
+  io.pinMode(SX1509_BAR_11, OUTPUT);
+  io.pinMode(SX1509_BAR_12, OUTPUT);
+  io.pinMode(SX1509_BAR_13, OUTPUT);
+  io.pinMode(SX1509_BAR_14, OUTPUT);
+  io.pinMode(SX1509_BAR_15, OUTPUT);
+
+  // set everything off initially
+  shutdown_leds();
+}
+
+/* ************* Audio Board Helper Functions ************* */
+// helper function to play a track by name on the audio board
+void playAudio( char* trackname, int playing ) {
+  // stop track if one is going
+  if (playing == 0) {
+    sfx.stop();
+  }
+
+  // now go play
+  if (sfx.playTrack(trackname)) {
+    sfx.unpause();
+  }
+}
+
+void playDialogTrack( int playing ){
+  // if the queue is empty reseed it
+  if ( dialogQueue.isEmpty() ){
+    for (int i=1; i<=numDialog; i++){
+      dialogQueue.enqueue(i);
+    }
+  }
+
+  switch (dialogQueue.dequeue()){
+    case (1):
+      playAudio(texTrack, playing);
+      break;
+    case (2):
+      playAudio(listenTrack, playing);
+      break;
+    case (3):
+      playAudio(choreTrack, playing);
+      break;
+    case (4):
+      playAudio(boxTrack, playing);
+      break;
+    case (5):
+      playAudio(thatTrack, playing);
+      break;
+    case (6):
+      playAudio(neutronizedTrack, playing);
+      break;
+    case (7):
+      playAudio(toolsTrack, playing);
+      break;
+    default:
+      playAudio(endTrack, playing);
+      break;
+  }
+}
+
+/* ************* Main Loop ************* */
+int cyclotronRunningFadeOut = 255;  // we reset this variable every time we change the cyclotron index so the fade effect works
+int cyclotronRunningFadeIn = 0;     // we reset this to 0 to fade the cyclotron in from nothing
+
+// intervals that can be adjusted in real time to speed up animations
+unsigned long pwr_interval = 60;        // interval at which to cycle lights for the powercell. We update this in the loop to speed up the animation so must be declared here (milliseconds)
+unsigned long cyc_interval = 1000;      // interval at which to cycle lights for the cyclotron.
+unsigned long cyc_fade_interval = 15;   // fade the inactive cyclotron to light to nothing
+unsigned long firing_interval = 40;     // interval at which to cycle firing lights on the bargraph. We update this in the loop to speed up the animation so must be declared here (milliseconds).
+
+void loop() {
+  // get the current time
+  unsigned long currentMillis = millis();
+
+  // find out of the audio board is playing audio
+  int playing = digitalRead(ACT);
+
+  // get the current switch states
+  int theme_switch = digitalRead(THEME_SWITCH);
+
+  // if the theme switch has recently changed from off to on we
+  // should play the full ghostbusters theme song
+  if (theme_switch == 1) {
+    if (theme == false) {
+      playAudio(themeTrack, playing);
+      theme = true;
+    }
+  } else {
+    theme = false;
+  }
+
+  int startup_switch = digitalRead(STARTUP_SWITCH);
+  int safety_switch = digitalRead(SAFETY_SWITCH);
+  int fire_button = digitalRead(FIRE_BUTTON);
+
+  // while the startup switch is set on
+  if (startup_switch == 1) {
+    // in general we always try to play the idle sound if started
+    if (playing == 1 && startup == true) {
+      playAudio(idleTrack, playing);
+    }
+
+    // choose the right powercell animation sequence for booted/on
+    if ( powerBooted == true ) {
+      // standard idle power sequence for the pack
+      poweredDown = false;
+      shuttingDown = false;
+      venting = false;
+      setWandLightState(3, 0, 0); //set sloblow red
+      setVentLightState(ventStart, ventEnd, 2);
+
+	  // Reset the relay to off. If relay is on set the pin HIGH
+      digitalWrite (relayPin, LOW);
+
+      powerSequenceOne(currentMillis, pwr_interval, cyc_interval, cyc_fade_interval);
+    } else {
+      // boot up the pack. powerSequenceBoot will set powerBooted when complete
+      powerSequenceBoot(currentMillis);
+      setWandLightState(3, 7, currentMillis);   //set sloblow red blinking
+    }
+
+    // if we are not started up we should play the startup sound and begin the boot sequence
+    if (startup == false) {
+      startup = true;
+      playAudio(startupTrack, playing);
+
+      // get the current safety switch state
+      if (safety_switch == 1 && safety == false) {
+        safety = true;
+      }
+    }
+
+    if( startup == true && safety_switch == 1 ){
+      if( venting == false && powerBooted == true ){
+        setWandLightState(1, 2, 0);    //  set back light orange
+        setWandLightState(2, 1, 0);    //  set body led white
+      // Reset the relay to off. If relay is on set the pin HIGH
+      digitalWrite (relayPin, LOW);
+
+      }else{
+        setWandLightState(1, 4, 0);    //  set back light off
+        setWandLightState(2, 4, 0);    //  set body led off
+        // Reset the relay to off. If relay is on set the pin HIGH
+        digitalWrite (relayPin, LOW);
+      }
+
+      // if the safety switch is set off then we can fire when the button is pressed
+      if ( fire_button == 0) {
+        // if the button is just pressed we clear all led's to start the firing animations
+        if ( isFiring == false ) {
+          shutdown_leds();
+          isFiring = true;
+        }
+
+        // show the firing bargraph sequence
+        barGraphSequenceTwo(currentMillis);
+
+        // strobe the nose pixels
+        fireStrobe(currentMillis);
+
+        // now powercell/cyclotron/wand lights
+        // if this is the first time reset some variables and play the blast track
+        if (fire == false) {
+          shouldWarn = false;
+          fire = true;
+          firingStateMillis = millis();
+          playAudio(blastTrack, playing);
+        } else {
+          // find out what our timing is
+          unsigned long diff = (unsigned long)(millis() - firingStateMillis);
+
+          if ( diff > firingWarnWaitTime) { // if we are in the fire warn interval
+            pwr_interval = 10;      // speed up the powercell animation
+            firing_interval = 20;   // speed up the bar graph animation
+            cyc_interval = 50;      // really speed up cyclotron
+            cyc_fade_interval = 5;  // speed up the fade of the cyclotron
+            if (playing == 1 || shouldWarn == false ) {
+              shouldWarn = true;
+              playAudio(warnTrack, playing); // play the firing track with the warning
+            }
+            setWandLightState(0, 8, currentMillis);    // set top light red flashing fast
+          } else if ( diff > firingWarmWaitTime) { // if we are in the dialog playing interval
+            pwr_interval = 30;      // speed up the powercell animation
+            firing_interval = 30;   // speed up the bar graph animation
+            cyc_interval = 200;     // speed up cyclotron
+            cyc_fade_interval = 10; // speed up the fade of the cyclotron
+            if (playing == 1) {
+              playAudio(blastTrack, playing); // play the normal blast track
+            }
+            setWandLightState(0, 6, currentMillis);    // set top light orange flashing
+          }
+        }
+      } else { // if we were firing and are no longer reset the leds
+        if ( isFiring == true ) {
+          shutdown_leds();
+          isFiring = false;
+        }
+
+        // and do the standard bargraph sequence
+        barGraphSequenceOne(currentMillis);
+
+        if (fire == true) { // if we were firing let's reset the animations and play the correct final firing track
+          clearFireStrobe();
+          setWandLightState(0, 4, currentMillis);    // set top light off
+
+          pwr_interval = 60;
+          firing_interval = 40;
+          cyc_interval = 1000;
+          cyc_fade_interval = 15;
+          fire = false;
+
+          // see if we've been firing long enough to get the dialog or vent sounds
+          unsigned long diff = (unsigned long)(millis() - firingStateMillis);
+
+          if ( diff > firingWarnWaitTime) { // if we are past the warning let's vent the pack
+            playAudio(ventTrack, playing);
+            venting = true;
+            // Set relay to on. If relay is off set the pin LOW
+            digitalWrite (relayPin, HIGH);
+
+            clearPowerStrip(); // play the boot animation on the powercell
+          } else if ( diff > firingWarmWaitTime) { // if in the dialog time play the dialog in sequence
+            if( useDialogTracks == true ){
+              playDialogTrack(playing);
+              // Set relay to off. If relay is on set the pin HIGH
+              digitalWrite (relayPin, LOW);
+            }else{
+              playAudio(endTrack, playing);
+            }
+          } else {
+            playAudio(endTrack, playing);
+          }
+        }
+      }
+
+      // if the safety was just changed play the click track
+      if (safety == false) {
+        safety = true;
+        playAudio(chargeTrack, playing);
+      }
+    } else {
+      // if the safety is switched off play the click track
+      if (safety == true) {
+        setWandLightState(1, 4, 0);    // set back light off
+        setWandLightState(2, 4, 0);    // set body off
+        safety = false;
+        playAudio(clickTrack, playing);
+      }
+    }
+  } else { // if we are powering down
+    if( poweredDown == false ){
+      if( shuttingDown == false ){
+        playAudio(shutdownTrack, playing); // play the pack shutdown track
+        shuttingDown = true;
+      }
+      cyclotronRunningFadeOut = 255;
+      powerSequenceShutdown(currentMillis);
+    }else{
+      if (startup == true) { // if started reset the variables
+        clearPowerStrip(); // clear all led's
+        shutdown_leds();
+        startup = false;
+        safety = false;
+        fire = false;
+      }
+    }
+  }
+  delay(1);
+}
+
+/*************** Wand Light Helpers *********************/
+unsigned long prevFlashMillis = 0; // last time we changed a powercell light in the idle sequence
+bool flashState = false;
+const unsigned long wandFastFlashInterval = 100; // interval at which we flash the top led on the wand
+const unsigned long wandMediumFlashInterval = 500; // interval at which we flash the top led on the wand
+
+void setWandLightState(int lednum, int state, unsigned long currentMillis){
+  switch ( state ) {
+    case 0: // set led red
+      wandLights.setPixelColor(lednum, wandLights.Color(255, 0, 0));
+      break;
+    case 1: // set led white
+      wandLights.setPixelColor(lednum, wandLights.Color(255, 255, 255));
+      break;
+    case 2: // set led orange
+      wandLights.setPixelColor(lednum, wandLights.Color(255, 127, 0));
+      break;
+    case 3: // set led blue
+      wandLights.setPixelColor(lednum, wandLights.Color(0, 0, 255));
+      break;
+    case 4: // set led off
+      wandLights.setPixelColor(lednum, 0);
+      break;
+    case 5: // fast white flashing
+      if ((unsigned long)(currentMillis - prevFlashMillis) >= wandFastFlashInterval) {
+        prevFlashMillis = currentMillis;
+        if( flashState == false ){
+          wandLights.setPixelColor(lednum, wandLights.Color(255, 255, 255));
+          flashState = true;
+        }else{
+          wandLights.setPixelColor(lednum, 0);
+          flashState = false;
+        }
+      }
+      break;
+    case 6: // slower orange flashing
+      if ((unsigned long)(currentMillis - prevFlashMillis) >= wandMediumFlashInterval) {
+        prevFlashMillis = currentMillis;
+        if( flashState == false ){
+          wandLights.setPixelColor(lednum, wandLights.Color(255, 127, 0));
+          flashState = true;
+        }else{
+          wandLights.setPixelColor(lednum, 0);
+          flashState = false;
+        }
+      }
+      break;
+    case 7: // medium red flashing
+      if ((unsigned long)(currentMillis - prevFlashMillis) >= wandMediumFlashInterval) {
+        prevFlashMillis = currentMillis;
+        if( flashState == false ){
+          wandLights.setPixelColor(lednum, wandLights.Color(255, 0, 0));
+          flashState = true;
+        }else{
+          wandLights.setPixelColor(lednum, 0);
+          flashState = false;
+        }
+      }
+      break;
+    case 8: // fast red flashing
+      if ((unsigned long)(currentMillis - prevFlashMillis) >= wandFastFlashInterval) {
+        prevFlashMillis = currentMillis;
+        if( flashState == false ){
+          wandLights.setPixelColor(lednum, wandLights.Color(255, 0, 0));
+          flashState = true;
+        }else{
+          wandLights.setPixelColor(lednum, 0);
+          flashState = false;
+        }
+      }
+      break;
+  }
+
+  wandLights.show();
+}
+
+/*************** Vent Light *************************/
+void setVentLightState(int startLed, int endLed, int state ){
+  switch ( state ) {
+    case 0: // set all leds to white
+      for(int i=startLed; i <= endLed; i++) {
+        powerStick.setPixelColor(i, powerStick.Color(255, 255, 255));
+      }
+      break;
+    case 1: // set all leds to blue
+      for(int i=startLed; i <= endLed; i++) {
+        powerStick.setPixelColor(i, powerStick.Color(0, 0, 255));
+      }
+      break;
+    case 2: // set all leds off
+      for(int i=startLed; i <= endLed; i++) {
+        powerStick.setPixelColor(i, 0);
+      }
+      break;
+  }
+}
+
+/*************** Powercell/Cyclotron Animations *********************/
+// timer helpers and intervals for the animations
+unsigned long prevPwrBootMillis = 0;    // the last time we changed a powercell light in the boot sequence
+const unsigned long pwr_boot_interval = 60;       // interval at which to cycle lights (milliseconds). Adjust this if
+
+unsigned long prevCycBootMillis = 0;    // the last time we changed a cyclotron light in the boot sequence
+const unsigned long cyc_boot_interval = 500;      // interval at which to cycle lights (milliseconds).
+const unsigned long cyc_boot_alt_interval = 600;      // interval at which to cycle lights (milliseconds).
+
+unsigned long prevShtdMillis = 0;       // last time we changed a light in the idle sequence
+const unsigned long pwr_shutdown_interval = 200;  // interval at which to cycle lights (milliseconds).
+
+unsigned long prevPwrMillis = 0;        // last time we changed a powercell light in the idle sequence
+unsigned long prevCycMillis = 0;        // last time we changed a cyclotron light in the idle sequence
+unsigned long prevFadeCycMillis = 0;    // last time we changed a cyclotron light in the idle sequence
+
+// LED tracking variables
+const int powerSeqTotal = powercellLedCount;                              // total number of led's for powercell 0 based
+int powerSeqNum = powercellIndexOffset;                                   // current running powercell sequence led
+int powerShutdownSeqNum = powercellLedCount - powercellIndexOffset;       // shutdown sequence counts down
+
+// animation level trackers for the boot and shutdown
+int currentBootLevel = powercellIndexOffset;                              // current powercell boot level sequence led
+int currentLightLevel = powercellLedCount - powercellIndexOffset;         // current powercell boot light sequence led
+
+void setCyclotronLightState(int startLed, int endLed, int state ){
+  switch ( state ) {
+    case 0: // set all leds to red
+      for(int i=startLed; i <= endLed; i++) {
+        powerStick.setPixelColor(i, powerStick.Color(255, 0, 0));
+      }
+      break;
+    case 1: // set all leds to orange
+      for(int i=startLed; i <= endLed; i++) {
+        powerStick.setPixelColor(i, powerStick.Color(255, 106, 0));
+      }
+      break;
+    case 2: // set all leds off
+      for(int i=startLed; i <= endLed; i++) {
+        powerStick.setPixelColor(i, 0);
+      }
+      break;
+    case 3: // fade all leds from red
+      for(int i=startLed; i <= endLed; i++) {
+        if( cyclotronRunningFadeOut >= 0 ){
+          powerStick.setPixelColor(i, 255 * cyclotronRunningFadeOut/255, 0, 0);
+          cyclotronRunningFadeOut--;
+        }else{
+          powerStick.setPixelColor(i, 0);
+        }
+      }
+      break;
+    case 4: // fade all leds to red
+      for(int i=startLed; i <= endLed; i++) {
+        if( cyclotronRunningFadeIn < 255 ){
+          powerStick.setPixelColor(i, 255 * cyclotronRunningFadeIn/255, 0, 0);
+          cyclotronRunningFadeIn++;
+        }else{
+          powerStick.setPixelColor(i, powerStick.Color(255, 0, 0));
+        }
+      }
+      break;
+  }
+}
+
+// shuts off and resets the powercell/cyclotron leds
+void clearPowerStrip() {
+  // reset vars
+  powerBooted = false;
+  poweredDown = true;
+  powerSeqNum = powercellIndexOffset;
+  powerShutdownSeqNum = powercellLedCount - powercellIndexOffset;
+  currentLightLevel = powercellLedCount;
+  currentBootLevel = powercellIndexOffset;
+  cyclotronRunningFadeIn = 0;
+
+  // shutoff the leds
+  for ( int i = 0; i <= c4End; i++) {
+    powerStick.setPixelColor(i, 0);
+  }
+  powerStick.show();
+
+  for ( int j=0; j<=3; j++ ){
+    wandLights.setPixelColor(j, 0);
+  }
+  wandLights.show();
+
+  if( venting == true ){
+    setVentLightState(ventStart, ventEnd, 0);
+	// Set the relay to on while venting. If relay is off set the pin LOW
+    digitalWrite (relayPin, HIGH);
+  }
+}
+
+// boot animation on the powercell/cyclotron
+bool reverseBootCyclotron = false;
+void powerSequenceBoot(unsigned long currentMillis) {
+  bool doUpdate = false;
+
+  // START CYCLOTRON
+  if( useCyclotronFadeInEffect == false ){
+    if ((unsigned long)(currentMillis - prevCycBootMillis) >= cyc_boot_interval) {
+      prevCycBootMillis = currentMillis;
+
+      if( reverseBootCyclotron == false ){
+        setCyclotronLightState(c1Start, c1End, 1);
+        setCyclotronLightState(c2Start, c2End, 2);
+        setCyclotronLightState(c3Start, c3End, 1);
+        setCyclotronLightState(c4Start, c4End, 2);
+
+        doUpdate = true;
+        reverseBootCyclotron = true;
+      }else{
+        setCyclotronLightState(c1Start, c1End, 2);
+        setCyclotronLightState(c2Start, c2End, 1);
+        setCyclotronLightState(c3Start, c3End, 2);
+        setCyclotronLightState(c4Start, c4End, 1);
+
+        doUpdate = true;
+        reverseBootCyclotron = false;
+      }
+    }
+  }else{
+    if ((unsigned long)(currentMillis - prevCycBootMillis) >= cyc_boot_alt_interval) {
+      prevCycBootMillis = currentMillis;
+      setCyclotronLightState(c1Start, c4End, 4);
+      doUpdate = true;
+    }
+  }
+  // END CYCLOTRON
+
+  if ((unsigned long)(currentMillis - prevPwrBootMillis) >= pwr_boot_interval) {
+    // save the last time you blinked the LED
+    prevPwrBootMillis = currentMillis;
+
+    // START POWERCELL
+    if( currentBootLevel != powerSeqTotal ){
+      if( currentBootLevel == currentLightLevel){
+        if(currentLightLevel+1 <= powerSeqTotal){
+          powerStick.setPixelColor(currentLightLevel+1, 0);
+        }
+        powerStick.setPixelColor(currentBootLevel, powerStick.Color(0, 0, 255));
+        currentLightLevel = powerSeqTotal;
+        currentBootLevel++;
+      }else{
+        if(currentLightLevel+1 <= powerSeqTotal){
+          powerStick.setPixelColor(currentLightLevel+1, 0);
+        }
+        powerStick.setPixelColor(currentLightLevel, powerStick.Color(0, 0, 255));
+        currentLightLevel--;
+      }
+      doUpdate = true;
+    }else{
+      powerBooted = true;
+      currentBootLevel = powercellIndexOffset;
+      currentLightLevel = powercellLedCount - powercellIndexOffset;
+    }
+    // END POWERCELL
+  }
+
+  // if we have changed an led
+  if( doUpdate == true ){
+    powerStick.show(); // commit all of the changes
+  }
+}
+
+// idle/firing animation for the powercell/cyclotron
+int cycOrder = 0;     // which cyclotron led will be lit next
+int cycFading = -1;   // which cyclotron led is fading out for game style
+void powerSequenceOne(unsigned long currentMillis, unsigned long anispeed, unsigned long cycspeed, unsigned long cycfadespeed) {
+  bool doUpdate = false;  // keep track of if we changed something so we only update on changes
+
+  // START CYCLOTRON
+  if( useGameCyclotronEffect == true ){ // if we are doing the video game style cyclotron
+    if ((unsigned long)(currentMillis - prevCycMillis) >= cycspeed) {
+      prevCycMillis = currentMillis;
+
+      switch ( cycOrder ) {
+        case 0:
+          setCyclotronLightState(c1Start, c1End, 0);
+          setCyclotronLightState(c2Start, c2End, 2);
+          setCyclotronLightState(c3Start, c3End, 2);
+          cycFading = 0;
+          cyclotronRunningFadeOut = 255;
+          cycOrder = 1;
+          break;
+        case 1:
+          setCyclotronLightState(c2Start, c2End, 0);
+          setCyclotronLightState(c3Start, c3End, 2);
+          setCyclotronLightState(c4Start, c4End, 2);
+          cycFading = 1;
+          cyclotronRunningFadeOut = 255;
+          cycOrder = 2;
+          break;
+        case 2:
+          setCyclotronLightState(c1Start, c1End, 2);
+          setCyclotronLightState(c3Start, c3End, 0);
+          setCyclotronLightState(c4Start, c4End, 2);
+          cycFading = 2;
+          cyclotronRunningFadeOut = 255;
+          cycOrder = 3;
+          break;
+        case 3:
+          setCyclotronLightState(c1Start, c1End, 2);
+          setCyclotronLightState(c2Start, c2End, 2);
+          setCyclotronLightState(c4Start, c4End, 0);
+          cycFading = 3;
+          cyclotronRunningFadeOut = 255;
+          cycOrder = 0;
+          break;
+      }
+
+      doUpdate = true;
+    }
+
+    // now figure out the fading light
+    if( (unsigned long)( currentMillis - prevFadeCycMillis) >= cycfadespeed ){
+      prevFadeCycMillis = currentMillis;
+      if( cycFading != -1 ){
+        switch ( cycFading ) {
+          case 0:
+            setCyclotronLightState(c4Start, c4End, 3);
+            break;
+          case 1:
+            setCyclotronLightState(c1Start, c1End, 3);
+            break;
+          case 2:
+            setCyclotronLightState(c2Start, c2End, 3);
+            break;
+          case 3:
+            setCyclotronLightState(c3Start, c3End, 3);
+            break;
+        }
+        doUpdate = true;
+      }
+    }
+  }else{ // otherwise this is the standard version
+    if ((unsigned long)(currentMillis - prevCycMillis) >= cycspeed) {
+      prevCycMillis = currentMillis;
+
+      switch ( cycOrder ) {
+        case 0:
+          setCyclotronLightState(c4Start, c4End, 2);
+          setCyclotronLightState(c1Start, c1End, 0);
+          setCyclotronLightState(c2Start, c2End, 2);
+          setCyclotronLightState(c3Start, c3End, 2);
+          cycFading = 0;
+          cyclotronRunningFadeOut = 255;
+          cycOrder = 1;
+          break;
+        case 1:
+          setCyclotronLightState(c1Start, c1End, 2);
+          setCyclotronLightState(c2Start, c2End, 0);
+          setCyclotronLightState(c3Start, c3End, 2);
+          setCyclotronLightState(c4Start, c4End, 2);
+          cycFading = 1;
+          cyclotronRunningFadeOut = 255;
+          cycOrder = 2;
+          break;
+        case 2:
+          setCyclotronLightState(c1Start, c1End, 2);
+          setCyclotronLightState(c2Start, c2End, 2);
+          setCyclotronLightState(c3Start, c3End, 0);
+          setCyclotronLightState(c4Start, c4End, 2);
+          cycFading = 2;
+          cyclotronRunningFadeOut = 255;
+          cycOrder = 3;
+          break;
+        case 3:
+          setCyclotronLightState(c1Start, c1End, 2);
+          setCyclotronLightState(c2Start, c2End, 2);
+          setCyclotronLightState(c3Start, c3End, 2);
+          setCyclotronLightState(c4Start, c4End, 0);
+          cycFading = 3;
+          cyclotronRunningFadeOut = 255;
+          cycOrder = 0;
+          break;
+      }
+
+      doUpdate = true;
+    }
+  }
+  // END CYCLOTRON
+
+  // START POWERCELL
+  if ((unsigned long)(currentMillis - prevPwrMillis) >= anispeed) {
+    // save the last time you blinked the LED
+    prevPwrMillis = currentMillis;
+
+    for ( int i = powercellIndexOffset; i <= powerSeqTotal; i++) {
+      if ( i <= powerSeqNum ) {
+        powerStick.setPixelColor(i, powerStick.Color(0, 0, 150));
+      } else {
+        powerStick.setPixelColor(i, 0);
+      }
+    }
+
+    if ( powerSeqNum <= powerSeqTotal) {
+      powerSeqNum++;
+    } else {
+      powerSeqNum = powercellIndexOffset;
+    }
+
+    doUpdate = true;
+  }
+  // END POWERCELL
+
+  // if we changed anything update
+  if( doUpdate == true ){
+    powerStick.show();
+  }
+}
+
+// shutdown animation for the powercell/cyclotron
+int cyclotronFadeOut = 255;
+void powerSequenceShutdown(unsigned long currentMillis) {
+  if ((unsigned long)(currentMillis - prevShtdMillis) >= pwr_shutdown_interval) {
+    prevShtdMillis = currentMillis;
+
+    // START CYCLOTRON
+    for(int i=c1Start; i <= c4End; i++) {
+      if( cyclotronFadeOut >= 0 ){
+        powerStick.setPixelColor(i, 255 * cyclotronFadeOut/255, 0, 0);
+        cyclotronFadeOut--;
+      }else{
+        powerStick.setPixelColor(i, 0);
+      }
+    }
+    // END CYCLOTRON
+
+    // START POWERCELL
+    for ( int i = powerSeqTotal; i >= powercellIndexOffset; i--) {
+      if ( i <= powerShutdownSeqNum ) {
+        powerStick.setPixelColor(i, powerStick.Color(0, 0, 150));
+      } else {
+        powerStick.setPixelColor(i, 0);
+      }
+    }
+
+    powerStick.show();
+
+    if ( powerShutdownSeqNum >= powercellIndexOffset) {
+      powerShutdownSeqNum--;
+    } else {
+      poweredDown = true;
+      powerShutdownSeqNum = powercellLedCount - powercellIndexOffset;
+      cyclotronFadeOut = 255;
+    }
+    // END POWERCELL
+  }
+}
+
+/*************** Nose Jewel Firing Animations *********************/
+unsigned long prevFireMillis = 0;
+const unsigned long fire_interval = 50;     // interval at which to cycle lights (milliseconds).
+int fireSeqNum = 0;
+int fireSeqTotal = 5;
+
+void clearFireStrobe() {
+  for ( int i = 0; i < 7; i++) {
+    noseJewel.setPixelColor(i, 0);
+  }
+  noseJewel.show();
+  fireSeqNum = 0;
+}
+
+void fireStrobe(unsigned long currentMillis) {
+  if ((unsigned long)(currentMillis - prevFireMillis) >= fire_interval) {
+    prevFireMillis = currentMillis;
+
+    switch ( fireSeqNum ) {
+      case 0:
+        noseJewel.setPixelColor(0, noseJewel.Color(255, 255, 255));
+        noseJewel.setPixelColor(1, noseJewel.Color(255, 255, 255));
+        noseJewel.setPixelColor(2, 0);
+        noseJewel.setPixelColor(3, noseJewel.Color(255, 255, 255));
+        noseJewel.setPixelColor(4, 0);
+        noseJewel.setPixelColor(5, noseJewel.Color(255, 255, 255));
+        noseJewel.setPixelColor(6, 0);
+        break;
+      case 1:
+        noseJewel.setPixelColor(0, noseJewel.Color(0, 0, 255));
+        noseJewel.setPixelColor(1, noseJewel.Color(255, 0, 0));
+        noseJewel.setPixelColor(2, noseJewel.Color(255, 255, 255));
+        noseJewel.setPixelColor(3, noseJewel.Color(255, 0, 0));
+        noseJewel.setPixelColor(4, noseJewel.Color(255, 255, 255));
+        noseJewel.setPixelColor(5, noseJewel.Color(255, 0, 0));
+        noseJewel.setPixelColor(6, noseJewel.Color(255, 255, 255));
+        break;
+      case 2:
+        noseJewel.setPixelColor(0, noseJewel.Color(255, 0, 0));
+        noseJewel.setPixelColor(1, 0);
+        noseJewel.setPixelColor(2, noseJewel.Color(0, 0, 255));
+        noseJewel.setPixelColor(3, 0);
+        noseJewel.setPixelColor(4, noseJewel.Color(0, 0, 255));
+        noseJewel.setPixelColor(5, 0);
+        noseJewel.setPixelColor(6, noseJewel.Color(255, 0, 0));
+        break;
+      case 3:
+        noseJewel.setPixelColor(0, noseJewel.Color(0, 0, 255));
+        noseJewel.setPixelColor(1, noseJewel.Color(255, 0, 0));
+        noseJewel.setPixelColor(2, noseJewel.Color(255, 255, 255));
+        noseJewel.setPixelColor(3, noseJewel.Color(255, 0, 0));
+        noseJewel.setPixelColor(4, noseJewel.Color(255, 255, 255));
+        noseJewel.setPixelColor(5, noseJewel.Color(255, 0, 0));
+        noseJewel.setPixelColor(6, noseJewel.Color(255, 255, 255));
+        break;
+      case 4:
+        noseJewel.setPixelColor(0, noseJewel.Color(255, 0, 0));
+        noseJewel.setPixelColor(1, 0);
+        noseJewel.setPixelColor(2, noseJewel.Color(255, 255, 255));
+        noseJewel.setPixelColor(3, 0);
+        noseJewel.setPixelColor(4, noseJewel.Color(255, 0, 0));
+        noseJewel.setPixelColor(5, 0);
+        noseJewel.setPixelColor(6, noseJewel.Color(255, 255, 255));
+        break;
+      case 5:
+        noseJewel.setPixelColor(0, noseJewel.Color(255, 0, 255));
+        noseJewel.setPixelColor(1, noseJewel.Color(0, 255, 0));
+        noseJewel.setPixelColor(2, noseJewel.Color(255, 0, 0));
+        noseJewel.setPixelColor(3, noseJewel.Color(0, 0, 255));
+        noseJewel.setPixelColor(4, noseJewel.Color(255, 0, 255));
+        noseJewel.setPixelColor(5, noseJewel.Color(255, 255, 255));
+        noseJewel.setPixelColor(6, noseJewel.Color(0, 0, 255));
+        break;
+    }
+
+    noseJewel.show();
+
+    fireSeqNum++;
+    if ( fireSeqNum > fireSeqTotal ) {
+      fireSeqNum = 0;
+    }
+  }
+}
+
+/*************** Bar Graph Animations *********************/
+// This is the idle sequence
+unsigned long prevBarMillis_on = 0;          // bargraph on tracker
+const unsigned long pwrcl_interval = 60;     // interval at which to cycle lights (milliseconds).
+bool reverseSequenceOne = false;
+
+void barGraphSequenceOne(unsigned long currentMillis) {
+  // normal sync animation on the bar graph
+  if ((unsigned long)(currentMillis - prevBarMillis_on) > pwrcl_interval) {
+    // save the last time you blinked the LED
+    prevBarMillis_on = currentMillis;
+
+    if ( reverseSequenceOne == false ) {
+      switch_graph_led(seq_1_current, HIGH);
+      seq_1_current++;
+      if ( seq_1_current > num_led ) {
+        reverseSequenceOne = true;
+      }
+    } else {
+      switch_graph_led(seq_1_current, LOW);
+      seq_1_current--;
+      if ( seq_1_current < 0  ) {
+        reverseSequenceOne = false;
+      }
+    }
+  }
+}
+
+// This is the firing sequence
+unsigned long prevBarMillis_fire = 0; // bargraph firing tracker
+int fireSequenceNum = 1;
+
+void barGraphSequenceTwo(unsigned long currentMillis) {
+  if ((unsigned long)(currentMillis - prevBarMillis_fire) > firing_interval) {
+    // save the last time you blinked the LED
+    prevBarMillis_fire = currentMillis;
+
+    switch (fireSequenceNum) {
+      case 1:
+        switch_graph_led(2, LOW);
+        switch_graph_led(14, LOW);
+        switch_graph_led(1, HIGH);
+        switch_graph_led(15, HIGH);
+        fireSequenceNum++;
+        break;
+      case 2:
+        switch_graph_led(1, LOW);
+        switch_graph_led(15, LOW);
+        switch_graph_led(2, HIGH);
+        switch_graph_led(14, HIGH);
+        fireSequenceNum++;
+        break;
+      case 3:
+        switch_graph_led(2, LOW);
+        switch_graph_led(14, LOW);
+        switch_graph_led(3, HIGH);
+        switch_graph_led(13, HIGH);
+        fireSequenceNum++;
+        break;
+      case 4:
+        switch_graph_led(3, LOW);
+        switch_graph_led(13, LOW);
+        switch_graph_led(4, HIGH);
+        switch_graph_led(12, HIGH);
+        fireSequenceNum++;
+        break;
+      case 5:
+        switch_graph_led(4, LOW);
+        switch_graph_led(12, LOW);
+        switch_graph_led(5, HIGH);
+        switch_graph_led(11, HIGH);
+        fireSequenceNum++;
+        break;
+      case 6:
+        switch_graph_led(5, LOW);
+        switch_graph_led(11, LOW);
+        switch_graph_led(6, HIGH);
+        switch_graph_led(10, HIGH);
+        fireSequenceNum++;
+        break;
+      case 7:
+        switch_graph_led(6, LOW);
+        switch_graph_led(10, LOW);
+        switch_graph_led(7, HIGH);
+        switch_graph_led(9, HIGH);
+        fireSequenceNum++;
+        break;
+      case 8:
+        switch_graph_led(7, LOW);
+        switch_graph_led(9, LOW);
+        switch_graph_led(6, HIGH);
+        switch_graph_led(10, HIGH);
+        fireSequenceNum++;
+        break;
+      case 9:
+        switch_graph_led(6, LOW);
+        switch_graph_led(10, LOW);
+        switch_graph_led(5, HIGH);
+        switch_graph_led(11, HIGH);
+        fireSequenceNum++;
+        break;
+      case 10:
+        switch_graph_led(5, LOW);
+        switch_graph_led(11, LOW);
+        switch_graph_led(4, HIGH);
+        switch_graph_led(12, HIGH);
+        fireSequenceNum++;
+        break;
+      case 11:
+        switch_graph_led(4, LOW);
+        switch_graph_led(12, LOW);
+        switch_graph_led(3, HIGH);
+        switch_graph_led(13, HIGH);
+        fireSequenceNum++;
+        break;
+      case 12:
+        switch_graph_led(3, LOW);
+        switch_graph_led(13, LOW);
+        switch_graph_led(2, HIGH);
+        switch_graph_led(14, HIGH);
+        fireSequenceNum = 1;
+        break;
+    }
+  }
+}
+
+/************************* Shutdown and helper functions ****************************/
+void shutdown_leds() {
+  // reset the sequence
+  seq_1_current = 1;
+  fireSequenceNum = 1;
+
+  // shut all led's off
+  for (int i = 1; i <= 15; i++) {
+    switch_graph_led(i, LOW);
+  }
+}
+
+void switch_graph_led(int num, int state) {
+  switch (num) {
+    case 1:
+      io.digitalWrite(SX1509_BAR_01, state);
+      break;
+    case 2:
+      io.digitalWrite(SX1509_BAR_02, state);
+      break;
+    case 3:
+      io.digitalWrite(SX1509_BAR_03, state);
+      break;
+    case 4:
+      io.digitalWrite(SX1509_BAR_04, state);
+      break;
+    case 5:
+      io.digitalWrite(SX1509_BAR_05, state);
+      break;
+    case 6:
+      io.digitalWrite(SX1509_BAR_06, state);
+      break;
+    case 7:
+      io.digitalWrite(SX1509_BAR_07, state);
+      break;
+    case 8:
+      io.digitalWrite(SX1509_BAR_08, state);
+      break;
+    case 9:
+      io.digitalWrite(SX1509_BAR_09, state);
+      break;
+    case 10:
+      io.digitalWrite(SX1509_BAR_10, state);
+      break;
+    case 11:
+      io.digitalWrite(SX1509_BAR_11, state);
+      break;
+    case 12:
+      io.digitalWrite(SX1509_BAR_12, state);
+      break;
+    case 13:
+      io.digitalWrite(SX1509_BAR_13, state);
+      break;
+    case 14:
+      io.digitalWrite(SX1509_BAR_14, state);
+      break;
+    case 15:
+      io.digitalWrite(SX1509_BAR_15, state);
+      break;
+  }
+}


Added Massimo's Serial command line example

error: pathspec 'hardware/arduino/avr/libraries/Bridge/examples/YunSerialTerminal/YunSerialTerminal.ino' did not match any file(s) known to git

--- hardware/arduino/avr/libraries/Bridge/examples/YunSerialTerminal/YunSerialTerminal.ino
+++ hardware/arduino/avr/libraries/Bridge/examples/YunSerialTerminal/YunSerialTerminal.ino
@@ -0,0 +1,61 @@
+
+/*
+  Arduino Yun USB-to-Serial
+
+ Allows you to use the Yun's 32U4 processor as a
+ serial terminal for the linino processor
+
+ Upload this to an Arduino Yun via serial (not WiFi)
+ then open the serial monitor at 115200 to see the boot process
+ of the linino processor. You can also use the serial monitor
+ as a basic command line interface for the linino processor using
+ this sketch.
+
+ The circuit:
+ * Arduino Yun
+
+ created March 2013
+ by Massimo Banzi
+
+ This example code is in the public domain.
+ */
+
+long baud = 115200;
+
+// Pin 13 has an LED connected on most Arduino boards.
+// give it a name:
+int led = 13;
+int ledState = HIGH;   // whether the LED is high or low
+
+
+void setup() {
+  Serial.begin(baud);        // open serial connection to Linino
+  Serial1.begin(baud);       // open serial connection via USB-Serial
+  Serial.println("Prova");   // Hello USB
+  Serial1.println("Prova1"); // Hello Linino
+
+  // initialize the digital pin as an output.
+  pinMode(led, OUTPUT);
+  digitalWrite(led, ledState);   // turn the LED on (HIGH is the voltage level)
+}
+
+
+void loop() {
+
+  // copy from virtual serial line to uart and vice versa
+  if (Serial.available()) {           // got anything from USB-Serial?
+    char c = (char)Serial.read();     // read from USB-serial
+    Serial1.write(c);                 // write to Linino
+    ledState=!ledState;               // invert LED state
+    digitalWrite(led, ledState);      // toggle the LED
+  }
+  if (Serial1.available()) {          // got anything from Linino?
+    char c = (char)Serial1.read();    // read from Linino
+    Serial.write(c);                  // write to USB-serial
+  }
+}
+
+
+
+
+


added arduino code

added arduino code

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

--- arduino/GearClock/GearClock.ino
+++ arduino/GearClock/GearClock.ino
@@ -0,0 +1,39 @@
+#include <Wire.h>
+#include "AFMotor.h"
+#include "rtcBOB.h"
+#include "Time.h"
+
+// Connect a stepper motor with 48 steps per revolution (7.5 degree)
+// to motor port #2 (M3 and M4)
+AF_Stepper motor(48, 2);
+const int DT = 75;
+
+uint32_t next_step_time;
+
+void setup() {
+  Serial.begin(115200);
+  Serial.println("Gear Clock");
+  Serial.println("WyoLum 2014");
+  Serial.println("Buy Open Hardware and own your future!");
+
+  Wire.begin();
+  motor.setSpeed(12);  // 10 rpm
+
+  uint32_t now = getTime();
+  next_step_time = now + DT - now % DT;
+  pinMode(13, OUTPUT);
+  //digitalWrite(13, HIGH);
+  // delay(100);
+  digitalWrite(13, LOW);
+  delay(100);
+}
+
+void loop(){
+  while(getTime() < next_step_time){
+    delay((next_step_time - getTime()) * 1000);
+  }
+  next_step_time += DT;
+  Serial.println(getTime());
+  motor.step(2, FORWARD, INTERLEAVE);
+  motor.release();
+}


Working setup with single ENC28J60

Working setup with single ENC28J60

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

--- myether/wsether1/wsether1.ino
+++ myether/wsether1/wsether1.ino
@@ -0,0 +1,69 @@
+// Notes:
+// - eternate cable connected to docking station using green eth. wire
+// - eth0 set as "Arduino shared" which is configured as "ipv4 shared to other computers"
+// - the connection is routed through wifi connection
+// - gets IP address from DHCP through wifi -> 10.42.0.?
+#include <UIPEthernet.h>
+
+const char server[] = "research.ciant.cz";
+
+EthernetClient client;
+
+void setup() {
+
+  Serial.begin(9600);
+  Serial.println("Starting WS");
+
+  const uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x05};
+
+  Serial.print("SPI_SS:");
+  Serial.println(SPI_SS);
+
+  Serial.print("ENC28J60_CONTROL_CS:");
+  Serial.println(ENC28J60_CONTROL_CS);
+
+
+  Serial.print("Contacting DHCP server ... ");
+  Ethernet.begin(mac); // DHCP happens here
+  Serial.println("done");
+
+  Serial.print("localIP: ");
+  Serial.println(Ethernet.localIP());
+  Serial.print("subnetMask: ");
+  Serial.println(Ethernet.subnetMask());
+  Serial.print("gatewayIP: ");
+  Serial.println(Ethernet.gatewayIP());
+  Serial.print("dnsServerIP: ");
+  Serial.println(Ethernet.dnsServerIP());
+}
+
+void loop() {
+
+  if (client.connect(server, 80)) {
+    Serial.println("connected");
+    // Make a HTTP request:
+
+    client.print("GET /wsgw.php");
+    client.print("?ts="); client.print( 0.001 * millis() );
+    client.print("&sid="); client.print(1);
+    client.print("&gid="); client.print(1);
+    client.print("&d=");
+    client.print(20);
+    client.print(",");
+    client.print(70);
+    client.println(" HTTP/1.1");
+
+    client.print("Host: ");
+    client.println(server);
+
+    client.println("User-Agent: arduino-eth");
+    client.println("Connection: close");
+    client.println();
+  }
+  else {
+    // if you didn't get a connection to the server:
+    Serial.println("connection failed");
+  }
+
+  delay(5000);
+}


add usb output example

add usb output example

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

--- jewelbots_friendship_v113/libraries/Jewelbots_Examples/examples/USB_output/USB_output.ino
+++ jewelbots_friendship_v113/libraries/Jewelbots_Examples/examples/USB_output/USB_output.ino
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017 Jewelbots
+ *
+ * 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.
+ */
+
+/*
+ * This example demonstrates how to use Serial output over the USB to print
+ * statements to the Arduino Serial Monitor.
+ */
+
+// Declare Jewelbots hardware components and variables
+uint32_t x = 0;
+Timer Timer;
+char str[50] = "End of loop()";
+
+void setup() {
+  // put your setup code here, to run once:
+
+  // Function to tell the Jewelbot to run the loop() function
+  // while plugged into USB power
+  set_run_loop_charging();
+
+  // Output a simple string letting you know the code got into the setup() section
+  JWB_SERIAL("In Setup\n");
+}
+
+
+
+void loop() {
+  // put your main code here, to run repeatedly:
+
+  // Formatted output
+  // Standard C printf commands are valid here (no float on the Jewelbots chip)
+  // This first statement outputs the current value of x as an unsigned integer value
+  JWB_SERIAL_PRINTF("Integer: x = %u\n", x);
+  // This statement outputs the value of x as a hexidecimal number
+  JWB_SERIAL_PRINTF("Hex: x = 0x%x\n", x);
+  x++;
+
+  Timer.pause(2000);
+
+  // This statement demonstrates outputting a string value (characters)
+  JWB_SERIAL_PRINTF("%s\n", str);
+}


Add Matrix-Hello

Add Matrix-Hello

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