Create Woodstation.ino

Create Woodstation.ino

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

--- Woodstation.ino
+++ Woodstation.ino
@@ -0,0 +1,474 @@
+#include <TimeLib.h>
+#include <ESP8266WiFi.h>
+#include <ESP8266mDNS.h>
+#include <WiFiUdp.h>
+#include <ArduinoOTA.h>
+
+#include "ht1632c.h"
+
+/// framebuffer
+static uint8_t** ht1632c_framebuffer = 0;
+static uint8_t ht1632c_framebuffer_len = 96;
+
+const char* ssid = "********";
+const char* password = "********";
+
+// NTP Servers:
+static const char ntpServerName[] = "europe.pool.ntp.org";
+//static const char ntpServerName[] = "time.nist.gov";
+//static const char ntpServerName[] = "time-a.timefreq.bldrdoc.gov";
+//static const char ntpServerName[] = "time-b.timefreq.bldrdoc.gov";
+//static const char ntpServerName[] = "time-c.timefreq.bldrdoc.gov";
+
+int timeZone = 0;     // Central European Time
+//const int timeZone = -5;  // Eastern Standard Time (USA)
+//const int timeZone = -4;  // Eastern Daylight Time (USA)
+//const int timeZone = -8;  // Pacific Standard Time (USA)
+//const int timeZone = -7;  // Pacific Daylight Time (USA)
+
+
+WiFiUDP Udp;
+unsigned int localPort = 8888;  // local port to listen for UDP packets
+
+time_t getNtpTime();
+void digitalClockDisplay();
+void printDigits(int digits);
+void sendNTPpacket(IPAddress &address);
+
+void setup()
+{
+  Serial.begin(115200);
+  Serial.println("Booting");
+  WiFi.mode(WIFI_STA);
+  WiFi.begin(ssid, password);
+  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
+    Serial.println("Connection Failed! Rebooting...");
+    delay(5000);
+    ESP.restart();
+  }
+
+  // Port defaults to 8266
+  // ArduinoOTA.setPort(8266);
+
+  // Hostname defaults to esp8266-[ChipID]
+  // ArduinoOTA.setHostname("myesp8266");
+
+  // No authentication by default
+  // ArduinoOTA.setPassword((const char *)"123");
+
+  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();
+  Serial.println("Ready");
+  Serial.print("IP address: ");
+  Serial.println(WiFi.localIP());
+
+  Serial.println("Starting UDP");
+  Udp.begin(localPort);
+  Serial.print("Local port: ");
+  Serial.println(Udp.localPort());
+  Serial.println("waiting for sync");
+  setSyncProvider(getNtpTime);
+  setSyncInterval(300);
+
+  Serial.println("Setting up SPI display");
+  ht1632c_init(HT1632_CMD_8PMOS);
+  ht1632c_clear();
+  ht1632c_pwm(15);
+  ht1632c_sendframe();
+}
+
+time_t prevDisplay = 0; // when the digital clock was displayed
+
+void loop()
+{
+  if (timeStatus() != timeNotSet) {
+    if (now() != prevDisplay) { //update the display only if time has changed
+      int newTimeZoneOffset = adjustDstEurope();
+      if(newTimeZoneOffset != timeZone)
+      {
+        Serial.print("Adjusting timezone offset: ");
+        Serial.println(newTimeZoneOffset);
+        timeZone = newTimeZoneOffset;
+        setSyncProvider(getNtpTime);
+      }
+      prevDisplay = now();
+      char buffer[7];
+      sprintf(buffer, "%02d%02d%02d", hour(), minute(), second());
+      updateTimeDisplay(buffer);
+    }
+  }
+  delay(100);
+}
+
+void digitalClockDisplay()
+{
+  char buffer[7];
+  sprintf(buffer, "%02d%02d%02d", hour(), minute(), second());
+  Serial.println(buffer);
+}
+
+void printDigits(int digits)
+{
+  // utility for digital clock display: prints preceding colon and leading 0
+  Serial.print(":");
+  if (digits < 10)
+    Serial.print('0');
+  Serial.print(digits);
+}
+
+
+
+
+//------------------ Woodstation related data -------------------
+
+static int timeDisplayBaseAddresses[6][2]=
+{
+    {0,2},  //H
+    {14,2}, //H
+    {28,2}, //m
+    {0,3},  //m
+    {14,3}, //s
+    {28,3}  //s
+};
+
+static int dateDisplayBaseAddresses[8][2]=
+{
+    {1,0},  //D
+    {15,0}, //D
+    {29,0}, //M
+    {1,1},  //M
+    {15,1}, //Y
+    {29,1}, //Y
+    {1,2},  //Y
+    {29,1}  //Y
+};
+
+static int sevenSegmentDigits[10][7]=
+{
+    {1, 1, 1, 1, 1, 1, 0},
+    {0, 1, 1, 0, 0, 0, 0},
+    {1, 1, 0, 1, 1, 0, 1},
+    {1, 1, 1, 1, 0, 0, 1},
+    {0, 1, 1, 0, 0, 1, 1},
+    {1, 0, 1, 1, 0, 1, 1},
+    {1, 0, 1, 1, 1, 1, 1},
+    {1, 1, 1, 0, 0, 0, 0},
+    {1, 1, 1, 1, 1, 1, 1},
+    {1, 1, 1, 1, 0, 1, 1}
+};
+static int spaceCharacter[7] = {0, 0, 0, 0, 0, 0, 0};
+static int minusCharacter[7] = {0, 0, 0, 0, 0, 0, 1};
+
+void writeDisplayCharacterAtIndex(int* sevenSegmentCharBitSequence, int baseAddr, int bitIndex){
+  if (!sevenSegmentCharBitSequence)
+    return;
+  int writeAddr = baseAddr;
+  for (int i = 0; i < 7; ++i) {
+    ht1632c_update_framebuffer(writeAddr, bitIndex, sevenSegmentCharBitSequence[i]);
+    Serial.print(sevenSegmentCharBitSequence[i]);
+    writeAddr = writeAddr + 2;
+  }
+  Serial.println();
+}
+
+void updateTimeDisplay(char* newTime){
+  int characterMap[7] = {0, 0, 0, 0, 0, 0, 0};
+  int iValue = 0;
+  char cValue = '0';
+  for(int timeDigitIndex = 0; timeDigitIndex < 6; timeDigitIndex++){
+    cValue = newTime[timeDigitIndex];
+    iValue = atoi(&cValue);
+    Serial.println(iValue);
+    int baseAddr = timeDisplayBaseAddresses[timeDigitIndex][0];
+    int bitIndex = timeDisplayBaseAddresses[timeDigitIndex][1];
+    writeDisplayCharacterAtIndex(sevenSegmentDigits[iValue], baseAddr, bitIndex);
+  }
+  Serial.println();
+}
+
+
+
+
+
+//-------------------- Time related data ------------------------
+
+
+int adjustDstEurope()
+{
+ // last sunday of march
+ int beginDSTDate=  (31 - (5* year() /4 + 4) % 7);
+ //Serial.println(beginDSTDate);
+ int beginDSTMonth=3;
+ //last sunday of october
+ int endDSTDate= (31 - (5 * year() /4 + 1) % 7);
+ //Serial.println(endDSTDate);
+ int endDSTMonth=10;
+ // DST is valid as:
+ if (((month() > beginDSTMonth) && (month() < endDSTMonth))
+     || ((month() == beginDSTMonth) && (day() >= beginDSTDate))
+     || ((month() == endDSTMonth) && (day() <= endDSTDate)))
+ return 2;  // DST europe = utc +2 hour
+ else return 1; // nonDST europe = utc +1 hour
+}
+
+/*-------- NTP code ----------*/
+
+const int NTP_PACKET_SIZE = 48; // NTP time is in the first 48 bytes of message
+byte packetBuffer[NTP_PACKET_SIZE]; //buffer to hold incoming & outgoing packets
+
+time_t getNtpTime()
+{
+  IPAddress ntpServerIP; // NTP server's ip address
+
+  while (Udp.parsePacket() > 0) ; // discard any previously received packets
+  Serial.println("Transmit NTP Request");
+  // get a random server from the pool
+  WiFi.hostByName(ntpServerName, ntpServerIP);
+  Serial.print(ntpServerName);
+  Serial.print(": ");
+  Serial.println(ntpServerIP);
+  sendNTPpacket(ntpServerIP);
+  uint32_t beginWait = millis();
+  while (millis() - beginWait < 1500) {
+    int size = Udp.parsePacket();
+    if (size >= NTP_PACKET_SIZE) {
+      Serial.println("Receive NTP Response");
+      Udp.read(packetBuffer, NTP_PACKET_SIZE);  // read packet into the buffer
+      unsigned long secsSince1900;
+      // convert four bytes starting at location 40 to a long integer
+      secsSince1900 =  (unsigned long)packetBuffer[40] << 24;
+      secsSince1900 |= (unsigned long)packetBuffer[41] << 16;
+      secsSince1900 |= (unsigned long)packetBuffer[42] << 8;
+      secsSince1900 |= (unsigned long)packetBuffer[43];
+      return secsSince1900 - 2208988800UL + timeZone * SECS_PER_HOUR;
+    }
+  }
+  Serial.println("No NTP Response :-(");
+  return 0; // return 0 if unable to get the time
+}
+
+// send an NTP request to the time server at the given address
+void sendNTPpacket(IPAddress &address)
+{
+  // set all bytes in the buffer to 0
+  memset(packetBuffer, 0, NTP_PACKET_SIZE);
+  // Initialize values needed to form NTP request
+  // (see URL above for details on the packets)
+  packetBuffer[0] = 0b11100011;   // LI, Version, Mode
+  packetBuffer[1] = 0;     // Stratum, or type of clock
+  packetBuffer[2] = 6;     // Polling Interval
+  packetBuffer[3] = 0xEC;  // Peer Clock Precision
+  // 8 bytes of zero for Root Delay & Root Dispersion
+  packetBuffer[12] = 49;
+  packetBuffer[13] = 0x4E;
+  packetBuffer[14] = 49;
+  packetBuffer[15] = 52;
+  // all NTP fields have been given values, now
+  // you can send a packet requesting a timestamp:
+  Udp.beginPacket(address, 123); //NTP requests are to port 123
+  Udp.write(packetBuffer, NTP_PACKET_SIZE);
+  Udp.endPacket();
+}
+
+
+//------------------- HT1632 Related data ------------
+
+void ht1632c_chipselect(const int value)
+{
+  digitalWrite(SS, toBit(value));
+}
+
+void ht1632c_sendcmd(const uint8_t cmd) {
+  uint16_t data = HT1632_ID_CMD;
+  data <<= HT1632_CMD_LEN;
+  data |= cmd;
+  data <<= 5;
+  //reverse_endian(&data, sizeof(data));
+
+  ht1632c_chipselect(1);
+  SPI.write16(data);
+  ht1632c_chipselect(0);
+
+}
+
+void ht1632c_update_framebuffer(const int addr, const uint8_t bitIndex, const uint8_t bitValue)
+{
+  if(addr <0 || addr > (ht1632c_framebuffer_len-1) || bitIndex > 3)
+    return;
+  ht1632c_framebuffer[addr][bitIndex] = toBit(bitValue);
+}
+
+uint8_t ht1632c_get_framebuffer(const int addr, const uint8_t bitIndex)
+{
+  if(addr <0 || addr > (ht1632c_framebuffer_len-1) || bitIndex > 3)
+      return 0;
+  return ht1632c_framebuffer[addr][bitIndex];
+}
+
+//
+// public functions
+//
+
+int ht1632c_init(const uint8_t commonsMode)
+{
+  // init SPI
+  pinMode(SS, OUTPUT);
+  SPI.begin();
+  SPI.setBitOrder(MSBFIRST);
+  SPI.setClockDivider(SPI_CLOCK_DIV64);
+  SPI.setDataMode(SPI_MODE0);
+
+
+  switch (commonsMode) {
+    case HT1632_CMD_8NMOS:
+    case HT1632_CMD_8PMOS:
+      ht1632c_framebuffer_len = 64;
+      break;
+    case HT1632_CMD_16NMOS:
+    case HT1632_CMD_16PMOS:
+      ht1632c_framebuffer_len = 96;
+      break;
+    default:
+      break;
+  }
+
+
+  ht1632c_framebuffer = (uint8_t**) malloc(ht1632c_framebuffer_len*sizeof(uint8_t*));
+  if (!ht1632c_framebuffer) {
+    Serial.println( "Framebuffer allocation failed.");
+    return 3;
+  }
+
+  for (int i = 0; i < ht1632c_framebuffer_len; ++i) {
+    ht1632c_framebuffer[i] = (uint8_t*) malloc(4*sizeof(uint8_t));
+    if (!ht1632c_framebuffer[i]) {
+        Serial.println( "Framebuffer allocation failed.");
+        return 3;
+      }
+    ht1632c_framebuffer[i][0] = ht1632c_framebuffer[i][1] = ht1632c_framebuffer[i][1] = ht1632c_framebuffer[i][3] = 0;
+  }
+
+  // init display
+  ht1632c_sendcmd(HT1632_CMD_SYSDIS);
+  ht1632c_sendcmd(commonsMode);
+  ht1632c_sendcmd(HT1632_CMD_MSTMD);
+  ht1632c_sendcmd(HT1632_CMD_RCCLK);
+  ht1632c_sendcmd(HT1632_CMD_SYSON);
+  ht1632c_sendcmd(HT1632_CMD_LEDON);
+  ht1632c_sendcmd(HT1632_CMD_BLOFF);
+  ht1632c_sendcmd(HT1632_CMD_PWM);
+
+  ht1632c_clear();
+  ht1632c_sendframe();
+
+  return 0;
+}
+
+int ht1632c_close()
+{
+  SPI.end();
+  if (ht1632c_framebuffer) {
+    for (int i = 0; i < ht1632c_framebuffer_len; ++i) {
+      if (ht1632c_framebuffer[i]) {
+        free(ht1632c_framebuffer[i]);
+        ht1632c_framebuffer[i] = 0;
+      }
+    }
+    free(ht1632c_framebuffer);
+    ht1632c_framebuffer = 0;
+  }
+}
+
+void ht1632c_pwm(const uint8_t value)
+{
+  ht1632c_sendcmd(HT1632_CMD_PWM | (value & 0x0f));
+}
+
+void ht1632c_sendframe()
+{
+  uint16_t data = HT1632_ID_WR;
+  data <<= HT1632_ADDR_LEN;
+  data <<= 6;
+
+  //We append the first 1.5 addresses values, to fill the 16bit buffer
+  uint8_t bitValues = 0;
+  for (int j = 0; j < 4; ++j) {
+    bitValues <<= 1;
+    bitValues |= toBit(ht1632c_framebuffer[0][j]);
+  }
+  for (int j = 0; j < 2; ++j) {
+    bitValues <<= 1;
+    bitValues |= toBit(ht1632c_framebuffer[1][j]);
+  }
+  data |= bitValues;
+  //reverse_endian(&data, sizeof(data));
+
+  ht1632c_chipselect(1);
+  SPI.write16(data);
+
+
+  //Loop to write the frame buffer
+  int i = 1;
+  while (i < ht1632c_framebuffer_len) {
+    bitValues = 0;
+    //we copy the last 2 bits of the previous address,
+    //as they are truncated due to message size of 16b
+    //
+    //(format of bit values : AABB BBCC)
+    for (int j = 2; j < 4; ++j) {
+      bitValues <<= 1;
+      bitValues |= toBit(ht1632c_framebuffer[i][j]);
+    }
+    i++;
+    if (i == ht1632c_framebuffer_len) {
+      bitValues <<=6;
+    }else {
+      for (int j = 0; j < 4; ++j) {
+        bitValues <<= 1;
+        bitValues |= toBit(ht1632c_framebuffer[i][j]);
+      }
+      i++;
+      if (i == ht1632c_framebuffer_len) {
+        bitValues <<= 2;
+      }else {
+        for (int j = 0; j < 2; ++j) {
+          bitValues <<= 1;
+          bitValues |= toBit(ht1632c_framebuffer[i][j]);
+        }
+      }
+
+    }
+    SPI.write(bitValues);
+  }
+
+  ht1632c_chipselect(0);
+}
+
+void ht1632c_clear()
+{
+  // clear buffer
+  if (ht1632c_framebuffer) {
+    for (int i = 0; i < ht1632c_framebuffer_len; ++i) {
+      if (ht1632c_framebuffer[i]) {
+        ht1632c_framebuffer[i][0] = ht1632c_framebuffer[i][1] = ht1632c_framebuffer[i][1] = ht1632c_framebuffer[i][3] = 0;
+      }
+    }
+  }
+
+}


Add files via upload

Add files via upload

Coin_Counter_Verison_2 is the second version of the script currently used in the Blue Box AC Controller. (Latest is 11, I think)
It's actually not that far off form the latest version. Most of the revisions were used to figure out that we needed to use a analog Low Pass Filter in order to handle the inrush current EMI when the AC turns on.

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

--- Coin_Counter_Version_2/Coin_Counter_Version_2.ino
+++ Coin_Counter_Version_2/Coin_Counter_Version_2.ino
@@ -0,0 +1,89 @@
+#include <Wire.h>  // Comes with Arduino IDE
+// Get the LCD I2C Library here:
+// https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
+// Move any other LCD libraries to another folder or delete them
+// See Library "Docs" folder for possible commands etc.
+#include <LiquidCrystal_I2C.h>
+volatile int INTcount;
+int pin = 2;
+int result;
+int timer;
+unsigned long time1;
+unsigned long minCounter;
+LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address
+void setup()
+{
+Serial.begin(9600);
+ lcd.begin(16,2);   // initialize the lcd for 16 chars 2 lines, turn on backlight
+  for(int i = 0; i< 3; i++)
+  {
+    lcd.backlight();
+    delay(250);
+    lcd.noBacklight();
+    delay(250);
+  }
+  lcd.backlight  ();
+
+  lcd.setCursor(0,0); //Start at character 4 on line 0
+  lcd.print("Hello, world!");
+  delay(1000);
+  lcd.setCursor(0,1);
+  lcd.print("HI!YourDuino.com");
+  delay(1000);
+
+// Wait and then tell user they can start the Serial Monitor and type in characters to
+// Display. (Set Serial Monitor option to "No Line Ending")
+  lcd.clear();
+  lcd.setCursor(0,0);
+  lcd.print("Time Left: ");
+  lcd.print(timer);
+  lcd.print("min");
+  lcd.setCursor(0,1);
+  lcd.print("1 cent per min");
+
+
+attachInterrupt(digitalPinToInterrupt(pin), timerControl, FALLING);
+pinMode(13, OUTPUT);
+}
+
+void timerControl()
+{
+  INTcount = INTcount + 1;
+  timer = timer + 1;
+
+}
+void loop() {
+  lcd.setCursor(0,0);
+  lcd.print("Time Left: ");
+  lcd.print(timer);
+  lcd.print("min");
+  lcd.setCursor(0,1);
+  lcd.print("1 cent per min");
+  time1 = millis();
+  Serial.println(minCounter);
+  Serial.println(time1);
+  if(timer == 1)
+  {
+    minCounter = millis() + 60000;
+  }
+
+  if(timer != 0 && minCounter <= millis())
+  {
+    timer = timer - 1;
+    minCounter = millis() + 600000;
+  }
+ /*while(timer > 0)
+ {
+   digitalWrite(13,HIGH);
+   delay(60000);
+   timer = timer - 1;
+ }
+
+ if(timer < 0)
+ {
+  digitalWrite(13,LOW);
+  delay(60000);
+ }*/
+}
+
+


Create Cock_Sketch.ino

Create Cock_Sketch.ino

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

--- Cock_Sketch.ino
+++ Cock_Sketch.ino
@@ -0,0 +1,160 @@
+/*
+    Author: Alejandro Palacios (pamanes@gmail.com)
+    Creation Date: Jan. 10, 2015
+    Purpose:
+
+    This is a clock program that pushes the time
+    to Shift Registers in order to light up Nixie Tubes.
+
+	H   H : M   M : S   S  (Nixies)
+	|   |   |   |   |   |   (Rusian Driver has 10 output pins, each lighting up a number)
+    D   D   D   D   D   D   (Russian Driver K155NA1)
+	  \/      \/      \/    (4 pins to each Russian Driver)
+	  SF3     SF2     SF1   (each shift register has 8 output pins - 74HC595)
+
+    There are three Shift Registers, each controls two nixie tubes
+*/
+
+#include "common.h"
+//define shifts pins for seconds
+const int sDataPin = 4;
+const int sLatchPin = 5;
+const int sClockPin = 6;
+//define shifts pins for minutes
+const int mDataPin = 7;
+const int mLatchPin = 8;
+const int mClockPin = 9;
+//define shifts pins for hours
+const int hDataPin = 10;
+const int hLatchPin = 11;
+constint hClockPin = 12;
+//pins for buttons
+const int hButtonPin = 3;
+const int mButtonPin = 13;
+//buttons state
+int hButtonState = 0;
+int mButtonState = 0;
+//flag when button released
+qboolean hFlag = qtrue;
+qboolean mFlag = qtrue;
+//wat a sec each cycle
+const int interval = 1000;
+//keep track o ftime
+unsigned long previousMillis = 0;
+//this is to handle when millis resets
+const unsigned long MAX = 4294967295;
+//byte pushed out to shift registers
+byte sLed = 0;
+byte mLed = 0;
+byte hLed = 0;
+
+//clock variables, init at 12:00:00
+int h = 12;
+int m = 0;
+int s = 0;
+
+//define pins direction
+void setup()
+{
+	//BUTTONS
+	pinMode(hButtonPin, INPUT);
+	pinMode(mButtonPin, INPUT);
+
+	//SHIFTS
+	pinMode(sLatchPin, OUTPUT);
+	pinMode(sDataPin, OUTPUT);
+	pinMode(sClockPin, OUTPUT);
+
+	pinMode(mLatchPin, OUTPUT);
+	pinMode(mDataPin, OUTPUT);
+	pinMode(mClockPin, OUTPUT);
+
+	pinMode(hLatchPin, OUTPUT);
+	pinMode(hDataPin, OUTPUT);
+	pinMode(hClockPin, OUTPUT);
+}
+
+//add either hour, minute or second
+//and call ShowClock to refresh nixies
+void clock(qboolean hAdd, qboolean mAdd, qboolean sAdd)
+{
+	if(hAdd == qtrue)
+		h = h + 1;
+	if(mAdd == qtrue)
+		m = m + 1;
+	if(sAdd == qtrue)
+		s = s + 1;
+
+	if(s>59){m = m + 1;s = 0;}
+	if(m>59){h = h + 1;m = 0;}
+	if(h>12){h = 1;m = 0;s = 0;}
+
+	ShowClock();
+}
+
+//display to nixies
+void ShowClock()
+{
+	//each shift register controls two nixies
+	//split the value into two , then shift bits
+	//of first digit and sum then update shifts
+	sLed = (s % 10) + ((s / 10) << 4);
+	mLed = (m % 10) + ((m / 10) << 4);
+	hLed = (h % 10) + ((h / 10) << 4);
+
+    UpdateShiftRegister();
+}
+
+void loop()
+{
+    // Get snapshot of time
+    unsigned long currentMillis = millis();
+
+    hButtonState = digitalRead(hButtonPin);//pin 3
+    mButtonState = digitalRead(mButtonPin);//pin 13
+    //flag for only processing one time when pressed
+    if(!hFlag && hButtonState == LOW)
+        hFlag = qtrue;
+    if(!mFlag && mButtonState == LOW)
+        mFlag = qtrue;
+	//Note: They will be high and low randomly if not connected!
+
+	//if hour button was pushed add hour
+    if (hButtonState == HIGH && hFlag)
+    {
+        //add hour
+        hFlag = qfalse;
+        clock(qtrue, qfalse, qfalse);
+    }
+    //if minute button was pushed
+    if (mButtonState == HIGH && mFlag)
+    {
+        //add minute
+        mFlag = qfalse;
+        clock(qfalse, qtrue, qfalse);
+    }
+
+    //handle reset to 0 when max unsigned long is reached (after 49 days)
+    if(((unsigned long)(currentMillis - previousMillis) >= interval) ||
+	((currentMillis < previousMillis) && ((unsigned long)(MAX - (previousMillis-1) + currentMillis) >= interval)))
+    {
+        // It's time to do something!
+        clock(qfalse, qfalse, qtrue);
+        previousMillis = currentMillis;
+    }
+}
+//shift out
+void UpdateShiftRegister()
+{
+    digitalWrite(sLatchPin, LOW);
+    shiftOut(sDataPin, sClockPin, LSBFIRST, sLed);
+    digitalWrite(sLatchPin, HIGH);
+
+    digitalWrite(mLatchPin, LOW);
+    shiftOut(mDataPin, mClockPin, LSBFIRST, mLed);
+    digitalWrite(mLatchPin, HIGH);
+
+    digitalWrite(hLatchPin, LOW);
+    shiftOut(hDataPin, hClockPin, LSBFIRST, hLed);
+    digitalWrite(hLatchPin, HIGH);
+}


Added constantly updating test for sensors

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

--- testsuite/REV20Sensors/REV20Sensors.ino
+++ testsuite/REV20Sensors/REV20Sensors.ino
@@ -0,0 +1,289 @@
+/*
+The OpenTRV project licenses this file to you
+under the Apache Licence, Version 2.0 (the "Licence");
+you may not use this file except in compliance
+with the Licence. You may obtain a copy of the Licence at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the Licence is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the Licence for the
+specific language governing permissions and limitations
+under the Licence.
+
+Author(s) / Copyright (s): Deniz Erbilgin 2016
+*/
+/**
+ * Minimal REV7 config for testing power consumption.
+ * Aim is to:
+ *     - todo init GPIO pins to safe mode.
+ *     - todo init peripherals to safe low power mode.
+ *     - loop endlessly.
+ */
+
+// INCLUDES & DEFINES
+// Debug output flag
+#define DEBUG
+// REV7 / DORM1 all-in-one valve unit, secure TX.
+#define CONFIG_TRV20_PROTO
+// Get defaults for valve applications.
+#include <OTV0p2_valve_ENABLE_defaults.h>
+// All-in-one valve unit (DORM1).
+#include <OTV0p2_CONFIG_REV20.h>
+// I/O pin allocation and setup: include ahead of I/O module headers.
+#include <OTV0p2_Board_IO_Config.h>
+// OTV0p2Base Libraries
+#include <OTV0p2Base.h>
+// RadValve libraries
+#include <OTRadValve.h>
+
+
+// Debugging output
+#ifndef DEBUG
+#define DEBUG_SERIAL_PRINT(s) // Do nothing.
+#define DEBUG_SERIAL_PRINTFMT(s, format) // Do nothing.
+#define DEBUG_SERIAL_PRINT_FLASHSTRING(fs) // Do nothing.
+#define DEBUG_SERIAL_PRINTLN_FLASHSTRING(fs) // Do nothing.
+#define DEBUG_SERIAL_PRINTLN() // Do nothing.
+#define DEBUG_SERIAL_TIMESTAMP() // Do nothing.
+#else
+// Send simple string or numeric to serial port and wait for it to have been sent.
+// Make sure that Serial.begin() has been invoked, etc.
+#define DEBUG_SERIAL_PRINT(s) { OTV0P2BASE::serialPrintAndFlush(s); }
+#define DEBUG_SERIAL_PRINTFMT(s, fmt) { OTV0P2BASE::serialPrintAndFlush((s), (fmt)); }
+#define DEBUG_SERIAL_PRINT_FLASHSTRING(fs) { OTV0P2BASE::serialPrintAndFlush(F(fs)); }
+#define DEBUG_SERIAL_PRINTLN_FLASHSTRING(fs) { OTV0P2BASE::serialPrintlnAndFlush(F(fs)); }
+#define DEBUG_SERIAL_PRINTLN() { OTV0P2BASE::serialPrintlnAndFlush(); }
+// Print timestamp with no newline in format: MinutesSinceMidnight:Seconds:SubCycleTime
+extern void _debug_serial_timestamp();
+#define DEBUG_SERIAL_TIMESTAMP() _debug_serial_timestamp()
+#endif // DEBUG
+
+// OBJECTS & VARIABLES
+/**
+ * Peripherals present on REV7
+ * - Pot        Set input to Hi-Z?
+ * - PHT        IO_POWER_UP LOW
+ * - Encoder    IO_POWER_UP LOW
+ * - LED        Set pin HIGH?
+ * - Button     Set to INPUT
+ * - H-Bridge   Control pins HIGH, Current sense set to input.
+ * - TMP112     read() once.
+ * - XTAL       Setup and leave running?
+ * - UART       Disable
+ */
+
+/**
+ * Dummy Types
+ */
+// Placeholder class with dummy static status methods to reduce code complexity.
+typedef OTV0P2BASE::DummySensorOccupancyTracker OccupancyTracker;
+
+/**
+ * Supply Voltage instance
+ */
+// Sensor for supply (eg battery) voltage in millivolts.
+// Singleton implementation/instance.
+OTV0P2BASE::SupplyVoltageCentiVolts Supply_cV;
+
+/*
+ * TMP112 instance
+ */
+OTV0P2BASE::RoomTemperatureC16_TMP112 TemperatureC16;
+
+/*
+ * SHT21 instance XXX Disabled
+ */
+//OTV0P2BASE::RoomTemperatureC16_SHT21 TemperatureC16; // SHT21 impl.
+
+// HUMIDITY_SENSOR_SUPPORT is defined if at least one humidity sensor has support compiled in.
+// Simple implementations can assume that the sensor will be present if defined;
+// more sophisticated implementations may wish to make run-time checks.
+// If SHT21 support is enabled at compile-time then its humidity sensor may be used at run-time.
+//// Singleton implementation/instance.
+//typedef OTV0P2BASE::HumiditySensorSHT21 RelHumidity_t;
+//RelHumidity_t RelHumidity;
+
+/**
+ * Temp pot
+ */
+// Sensor for temperature potentiometer/dial UI control.
+// Correct for DORM1/TRV1 with embedded REV7.
+// REV7 does not drive pot from IO_POWER_UP.
+typedef OTV0P2BASE::SensorTemperaturePot<OccupancyTracker, nullptr, 48, 296, false> TempPot_t;
+TempPot_t TempPot;
+
+/**
+ * Ambient Light Sensor
+ */
+typedef OTV0P2BASE::SensorAmbientLight AmbientLight;
+// Singleton implementation/instance.
+AmbientLight AmbLight;
+
+/**
+ * Valve Actuator
+ */
+// DORM1/REV7 direct drive motor actuator.
+static constexpr bool binaryOnlyValveControl = false;
+static constexpr uint8_t m1 = MOTOR_DRIVE_ML;
+static constexpr uint8_t m2 = MOTOR_DRIVE_MR;
+typedef OTRadValve::ValveMotorDirectV1<m1, m2, MOTOR_DRIVE_MI_AIN, MOTOR_DRIVE_MC_AIN, decltype(Supply_cV), &Supply_cV, binaryOnlyValveControl> ValveDirect_t;
+// Singleton implementation/instance.
+// Suppress unnecessary activity when room dark, eg to avoid disturbance if device crashes/restarts,
+// unless recent UI use because value is being fitted/adjusted.
+ValveDirect_t ValveDirect([](){return(AmbLight.isRoomDark());});
+
+// FUNCTIONS
+
+/**
+ * Panic Functions
+ */
+// Indicate that the system is broken in an obvious way (distress flashing the main LED).
+// DOES NOT RETURN.
+// Tries to turn off most stuff safely that will benefit from doing so, but nothing too complex.
+// Tries not to use lots of energy so as to keep distress beacon running for a while.
+void panic()
+{
+    // Reset radio and go into low-power mode.
+//    PrimaryRadio.panicShutdown();
+    // Power down almost everything else...
+    OTV0P2BASE::minimisePowerWithoutSleep();
+    pinMode(OTV0P2BASE::LED_HEATCALL_L, OUTPUT);
+    for( ; ; )
+    {
+        OTV0P2BASE::LED_HEATCALL_ON();
+        OTV0P2BASE::nap(WDTO_15MS);
+        OTV0P2BASE::LED_HEATCALL_OFF();
+        OTV0P2BASE::nap(WDTO_120MS);
+    }
+}
+// Panic with fixed message.
+void panic(const __FlashStringHelper *s)
+{
+    OTV0P2BASE::serialPrintlnAndFlush(); // Start new line to highlight error.  // May fail.
+    OTV0P2BASE::serialPrintAndFlush('!'); // Indicate error with leading '!' // May fail.
+    OTV0P2BASE::serialPrintlnAndFlush(s); // Print supplied detail text. // May fail.
+    panic();
+}
+
+
+/**
+ * @brief   Set pins and on-board peripherals to safe low power state.
+ */
+
+
+//========================================
+// SETUP
+//========================================
+
+// Setup routine: runs once after reset.
+// Does some limited board self-test and will panic() if anything is obviously broken.
+void setup()
+{
+    // Set appropriate low-power states, interrupts, etc, ASAP.
+    OTV0P2BASE::powerSetup();
+    // IO setup for safety, and to avoid pins floating.
+    OTV0P2BASE::IOSetup();
+
+    OTV0P2BASE::serialPrintAndFlush(F("\r\nOpenTRV: ")); // Leading CRLF to clear leading junk, eg from bootloader.
+    V0p2Base_serialPrintlnBuildVersion();
+
+    OTV0P2BASE::LED_HEATCALL_ON();
+
+    // Give plenty of time for the XTal to settle.
+    delay(1000);
+
+    // Have 32678Hz clock at least running before going any further.
+    // Check that the slow clock is running reasonably OK, and tune the fast one to it.
+    if(!::OTV0P2BASE::HWTEST::calibrateInternalOscWithExtOsc()) { panic(F("Xtal")); } // Async clock not running or can't tune.
+//    if(!::OTV0P2BASE::HWTEST::check32768HzOsc()) { panic(F("xtal")); } // Async clock not running correctly.
+
+    // Buttons should not be activated DURING boot for user-facing boards; an activated button implies a fault.
+    // Check buttons not stuck in the activated position.
+    if(fastDigitalRead(BUTTON_MODE_L) == LOW) { panic(F("b")); }
+
+    // Collect full set of environmental values before entering loop() in normal mode.
+    // This should also help ensure that sensors are properly initialised.
+
+    // No external sensors are *assumed* present if running alt main loop
+    // This may mean that the alt loop/POST will have to initialise them explicitly,
+    // and the initial seed entropy may be marginally reduced also.
+    const int cV = Supply_cV.read();
+    DEBUG_SERIAL_PRINT_FLASHSTRING("V: ");
+    DEBUG_SERIAL_PRINT(cV);
+    DEBUG_SERIAL_PRINTLN();
+    const int heat = TemperatureC16.read();
+    DEBUG_SERIAL_PRINT_FLASHSTRING("T: ");
+    DEBUG_SERIAL_PRINT(heat);
+    DEBUG_SERIAL_PRINTLN();
+// SHT21 not present by default.
+//    const uint8_t rh = RelHumidity.read();
+//    DEBUG_SERIAL_PRINT_FLASHSTRING("RH%: ");
+//    DEBUG_SERIAL_PRINT(rh);
+//    DEBUG_SERIAL_PRINTLN();
+    const int light = AmbLight.read();
+    DEBUG_SERIAL_PRINT_FLASHSTRING("L: ");
+    DEBUG_SERIAL_PRINT(light);
+    DEBUG_SERIAL_PRINTLN();
+    const int tempPot = TempPot.read();
+    DEBUG_SERIAL_PRINT_FLASHSTRING("temp pot: ");
+    DEBUG_SERIAL_PRINT(tempPot);
+    DEBUG_SERIAL_PRINTLN();
+
+    ValveDirect.read();
+
+    // Initialised: turn main/heatcall UI LED off.
+    OTV0P2BASE::LED_HEATCALL_OFF();
+
+    // Do OpenTRV-specific (late) setup.
+}
+
+
+//========================================
+// MAIN LOOP
+//========================================
+/**
+ * @brief   Sleep in low power mode if not sleeping.
+ */
+void loop()
+{
+    // Ensure that serial I/O is off while sleeping.
+    OTV0P2BASE::powerDownSerial();
+    // Power down most stuff (except radio for hub RX).
+    OTV0P2BASE::minimisePowerWithoutSleep();
+
+    delay(1000);
+        const int cV = Supply_cV.read();
+    DEBUG_SERIAL_PRINT_FLASHSTRING("V: ");
+    DEBUG_SERIAL_PRINT(cV);
+    DEBUG_SERIAL_PRINTLN();
+    const int heat = TemperatureC16.read();
+    DEBUG_SERIAL_PRINT_FLASHSTRING("T: ");
+    DEBUG_SERIAL_PRINT(heat);
+    DEBUG_SERIAL_PRINTLN();
+// SHT21 not present by default.
+//    const uint8_t rh = RelHumidity.read();
+//    DEBUG_SERIAL_PRINT_FLASHSTRING("RH%: ");
+//    DEBUG_SERIAL_PRINT(rh);
+//    DEBUG_SERIAL_PRINTLN();
+    const int light = AmbLight.read();
+    DEBUG_SERIAL_PRINT_FLASHSTRING("L: ");
+    DEBUG_SERIAL_PRINT(light);
+    DEBUG_SERIAL_PRINTLN();
+    const int tempPot = TempPot.read();
+    DEBUG_SERIAL_PRINT_FLASHSTRING("temp pot: ");
+    DEBUG_SERIAL_PRINT(tempPot);
+    DEBUG_SERIAL_PRINTLN();
+}
+
+
+
+/**
+ * @note    Power consumption figures (all in mA).
+ * Date/commit:         Device: Wake (Sleep) @ Voltage
+ * 20161111/0e6ec96     REV7:   1.5 (1.1) @ 2.5 V       REV11:  0.45 (0.03) @ 2.5 V
+ * 20161111/f2eed5e     REV7:   0.46 (0.04) @ 2.5 V
+ */
+


Cleanup

Cleanup

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/lgramatikov/celeste.git/'


Add arduino sketch

Add arduino sketch

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

--- arduino/leap_arduino_sketch/leap_arduino_sketch.ino
+++ arduino/leap_arduino_sketch/leap_arduino_sketch.ino
@@ -0,0 +1,109 @@
+// oc_sample_5.ino
+// 両側に取り付けた赤外線測距センサーに反応して行動する二輪ロボットのプログラム
+
+int pwm_a = 3;   //PWM control for motor outputs 1 and 2 is on digital pin 3
+int pwm_b = 11;  //PWM control for motor outputs 3 and 4 is on digital pin 11
+int dir_a = 12;  //direction control for motor outputs 1 and 2 is on digital pin 12
+int dir_b = 13;  //direction control for motor outputs 3 and 4 is on digital pin 13
+
+void setup()
+{
+  Serial.begin(115200);
+
+  pinMode(pwm_a, OUTPUT);  //Set control pins to be outputs
+  pinMode(pwm_b, OUTPUT);
+  pinMode(dir_a, OUTPUT);
+  pinMode(dir_b, OUTPUT);
+
+}
+
+void loop()
+{
+  ///*
+  char c = 0;
+  if (Serial.available()) {
+    c = Serial.read();
+  }
+  // シリアルからのデータ受信
+  if( c == '0' ){
+    stopped();
+  }
+  else if( c == '5' ){
+    goForward(255);
+  }
+  else if( c == '2' ){
+    goBackward(255);
+  }
+  else if( c == '6' ){
+    turnRight(128);
+  }
+  else if( c == '7' ){
+    turnLeft(128);
+  }
+  //*/
+  //goForward(255);
+  //Serial.println(aa);
+
+  // 100ミリ秒停止
+  delay(100);
+}
+
+
+// 引数で指定したpinに接続された赤外線測距センサーの距離値を取得する関数
+// cm単位の距離を整数値で返す。範囲外（10cm未満、又は80cmより大きい）の場合は0を返す。
+int getRange(int pin) {
+
+// 引数で指定されたpinの電圧値を0から1023の値で取得する
+  int voltage = analogRead(pin);
+
+  // 取得した電圧値を距離（cm）に変換
+  int range = ((6787 / (voltage - 3)) - 4);
+
+  if( range >= 10 && range <= 80 ){
+    return range;
+  }
+  else {
+    return 0;
+  }
+}
+
+void goForward(int speed) // forward
+{
+  digitalWrite(dir_a, HIGH);  //Reverse motor direction, 1 high, 2 low
+  digitalWrite(dir_b, HIGH);  //Reverse motor direction, 3 low, 4 high
+  analogWrite(pwm_a, speed);    //set both motors to run at (100/255 = 39)% duty cycle
+  analogWrite(pwm_b, speed);
+}
+
+void goBackward(int speed) // backward
+{
+  digitalWrite(dir_a, LOW);  //Set motor direction, 1 low, 2 high
+  digitalWrite(dir_b, LOW);  //Set motor direction, 3 high, 4 low
+  analogWrite(pwm_a, speed);   //set both motors to run at 100% duty cycle (fast)
+  analogWrite(pwm_b, speed);
+}
+
+void stopped() //stop
+{
+  digitalWrite(dir_a, LOW); //Set motor direction, 1 low, 2 high
+  digitalWrite(dir_b, LOW); //Set motor direction, 3 high, 4 low
+  analogWrite(pwm_a, 0);    //set both motors to run at 100% duty cycle (fast)
+  analogWrite(pwm_b, 0);
+}
+
+void turnLeft(int speed)  // turn left
+{
+  digitalWrite(dir_a, HIGH);  //Reverse motor direction, 1 high, 2 low
+  digitalWrite(dir_b, LOW);  //Reverse motor direction, 3 low, 4 high
+  analogWrite(pwm_a, speed);    //set both motors to run at (100/255 = 39)% duty cycle
+  analogWrite(pwm_b, speed);
+}
+
+void turnRight(int speed)  // turn right
+{
+  digitalWrite(dir_a, LOW);  //Reverse motor direction, 1 high, 2 low
+  digitalWrite(dir_b, HIGH);  //Reverse motor direction, 3 low, 4 high
+  analogWrite(pwm_a, speed);    //set both motors to run at (100/255 = 39)% duty cycle
+  analogWrite(pwm_b, speed);
+}
+


Triangles and curtains, annnnd two.. two brothers

error: pathspec 'examples/cymatic-curtains-with-triangles/cymatic-curtains-with-triangles.ino' did not match any file(s) known to git

--- examples/cymatic-curtains-with-triangles/cymatic-curtains-with-triangles.ino
+++ examples/cymatic-curtains-with-triangles/cymatic-curtains-with-triangles.ino
@@ -0,0 +1,129 @@
+#include "pixelmap/pixelmap.h"
+#include <FastLED.h>
+#include <Logging.h>
+
+// Weird thing I had to do to get the Logging library working with teensy
+extern "C"{
+  int _getpid(){ return -1;}
+  int _kill(int pid, int sig){ return -1; }
+  int _write(){return -1;}
+}
+
+#define LOGLEVEL LOG_LEVEL_INFOS
+
+using namespace pixelmap;
+
+Input* input;
+
+LEDStrip strip1 = LEDStrip(150);
+LEDStrip strip2 = LEDStrip(150);
+LEDStrip strip3 = LEDStrip(150);
+LEDStrip strip4 = LEDStrip(150);
+LEDStrip strip5 = LEDStrip(57);
+
+LEDs leds1 = LEDs(&strip1, 0, 150);
+LEDs leds2 = LEDs(&strip2, 0, 150);
+LEDs leds3 = LEDs(&strip3, 0, 150);
+LEDs leds4 = LEDs(&strip4, 0, 150);
+LEDs leds5 = LEDs(&strip5, 0, 57);
+
+Visualization* viz;
+CurtainAnimation* anim1;
+CurtainAnimation* anim2;
+CurtainAnimation* anim3;
+CurtainAnimation* anim4;
+TriangleAnimation* anim5;
+
+void setup() {
+  Log.Init(LOGLEVEL, 9600);
+  delay(1000);
+  Log.Info("Starting setup()\n");
+  Serial.flush();
+  delay(1000);
+
+  //input = new WaveInput();
+  input = new MSGEQ7Input(
+    1,    // left pin
+    0,    // right pin
+    12,   // strobe pin
+    13,   // reset pin,
+    1000, // max amplitude
+    250   // min amplutide
+  );
+
+  viz = new RippleVisualization(input, 75, 1);
+
+  anim1 = new CurtainAnimation(viz, leds1);
+  anim2 = new CurtainAnimation(viz, leds2);
+  anim3 = new CurtainAnimation(viz, leds3);
+  anim4 = new CurtainAnimation(viz, leds4);
+  anim5 = new TriangleAnimation(viz, leds5);
+
+  // Far right curtain
+  anim1->init(
+     25,    // height in pixels
+     6,     // width in pixels
+     1.0,   // height in ratio of visualiation
+     0.25,  // width in ratio of visualiation
+     0.0,   // rotation in radians
+     0.45,  // x distance from visualization start in ratio of visualization
+    -0.7,   // y "
+     0.0);  // z "
+
+  // Middle right curtain
+  anim2->init(
+     25,    // height in pixels
+     6,     // width in pixels
+     1.0,   // height in ratio of visualiation
+     0.25,  // width in ratio of visualiation
+     0.0,   // rotation in radians
+     0.13,   // x distance from visualization start in ratio of visualization
+    -0.5,   // y "
+     0.0);  // z "
+
+  // Middle left curtain
+  anim3->init(
+     25,    // height in pixels
+     6,     // width in pixels
+     1.0,   // height in ratio of visualiation
+     0.25,  // width in ratio of visualiation
+     0.0,   // rotation in radians
+    -0.38,  // x distance from visualization start in ratio of visualization
+    -0.5,   // y "
+     0.0);  // z "
+
+  // Far left curtain
+  anim4->init(
+     25,    // height in pixels
+     6,     // width in pixels
+     1.0,   // height in ratio of visualiation
+     0.25,  // width in ratio of visualiation
+     0.0,   // rotation in radians
+    -0.7,   // x distance from visualization start in ratio of visualization
+    -0.7,   // y "
+     0.0);  // z "
+
+  anim5->init(1.0);
+
+  FastLED.addLeds<WS2811, 6, RGB>(strip1.leds, 150);
+  FastLED.addLeds<WS2811, 7, RGB>(strip2.leds, 150);
+  FastLED.addLeds<WS2811, 8, RGB>(strip3.leds, 150);
+  FastLED.addLeds<WS2811, 9, RGB>(strip4.leds, 150);
+  FastLED.addLeds<WS2811, 10, GRB>(strip5.leds, 57);
+
+  Looper* looper = Looper::instance();
+  looper->addInput(input);
+  looper->addVisualization(viz);
+  looper->addAnimation(anim1);
+  looper->addAnimation(anim2);
+  looper->addAnimation(anim3);
+  looper->addAnimation(anim4);
+  looper->addAnimation(anim5);
+
+  Log.Info("Finished setup()\n");
+  delay(100);
+}
+
+void loop() {
+  Looper::instance()->loop();
+}


add akene_index

add akene_index

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

--- akene_index/akene_index.ino
+++ akene_index/akene_index.ino
@@ -0,0 +1,197 @@
+/*
+  Sigfox index sender (network and board test)
+
+  Note         :
+  With card(s) : 1. Olimexino-328 (Arduino IDE set on "Duemilanove" with ATMega328)
+                 https://www.olimex.com/Products/Duino/AVR/OLIMEXINO-328/
+                 2. Akene V1 (Sigfox UNB modem TD1208)
+                 http://snootlab.com/lang-en/snootlab-shields/889-akene-v1-en.html
+  License      : MIT
+
+*/
+
+/* library */
+// Arduino core
+#include <SoftwareSerial.h>
+// AVR low-power library (see https://github.com/rocketscream/Low-Power)
+#include "LowPower.h"
+
+// some const
+#define TEST_LED     13
+
+// some types
+union payload_t
+{
+  struct
+  {
+    uint32_t index;
+  };
+  uint8_t byte[12];
+};
+
+// some prototypes
+void sig_send_index(uint32_t index);
+uint32_t bswap_32 (uint32_t x);
+uint16_t bswap_16(uint16_t x);
+
+// some vars
+// Akene UNB modem : S_RX is D5, S_TX is D4
+SoftwareSerial modem(4,5); //uC Rx D4, Tx D5
+uint32_t tick_8s = 0;
+uint32_t index = 0;
+bool debug_mode = 0;
+
+// link stdout (printf) to Serial object
+// create a FILE structure to reference our UART
+static FILE console_out = {0};
+// create a FILE structure to reference our UNB modem
+static FILE modem_out = {0};
+
+// create serial outputs functions
+// This works because Serial.write, although of
+// type virtual, already exists.
+static int console_putchar (char c, FILE *stream)
+{
+  Serial.write(c);
+  return 0;
+}
+
+static int modem_putchar (char c, FILE *stream)
+{
+  modem.write(c);
+  return 0;
+}
+
+void setup()
+{
+  // IO setup
+  pinMode(TEST_LED, OUTPUT);
+  // test led on
+  digitalWrite(TEST_LED, HIGH);
+  // open serial communications, link Serial to stdio lib
+  Serial.begin(9600);
+  // set the data rate for the SoftwareSerial port
+  modem.begin(9600);
+  //modem.setTimeout(5000);
+  // fill in the UART file descriptor with pointer to writer
+  fdev_setup_stream(&console_out, console_putchar, NULL, _FDEV_SETUP_WRITE);
+  fdev_setup_stream(&modem_out,   modem_putchar,   NULL, _FDEV_SETUP_WRITE);
+  // standard output device STDOUT is console
+  stdout = &console_out;
+  // fill in the UART file descriptor with pointer to writer
+  fdev_setup_stream(&console_out, console_putchar, NULL, _FDEV_SETUP_WRITE);
+  fdev_setup_stream(&modem_out,   modem_putchar,   NULL, _FDEV_SETUP_WRITE);
+  // standard output device STDOUT is console
+  stdout = &console_out;
+  // UNB modem boot time
+  fprintf_P(&console_out, PSTR("system startup\r\n"));
+  fprintf_P(&console_out, PSTR("wait 3s for UNB modem boot time...\r\n"));
+  delay(3000);
+  // test led off
+  digitalWrite(TEST_LED, LOW);
+  // set reroute (console <-> UNB modem) ?
+  fprintf_P(&console_out, PSTR("PRESS \"r\" key to reroute to UNB modem\r\n"));
+  fprintf_P(&console_out, PSTR("PRESS \"d\" key to set debug mode\r\n"));
+  fprintf_P(&console_out, PSTR("wait 4s...\r\n"));
+  uint8_t k_loop = 0;
+  char key;
+  while (k_loop++ < 4)
+  {
+    delay(1000);
+    key = Serial.read();
+    if (key != -1) break;
+  }
+  // check user choice : debug
+  if (key == 'd')
+  {
+    debug_mode = 1;
+    fprintf_P(&console_out, PSTR("debug mode on\r\n"));
+  }
+  // check user choice : reroute
+  else if (key == 'r')
+  {
+    // debug mode : reroute console to UNB modem
+    fprintf_P(&console_out, PSTR("reroute to UNB modem (reset board to exit this mode)\r\n"));
+    while (1)
+    {
+      // read from port 0, send to port 1:
+      while (Serial.available())
+        modem.write(Serial.read());
+      // read from port 1, send to port 0:
+      while (modem.available())
+        Serial.write(modem.read());
+    }
+  } else {
+    // startup message
+    fprintf_P(&console_out, PSTR("system ready\r\n"));
+  }
+}
+
+void loop() {
+  // vars
+  char inChar = ' ';
+  // update tick
+  tick_8s++;
+  // send Sigfox frame
+  // send index: every 15 mins
+  if (tick_8s % 112 == 0)
+    sig_send_index(index++);
+  // debug mode
+  if (debug_mode) {
+    fprintf_P(&console_out, PSTR("tick_8s=%d\r\n"), tick_8s);
+    // arduino printf don't include "%f" for printf
+    Serial.print("Index: ");
+    Serial.println(index);
+  }
+  // ensure outgoing serial data is complete before sleep
+  Serial.flush();
+  modem.flush();
+  // enter power down state for 8 s with ADC and BOD module disabled
+  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
+}
+
+void sig_send_index(uint32_t index) {
+  payload_t frame;
+  char buffer[30];
+  // init var
+  memset(&frame, 0, sizeof(frame));
+  // set frame field
+  frame.index = index;
+  // format hex string (ex : 0101fe5ec8990000...)
+  strcpy_P(buffer, PSTR(""));
+  uint8_t i = 0;
+  char digits[3];
+  do
+  {
+    sprintf(digits, "%02x", frame.byte[i]);
+    strcat(buffer, digits);
+  } while(++i < sizeof(frame));
+  // send command
+  fprintf_P(&modem_out, PSTR("AT$SS=%s\r"), buffer);
+  // debug message
+  if (debug_mode) {
+    fprintf_P(&console_out, PSTR("send \"AT$SS=%s\"\r\n"), buffer);
+  }
+}
+
+// *** swap byte order function for 32 and 16 bits ***
+uint32_t bswap_32(uint32_t x)
+{
+  unsigned char c[4], temp;
+
+  memcpy (c, &x, 4);
+  temp = c[0];
+  c[0] = c[3];
+  c[3] = temp;
+  temp = c[1];
+  c[1] = c[2];
+  c[2] = temp;
+  memcpy (&x, c, 4);
+  return (x);
+}
+
+uint16_t bswap_16(uint16_t x)
+{
+  return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8));
+}
+


Updated XivelyClient example

Updated XivelyClient example

--- hardware/arduino/avr/libraries/Bridge/examples/XivelyClient/XivelyClient.ino
+++ hardware/arduino/avr/libraries/Bridge/examples/XivelyClient/XivelyClient.ino
@@ -1,15 +1,12 @@
-
 /*
   Xively sensor client with Strings

  This sketch connects an analog sensor to Xively,
- using an Arduino Yun.
+ using an Arduino Yún.

- created  15 March 2010
+ created 15 March 2010
  updated 27 May 2013
  by Tom Igoe
-
- NOT CURRENTLY WORKING as of Arduino 1.5.3 27 May 2013

  */

@@ -25,88 +22,89 @@
  #define APIKEY        "foo"                  // replace your pachube api key here
  #define FEEDID        0000                   // replace your feed ID
  #define USERAGENT     "my-project"           // user agent is the project name
-  */
+ */

 // set up net client info:
-boolean lastConnected = false;      // state of the connection last time through the main loop
-const unsigned long postingInterval = 60000;  //delay between updates to Pachube.com
+const unsigned long postingInterval = 60000;  //delay between updates to xively.com
 unsigned long lastRequest = 0;      // when you last made a request
 String dataString = "";
-Process xively;

 void setup() {
   // start serial port:
-  Serial.begin(9600);
   Bridge.begin();
-  delay(2000);
+  Console.begin();

-  while(!Serial);    // wait for Serial Monitor to open
-  Serial.println("Xively client");
+  while(!Console);    // wait for Network Console to open
+  Console.println("Xively client");

-  // reserve space for dataString:
-  dataString.reserve(100);
+  // Do a first update immediatly
+  updateData();
   sendData();
+  lastRequest = millis();
 }

 void loop() {
   // get a timestamp so you can calculate reading and sending intervals:
   long now = millis();

-  // convert the readings to a String to send it:
-  dataString = "temp,";
-  dataString += random(10) + 20;
-  // add pressure:
-  dataString += "\nPressure,";
-  dataString += random(5) + 100;
-
-  // if there's incoming data from the net connection,
-  // send it out the serial port:
-  if (xively.available()>0) {
-    char c = xively.read();
-    Serial.write(c);
-  }
-
-
-  // if you're not connected, and the sending interval has passed since
-  // your last connection, then connect again and send data:
-  if(now - lastRequest >= postingInterval) {
+  // if the sending interval has passed since your
+  // last connection, then connect again and send data:
+  if (now - lastRequest >= postingInterval) {
+    updateData();
     sendData();
     lastRequest = now;
   }
 }

+void updateData() {
+  // convert the readings to a String to send it:
+  dataString = "Temperature,";
+  dataString += random(10) + 20;
+  // add pressure:
+  dataString += "\nPressure,";
+  dataString += random(5) + 100;
+}
+
 // this method makes a HTTP connection to the server:
 void sendData() {
-  Serial.println("Sending data");
-  dataString = "--data \'" + dataString;
-  dataString += "\'";
-
   // form the string for the API header parameter:
-  String apiString =  "--header \"X-ApiKey: ";
+  String apiString = "X-ApiKey: ";
   apiString += APIKEY;
-  apiString += "\"";

   // form the string for the URL parameter:
-  String url =  " \"https://api.xively.com/v2/feeds/";
+  String url = "https://api.xively.com/v2/feeds/";
   url += FEEDID;
-  url += ".csv\"";
-
-  // send the HTTP PUT request:
+  url += ".csv";
+
+  // Send the HTTP PUT request
+
+  // Is better to declare the Process here, so when the
+  // sendData function finishes the resources are immediatly
+  // released. Declaring it global works too, BTW.
+  Process xively;
+  Console.print("\n\nSending data... ");
   xively.begin("curl");
   xively.addParameter("-k");
-  xively.addParameter("--request PUT");
+  xively.addParameter("--request");
+  xively.addParameter("PUT");
+  xively.addParameter("--data");
   xively.addParameter(dataString);
+  xively.addParameter("--header");
   xively.addParameter(apiString);
   xively.addParameter(url);
   xively.run();
+  Console.println("done!");
+
+  // If there's incoming data from the net connection,
+  // send it out the Console:
+  while (xively.available()>0) {
+    char c = xively.read();
+    Console.write(c);
+  }
+
 }

-
-
-
-
-


add autobaud_bitlash.ino

add autobaud_bitlash.ino

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

--- autobaud_bitlash.ino
+++ autobaud_bitlash.ino
@@ -0,0 +1,197 @@
+// auto serial baudrate discover
+//
+// target : Arduino Mega (ATMega2560)
+// note   : - use timer1 for 0.5 uS accuracy time measure
+//            (arduino core micros() is just 4us accuracy).
+//          - signal to detect must be wire on pin 2.
+//          - use bitlash for console manager (see https://github.com/billroy/bitlash)
+//          - use Timer for schedule tasks (see  https://github.com/JChristensen/Timer)
+
+// library
+#include "bitlash.h"
+#include "Timer.h"
+
+// const
+// pin 2 = interrupt 1 on UNO board
+const byte SERIAL_IN_PIN = 2;
+const byte SERIAL_IN_INT = 0;
+
+// vars
+word times_buffer[60];
+byte level;
+volatile word isr_times_buffer[60];
+byte isr_index_buffer;
+word start_bit;
+word max_step, min_step;
+byte max_index, min_index;
+unsigned long baud;
+Timer t;
+
+// ISR call when edges rising/falling occurs on SERIAL_IN_PIN
+void isr_serial_change() {
+  // vars
+  word time;
+  // check timer1 overflow flag
+  if (TIFR1 & 0x01) {
+    // reset overflow flag and timer
+    TIFR1 = TIFR1 | 0x01;
+    // on overflow time is 0xFFFF
+    time  = 0xFFFF;
+  } else {
+    // save time between two edges, reset timer
+    time  = TCNT1;
+  }
+  // reset timer
+  TCNT1 =  0;
+  // update slots array
+  if (isr_index_buffer > 59)
+    isr_index_buffer = 0;
+  isr_times_buffer[isr_index_buffer++] = time;
+}
+
+void update_time_buffer(void) {
+  // copy ISR buffer to times array (avoid long ISRs stop)
+  cli();
+  for (byte i = 0; i < 60; i++) {
+    times_buffer[i] = isr_times_buffer[i];
+  }
+  sei();
+
+  // search minimal/maximal time step
+  max_step = 0;
+  min_step = 0xFFFF;
+  start_bit = 0;
+  level = 0;
+
+  for (byte i = 0; i < 60; i++) {
+    // skip special values
+    if ((times_buffer[i] != 0) and (times_buffer[i] != 0xFFFF))  {
+      // search max step
+      if (times_buffer[i] > max_step) {
+        max_step = times_buffer[i];
+        max_index = i;
+      }
+      // search min step
+      if (times_buffer[i] < min_step) {
+        min_step = times_buffer[i];
+        min_index = i;
+      }
+    }
+    if (times_buffer[i] != 0)
+      level++;
+  }
+
+  // compute baudrate
+  baud = 2 * (1e6 / min_step);
+
+  // count start bit
+  for (byte i = 0; i < 60; i++) {
+    // count start bit
+    if (times_buffer[i] > (min_step * 15)) {
+      start_bit++;
+    }
+  }
+}
+
+numvar printRAW(void) {
+  // display array
+  /*
+  for (byte i = 0; i < 60; i++) {
+    Serial.print(times_buffer[i]);
+    Serial.print(" ");
+  }
+  Serial.println();*/
+
+  // display min_step time and compute baudrate
+  printf_P(PSTR("start bit : %5d\r\n"), start_bit);
+  printf_P(PSTR("min step  : %5d us\r\n"), min_step/2);
+  printf_P(PSTR("max step  : %5d us\r\n"), max_step/2);
+  printf_P(PSTR("level     : %5d\r\n"), level);
+
+  return 0;
+}
+
+bool is_baud(long theoric, long measure) {
+  return (measure > (theoric - theoric * 0.1)) and (measure < (theoric + theoric *0.1));
+}
+
+numvar printBaud(void) {
+  printf_P(PSTR("baud measured  : %6lu bps\r\n"), baud);
+  // convert measured baud to estimated baud
+  long estim_baud = 0;
+
+  if (is_baud(300, baud))
+    estim_baud = 300;
+  else if (is_baud(600, baud))
+    estim_baud = 600;
+  else if (is_baud(1200, baud))
+    estim_baud = 1200;
+  else if (is_baud(2400, baud))
+    estim_baud = 2400;
+  else if (is_baud(4800, baud))
+    estim_baud = 4800;
+  else if (is_baud(9600, baud))
+    estim_baud = 9600;
+  else if (is_baud(14400, baud))
+    estim_baud = 14400;
+  else if (is_baud(19200, baud))
+    estim_baud = 19200;
+  else if (is_baud(28800, baud))
+    estim_baud = 28800;
+  else if (is_baud(38400, baud))
+    estim_baud = 38400;
+  else if (is_baud(57600, baud))
+    estim_baud = 57600;
+  else if (is_baud(115200, baud))
+    estim_baud = 115200;
+
+  printf_P(PSTR("baud estimated : %6lu bps\r\n"), estim_baud);
+  return 0;
+}
+
+// link stdout (printf) to Serial object
+// create a FILE structure to reference our UART and LCD output function
+static FILE uartout = {0};
+
+// create a output function
+// This works because Serial.write, although of
+// type virtual, already exists.
+static int uart_putchar (char c, FILE *stream)
+{
+  Serial.write(c);
+  return 0;
+}
+
+void setup(void) {
+  // vars init
+  isr_index_buffer = 0;
+  // timer1 init
+  // disable global interrupts
+  cli();
+  TCCR1A = 0;
+  // set timer runs at clock speed/8 (= 2 MHz -> 0.5us/step)
+  TCCR1B = (1 << CS11);
+  // enable global interrupts
+  sei();
+  // init bitlash
+  initBitlash(57600);
+  // add bitlash function
+  addBitlashFunction("raw", (bitlash_function) printRAW);
+  addBitlashFunction("bd", (bitlash_function) printBaud);
+  // fill in the UART file descriptor with pointer to writer
+  fdev_setup_stream (&uartout, uart_putchar, NULL, _FDEV_SETUP_WRITE);
+  // standard output device STDOUT is uart
+  stdout = &uartout ;
+  // launch timer task
+  int updateJob = t.every(500, update_time_buffer);
+  // IO init
+  pinMode(SERIAL_IN_PIN, INPUT);
+  attachInterrupt(SERIAL_IN_INT, isr_serial_change, CHANGE);
+}
+
+void loop(void) {
+  // bitlash job
+  runBitlash();
+  // timer job
+  t.update();
+}


add Arduino sketch

add Arduino sketch

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

--- arduino_arm/arduino_arm.ino
+++ arduino_arm/arduino_arm.ino
@@ -0,0 +1,120 @@
+#include <Servo.h>
+
+const int NMB = 5;
+Servo servos[NMB];
+//Servo myclaw;
+//Servo myelbow;
+//Servo mywrist;
+// create servo object to control a servo
+// a maximum of eight servo objects can be created
+
+const int INC = 5; // angle increment in degrees
+const int CONSTRAINTS[NMB][2] = { {20, 120}, {30, 180}, {0, 180}, {0, 180}, {0, 180} };
+const int PINS[NMB] = {3, 5, 6, 9 ,10};
+//const int CLAW[]  = {20, 120};
+//const int ELBOW[] = {30, 180};
+//const int WRIST[] = {0,  180};
+
+void printState()
+{
+  for (int i=0; i < NMB; ++i) {
+    Serial.print(servos[i].read());
+    if (i != NMB-1) Serial.print(',');
+  }
+
+  //Serial.print(myclaw.read());  Serial.print(',');
+  //Serial.print(mywrist.read()); Serial.print(',');
+  //Serial.print(myelbow.read());
+  Serial.println();
+}
+
+void allHome()
+{
+  // set servos to mid-point
+  for (int i=0; i < NMB; ++i) {
+    servos[i].writeMicroseconds(1500);
+  }
+  //myclaw.writeMicroseconds(1500);
+  //mywrist.writeMicroseconds(1500);
+  //myelbow.writeMicroseconds(1500);
+}
+
+void moveServo(int ac_ServoIdx, int ac_Inc)
+{
+  if (ac_ServoIdx < 0 || ac_ServoIdx >= NMB)
+    return;
+  //int pos = servos[ac_ServoIdx].read();
+  int pos = constrain( /*pos +*/ ac_Inc, CONSTRAINTS[ac_ServoIdx][0], CONSTRAINTS[ac_ServoIdx][1] );
+  servos[ac_ServoIdx].write(pos);
+  delay(15);
+}
+
+void setup()
+{
+  //open serial
+  Serial.begin(9600);
+  for (int i=0; i < NMB; ++i) {
+    servos[i].attach(PINS[i]);
+  }
+  //myclaw.attach(3);  // attaches the servo on pin 3 to the servo object
+  //mywrist.attach(5);  // attaches the servo on pin 6 to the servo object
+  //myelbow.attach(6);  // attaches the servo on pin 6 to the servo object
+
+  allHome();
+}
+
+void loop()
+{
+
+  // if there's any serial available, read it:
+  while (Serial.available() > 0) {
+    int values[NMB];
+    // look for the next valid integer in the incoming serial stream:
+    for (int i = 0; i < NMB; ++i) {
+      values[i] = Serial.parseInt();
+    }
+
+    // look for the newline. That's the end of your
+    // sentence:
+    if (Serial.read() == '\n') {
+
+      Serial.print('<');
+      for (int i = 0; i < NMB; ++i) {
+        Serial.print(values[i]);
+        if (i != NMB-1) Serial.print(',');
+
+        moveServo(i, values[i]);
+      }
+      Serial.println('>');
+
+      printState();
+    }
+  }
+
+//    if (Serial.available() > 0) {
+//     int inByte = Serial.read();
+//     switch (inByte) {
+//      case 'A':
+//        moveServo(myclaw, INC, CLAW);
+//        break;
+//      case 'a':
+//        moveServo(myclaw, -INC, CLAW);
+//        break;
+//      case 'S':
+//        moveServo(mywrist, INC, WRIST);
+//        break;
+//      case 's':
+//        moveServo(mywrist, -INC, WRIST);
+//        break;
+//      case 'D':
+//        moveServo(myelbow, INC, ELBOW);
+//        break;
+//      case 'd':
+//        moveServo(myelbow, -INC, ELBOW);
+//        break;
+//
+//      default:
+//        allHome();
+//
+//      }
+}


Create brakeLights_with_button.ino

Create brakeLights_with_button.ino

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

--- brakeLights_with_button.ino
+++ brakeLights_with_button.ino
@@ -0,0 +1,169 @@
+//***************************************************************
+// Brake lights triggerd by a button example.
+//
+// Open the serial monitor to see some feedback as the button is
+// pressed, held, and released.
+//
+// This is the hardware debounced button wiring setup I use:
+// http://i.imgur.com/hOgQwjX.jpg
+// It does not include the capacitor typically included in a
+// debounce setup, but this has always worked fine for me.
+//
+// Marc Miller, July 2017
+//***************************************************************
+
+
+//---------------------------------------------------------------
+// This sketch uses JChristensen's Button Library from:
+//   https://github.com/JChristensen/Button
+//
+#include "Button.h"    // Include the Button library
+
+// Set the digital pin for the debounced pushbutton, and declare the button
+const uint8_t brakeButtonPin = 4;
+Button brakeButton(brakeButtonPin, true, true, 50);
+
+
+//---------------------------------------------------------------
+#include "FastLED.h"
+#define DATA_PIN    11
+#define CLK_PIN   13
+#define LED_TYPE    LPD8806
+#define COLOR_ORDER GRB
+#define NUM_LEDS    8
+CRGB leds[NUM_LEDS];
+#define BRIGHTNESS 255
+
+uint8_t BrakeStatus = 0;  // Status of brake lights.  [0=Off, 1=Activated, 2=On]
+
+CHSV black (0,0,0);  // black
+CHSV brakeRed (0,255,255);  // red full brightness
+CHSV brakeDimRed (0,255,32);  // dim red
+CHSV accent (185,120,70);  // alternate accent color
+
+// setup pixel groups
+byte center[] = {3,4};  // center ring
+byte first[] = {2,3,4,5};  // first ring
+byte second[] = {1,2,5,6};  // second ring
+byte third[] = {0,1,6,7};  // third ring
+
+
+//---------------------------------------------------------------
+void setup() {
+  Serial.begin(115200);  // Allows serial monitor output (check baud rate)
+  delay(1500); // short delay for recovery
+  //FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
+  FastLED.addLeds<LED_TYPE,DATA_PIN,CLK_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
+  FastLED.setBrightness(BRIGHTNESS);
+  FastLED.clear();
+}
+
+
+//---------------------------------------------------------------
+void loop()
+{
+  readbutton();  // check the button
+
+  if (BrakeStatus == 0) { brakeOff(); }
+  if (BrakeStatus == 1) { brakeActivated(); }
+  if (BrakeStatus == 2) { brakeOn(); }
+  FastLED.show();
+
+}//end_main_loop
+
+
+
+
+//---------------------------------------------------------------
+// Functions
+
+//---------------------------------------------------------------
+//Check the button and set the appropriate flag
+void readbutton() {
+  brakeButton.read();  // check the state of the brake button
+
+  if(brakeButton.isPressed()) {
+    BrakeStatus = 2;
+    EVERY_N_MILLISECONDS(250){
+      Serial.print(BrakeStatus); Serial.println("  Brake is On...");
+    }
+  } else {
+    BrakeStatus = 0;
+    EVERY_N_MILLISECONDS(500){
+      Serial.print(BrakeStatus); Serial.println("  Brake Off");
+    }
+  }
+
+  if(brakeButton.wasPressed()) {
+    BrakeStatus = 1;
+    Serial.print(BrakeStatus); Serial.println("  Running brake activated sequence.");
+  }
+
+}//end_readbutton
+
+
+//---------------------------------------------------------------
+// Brake lights activated sequence
+void brakeActivated(){
+
+  for (uint8_t i=0; i<(sizeof(third)/sizeof((third)[0])); i++) {
+   leds[third[i]] = black;
+  }
+  for (uint8_t i=0; i<(sizeof(center)/sizeof((center)[0])); i++) {
+   leds[center[i]] = brakeRed;
+  }
+  FastLED.show();
+  delay(200);
+
+
+  for (uint8_t i=0; i<(sizeof(first)/sizeof((first)[0])); i++) {
+    leds[first[i]] = brakeRed;
+  }
+  FastLED.show();
+  delay(200);
+
+
+  for (uint8_t i=0; i<(sizeof(first)/sizeof((first)[0])); i++) {
+   leds[first[i]] = accent;
+  }
+  for (uint8_t i=0; i<(sizeof(second)/sizeof((second)[0])); i++) {
+    leds[second[i]] = brakeRed;
+  }
+  FastLED.show();
+  delay(200);
+
+
+  for (uint8_t i=0; i<(sizeof(first)/sizeof((first)[0])); i++) {
+   leds[first[i]] = black;
+  }
+  for (uint8_t i=0; i<(sizeof(second)/sizeof((second)[0])); i++) {
+    leds[second[i]] = accent;
+  }
+  for (uint8_t i=0; i<(sizeof(third)/sizeof((third)[0])); i++) {
+    leds[third[i]] = brakeRed;
+  }
+  FastLED.show();
+  delay(200);
+
+}//end_brakeLightsOn
+
+
+//---------------------------------------------------------------
+// Brake lights On
+void brakeOn(){
+  fill_solid(leds,NUM_LEDS,CRGB::Black);
+  for (uint8_t i=0; i<(sizeof(third)/sizeof((third)[0])); i++) {
+    leds[third[i]] = brakeRed;
+  }
+}
+
+
+//---------------------------------------------------------------
+// Brake lights Off
+void brakeOff(){
+  fill_solid(leds,NUM_LEDS,CRGB::Black);
+  for (uint8_t i=0; i<(sizeof(third)/sizeof((third)[0])); i++) {
+    leds[third[i]] = brakeDimRed;  // use dim red
+  }
+}
+


Create blink.ino

Create blink.ino

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

--- blink/blink.ino
+++ blink/blink.ino
@@ -0,0 +1,12 @@
+void setup() {
+  // put your setup code here, to run once:
+  pinMode(13, OUTPUT);
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  digitalWrite(13, HIGH);
+  delay(1000);
+  digitalWrite(13, LOW);
+  delay(1000);
+}


Initial commit

Initial commit

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

--- clock/clock.ino
+++ clock/clock.ino
@@ -0,0 +1,255 @@
+/*************************************************************
+
+CIRCADIAN CLOCK project by Anais Moisy
+
+Arduino Yun
+Stepper motor
+Motor shield
+NeoPixel Ring
+
+Demo & Details @
+https://player.vimeo.com/video/127464892
+http://anaismoisy.com/essay-cardican-clock/
+
+*************************************************************/
+
+int delaylegnth_speed = 50;  //speed to go to the correct 'time' when it is launched
+unsigned long delay_day1 = 5;  //I guess I will need only one delay and change it dynamicaly (see email to get how it is calculated)
+unsigned long delay_day2 = 5;
+unsigned long delay_night = 5;
+int i=0;
+int steps_day1 = 206; //tricks to get a full 360 degree (I don't know why it is not doing it in 200 steps)
+int steps_night = 406;
+int steps_day2 = 606;
+int steps_current_time = 53; //number of steps to go to the correct 'time' when it is launched (see email to get how it is calculated)
+unsigned long start_time;
+
+//for the LEDs
+#include <Wire.h>
+#include <Adafruit_NeoPixel.h>
+#define NEOPIN 6  // define pins
+#define BRIGHTNESS 64 // set max brightness
+Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, NEOPIN, NEO_GRB + NEO_KHZ800); // strip object
+
+
+
+
+
+
+void setup() {
+
+  //establish motor direction toggle pins
+  pinMode(12, OUTPUT); //CH A -- HIGH = forwards and LOW = backwards???
+  pinMode(13, OUTPUT); //CH B -- HIGH = forwards and LOW = backwards???
+
+  //establish motor brake pins
+  pinMode(9, OUTPUT); //brake (disable) CH A
+  pinMode(8, OUTPUT); //brake (disable) CH B
+
+  Serial.begin(9600);
+  start_time = millis();
+
+  Serial.println("Setup complete");
+
+  //setup LEDs
+  Wire.begin();        	// Begin I2C
+  pinMode(NEOPIN, OUTPUT);
+  strip.begin();
+  strip.setBrightness(BRIGHTNESS); // set brightness
+  delay(500);
+  colorWipe(strip.Color(0, 0, 0), 1); // Red
+  delay(500);
+
+}
+
+void loop(){
+
+  //make needle turn fast to the right time
+  while(i < steps_current_time){
+
+    step1(delaylegnth_speed);
+    step2(delaylegnth_speed);
+    step3(delaylegnth_speed);
+    step4(delaylegnth_speed);
+  }
+
+  Serial.println("Time was initialized");
+  Serial.println("I is: " + String(i));
+
+
+  start_time = millis();
+  Serial.println("HEEEERREEE startime: ");
+  Serial.println(String(start_time));
+  Serial.println(String(millis()));
+
+  //set the new step limit for day 1
+  steps_current_time = steps_day1;
+
+  //make needle turn right speed until sunset day1
+  while(i < steps_day1){
+
+      step1(1);
+      waitTime(delay_day1);
+
+      step2(1);
+      waitTime(delay_day1);
+
+      step3(1);
+      waitTime(delay_day1);
+
+      step4(1);
+      waitTime(delay_day1);
+  }
+
+  Serial.println("I is: " + String(i));
+  Serial.println("Day 1 is over!");
+  steps_current_time = steps_night;
+
+  if (i==steps_day1){
+  delay(5);
+  colorWipe(strip.Color(255, 255, 255), 1); // Red
+  delay(5);
+  }
+
+  //make needle turn right speed until sunrise day2
+  while(i < steps_night){
+
+      step1(1);
+      waitTime(delay_night);
+
+      step2(1);
+      waitTime(delay_night);
+
+      step3(1);
+      waitTime(delay_night);
+
+      step4(1);
+      waitTime(delay_night);
+  }
+
+  if (i==steps_night){
+  delay(5);
+  colorWipe(strip.Color(0, 0, 0), 1); // Red
+  delay(5);
+  }
+
+  //set the new step limit for day 2
+  Serial.println("I is: " + String(i));
+  Serial.println("Night 1 is over!");
+  steps_current_time = steps_day2;
+
+  //make needle turn right speed until sunset day2
+  while(i < steps_day2){
+
+      step1(1);
+      waitTime(delay_day2);
+
+      step2(1);
+      waitTime(delay_day2);
+
+      step3(1);
+      waitTime(delay_day2);
+
+      step4(1);
+      waitTime(delay_day2);
+  }
+
+  Serial.println("I is: " + String(i));
+  Serial.println("Day 2 is over!");
+
+}
+
+
+//delay between steps for day1
+boolean waitTime(unsigned long time)
+{
+
+  Serial.println("time day one is being called:");
+  Serial.println(start_time);
+  Serial.println("Starttime + delay_day_1 is:");
+  Serial.println(start_time + delay_day1);
+  while ((start_time + time) > millis())
+  {
+    delay(5);
+  }
+
+  Serial.println("Setting new Starttime to now:");
+  Serial.println(millis());
+    start_time = millis();
+    return true;
+}
+
+
+
+void step1(int delayMilliseconds)
+{
+ if (i < steps_current_time)
+    {
+    digitalWrite(9, LOW);  //ENABLE CH A
+    digitalWrite(8, HIGH); //DISABLE CH B
+
+    digitalWrite(12, HIGH);   //Sets direction of CH A
+    analogWrite(3, 255);   //Moves CH A
+    Serial.println("step 1");
+    Serial.println("delay is: " + String(delayMilliseconds));
+    delay(delayMilliseconds);
+    i++;
+    }
+}
+
+void step2(int delayMilliseconds)
+{
+  if (i < steps_current_time)
+    {
+    digitalWrite(9, HIGH);  //DISABLE CH A
+    digitalWrite(8, LOW); //ENABLE CH B
+
+    digitalWrite(13, LOW);   //Sets direction of CH B
+    analogWrite(11, 255);   //Moves CH B
+    Serial.println("step 2");
+    Serial.println("delay is: " + String(delayMilliseconds));
+    delay(delayMilliseconds);
+    i++;
+    }
+}
+
+void step3(int delayMilliseconds)
+{
+  if (i < steps_current_time)
+    {
+    digitalWrite(9, LOW);  //ENABLE CH A
+    digitalWrite(8, HIGH); //DISABLE CH B
+
+    digitalWrite(12, LOW);   //Sets direction of CH A
+    analogWrite(3, 255);   //Moves CH A
+    Serial.println("step 3");
+    Serial.println("delay is: " + String(delayMilliseconds));
+    delay(delayMilliseconds);
+    i++;
+    }
+}
+
+void step4(int delayMilliseconds)
+{
+  if (i < steps_current_time)
+    {
+    digitalWrite(9, HIGH);  //DISABLE CH A
+    digitalWrite(8, LOW); //ENABLE CH B
+
+    digitalWrite(13, HIGH);   //Sets direction of CH B
+    analogWrite(11, 255);   //Moves CH B
+    Serial.println("step 4");
+    Serial.println("delay is: " + String(delayMilliseconds));
+    delay(delayMilliseconds);
+    i++;
+    }
+}
+
+// Fill the dots one after the other with a color
+void colorWipe(uint32_t c, uint8_t wait) {
+  for(uint16_t i=0; i<strip.numPixels(); i++) {
+	strip.setPixelColor(i, c);
+	strip.show();
+	delay(wait);
+  }
+}


changed line to arrow

changed line to arrow

error: pathspec 'Microcontroller' did not match any file(s) known to git
error: pathspec 'Code/libraries/my_lib/examples/base_uno_w_lib/base_uno_w_lib.ino' did not match any file(s) known to git


adding arduino sketch code

adding arduino sketch code

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

--- arduino/StripLEDNeoPixel.ino
+++ arduino/StripLEDNeoPixel.ino
@@ -0,0 +1,180 @@
+#include <Adafruit_NeoPixel.h>
+
+// Download library from https://github.com/adafruit/Adafruit_NeoPixel
+
+
+#define PIN 6
+
+// Parameter 1 = number of pixels in strip
+// Parameter 2 = Arduino pin number (most are valid)
+// Parameter 3 = pixel type flags, add together as needed:
+//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
+//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
+//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
+//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
+Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);
+
+// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
+// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
+// and minimize distance between Arduino and first pixel.  Avoid connecting
+// on a live circuit...if you must, connect GND first.
+
+int mode = 0;
+int delayTime = 10;
+
+void setup() {
+  strip.begin();
+  strip.show(); // Initialize all pixels to 'off'
+  Serial.begin(14400);
+}
+
+void loop() {
+  // Some example procedures showing how to display to the pixels:
+
+  if(Serial.available()){
+     if(Serial.peek() == 'm'){
+       Serial.read();
+       mode = Serial.parseInt();
+     }else if(Serial.peek() == 'v'){
+       Serial.read();
+       delayTime = Serial.parseInt();
+     }
+
+     while(Serial.available() > 0)
+       Serial.read();
+  }
+
+  Serial.println(mode);
+
+  switch( mode ){
+    case 1:
+      colorWipe(strip.Color(255, 0, 0), delayTime); // Red
+      break;
+    case 2:
+      colorWipe(strip.Color(0, 255, 0), delayTime); // Green
+      break;
+    case 3:
+      colorWipe(strip.Color(0, 0, 255), delayTime); // Blue
+      break;
+    case 4:
+      theaterChase(strip.Color(127, 127, 127), delayTime); // White
+      break;
+    case 5:
+      theaterChase(strip.Color(127,   0,   0), delayTime); // Red
+      break;
+    case 6:
+      theaterChase(strip.Color(  0,   0, 127), delayTime); // Blue
+      break;
+    case 7:
+      rainbow(20);
+      break;
+    case 8:
+      rainbowCycle(20);
+      break;
+    case 9:
+     theaterChaseRainbow( delayTime );
+      break;
+
+
+  }
+
+  /*
+  colorWipe(strip.Color(255, 0, 0), 50); // Red
+  colorWipe(strip.Color(0, 255, 0), 50); // Green
+  colorWipe(strip.Color(0, 0, 255), 50); // Blue
+  // Send a theater pixel chase in...
+  theaterChase(strip.Color(127, 127, 127), 50); // White
+  theaterChase(strip.Color(127,   0,   0), 50); // Red
+  theaterChase(strip.Color(  0,   0, 127), 50); // Blue
+
+  rainbow(20);
+  rainbowCycle(20);
+  theaterChaseRainbow(50);
+  */
+}
+
+// Fill the dots one after the other with a color
+void colorWipe(uint32_t c, uint8_t wait) {
+  for(uint16_t i=0; i<strip.numPixels(); i++) {
+      strip.setPixelColor(i, c);
+      strip.show();
+      delay(wait);
+  }
+}
+
+void rainbow(uint8_t wait) {
+  uint16_t i, j;
+
+  for(j=0; j<256; j++) {
+    for(i=0; i<strip.numPixels(); i++) {
+      strip.setPixelColor(i, Wheel((i+j) & 255));
+    }
+    strip.show();
+    delay(wait);
+  }
+}
+
+// Slightly different, this makes the rainbow equally distributed throughout
+void rainbowCycle(uint8_t wait) {
+  uint16_t i, j;
+
+  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
+    for(i=0; i< strip.numPixels(); i++) {
+      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
+    }
+    strip.show();
+    delay(wait);
+  }
+}
+
+//Theatre-style crawling lights.
+void theaterChase(uint32_t c, uint8_t wait) {
+  for (int j=0; j<10; j++) {  //do 10 cycles of chasing
+    for (int q=0; q < 3; q++) {
+      for (int i=0; i < strip.numPixels(); i=i+3) {
+        strip.setPixelColor(i+q, c);    //turn every third pixel on
+      }
+      strip.show();
+
+      delay(wait);
+
+      for (int i=0; i < strip.numPixels(); i=i+3) {
+        strip.setPixelColor(i+q, 0);        //turn every third pixel off
+      }
+    }
+  }
+}
+
+//Theatre-style crawling lights with rainbow effect
+void theaterChaseRainbow(uint8_t wait) {
+  for (int j=0; j < 256; j++) {     // cycle all 256 colors in the wheel
+    for (int q=0; q < 3; q++) {
+        for (int i=0; i < strip.numPixels(); i=i+3) {
+          strip.setPixelColor(i+q, Wheel( (i+j) % 255));    //turn every third pixel on
+        }
+        strip.show();
+
+        delay(wait);
+
+        for (int i=0; i < strip.numPixels(); i=i+3) {
+          strip.setPixelColor(i+q, 0);        //turn every third pixel off
+        }
+    }
+  }
+}
+
+// Input a value 0 to 255 to get a color value.
+// The colours are a transition r - g - b - back to r.
+uint32_t Wheel(byte WheelPos) {
+  WheelPos = 255 - WheelPos;
+  if(WheelPos < 85) {
+   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
+  } else if(WheelPos < 170) {
+    WheelPos -= 85;
+   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
+  } else {
+   WheelPos -= 170;
+   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
+  }
+}
+


Initial Commit

Initial Commit

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

--- autorium.ino
+++ autorium.ino
@@ -0,0 +1,30 @@
+
+// Define all the relay ports
+#define relayLight 31
+#define relayExtractorMotor 32
+#define relayFilter 33
+#define relayHeater 34
+
+
+void setup() {
+  // Initialze relay pins
+  pinMode(relayLight, OUTPUT);
+  pinMode(relayExtractorMotor, OUTPUT);
+  pinMode(relayFilter, OUTPUT);
+  pinMode(relayHeater, OUTPUT);
+
+}
+
+void loop() {
+
+  // Test Code for relay
+
+  for(int iCounter=31;iCounter < 39;iCounter++){
+
+    digitalWrite(iCounter, HIGH);   // turn the LED on (HIGH is the voltage level)
+    delay(500);              // wait for a second
+    digitalWrite(iCounter, LOW);    // turn the LED off by making the voltage LOW
+    delay(400);             // wait for a second
+  }
+
+}


first version of arduino file

first version of arduino file

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

--- driver_mega.ino
+++ driver_mega.ino
@@ -0,0 +1,111 @@
+#include <DStepper.h>
+
+const int stepPer = 200;
+
+DStepper stepper1(stepPer, 4, 5, 6, 7);
+DStepper stepper2(stepPer, 8, 9, 10, 11);
+
+int begin;
+char ins[2];
+int i;
+void goAhead(){
+
+  for(i = 0; i < 50; i++){
+        stepper1.step(4);
+	stepper2.step(4);
+  }
+
+
+	Serial.println("Go ahead");
+}
+
+void goBack(){
+
+	stepper1.step(-stepPer);
+	stepper2.step(-stepPer);
+	Serial.println("Go Back");
+}
+
+void turnLeft(){
+
+	stepper1.step(-stepPer);
+	stepper2.step(stepPer);
+	Serial.println("Turn Left");
+
+}
+
+void turnRight(){
+
+	stepper1.step(stepPer);
+	stepper2.step(-stepPer);
+	Serial.println("Turn Right");
+}
+
+void stepControl(char inst){
+
+	switch(inst){
+		// go ahead
+		case '1': goAhead();
+			break;
+		// go back
+		case '2': goBack();
+			break;
+		// turn left
+		case '3': turnLeft();
+			break;
+		// turn right
+		case '4': turnRight();
+			break;
+		default:
+			Serial.println("Error");
+	}
+}
+
+void other(char inst){
+
+}
+
+void setup(){
+	stepper1.setSpeed(60);
+	stepper2.setSpeed(60);
+
+	Serial.begin(9600);
+}
+
+void loop(){
+
+
+	if(Serial.available()){
+
+		Serial.println("loop step1");
+
+		begin = Serial.read();
+
+		Serial.println("loop step2");
+                Serial.println(begin);
+		if(begin==35){
+
+		Serial.println("loop step3");
+	 		Serial.readBytes(ins, 2);
+			switch(ins[0]){
+				case '1':
+					Serial.println("switch step1");
+					stepControl(ins[1]);
+					break;
+				case '2':
+					Serial.println("switch step2");
+					other(ins[1]);
+					break;
+				default:
+					break;
+			}
+
+                        Serial.println("end of if #");
+			begin = 0;
+		}
+
+                Serial.println("end of available");
+
+	}
+}
+


Bug fix

Bug fix

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/MichalMares/Ardularm.git/'


A7 with Deepsleep

A7 with Deepsleep

Added Deepsleep of 10minutes, checks temp’s from sensors against saved
sensor value in EEPROM, if different then start moden and send data,
else sleep for 10minutes again

error: pathspec 'Prototypes/A7' did not match any file(s) known to git
error: pathspec 'Test/A7_Test_Sleep/A7_Test_Sleep.ino' did not match any file(s) known to git


Update ds3231.ino

Update ds3231.ino

Forced RTC to adjust time

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


Added motor functionality

Added motor functionality

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


Latch the differential flag if it becomes set.

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


Added anchor_configurator sketch

Added anchor_configurator sketch

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

--- useful/pozyx_anchor_configurator/pozyx_anchor_configurator.ino
+++ useful/pozyx_anchor_configurator/pozyx_anchor_configurator.ino
@@ -0,0 +1,405 @@
+#include <Pozyx.h>
+#include <Pozyx_definitions.h>
+#include <Wire.h>
+#include <stdlib.h>
+
+// change this if you want to perform remote configuration
+uint16_t remote_id = NULL;
+
+#define MAX_DEVICES                20
+uint8_t devlist_size = 0;
+uint16_t device_ids[MAX_DEVICES];
+
+void setup() {
+  Serial.begin(115200);
+  while(!Serial); // for the Arduino Leonardo/Micro only
+
+  Pozyx.begin();
+
+  Serial.println("\n\nAnchor configurator started.");
+  Serial.println("------------------------------------");
+
+  if(remote_id == NULL) {
+    Serial.print(F("Configuring the local pozyx device with network id: 0x"));
+    uint16_t netid = 0;
+    Pozyx.getNetworkId(&netid);
+    Serial.println(netid, HEX);
+  }else{
+    uint8_t whoami=0;
+    Pozyx.getWhoAmI(&whoami, remote_id);
+    if(whoami == 0x43){
+      Serial.print(F("Configuring the remote pozyx device with network id: 0x"));
+      Serial.println(remote_id, HEX);
+    }else{
+      Serial.print(F("Cannot connect to the remote device with network id 0x"));
+      Serial.println(remote_id, HEX);
+      delay(50);
+      abort();
+    }
+  }
+
+  printLocalizationOptions(remote_id);
+  printMain(remote_id);
+}
+
+#define STATE_MAIN                0
+#define STATE_ADD_HEX             1
+#define STATE_ADD_X               2
+#define STATE_ADD_Y               3
+#define STATE_ADD_Z               4
+#define STATE_REMOVE_ID           5
+#define STATE_OPTION_ALGORITHM      6
+#define STATE_OPTION_DIM            7
+#define STATE_OPTION_NUM_ANCHORS    8
+#define STATE_OPTION_ANCHOR_SEL     9
+#define STATE_MANUAL_IDS          10
+
+String input;
+int state = STATE_MAIN;
+int dev_Selected;
+device_coordinates_t new_device;
+int algorithm = -1;
+int numAnchors;
+int selected_anchor_num = 0;
+uint16_t anchor_sel[15];
+
+void loop() {
+
+  if (Serial.available() > 0) {    // is a character available?
+    char rx_byte = Serial.read();       // get the character
+
+    if(rx_byte != '\r' && rx_byte != '\n')
+      input += rx_byte;
+
+    if(rx_byte == '\r') {
+
+      if(state == STATE_MAIN)
+      {
+        if(input == "add")
+        {
+          Serial.println("\tAdding new anchor:");
+          Serial.print("\tplease give network id (hex): ");
+          state = STATE_ADD_HEX;
+        }
+        else if(input == "remove")
+        {
+          Serial.print("\tGive network id of device to remove (hex): ");
+          state = STATE_REMOVE_ID;
+        }
+        else if(input == "remove all")
+        {
+          Pozyx.clearDevices(remote_id);
+          Pozyx.saveConfiguration(POZYX_FLASH_NETWORK, NULL, 0, remote_id);
+          printMain(remote_id);
+        }
+        else if(input == "localization options")
+        {
+          Serial.println("\tselect positioning algoirthm [LS, UWB_only, default] ");
+          state = STATE_OPTION_ALGORITHM;
+        }else{
+          Serial.println("\tUnknown command.");
+        }
+      }else if(state == STATE_ADD_HEX)
+      {
+        char input_hex[sizeof(input)];
+        input.toCharArray(input_hex, sizeof(input));
+        long network_id = strtol(input_hex, NULL, 16);
+        if(network_id >0 && network_id <= 0xFFFF)
+        {
+          new_device.network_id = (uint16_t)network_id;
+          Serial.print("0x");
+          Serial.println(network_id, HEX);
+          Serial.print("\tSet anchor x-coordinate(mm): ");
+          state = STATE_ADD_X;
+        }else{
+          Serial.print(F("\n\tNot a valid network id, try again: "));
+        }
+      }else if(state == STATE_ADD_X)
+      {
+        int x_mm = input.toInt();
+        if(x_mm >=-100000 && x_mm < 100000)
+        {
+          new_device.pos.x = x_mm;
+          Serial.println(x_mm);
+          Serial.print(F("\tSet anchor y-coordinate(mm): "));
+          state = STATE_ADD_Y;
+        }else{
+          Serial.print(F("\n\tNot a valid x-coordinate, try again: "));
+        }
+      }else if(state == STATE_ADD_Y)
+      {
+        int y_mm = input.toInt();
+        if(y_mm >=-100000 && y_mm < 100000)
+        {
+          new_device.pos.y = y_mm;
+          Serial.println(y_mm);
+          Serial.print(F("\tSet anchor z-coordinate(mm): "));
+          state = STATE_ADD_Z;
+        }else{
+          Serial.print(F("\n\tNot a valid y-coordinate, try again: "));
+        }
+      }else if(state == STATE_ADD_Z)
+      {
+        int z_mm = input.toInt();
+        if(z_mm >=-100000 && z_mm < 100000)
+        {
+          new_device.pos.z = z_mm;
+          Serial.println(z_mm);
+
+          new_device.flag = 0x1;
+          int result = Pozyx.addDevice(new_device, remote_id);
+          Pozyx.saveConfiguration(POZYX_FLASH_NETWORK, NULL, 0, remote_id);
+          if(result == POZYX_SUCCESS)
+          {
+            Serial.println(F("\tAnchor successfully added."));
+          }else{
+            Serial.println(F("\tFailed to add anchor."));
+          }
+          state = STATE_MAIN;
+          printMain(remote_id);
+        }else{
+          Serial.print(F("\n\tNot a valid x-coordinate, try again: "));
+        }
+      }else if(state == STATE_REMOVE_ID)
+      {
+        char input_hex[sizeof(input)];
+        input.toCharArray(input_hex, sizeof(input));
+        long network_id = strtol(input_hex, NULL, 16);
+        if(network_id >0 && network_id <= 0xFFFF)
+        {
+          Serial.print("0x");
+          Serial.println(network_id, HEX);
+          // remove anchor
+          remove_anchor(network_id, remote_id);
+          Pozyx.saveConfiguration(POZYX_FLASH_NETWORK, NULL, 0, remote_id);
+          Serial.println("\tAnchor removed");
+
+          state = STATE_MAIN;
+          printMain(remote_id);
+
+        }else{
+          Serial.println(F("\n\tNot a valid network id, try again:"));
+        }
+      } else if(state == STATE_OPTION_ALGORITHM)
+      {
+        algorithm = -1;
+
+        if(input == "LS") {
+          algorithm = POZYX_POS_ALG_LS;
+        }else if(input == "UWB_only" || input == "default") {
+          algorithm = POZYX_POS_ALG_UWB_ONLY ;
+        }else{
+          Serial.println("\tInvalid input");
+        }
+
+        if(algorithm != -1)
+        {
+          Serial.println(F("\tSelect the localization dimension [2D, 2.5D, 3D]"));
+          state = STATE_OPTION_DIM;
+        }
+      }else if(state == STATE_OPTION_DIM)
+      {
+        int dim = -1;
+        if(input == "2D")
+        {
+          dim = 2;
+        }else if(input == "2.5D"){
+          dim = 1;
+        }else if(input == "3D"){
+          dim = 3;
+        }else{
+          Serial.println("\tInvalid input");
+        }
+
+        if(dim != -1)
+        {
+          Pozyx.setPositionAlgorithm(algorithm,dim, remote_id);
+          Serial.println(F("\tChoose the number of anchors to use [3-15]"));
+          state = STATE_OPTION_NUM_ANCHORS;
+        }
+      }else if(state == STATE_OPTION_NUM_ANCHORS)
+      {
+        numAnchors = input.toInt();
+        if(numAnchors >= 3 && numAnchors <= 15 )
+        {
+          Serial.println(F("\tSelect the anchor selection method [manual, automatic]"));
+          state = STATE_OPTION_ANCHOR_SEL;
+        }else{
+          Serial.println(F("\tInvalid input"));
+        }
+      }else if(state == STATE_OPTION_ANCHOR_SEL)
+      {
+        if(input == "manual")
+        {
+          Pozyx.setSelectionOfAnchors(POZYX_ANCHOR_SEL_MANUAL, numAnchors, remote_id );
+          uint8_t regs[2] = {POZYX_POS_ALG, POZYX_POS_NUM_ANCHORS};
+          Pozyx.saveConfiguration(POZYX_FLASH_REGS, regs, 2, remote_id);
+          state = STATE_MANUAL_IDS;
+          Serial.print(F("\tenter network id of anchor 1 (hex): "));
+          selected_anchor_num = 1;
+        }else if(input == "automatic")
+        {
+          Pozyx.setSelectionOfAnchors(POZYX_ANCHOR_SEL_AUTO , numAnchors, remote_id );
+          uint8_t regs[2] = {POZYX_POS_ALG, POZYX_POS_NUM_ANCHORS};
+          Pozyx.saveConfiguration(POZYX_FLASH_REGS, regs, 2, remote_id);
+          Serial.println(F("\tLocalization options saved"));
+          printLocalizationOptions(remote_id);
+          state = STATE_MAIN;
+          printMain(remote_id);
+        }else{
+          Serial.println(F("\tInvalid input, please try again"));
+        }
+      }else if(state == STATE_MANUAL_IDS)
+      {
+        char input_hex[sizeof(input)];
+        input.toCharArray(input_hex, sizeof(input));
+        long network_id = strtol(input_hex, NULL, 16);
+        if(network_id >0 && network_id <= 0xFFFF)
+        {
+          Serial.print("0x");
+          Serial.println(network_id, HEX);
+
+          anchor_sel[selected_anchor_num-1] = network_id;
+
+          if(selected_anchor_num < numAnchors)
+          {
+            Serial.print(F("\tenter network id of anchor "));
+            Serial.print(++selected_anchor_num);
+            Serial.print(F(" (hex): "));
+          }else
+          {
+            Pozyx.setPositioningAnchorIds(anchor_sel, numAnchors, remote_id);
+            Pozyx.saveConfiguration(POZYX_FLASH_ANCHOR_IDS, NULL, 0, remote_id);
+            printLocalizationOptions(remote_id);
+            state = STATE_MAIN;
+            printMain(remote_id);
+          }
+
+        }else{
+          Serial.print(F("\n\tNot a valid network id, try again: "));
+        }
+      }
+
+      input = "";
+    }
+
+  } // end: if (Serial.available() > 0)
+
+}
+
+void printLocalizationOptions(uint16_t remote_id)
+{
+  uint8_t algorithm = 0;
+  Pozyx.getPositionAlgorithm(&algorithm, remote_id);
+  uint8_t dimension = 0;
+  Pozyx.getPositionDimension(&dimension, remote_id);
+
+  Serial.print(F("using the "));
+  if(algorithm == POZYX_POS_ALG_UWB_ONLY  )
+    Serial.print(F("UWB-only"));
+  else if(algorithm == POZYX_POS_ALG_LS  )
+    Serial.print(F("Least squares"));
+  Serial.print(F(" algorithm in "));
+  if(dimension == POZYX_2D )
+    Serial.println(F("2D."));
+  else if(dimension == POZYX_2_5D )
+    Serial.println(F("3D with fixed height (2.5D)."));
+  else if(dimension == POZYX_3D )
+    Serial.println(F("3D."));
+
+  uint8_t mode = 0;
+  Pozyx.getAnchorSelectionMode(&mode, remote_id);
+  uint8_t numAnchors = 0;
+  Pozyx.getNumberOfAnchors(&numAnchors, remote_id);
+
+  Serial.print(F("using "));
+  Serial.print(numAnchors);
+  Serial.print(F(" anchors that are "));
+  if(mode == POZYX_ANCHOR_SEL_MANUAL)
+  {
+    Serial.println(F("manually selected."));
+    uint16_t anchors[numAnchors];
+    for(int i=0;i<numAnchors;i++)    {
+      anchors[i] = 0;
+    }
+
+    int status = Pozyx.getPositioningAnchorIds(anchors, numAnchors, remote_id);
+    for(int i=0;i<numAnchors;i++)
+    {
+      Serial.print("\t0x");
+      Serial.print(anchors[i],HEX);
+    }
+    Serial.println();
+  }else if(mode == POZYX_ANCHOR_SEL_AUTO)
+    Serial.println(F("automatically selected."));
+}
+
+void printMain(uint16_t remote_id)
+{
+  Serial.println(F("\nCurrent devices in device list: (max 20)"));
+
+  int result = Pozyx.getDeviceListSize(&devlist_size, remote_id);
+  if(devlist_size > 0)
+  {
+    uint16_t devices[devlist_size];
+    result = Pozyx.getDeviceIds(device_ids, devlist_size, remote_id);
+
+    int i;
+    for(i=0; i<devlist_size; i++)
+    {
+      coordinates_t anchor_coor;
+      Serial.print("\tAnchor ");
+      Serial.print(i+1);
+      Serial.print(") 0x");
+      Serial.print(device_ids[i], HEX);
+      result = Pozyx.getDeviceCoordinates(device_ids[i], &anchor_coor, remote_id);
+      Serial.print("\tx= ");
+      Serial.print(anchor_coor.x);
+      Serial.print("\ty= ");
+      Serial.print(anchor_coor.y);
+      Serial.print("\tz= ");
+      Serial.println(anchor_coor.z);
+    }
+  }else
+  {
+    Serial.println("\tNone.");
+  }
+
+  Serial.println(F("Options [add, remove, remove all, localization options]"));
+}
+
+void remove_anchor(uint16_t network_id, uint16_t remote_id)
+{
+  uint8_t devlist_size = 0;
+  int result = Pozyx.getDeviceListSize(&devlist_size, remote_id);
+
+  if(devlist_size > 0)
+  {
+    uint16_t device_ids[devlist_size];
+    device_coordinates_t devices[devlist_size];
+    result = Pozyx.getDeviceIds(device_ids, devlist_size, remote_id);
+
+    // load all the current devices
+    for(int i=0; i<devlist_size; i++)    {
+      coordinates_t tmp;
+      result = Pozyx.getDeviceCoordinates(device_ids[i], &tmp, remote_id);
+      devices[i].network_id = device_ids[i];
+      devices[i].flag = 1;
+      devices[i].pos = tmp;
+    }
+
+    // clear the current devices
+    Pozyx.clearDevices(remote_id);
+
+
+    // add all the devices except the one to delete
+    for(int i=0; i<devlist_size; i++)
+    {
+      if(device_ids[i] != network_id)
+      {
+        Pozyx.addDevice(devices[i], remote_id);
+      }
+    }
+  }
+}
+


hmm, returning the 5041 pos is a piece of cake

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


Create GoalCode.ino

Create GoalCode.ino

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

--- GoalCode.ino
+++ GoalCode.ino
@@ -0,0 +1,27 @@
+/*
+*
+*  Aansluitingen HCSR04 - Arduino
+*  Vcc - 5V
+*  Trig - 2
+*  Echo - 3
+*  Gnd - GND
+*/
+
+#include "HCSR04.h"
+HCSR04 ultrasonic(2, 3); //Trig, Echo
+
+int cm;
+
+void setup()
+{
+  Serial.begin(115200);
+  Serial.println("start");
+}
+
+void loop()
+{
+  cm = ultrasonic.Ranging(CM); //CM of INCH
+  if(cm >= 0)
+    Serial.println(cm);
+  delay(100);
+}


added upper limit, stable

added upper limit, stable