add battery version

add battery version

/*
 * Energino
 *
 * Energino is a energy consumption meter for DC loads (win average).
 *
 * Circuit:
 *  Analog inputs attached to pins A0 (Current), A1 (Voltage)
 *  Digital output attached to pin D2 (Relay)
 *
 * Supported commands from the serial:
 *  #P<integer>, sets the period between two updates (in ms) [default is 2000]
 *  #S<0/1>, sets the relay configuration, 0 load on, 1 load off [default is 0]
 *  #A<integer>, sets the value in ohms of the R1 resistor [default is 100000]
 *  #B<integer>, sets the value in ohms of the R2 resistor [default is 10000]
 *  #C<integer>, sets the current sensor offset in mV [default is 2500]
 *  #D<integer>, sets the current sensor sensitivity in mV [default is 185]
 *  #R, reset the configuration to the defaults
 *  #T, self-tune the current sensor offset (use with no load attached)
 *  #Z, print settings
 *
 * Serial putput:
 *   #Energino,0,<voltage>,<current>,<power>,<relay>,<period>,<samples>,<voltage_error>,<current_error>
 *
 * created 31 October 2012
 * by Roberto Riggio
 *
 * This code is released under the BSD Licence
 *
 */

#include <energino.h>

#define RELAYPIN      2
#define CURRENTPIN    A0
#define VOLTAGEPIN    A1

// Energino parameters
int R1 = 100;
int R2 = 10;
int OFFSET = 2500;
int SENSITIVITY = 185;
int PERIOD = 2000;

// Running averages
long VRaw = 0;
long IRaw = 0;
long samples = 0;

// magic string
const char MAGIC[] = "Energino";
const int REVISION = 1;

void reset() {
  strcpy (settings.magic, MAGIC);
  settings.revision = REVISION;
  settings.period = PERIOD;
  settings.r1 = R1;
  settings.r2 = R2;
  settings.offset = OFFSET;
  settings.sensitivity = SENSITIVITY;
  settings.relaypin = RELAYPIN;
  settings.currentpin = CURRENTPIN;
  settings.voltagepin = VOLTAGEPIN;
}

void setup() {
  // Set serial port
  Serial.begin(115200);
  // Loading setting
  loadSettings();
  if (strcmp(settings.magic, MAGIC) != 0) {
    reset();
    saveSettings();
  }
  // Default on
  pinMode(settings.relaypin,OUTPUT);
  digitalWrite(settings.relaypin, LOW);
  // Use the led 13 to notify that the
  // setup completed
  pinMode(13,OUTPUT);
  digitalWrite(13, HIGH);
  // Set last update to now
  lastUpdated = millis();
}

void loop() {
  // Parse incoming commands
  serParseCommand();
  // accumulate readings
  VRaw += analogRead(VOLTAGEPIN);
  IRaw += analogRead(CURRENTPIN);
  samples++;
  if (lastUpdated + settings.period <= millis()) {
    // Conversion
    VFinal = double(VRaw) / samples;
    IFinal = double(IRaw) / samples;
    lastSamples = samples;
    // dump to serial
    dumpToSerialBatt();
    // reset counters
    VRaw = 0;
    IRaw = 0;
    samples = 0;
    lastUpdated = millis();
  }
}

int MAX_V_BATT = 12;
int MIN_V_BATT = 10;

double a =  1 / double(MAX_V_BATT -  MIN_V_BATT);
double b = 1 - a * MAX_V_BATT;

// coumpute battery percentage
double getBattery(double VFinal) {
    if (VFinal > MAX_V_BATT) {
      return 1.0;
    }
    if (VFinal < MIN_V_BATT) {
      return 0.0;
    }
    return a * VFinal - b;
}

// dump current readings to serial
void dumpToSerialBatt() {
  // Print data also on the serial
  Serial.print("#");
  Serial.print(settings.magic);
  Serial.print(",");
  Serial.print(settings.revision);
  Serial.print(",");
  Serial.print(getAvgVoltage(VFinal), V_DIGITS);
  Serial.print(",");
  Serial.print(getAvgCurrent(IFinal), C_DIGITS);
  Serial.print(",");
  Serial.print(getAvgPower(VFinal, IFinal), P_DIGITS);
  Serial.print(",");
  Serial.print(digitalRead(settings.relaypin));
  Serial.print(",");
  Serial.print(settings.period);
  Serial.print(",");
  Serial.print(lastSamples);
  Serial.print(",");
  Serial.print(getVError());
  Serial.print(",");
  Serial.print(getIError());
  Serial.print(",");
  Serial.print(getBattery(VFinal), 2);
  Serial.print("\n");
}

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


add arduino sketch

add arduino sketch

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


Init of program. LED swiping only..

Init of program. LED swiping only..

/*-------------------------------------------------------------------------
  Spark Core library to control WS2811/WS2812 based RGB
  LED devices such as Adafruit NeoPixel strips.
  Currently handles 800 KHz and 400kHz bitstream on Spark Core,
  WS2812, WS2812B and WS2811.

  Also supports:
  - Radio Shack Tri-Color Strip with TM1803 controller 400kHz bitstream.
  - TM1829 pixels

  PLEASE NOTE that the NeoPixels require 5V level inputs
  and the Spark Core only has 3.3V level outputs. Level shifting is
  necessary, but will require a fast device such as one of the following:

  [SN74HCT125N]
  http://www.digikey.com/product-detail/en/SN74HCT125N/296-8386-5-ND/376860

  [SN74HCT245N]
  http://www.digikey.com/product-detail/en/SN74HCT245N/296-1612-5-ND/277258

  Written by Phil Burgess / Paint Your Dragon for Adafruit Industries.
  Modified to work with Spark Core by Technobly.
  Contributions by PJRC and other members of the open source community.

  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing products
  from Adafruit!
  --------------------------------------------------------------------*/

/* ======================= includes ================================= */

#include "application.h"
//#include "spark_disable_wlan.h" (for faster local debugging only)
#include "neopixel/neopixel.h"

/* ======================= prototypes =============================== */

void colorAll(uint32_t c, uint8_t wait);
void colorWipe(uint32_t c, uint8_t wait);
void rainbow(uint8_t wait);
void rainbowCycle(uint8_t wait);
uint32_t Wheel(byte WheelPos);

/* ======================= extra-examples.cpp ======================== */

// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_COUNT 10
#define PIXEL_PIN A7
#define PIXEL_TYPE WS2812B

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
//               note: if not specified, D2 is selected for you.
// Parameter 3 = pixel type [ WS2812, WS2812B, WS2811, TM1803 ]
//               note: if not specified, WS2812B is selected for you.
//               note: RGB order is automatically applied to WS2811,
//                     WS2812/WS2812B/TM1803 is GRB order.
//
// 800 KHz bitstream 800 KHz bitstream (most NeoPixel products ...
//                         ... WS2812 (6-pin part)/WS2812B (4-pin part) )
//
// 400 KHz bitstream (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//                   (Radio Shack Tri-Color LED Strip - TM1803 driver
//                    NOTE: RS Tri-Color LED's are grouped in sets of 3)

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel.  Avoid connecting
// on a live circuit...if you must, connect GND first.

void setup() {
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
  // Some example procedures showing how to display to the pixels:
  // Do not run more than one of these at a time, or the b/g tasks
  // will be blocked.
  //--------------------------------------------------------------

  pixelSwipeRandom(strip.Color(0, 0, 10),strip.Color(15, 10, 0), 20);

  //pixelWipe(strip.Color(0, 0, 0),strip.Color(0, 0, 15), 50); // Red
  //pixelWipeReverse(strip.Color(0, 0, 0),strip.Color(0, 0, 15), 50);
  //colorWipe(strip.Color(255, 0, 0), 50); // Red

  //colorWipe(strip.Color(20, 25, 0), 50); // Green

  //colorWipe(strip.Color(0, 0, 25), 50); // Blue

  //rainbow(20);

  //rainbowCycle(20);

  //colorAll(strip.Color(0, 255, 255), 50); // Magenta
}

void pixelSwipeRandom(uint32_t c, uint32_t b, uint8_t wait) {
  pixelWipe(c, b, wait); // Red
  clearAll(b);
  strip.show();
  delay(random(100,10000));
  pixelWipeReverse(c,b, wait);
  clearAll(b);
  strip.show();
  delay(random(100,10000));
}
// Set all pixels in the strip to a solid color, then wait (ms)
void colorAll(uint32_t c, uint8_t wait) {
  uint16_t i;

  for(i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
  }
  strip.show();
  delay(wait);
}

// Fill the dots one after the other with a color, wait (ms) after each one
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 pixelWipe(uint32_t c, uint32_t b, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
    clearAll(b);
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);

  }
}

void pixelWipeReverse(uint32_t c, uint32_t b, uint8_t wait) {
  for(int16_t i=strip.numPixels() -1; i>=0; i--) {
    clearAll(b);
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}

void clearAll(uint32_t b) {
  for(uint16_t t=0; t<strip.numPixels(); t++) {
    strip.setPixelColor(t, b);
  }
}

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, then wait (ms)
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) { // 1 cycle 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);
  }
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}

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


Create bargraph24.ino

Create bargraph24.ino

/***************************************************
  This is a library for our I2C LED Backpacks

  Designed specifically to work with the Adafruit LED 24 Bargraph Backpack
  ----> http://www.adafruit.com/products/721

  These displays use I2C to communicate, 2 pins are required to
  interface. There are multiple selectable I2C addresses. For backpacks
  with 2 Address Select pins: 0x70, 0x71, 0x72 or 0x73. For backpacks
  with 3 Address Select pins: 0x70 thru 0x77

  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

Adafruit_24bargraph bar = Adafruit_24bargraph();

void setup() {
  Serial.begin(9600);
  Serial.println("HT16K33 Bi-Color Bargraph test");

  bar.begin(0x70);  // pass in the address

  for (uint8_t b=0; b<24; b++ ){
    if ((b % 3) == 0)  bar.setBar(b, LED_RED);
    if ((b % 3) == 1)  bar.setBar(b, LED_YELLOW);
    if ((b % 3) == 2)  bar.setBar(b, LED_GREEN);
  }
  bar.writeDisplay();
  delay(2000);
}

void loop() {
 for (uint8_t b=0; b<24; b++) {
   bar.setBar(b, LED_RED);
   bar.writeDisplay();
   delay(50);
   bar.setBar(b, LED_OFF);
   bar.writeDisplay();
 }
  for (uint8_t b=0; b<24; b++) {
   bar.setBar(b, LED_GREEN);
   bar.writeDisplay();
   delay(50);
   bar.setBar(b, LED_OFF);
   bar.writeDisplay();
 }

 for (uint8_t b=0; b<24; b++) {
   bar.setBar(23-b, LED_YELLOW);
   bar.writeDisplay();
   delay(50);
   bar.setBar(23-b, LED_OFF);
   bar.writeDisplay();
 }
}

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


Added support for additional parameters

Added support for additional parameters

#include <ESP8266WiFi.h>          //https://github.com/esp8266/Arduino

//needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>          //https://github.com/tzapu/WiFiManager

// The extra parameters to be configured (can be either global or just in the setup)
WiFiManagerParameter mqtt_server("server", "mqtt server", NULL, 40);
WiFiManagerParameter mqtt_port("port", "mqtt port", "8080", 8);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  //WiFiManager
  //Local intialization. Once its business is done, there is no need to keep it around
  WiFiManager wifiManager;

  //add all your parameters here
  wifiManager.addParameter(&mqtt_server);
  wifiManager.addParameter(&mqtt_port);

  //reset settings - for testing
  wifiManager.resetSettings();

  //sets timeout until configuration portal gets turned off
  //useful to make it all retry or go to sleep
  //in seconds
  wifiManager.setTimeout(180);

  //fetches ssid and pass and tries to connect
  //if it does not connect it starts an access point with the specified name
  //here  "AutoConnectAP"
  //and goes into a blocking loop awaiting configuration
  if(!wifiManager.autoConnect("AutoConnectAP")) {
    Serial.println("failed to connect and hit timeout");
    delay(3000);
    //reset and try again, or maybe put it to deep sleep
    ESP.reset();
    delay(5000);
  }

  //if you get here you have connected to the WiFi
  Serial.println("connected...yeey :)");

  // use your parameter values as needed
  Serial.print(mqtt_server.getPlaceholder());
  Serial.print(": ");
  Serial.println(mqtt_server.getValue());

  Serial.print(mqtt_port.getPlaceholder());
  Serial.print(": ");
  Serial.println(mqtt_port.getValue());
}

void loop() {
  // put your main code here, to run repeatedly:

}

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


indoor firmware

indoor firmware

/*
   CONNECTIONS:
   - GND
   - Pin 2 to HC-05 TXD
   - Pin 3 to HC-05 RXD
   - 3.3v to HC-05 Vcc
   - GND
 */

#include <SoftwareSerial.h>

#define HC_05_TXD_ARDUINO_RXD 2
#define HC_05_RXD_ARDUINO_TXD 3

SoftwareSerial BTSerial(HC_05_TXD_ARDUINO_RXD, HC_05_RXD_ARDUINO_TXD);

void setup()
{

  Serial.begin(9600);
  BTSerial.begin(38400);
}

void loop()
{
  int btIn = -1;
  if (BTSerial.available() && (btIn = BTSerial.read()) ) {
    Serial.write(btIn);
  }
}

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


Added sensor arduino code

Added sensor arduino code

#include <ESP8266HTTPClient.h>
#include <ESP8266WiFi.h>
#include <ArduinoJson.h>

#define MIN2MS     60*1000  // 1000 ms -> 1 sec; 60 sec -> 1 min
#define POSTRATE   5*MIN2MS // POST to server every timestep
#define BUFFERSIZE 50       // JSON Buffer size
#define IN_PIN 5
#define OUT_PIN 12

int sensorStatus, httpCode;
char JSONmessageBuffer[BUFFERSIZE];

void setup() {
  Serial.begin(115200);                        // Serial connection

  pinMode(IN_PIN, INPUT_PULLUP);
  pinMode(OUT_PIN, OUTPUT);

  digitalWrite(OUT_PIN, HIGH);

  WiFi.begin("CINE", "");   // WiFi connection

  while (WiFi.status() != WL_CONNECTED) {      // Wait for the WiFI connection completion
    delay(500);
    Serial.println("Waiting for connection...");
  }
}

void loop() {
  if (WiFi.status() == WL_CONNECTED) {       // Connected to WIFI?
    sensorStatus = digitalRead(IN_PIN);

    StaticJsonBuffer<BUFFERSIZE> JSONbuffer; // Declaring static JSON buffer
    JsonObject& JSONencoder = JSONbuffer.createObject();

    JSONencoder["doorStatus"] = sensorStatus; // read from the sensor; is the door open or closed?

    JSONencoder.prettyPrintTo(JSONmessageBuffer, sizeof(JSONmessageBuffer));

    Serial.println(JSONmessageBuffer);

    HTTPClient http;    // Declare object of class HTTPClient

    http.begin("http://hmcmailroom.pythonanywhere.com/"); // Specify request destination
    http.addHeader("Content-Type", "application/json");   // Specify content-type header

    httpCode = http.POST(JSONmessageBuffer); // Send the request
    String payload = http.getString();                                        //Get the response payload

    Serial.println(httpCode);   //Print HTTP return code
    Serial.println(payload);    //Print request response payload

    http.end();  // Close connection
  } else {
    Serial.println("Error in WiFi connection");
  }

  delay(POSTRATE);
}

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


u8g2 hello

u8g2 hello

/*

  HelloWorld.ino

  Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)

  Copyright (c) 2016, olikraus@gmail.com
  All rights reserved.

  Redistribution and use in source and binary forms, with or without modification,
  are permitted provided that the following conditions are met:

  * Redistributions of source code must retain the above copyright notice, this list
    of conditions and the following disclaimer.

  * Redistributions in binary form must reproduce the above copyright notice, this
    list of conditions and the following disclaimer in the documentation and/or other
    materials provided with the distribution.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*/

#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

/*
  U8glib Example Overview:
    Frame Buffer Examples: clearBuffer/sendBuffer. Fast, but may not work with all Arduino boards because of RAM consumption
    Page Buffer Examples: firstPage/nextPage. Less RAM usage, should work with all Arduino boards.
    U8x8 Text Only Example: No RAM usage, direct communication with display controller. No graphics, 8x8 Text only.

*/

// Please UNCOMMENT one of the contructor lines below
// U8g2 Contructor List (Frame Buffer)
// The complete list is available here: https://github.com/olikraus/u8g2/wiki/u8g2setupcpp
// Please update the pin numbers according to your setup. Use U8X8_PIN_NONE if the reset pin is not connected
//U8G2_SSD1306_128X64_NONAME_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_SSD1306_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 12, /* dc=*/ 4, /* reset=*/ 6);	// Arduboy (Production, Kickstarter Edition)
//U8G2_SSD1306_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_SSD1306_128X64_NONAME_F_3W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* reset=*/ 8);
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
//U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* reset=*/ 8);
//U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);   // All Boards without Reset of the Display
//U8G2_SSD1306_128X64_NONAME_F_6800 u8g2(U8G2_R0, 13, 11, 2, 3, 4, 5, 6, A4, /*enable=*/ 7, /*cs=*/ 10, /*dc=*/ 9, /*reset=*/ 8);
//U8G2_SSD1306_128X64_NONAME_F_8080 u8g2(U8G2_R0, 13, 11, 2, 3, 4, 5, 6, A4, /*enable=*/ 7, /*cs=*/ 10, /*dc=*/ 9, /*reset=*/ 8);
//U8G2_SSD1306_128X64_VCOMH0_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);	// same as the NONAME variant, but maximizes setContrast() range
//U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_SH1106_128X64_VCOMH0_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);		// same as the NONAME variant, but maximizes setContrast() range
//U8G2_SSD1306_128X32_UNIVISION_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ 21, /* data=*/ 20, /* reset=*/ U8X8_PIN_NONE);   // Adafruit Feather M0 Basic Proto + FeatherWing OLED
//U8G2_SSD1306_128X32_UNIVISION_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);   // Adafruit Feather ESP8266/32u4 Boards + FeatherWing OLED
//U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);  // Adafruit ESP8266/32u4/ARM Boards + FeatherWing OLED
//U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE, /* clock=*/ SCL, /* data=*/ SDA);   // pin remapping with ESP8266 HW I2C
//U8G2_SSD1306_64X48_ER_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);   // EastRising 0.66" OLED breakout board, Uno: A4=SDA, A5=SCL, 5V powered
//U8G2_SSD1322_NHD_256X64_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);	// Enable U8G2_16BIT in u8g2.h
//U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);	// Enable U8G2_16BIT in u8g2.h
//U8G2_SSD1325_NHD_128X64_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_SSD1325_NHD_128X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_SSD1327_SEEED_96X96_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);	// Seeedstudio Grove OLED 96x96
//U8G2_SSD1327_SEEED_96X96_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);	// Seeedstudio Grove OLED 96x96
//U8G2_SSD1329_128X96_NONAME_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_SSD1329_128X96_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_SSD1305_128X32_NONAME_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_SSD1305_128X32_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_SSD1309_128X64_NONAME_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_SSD1309_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_LD7032_60X32_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 11, /* data=*/ 12, /* cs=*/ 9, /* dc=*/ 10, /* reset=*/ 8);	// SW SPI Nano Board
//U8G2_LD7032_60X32_F_4W_SW_I2C u8g2(U8G2_R0, /* clock=*/ 11, /* data=*/ 12, /* reset=*/ U8X8_PIN_NONE);	// NOT TESTED!
//U8G2_UC1701_EA_DOGS102_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_UC1701_EA_DOGS102_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_PCD8544_84X48_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);  // Nokia 5110 Display
//U8G2_PCD8544_84X48_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); 		// Nokia 5110 Display
//U8G2_PCF8812_96X65_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);	// Could be also PCF8814
//U8G2_PCF8812_96X65_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);						// Could be also PCF8814
//U8G2_KS0108_128X64_F u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*dc=*/ 17, /*cs0=*/ 14, /*cs1=*/ 15, /*cs2=*/ U8X8_PIN_NONE, /* reset=*/  U8X8_PIN_NONE); 	// Set R/W to low!
//U8G2_KS0108_ERM19264_F u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*dc=*/ 17, /*cs0=*/ 14, /*cs1=*/ 15, /*cs2=*/ 16, /* reset=*/  U8X8_PIN_NONE); 	// Set R/W to low!
//U8G2_ST7920_192X32_F_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*cs=*/ U8X8_PIN_NONE, /*dc=*/ 17, /*reset=*/ U8X8_PIN_NONE);
//U8G2_ST7920_192X32_F_SW_SPI u8g2(U8G2_R0, /* clock=*/ 18 /* A4 */ , /* data=*/ 16 /* A2 */, /* CS=*/ 17 /* A3 */, /* reset=*/ U8X8_PIN_NONE);
//U8G2_ST7920_128X64_F_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18 /* A4 */, /*cs=*/ U8X8_PIN_NONE, /*dc/rs=*/ 17 /* A3 */, /*reset=*/ 15 /* A1 */);	// Remember to set R/W to 0
//U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R0, /* clock=*/ 18 /* A4 */ , /* data=*/ 16 /* A2 */, /* CS=*/ 17 /* A3 */, /* reset=*/ U8X8_PIN_NONE);
//U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* CS=*/ 10, /* reset=*/ 8);
//U8G2_ST7920_128X64_F_HW_SPI u8g2(U8G2_R0, /* CS=*/ 10, /* reset=*/ 8);
//U8G2_ST7565_EA_DOGM128_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_ST7565_EA_DOGM128_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_ST7565_EA_DOGM132_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ U8X8_PIN_NONE);	// DOGM132 Shield
//U8G2_ST7565_EA_DOGM132_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ U8X8_PIN_NONE);	// DOGM132 Shield
//U8G2_ST7565_ZOLEN_128X64_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_ST7565_ZOLEN_128X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_ST7565_LM6059_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);		// Adafruit ST7565 GLCD
//U8G2_ST7565_LM6059_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);		// Adafruit ST7565 GLCD
//U8G2_ST7565_ERC12864_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_ST7565_ERC12864_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_ST7565_NHD_C12832_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_ST7565_NHD_C12832_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_ST7565_NHD_C12864_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_ST7565_NHD_C12864_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_ST7567_PI_132X64_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 7, /* dc=*/ 9, /* reset=*/ 8);  // Pax Instruments Shield, LCD_BL=6
//U8G2_ST7567_PI_132X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 7, /* dc=*/ 9, /* reset=*/ 8);  // Pax Instruments Shield, LCD_BL=6
//U8G2_NT7534_TG12864R_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_NT7534_TG12864R_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_ST7588_JLX12864_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ 5);
//U8G2_ST7588_JLX12864_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ 5);
//U8G2_IST3020_ERC19264_F_6800 u8g2(U8G2_R0, 44, 43, 42, 41, 40, 39, 38, 37,  /*enable=*/ 28, /*cs=*/ 32, /*dc=*/ 30, /*reset=*/ 31); // Connect WR pin with GND
//U8G2_IST3020_ERC19264_F_8080 u8g2(U8G2_R0, 44, 43, 42, 41, 40, 39, 38, 37,  /*enable=*/ 29, /*cs=*/ 32, /*dc=*/ 30, /*reset=*/ 31); // Connect RD pin with 3.3V
//U8G2_IST3020_ERC19264_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_LC7981_160X80_F_6800 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*cs=*/ 14, /*dc=*/ 15, /*reset=*/ 16); // Connect RW with GND
//U8G2_LC7981_240X128_F_6800 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*cs=*/ 14, /*dc=*/ 15, /*reset=*/ 16); // Connect RW with GND
//U8G2_T6963_240X128_F_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 17, /*cs=*/ 14, /*dc=*/ 15, /*reset=*/ 16); // Connect RD with +5V, FS0 and FS1 with GND
//U8G2_T6963_256X64_F_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 17, /*cs=*/ 14, /*dc=*/ 15, /*reset=*/ 16); // Connect RD with +5V, FS0 and FS1 with GND
//U8G2_SED1330_240X128_F_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 17, /*cs=*/ 14, /*dc=*/ 15, /*reset=*/ 16); // Connect RD with +5V, FG with GND
//U8G2_SED1330_240X128_F_6800 u8g2(U8G2_R0, 13, 11, 2, 3, 4, 5, 6, A4, /*enable=*/ 7, /*cs=*/ 10, /*dc=*/ 9, /*reset=*/ 8); // A0 is dc pin!
//U8G2_RA8835_NHD_240X128_F_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 17, /*cs=*/ 14, /*dc=*/ 15, /*reset=*/ 16); // Connect /RD = E with +5V, enable is /WR = RW, FG with GND, 14=Uno Pin A0
//U8G2_RA8835_NHD_240X128_F_6800 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7,  /*enable=*/ 17, /*cs=*/ 14, /*dc=*/ 15, /*reset=*/ 16); // A0 is dc pin, /WR = RW = GND, enable is /RD = E
//U8G2_UC1604_JLX19264_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_UC1604_JLX19264_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_UC1608_ERC24064_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);  // SW SPI, Due ERC24064-1 Test Setup
//U8G2_UC1608_240X128_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);  // SW SPI, Due ERC24064-1 Test Setup
//U8G2_UC1610_EA_DOGXL160_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/  U8X8_PIN_NONE);
//U8G2_UC1610_EA_DOGXL160_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/  U8X8_PIN_NONE);
//U8G2_UC1611_EA_DOGM240_F_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8);	// Due, 2nd I2C, DOGM240 Test Board
//U8G2_UC1611_EA_DOGM240_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);   // Due, SW SPI, DOGXL240 Test Board
//U8G2_UC1611_EA_DOGXL240_F_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8);	// Due, 2nd I2C, DOGXL240 Test Board
//U8G2_UC1611_EA_DOGXL240_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);   // Due, SW SPI, DOGXL240 Test Board
//U8G2_SSD1606_172X72_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);		// eInk/ePaper Display
//U8G2_SSD1607_200X200_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);	// eInk/ePaper Display

// End of constructor list

void setup(void) {
  u8g2.begin();
}

void loop(void) {
  u8g2.clearBuffer();					// clear the internal memory
  u8g2.setFont(u8g2_font_ncenB14_tr);	// choose a suitable font
  u8g2.drawStr(0,20,"Hello World!");	// write something to the internal memory
  u8g2.sendBuffer();					// transfer internal memory to the display
  delay(1000);
}

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


empty servo controller file

empty servo controller file

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


Servo interface on the arduino works and is pretty darn spiffy.

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/VisIR/RoboCode.git/'


Update Delta5-Race-Timer.ino

Update Delta5-Race-Timer.ino

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


initial import of micro code implemented serial proxy handle LCD commands handle analogOut (PWM) commands placeholder for joystick button events

#include <Arduino.h>
#include <Wire.h>
// https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
#include <LiquidCrystal_I2C.h> // Using version 1.2.1

// IDE: Arduino/Genuino Micro

// potencjometr: niebieski z czarną kreską do GND, biały do +5V, niebieski do pinu A0 / A1
// LCD: SDA->2, SCL->3

class analogOutPin {
  public:
    analogOutPin(const uint8_t id, const uint8_t pin);
    void updateState(const uint8_t val) const ;
    const uint8_t getId() const { return(m_id); }
  private:
    const uint8_t m_id, m_pin;
};

analogOutPin::analogOutPin(const uint8_t id, const uint8_t pin) :
	m_id(id), m_pin(pin)
{
}

void analogOutPin::updateState(const uint8_t val) const {
  analogWrite(m_pin,val);
}

analogOutPin analogOutPins[] = {
  analogOutPin(0,9),	// g-force
  analogOutPin(1,10)    // electrical power
};

// Set the pins on the I2C chip used for LCD connections:
//                    addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x3f, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

// serial port
#define SERIAL_SPEED 115200

void setup() {
  // initialize serial communications
  Serial.begin(SERIAL_SPEED);
  Serial1.begin(SERIAL_SPEED);
  // wait for USB device
  while (!Serial);
  // set timeout to 200ms
  Serial.setTimeout(200);
  // start blink counter
  lcd.begin(16,2);   // initialize the lcd for 16 chars 2 lines, turn on backlight
  lcd.setCursor(0,0);
  lcd.print("KSP-Gegi");
  lcd.setCursor(0,1);
  lcd.print("Ready for action");
  // request status update
  Serial.println("I");
}

// commands like ^A{id}={val}$
void handleSerialInputAnalogOut() {
  const uint8_t id = Serial.parseInt();  // skip '='
  const uint8_t val = Serial.parseInt(); // skip newline
//  Serial.print(id); Serial.write(' '); Serial.println(val);
  for (auto &p : analogOutPins) {
    if (p.getId()==id) {
      p.updateState(val);
    }
  }
}

// commands like ^P{line:0,1}={text0..15}$ (consume all characters until end of the line)
void handleSerialInputLCD() {
  uint8_t i=0, c;
  const uint8_t id = Serial.parseInt();
  Serial.read(); // skip '='
//  Serial.print("LCDin"); Serial.println(id);
  if (id==0 || id==1) {
    lcd.setCursor(0,id);
    c = -1;
    while (c!='\r' && c!='\n') {
      if (Serial.available()>0) {
        c = Serial.read();
      } else {
        c = -1;
      }
      if (c>0 && c!='\r' && c!='\n' && i<16) {
        i++;
        lcd.write(c);
//        Serial.print(c,HEX);
      }
    }
    for (;i<16;i++) {
      lcd.write(' ');
    }
//    Serial.println("endLCD");
  }
}

// pass data from USB host (PC) to UART
// - handle own devices (consume this data)
// - pass everything else to mini slave
void checkSerialInputUSBtoUART() {
  uint8_t c;
  while (Serial.available()) {
    c = Serial.read();
    if (c == 'A') {
      handleSerialInputAnalogOut();
    }
    else if (c == 'P') {
      handleSerialInputLCD();
    }
	  else {
      Serial1.write(c);
	  }
  }
}

// pass data from UART slave (mini) to USB host (PC)
// - convert some button presses to joystick events
// - pass everyting else
void checkSerialInputUARTtoUSB() {
  uint8_t c;
  while (Serial1.available()) {
		c = Serial1.read();
		Serial.write(c);
	}
}

void loop() {
  checkSerialInputUSBtoUART();
  checkSerialInputUARTtoUSB();
  // send joystick state
  delay(200);
}

error: pathspec 'ksp-gegi-microusb/ksp-gegi-microusb.ino' did not match any file(s) known to git


RFduino firmware: fix comment so that sketch compiles

// Physical-Web example for RFDigital RFduino

#include <RFduinoBLE.h>

uint8_t advdata[] =
{
  0x03,  // length
  0x03,  // Param: Service List
  0xD8, 0xFE,  // URI Beacon ID
  0x0A,  // length
  0x16,  // Service Data
  0xD8, 0xFE, // URI Beacon ID
  0x00,  // flags
  0x20,  // power
  0x00,  // http://www.
  'A',
  'B',
  'C',
  0x07,  // .".com"
};

void setup() {
  RFduinoBLE_advdata = advdata;
  RFduinoBLE_advdata_len = sizeof(advdata);
  RFduinoBLE.advertisementInterval = 1000; // advertise every 1000ms
  RFduinoBLE.begin();
}

void loop() {
  RFduino_ULPDelay(INFINITE);   // switch to lower power mode
}

# Physical-Web example for RFDigital RFduino

#include <RFduinoBLE.h>

uint8_t advdata[] =
{
  0x03,  // length
  0x03,  // Param: Service List
  0xD8, 0xFE,  // URI Beacon ID
  0x0A,  // length
  0x16,  // Service Data
  0xD8, 0xFE, // URI Beacon ID
  0x00,  // flags
  0x20,  // power
  0x00,  // http://www.
  'A',
  'B',
  'C',
  0x07,  // .".com"
};

void setup() {
  RFduinoBLE_advdata = advdata;
  RFduinoBLE_advdata_len = sizeof(advdata);
  RFduinoBLE.advertisementInterval = 1000; // advertise every 1000ms
  RFduinoBLE.begin();
}

void loop() {
  RFduino_ULPDelay(INFINITE);   // switch to lower power mode
}


Simple screen message to impress people

Simple screen message to impress people

/***************************************************
  This is our GFX example for the Adafruit ILI9341 Breakout and Shield
  ----> http://www.adafruit.com/products/1651

  Check out the links above for our tutorials and wiring diagrams
  These displays use SPI to communicate, 4 or 5 pins are required to
  interface (RST is optional)
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

// Custom pins like
#define TFT_DC 5
#define TFT_CS 7
#define TFT_MOSI 4
#define TFT_CLK 3
#define TFT_RST 6
#define TFT_MISO 2

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

void setup() {
  Serial.begin(9600);
  Serial.println("ILI9341 Test!");

  tft.begin();

//  // read diagnostics (optional but can help debug problems)
//  uint8_t x = tft.readcommand8(ILI9341_RDMODE);
//  Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);
//  x = tft.readcommand8(ILI9341_RDMADCTL);
//  Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);
//  x = tft.readcommand8(ILI9341_RDPIXFMT);
//  Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);
//  x = tft.readcommand8(ILI9341_RDIMGFMT);
//  Serial.print("Image Format: 0x"); Serial.println(x, HEX);
//  x = tft.readcommand8(ILI9341_RDSELFDIAG);
//  Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX);
//
//  Serial.println(F("Benchmark                Time (microseconds)"));
//
//  Serial.print(F("Screen fill              "));
//  Serial.println(testFillScreen());
//  delay(500);
//
//  Serial.print(F("Text                     "));
//  Serial.println(testText());
//  delay(3000);
//
//  Serial.print(F("Lines                    "));
//  Serial.println(testLines(ILI9341_CYAN));
//  delay(500);
//
//  Serial.print(F("Horiz/Vert Lines         "));
//  Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE));
//  delay(500);
//
//  Serial.print(F("Rectangles (outline)     "));
//  Serial.println(testRects(ILI9341_GREEN));
//  delay(500);
//
//  Serial.print(F("Rectangles (filled)      "));
//  Serial.println(testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA));
//  delay(500);
//
//  Serial.print(F("Circles (filled)         "));
//  Serial.println(testFilledCircles(10, ILI9341_MAGENTA));
//
//  Serial.print(F("Circles (outline)        "));
//  Serial.println(testCircles(10, ILI9341_WHITE));
//  delay(500);
//
//  Serial.print(F("Triangles (outline)      "));
//  Serial.println(testTriangles());
//  delay(500);
//
//  Serial.print(F("Triangles (filled)       "));
//  Serial.println(testFilledTriangles());
//  delay(500);
//
//  Serial.print(F("Rounded rects (outline)  "));
//  Serial.println(testRoundRects());
//  delay(500);
//
//  Serial.print(F("Rounded rects (filled)   "));
//  Serial.println(testFilledRoundRects());
//  delay(500);
//
//  Serial.println(F("Done!"));

}

void loop(void) {
  for(uint8_t rotation=1; rotation<4; rotation = rotation + 2) {
    tft.setRotation(rotation);
    testText();
    delay(1000);
  }
}

unsigned long testFillScreen() {
  unsigned long start = micros();
  tft.fillScreen(ILI9341_BLACK);
  tft.fillScreen(ILI9341_RED);
  tft.fillScreen(ILI9341_GREEN);
  tft.fillScreen(ILI9341_BLUE);
  tft.fillScreen(ILI9341_BLACK);
  return micros() - start;
}

unsigned long testText() {
  tft.fillScreen(ILI9341_BLACK);
  unsigned long start = micros();
  tft.setCursor(0, 75);
//  tft.setTextColor(ILI9341_WHITE);  tft.setTextSize(1);
//  tft.println("Hello World!");
//  tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2);
//  tft.println(1234.56);
  tft.setTextColor(ILI9341_RED);    tft.setTextSize(5);
//  tft.println(0xDEADBEEF, HEX);
//  tft.println();
//  tft.setTextColor(ILI9341_GREEN);
//  tft.setTextSize(5);
  tft.println("bleepr");

  delay(1500);

  tft.setTextColor(ILI9341_WHITE);
  tft.setTextSize(2);

  tft.println();

  tft.println("Smart Tables");
  delay(1000);
  tft.println("Smart Restaurants");

  delay(2000);
//  tft.setTextSize(2);
//  tft.println("I implore thee,");
//  tft.setTextSize(1);
//  tft.println("my foonting turlingdromes.");
//  tft.println("And hooptiously drangle me");
//  tft.println("with crinkly bindlewurdles,");
//  tft.println("Or I will rend thee");
//  tft.println("in the gobberwarts");
//  tft.println("with my blurglecruncheon,");
//  tft.println("see if I don't!");
  return micros() - start;
}

unsigned long testLines(uint16_t color) {
  unsigned long start, t;
  int           x1, y1, x2, y2,
                w = tft.width(),
                h = tft.height();

  tft.fillScreen(ILI9341_BLACK);

  x1 = y1 = 0;
  y2    = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t     = micros() - start; // fillScreen doesn't count against timing

  tft.fillScreen(ILI9341_BLACK);

  x1    = w - 1;
  y1    = 0;
  y2    = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;

  tft.fillScreen(ILI9341_BLACK);

  x1    = 0;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;

  tft.fillScreen(ILI9341_BLACK);

  x1    = w - 1;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);

  return micros() - start;
}

unsigned long testFastLines(uint16_t color1, uint16_t color2) {
  unsigned long start;
  int           x, y, w = tft.width(), h = tft.height();

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(y=0; y<h; y+=5) tft.drawFastHLine(0, y, w, color1);
  for(x=0; x<w; x+=5) tft.drawFastVLine(x, 0, h, color2);

  return micros() - start;
}

unsigned long testRects(uint16_t color) {
  unsigned long start;
  int           n, i, i2,
                cx = tft.width()  / 2,
                cy = tft.height() / 2;

  tft.fillScreen(ILI9341_BLACK);
  n     = min(tft.width(), tft.height());
  start = micros();
  for(i=2; i<n; i+=6) {
    i2 = i / 2;
    tft.drawRect(cx-i2, cy-i2, i, i, color);
  }

  return micros() - start;
}

unsigned long testFilledRects(uint16_t color1, uint16_t color2) {
  unsigned long start, t = 0;
  int           n, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  n = min(tft.width(), tft.height());
  for(i=n; i>0; i-=6) {
    i2    = i / 2;
    start = micros();
    tft.fillRect(cx-i2, cy-i2, i, i, color1);
    t    += micros() - start;
    // Outlines are not included in timing results
    tft.drawRect(cx-i2, cy-i2, i, i, color2);
  }

  return t;
}

unsigned long testFilledCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(x=radius; x<w; x+=r2) {
    for(y=radius; y<h; y+=r2) {
      tft.fillCircle(x, y, radius, color);
    }
  }

  return micros() - start;
}

unsigned long testCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int           x, y, r2 = radius * 2,
                w = tft.width()  + radius,
                h = tft.height() + radius;

  // Screen is not cleared for this one -- this is
  // intentional and does not affect the reported time.
  start = micros();
  for(x=0; x<w; x+=r2) {
    for(y=0; y<h; y+=r2) {
      tft.drawCircle(x, y, radius, color);
    }
  }

  return micros() - start;
}

unsigned long testTriangles() {
  unsigned long start;
  int           n, i, cx = tft.width()  / 2 - 1,
                      cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  n     = min(cx, cy);
  start = micros();
  for(i=0; i<n; i+=5) {
    tft.drawTriangle(
      cx    , cy - i, // peak
      cx - i, cy + i, // bottom left
      cx + i, cy + i, // bottom right
      tft.color565(0, 0, i));
  }

  return micros() - start;
}

unsigned long testFilledTriangles() {
  unsigned long start, t = 0;
  int           i, cx = tft.width()  / 2 - 1,
                   cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(i=min(cx,cy); i>10; i-=5) {
    start = micros();
    tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
      tft.color565(0, i, i));
    t += micros() - start;
    tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
      tft.color565(i, i, 0));
  }

  return t;
}

unsigned long testRoundRects() {
  unsigned long start;
  int           w, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  w     = min(tft.width(), tft.height());
  start = micros();
  for(i=0; i<w; i+=6) {
    i2 = i / 2;
    tft.drawRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(i, 0, 0));
  }

  return micros() - start;
}

unsigned long testFilledRoundRects() {
  unsigned long start;
  int           i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(i=min(tft.width(), tft.height()); i>20; i-=6) {
    i2 = i / 2;
    tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(0, i, 0));
  }

  return micros() - start;
}

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


Updated formats of accelration values

Updated formats of accelration values

Reversed Tx Rx

BitBangingMpu6050/Right Hand Arduino Code.ino

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


Added lcdChoose

Added lcdChoose

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/mojtabacazi/Arduino-Additions.git/'


Add a Tron Light Cycle animation test for the rim.  Dunno how to work the Animations in Light.ino.

//#include <Adafruit_GFX.h>
#include <Adafruit_NeoPixel.h>
#include <Streaming.h>
#include <Metro.h>

// GRN > RED
//  ^     v
// YEL < BLU

#define RIM_PIN 13
#define RIM_X 20
#define RIM_Y 3
#define RIM_SEG_LENGTH RIM_X/4 // floor(RIM_N/4)=27
#define RED_OFFSET 12
#define RED_X (RED_OFFSET + RIM_SEG_LENGTH) % RIM_X
#define BLU_X (RED_X + RIM_SEG_LENGTH) % RIM_X
#define YEL_X (BLU_X + RIM_SEG_LENGTH) % RIM_X
#define GRN_X (YEL_X + RIM_SEG_LENGTH) % RIM_X
#define ALL_Y 1

#define UPDATE_INTERVAL 100UL
Metro updateCycles(UPDATE_INTERVAL);

#define ADD_INTERVAL 1000UL
Metro addCycles(ADD_INTERVAL);

Adafruit_NeoPixel rimJob = Adafruit_NeoPixel(RIM_X*RIM_Y, RIM_PIN, NEO_GRB + NEO_KHZ800);

const uint32_t Red = rimJob.Color(255, 0, 0);
const uint32_t Yel = rimJob.Color(255, 255, 0);
const uint32_t Grn = rimJob.Color(0, 255, 0);
const uint32_t Blu = rimJob.Color(0, 0, 255);
const uint32_t Dead = rimJob.Color(0, 0, 0);
const uint32_t White = rimJob.Color(255, 255, 255);

// tracks the cycles
typedef struct {
  boolean live; // live or dead
  uint32_t x,y; // location
  uint32_t color; // color of the cycle
} cycle_t;

#define MAX_CYCLES 20
cycle_t cycles[MAX_CYCLES];

void setup() {

  Serial.begin(115200);

  // put your setup code here, to run once:
  // Neopixel strips
  rimJob.begin();

  // clear strip
  for( int p=0; p<rimJob.numPixels(); p++ ) rimJob.setPixelColor(p, Dead);

  Serial << F("numPixels: ") << rimJob.numPixels() << endl;

  // clear cycles
  for( int c=0; c<MAX_CYCLES; c++ ) {
    cycles[c].live=false;
  }

  addCycle(RED_X, ALL_Y, Red);
  addCycle(GRN_X, ALL_Y, Grn);
  addCycle(BLU_X, ALL_Y, Blu);
  addCycle(YEL_X, ALL_Y, Yel);

  Serial << F("Startup complete.") << endl;

  rimJob.show();
  serialPrint();

}

void loop() {
  // put your main code here, to run repeatedly:
  if( updateCycles.check() ) {
    fadeCycles();
    moveCycles();
    serialPrint();
    rimJob.show();
  }
  if( addCycles.check() ) {
    switch( random(0,4) ) {
      case 0: addCycle(RED_X, ALL_Y, Red); break;
      case 1: addCycle(GRN_X, ALL_Y, Grn); break;
      case 2: addCycle(BLU_X, ALL_Y, Blu); break;
      case 3: addCycle(YEL_X, ALL_Y, Yel); break;
    }
  }
}

void serialPrint() {
  static unsigned long it=0;
  Serial << endl << it << F(":") << endl;
  for( int y=0; y<RIM_Y; y++) {
    for( int x=0; x<RIM_X; x++) {
      uint32_t c = rimJob.getPixelColor(getPixelN(x,y));
      boolean isC = isCycle(x,y);
      char p;

           if( isC && c==Red ) p = 'R';
      else if( isC && c==Grn ) p = 'G';
      else if( isC && c==Blu ) p = 'B';
      else if( isC && c==Yel ) p = 'Y';
      else if( isC ) p = '!'; // BAD: cycles have a color
      else if( c==Red ) p = 'r';
      else if( c==Grn ) p = 'g';
      else if( c==Blu ) p = 'b';
      else if( c==Yel ) p = 'y';
      else if( c==Dead ) p = ' ';
      else if( c==White ) p = '*';
      else p = '.'; // faded/cycle trail

      Serial << p;
    }
    Serial << endl;
  }

  it++;
}

// looks for active cycle at a pixel location
boolean isCycle(int x, int y) {
  for( int c=0; c<MAX_CYCLES; c++ ) {
    if( cycles[c].live && cycles[c].x==x && cycles[c].y==y )
      return( true );
  }
  return( false );
}

void addCycle(uint32_t x, uint32_t y, uint32_t color) {

  byte availableCycle=0;
  while( cycles[availableCycle].live ) {
    availableCycle++;
    if( availableCycle == MAX_CYCLES ) {
      Serial << F("addCycle error.  no available cycle slots.  Halting!") << endl;
      while(1);
    }
  }

  rimJob.setPixelColor(getPixelN(x,y), color);

  cycles[availableCycle].x = x;
  cycles[availableCycle].y = y;
  cycles[availableCycle].color = color;
  cycles[availableCycle].live = true;
}

void fadeCycles() {
  const int trailLength = RIM_SEG_LENGTH; // a light cycle leaves a trail as long as 1/4 of the rim circumference
  const int fadeAmount = 255 / trailLength;

  for( int p=0; p<rimJob.numPixels(); p++ ) {
    uint32_t c = rimJob.getPixelColor(p);

    // assuming GRB order.
    byte red = constrain( (int)((c << 16) >> 24) - fadeAmount, 0, 255);
    byte green = constrain( (int)((c << 8) >> 24) - fadeAmount, 0, 255);
    byte blue = constrain( (int)((c << 24) >> 24) - fadeAmount, 0, 255);

    rimJob.setPixelColor(p, red, green, blue);
  }
}

void moveCycles() {
  for( byte c=0; c<MAX_CYCLES; c++ ) {
    if( cycles[c].live ) {
      moveThisCycle(c);
     }
  }
}

void moveThisCycle(byte c) {
  int cw = (int)cycles[c].x+1;
  if( cw<0 ) cw = RIM_X-1;
  else if ( cw >= RIM_X) cw = 0;

  int ccw = (int)cycles[c].x-1;
  if( ccw<0 ) ccw = RIM_X-1;
  else if ( ccw >= RIM_X) ccw = 0;

  uint32_t moveX[4] = {
    cw, // CW. wrap.
    ccw, // CCW. wrap
    cycles[c].x, // DOWN
    cycles[c].x, // UP
  };
  uint32_t moveY[4] = {
    cycles[c].y, // CW
    cycles[c].y, // CCW
    constrain(((int)cycles[c].y+1), 0, RIM_Y-1), // DOWN.  no wrap.
    constrain(((int)cycles[c].y-1), 0, RIM_Y-1), // UP. no wrap.
  };

  // preference for moves
  byte movePref[4];
/*
  // prefer CW/CCW over UP/DOWN
  movePref[0]=random(0,2); // either CW or CCW.
  movePref[1]=movePref[0]==0 ? 1 : 0;
  movePref[2]=random(2,4); // either UP or DOWN.
  movePref[3]=movePref[2]==2 ? 3 : 2;
*/
  // equal preference
  movePref[0]=random(0,4); // any
  movePref[1]=(movePref[0]+1) % 4;
  movePref[2]=(movePref[1]+1) % 4;
  movePref[3]=(movePref[2]+1) % 4;

  // try some moves
  for( byte m=0; m<4; m++ ) {
    if( rimJob.getPixelColor(getPixelN(moveX[movePref[m]], moveY[movePref[m]])) == Dead ) {
      // good.
      cycles[c].x = moveX[movePref[m]];
      cycles[c].y = moveY[movePref[m]];

      rimJob.setPixelColor(getPixelN(cycles[c].x,cycles[c].y), cycles[c].color);

      return;
    }
  }
  // uh oh. smash!
  cycles[c].live = false;
  rimJob.setPixelColor(getPixelN(cycles[c].x,cycles[c].y), White);

/*
  Serial << "Oh dear! Cycle " << c << " died." << endl;
  Serial << "Moves available: " << endl;
  for( byte m=0; m<4; m++ ) {
    Serial << "X=" << moveX[movePref[m]] << " Y=" << moveY[movePref[m]] << endl;
  }
  Serial << "Result: ";
  */
}

// returns the i-th pixel mapped to x,y
uint32_t getPixelN(uint32_t x, uint32_t y) {
  if( x >= RIM_X || y >= RIM_Y ) {
    Serial << F("getPixelN error: out of range.  x=") << x << F(" y=") << y << endl << F("Halting.") << endl;
    while(1);
  }
  return( y*RIM_X + x ); // this could be right?
}

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


Christmas 2012.

Christmas 2012.

/* -*- mode: c; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*-

   G35: An Arduino library for GE Color Effects G-35 holiday lights.
   Copyright © 2012 The G35 Authors. Use, modification, and distribution are
   subject to the BSD license as described in the accompanying LICENSE file.

   TiconXmas2012.ino is the code that I used for Christmas 2012 at my home.
   It's yet another demonstration of working code.

   By Mike Tsao <github.com/sowbug>. See README for complete attributions.
*/

#include <G35String.h>
#include <G35StringGroup.h>
#include <ProgramRunner.h>
#include <StockPrograms.h>
#include <PlusPrograms.h>
#include <MEOPrograms.h>

// Arduino with Like A G35 shield (https://github.com/sowbug/like-a-g35).
// First string on pin 8. Second on 9. My roofline isn't quite long enough
// for 100 lights, so I have the final 9 hidden.
G35String lights_1(8, 50, 50, 0, false);
G35String lights_2(9, 41);

const int PROGRAM_COUNT = StockProgramGroup::ProgramCount +
  PlusProgramGroup::ProgramCount + MEOProgramGroup::ProgramCount;

StockProgramGroup stock_programs;
PlusProgramGroup plus_programs;
MEOProgramGroup meo_programs;
G35StringGroup string_group;

LightProgram* CreateProgram(uint8_t program_index) {
  program_index = random() % PROGRAM_COUNT;

  if (program_index < StockProgramGroup::ProgramCount) {
    return stock_programs.CreateProgram(string_group, program_index);
  }
  program_index -= StockProgramGroup::ProgramCount;

  if (program_index < PlusProgramGroup::ProgramCount) {
    return plus_programs.CreateProgram(string_group, program_index);
  }
  program_index -= PlusProgramGroup::ProgramCount;

  if (program_index < MEOProgramGroup::ProgramCount) {
    return meo_programs.CreateProgram(string_group, program_index);
  }
  program_index -= MEOProgramGroup::ProgramCount;

  return NULL;
}

// How long each program should run.
#define PROGRAM_DURATION_SECONDS (90)

ProgramRunner runner(CreateProgram, PROGRAM_COUNT, PROGRAM_DURATION_SECONDS);

// http://www.utopiamechanicus.com/77/better-arduino-random-numbers/
// We assume A0 and A1 are disconnected.
uint32_t seedOut(unsigned int noOfBits) {
  uint32_t seed = 0, limit = 99;
  int bit0 = 0, bit1 = 0;
  while (noOfBits--) {
    for (int i = 0; i < limit; ++i) {
      bit0 = analogRead(0) & 1;
      bit1 = analogRead(1) & 1;
      if (bit1 != bit0)
        break;
    }
    seed = (seed << 1) | bit1;
  }
  return seed;
}

void setup() {
  uint32_t seed = seedOut(32);
  randomSeed(seed);
  seed &= 0xff;
  // random() isn't very random. But this seed generator works quite well.
  while (seed--) {
    random();
  }

  delay(50);
  lights_1.enumerate();
  lights_2.enumerate();

  lights_1.do_test_patterns();
  lights_2.do_test_patterns();

  string_group.AddString(&lights_1);
  string_group.AddString(&lights_2);
}

void loop() {
  runner.loop();
}

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


halleffectsensor: initial commit

halleffectsensor: initial commit

/**
 * The MySensors Arduino library handles the wireless radio link and protocol
 * between your home built sensors/actuators and HA controller of choice.
 * The sensors forms a self healing radio network with optional repeaters. Each
 * repeater and gateway builds a routing tables in EEPROM which keeps track of the
 * network topology allowing messages to be routed to nodes.
 *
 * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
 * Copyright (C) 2013-2015 Sensnology AB
 * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
 *
 * Documentation: http://www.mysensors.org
 * Support Forum: http://forum.mysensors.org
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2 as published by the Free Software Foundation.
 *
 *******************************
 *
 * REVISION HISTORY
 * Version 0.1 - Based on humidity sensor by Henrik EKblad
 *
 * DESCRIPTION
 * This sketch implements hall effect sensor monitoring
 * based on http://www.mysensors.org/build/humidity
 */

// Enable debug prints
//#define MY_DEBUG

// Enable and select radio type attached
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69

#define MY_NODE_ID 6 //manual node id
//#define MY_DISABLED_SERIAL //disable serial

#include <SPI.h>
#include <MySensor.h>
#include <DHT.h>

#define CHILD_ID_HALL 0
int HALL_SENSOR_ANALOG_PIN = A5;
unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)

//int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
int SAMPLES=100; //how many samples to take for voltage reading
const long InternalReferenceVoltage = 1080L;  // Detected using the method described at http://arduino.cc/forum/index.php/topic,38119.0.html
//3 - 1080
//5 - 1095
//const int MIN_BATTERY = 700; //2 li Ion batteries, minimum is 7V
//const int MAX_BATTERY = 840; //2 li Ion batteries, max is 8.4V

//NiMH - note: discharge curve of NiMH is almost flat at 1.2V for most of the time - i.e. voltage measurement is not a very good indicator
//const int MIN_BATTERY = 660; //6 NiMH cell pack, minimum is 6.6V (in theory 0.9V per cell, i.e. 5.4V, but since 6 in series, be conservative)
//const int MAX_BATTERY = 840; //6 NiMH cell pack, max is 8.4V

//NiMH - note: discharge curve of NiMH is almost flat at 1.2V for most of the time - i.e. voltage measurement is not a very good indicator
const int MIN_BATTERY = 440; //4 NiMH cell pack, minimum is 6.6V (in theory 0.9V per cell, i.e. 5.4V, but since 6 in series, be conservative)
const int MAX_BATTERY = 560; //4 NiMH cell pack, max is 8.4V

//abusing temp for now
MyMessage msgHall(CHILD_ID_HALL, V_TEMP);

void setup()
{
  //Serial.begin(115200);
}

void presentation()
{
  // Send the Sketch Version Information to the Gateway
  sendSketchInfo("HallEffectBattery", "0.1");

  // Register all sensors to gw (they will be created as child devices)
  present(CHILD_ID_HALL, S_TEMP);
}

void loop()
{
  //get battery voltage - battery connected through even voltage divider of 2*10K
  //oversampling (seems overkill, but doing it anyway)
  long Vcc=0L;
  long hallSensorValue=0L;
  for (int i=0; i < SAMPLES; i++){
        Vcc += readVcc();
        hallSensorValue += analogRead(HALL_SENSOR_ANALOG_PIN);
        delay(10);
  }
  Vcc=Vcc/SAMPLES; //get average from SAMPLES readings; dont care about truncation
  Serial.println(Vcc);

  int batteryPcnt = constrain(map(Vcc,MIN_BATTERY, MAX_BATTERY, 0, 100),0,100); //convert from voltage to percentage; constrain to 0-100 range
  Serial.println(batteryPcnt);
  //always send batteryPcnt; use this as heartbeat
  sendBatteryLevel(batteryPcnt);

  hallSensorValue=hallSensorValue/SAMPLES;
  send(msgHall.set(hallSensorValue, 1));
  Serial.println(hallSensorValue);

  sleep(SLEEP_TIME); //power down, defined in MySensorCore.cpp - akin to lowpower.h power down routine
}

long readVcc() {
  // Read 1.1V reference against AVcc
  // set the reference to Vcc and the measurement to the internal 1.1V reference
  #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
    ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
  #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
    ADMUX = _BV(MUX5) | _BV(MUX0);
  #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
    ADMUX = _BV(MUX3) | _BV(MUX2);
  #else
    ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
  #endif

  delay(2); // Wait for Vref to settle
  ADCSRA |= _BV(ADSC); // Start conversion
  while (bit_is_set(ADCSRA,ADSC)); // measuring

  long result = (((InternalReferenceVoltage*1023L) / ADC)+5L)/10L;
  return result; // Vcc in millivolts
}

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


Test code for Testing Jig

Test code for Testing Jig

Initial commit for 64Kb test code only.

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/enablersg/usd-fram-shield.git/'


add analog output for piezo

add analog output for piezo

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


Add read an URL in the NTAG213

Add read an URL in the NTAG213

// Initial version: taken from https://github.com/miguelbalboa/rfid/blob/268682dc0b1aabc2d285c31f296659981540967f/examples/Ntag216_AUTH/Ntag216_AUTH.ino
// Thanks to GARGANTUA from RoboCreators.com & paradoxalabs.com for initial version

// This version has been written by Luca Ferroni IIS Merloni Miliani
// for the NAOCHALLENGE 2020

#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN    9   //
#define SS_PIN    10    //

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance

void setup() {
  Serial.begin(9600);   // Initialize serial communications with the PC
  while (!Serial);    // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
  SPI.begin();      // Init SPI bus
  mfrc522.PCD_Init();   // Init MFRC522
  Serial.println(F("Scan PICC to see UID, type, and data blocks..."));
}

void loop() {
  // Reset the loop if no new card present on the sensor/reader. This saves the entire process when idle.
  if ( ! mfrc522.PICC_IsNewCardPresent()) {
    return;
  }

  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) {
    return;
  }

  byte PSWBuff[] = {0xFF, 0xFF, 0xFF, 0xFF}; //32 bit PassWord default FFFFFFFF
  byte pACK[] = {0, 0}; //16 bit PassWord ACK returned by the NFCtag

  Serial.print("Auth: ");
  Serial.println(mfrc522.PCD_NTAG216_AUTH(&PSWBuff[0], pACK)); //Request Authentification if return STATUS_OK we are good

  //Print PassWordACK
  Serial.print(pACK[0], HEX);
  Serial.println(pACK[1], HEX);

  byte WBuff[] = {0x00, 0x00, 0x00, 0x04};
  byte RBuff[18];

  //mfrc522.PICC_DumpMifareUltralightToSerial(); //This is a modifier dunp just cghange the for cicle to < 232 instead of < 16 in order to see all the pages on NTAG216
  MFRC522::StatusCode status;
  byte byteCount;
  byte buffer[18];
  byte nfc_data[256];
  byte index = 0;
  byte i;
  // Try the mpages of the original Ultralight. Ultralight C has more pages.
  for (byte page = 0; page < 16; page +=4) { // Read returns data for 4 pages at a time.
    // Read pages
    byteCount = sizeof(buffer);
    status = mfrc522.MIFARE_Read(page, buffer, &byteCount);
    if (status != mfrc522.STATUS_OK) {
      Serial.print(F("MIFARE_Read() failed: "));
      Serial.println(mfrc522.GetStatusCodeName(status));
      break;
    }

    //Put results in a common array
    for (i=0; i<16; i++) {
        nfc_data[index] = buffer[i];
        index++;
    }
  }

  Serial.println("-- HO LETTO I DATI NEL TAG RFID NTAG213 --");
  //TODO: Print URL type, by interpretation of the first byte

  for (i=27; i<255; i++) {
    if (nfc_data[i] == 0xFE) // End of string
      break;

    // Serial.print(nfc_data[i]);
    // Serial.print(F(" ")); // Pad with spaces
    Serial.print((char)nfc_data[i]);
  }

  Serial.println();
  delay(3000);
}

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


Added a new ultrasonic sensor test class

/* HC-SR04 Sensor
   https://www.dealextreme.com/p/hc-sr04-ultrasonic-sensor-distance-measuring-module-133696

   This sketch reads a HC-SR04 ultrasonic rangefinder and returns the
   distance to the closest object in range. To do this, it sends a pulse
   to the sensor to initiate a reading, then listens for a pulse
   to return.  The length of the returning pulse is proportional to
   the distance of the object from the sensor.

   The circuit:
  * VCC connection of the sensor attached to +5V
  * GND connection of the sensor attached to ground
  * TRIG connection of the sensor attached to digital pin 2
  * ECHO connection of the sensor attached to digital pin 4
   Original code for Ping))) example was created by David A. Mellis
   Adapted for HC-SR04 by Tautvidas Sipavicius
   This example code is in the public domain.
 */

const int trigPin = 2;
const int echoPin = 4;

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
}

void loop()
{
  // establish variables for duration of the ping,
  // and the distance result in inches and centimeters:
  long duration, inches, cm;

  // The sensor is triggered by a HIGH pulse of 10 or more microseconds.
  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
  pinMode(trigPin, OUTPUT);
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  // Read the signal from the sensor: a HIGH pulse whose
  // duration is the time (in microseconds) from the sending
  // of the ping to the reception of its echo off of an object.
  pinMode(echoPin, INPUT);
  duration = pulseIn(echoPin, HIGH);

  // convert the time into a distance
  inches = microsecondsToInches(duration);
  cm = microsecondsToCentimeters(duration);

  Serial.print(inches);
  Serial.print("in, ");
  Serial.print(cm);
  Serial.print("cm");
  Serial.println();

  delay(100);
}

long microsecondsToInches(long microseconds)
{
  // According to Parallax's datasheet for the PING))), there are
  // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
  // second).  This gives the distance travelled by the ping, outbound
  // and return, so we divide by 2 to get the distance of the obstacle.
  // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
  return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds)
{
  // The speed of sound is 340 m/s or 29 microseconds per centimeter.
  // The ping travels out and back, so to find the distance of the
  // object we take half of the distance travelled.
  return microseconds / 29 / 2;
}

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


ok, and we need to check if all motors reached their target …

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


Delete WiFi.ino

Delete WiFi.ino

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


Adding a test file for the compass telemetry module.

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


Create .ino

Create .ino

//T1A11-Range-Finder-Name.ino

// EXAMPLE
//using Ultrasonic Range Finder from Robotshop
//http://www.robotshop.com/ca/en/hc-sr04-ultrasonic-range-finder.html

unsigned long duration;

void setup()
{

    pinMode(D7, OUTPUT);   // LED on D7
    pinMode(D1, OUTPUT);   // Other LED connected from D1 through resistor to ground

                           // ultrasonic range finder Robotshop RB-lte-54

                           // GND pin goes to ground
    pinMode(D6, INPUT);    // echo
    pinMode(D2, OUTPUT);   // Trig
                           // VCC pin goes to VIN on the photon

}

void loop(){

        delay(10);                      // even cicuits need a break
        digitalWrite(D2, HIGH);         // activate trigger
        delayMicroseconds(10);
        digitalWrite(D2, LOW);          // de-activate trigger

        duration = pulseIn(D6, HIGH);   // how long until a reply?
                                        // a blocking call so may wait a few seconds

        if (duration > 2000    ){        // raw data from 200 to 16000
                                        // where  2000 raw = ~35cm,  4000 raw = ~80cm
            digitalWrite(D7, HIGH);     // D7 Blue LED on if far
            digitalWrite(D1, LOW);      // Other LED off
        } else {
            digitalWrite(D7, LOW);      // D7 Blue LED off
            digitalWrite(D1, HIGH);     // Other LED on if Close

        }
   }

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


Add non-blocking example (#26)

Add non-blocking example (#26)

/*
 * Example for using non-blocking mode to move until condition
 *
 * Copyright (C)2015-2017 Laurentiu Badea
 *
 * This file may be redistributed under the terms of the MIT license.
 * A copy of this license has been included with this distribution in the file LICENSE.
 */
#include <Arduino.h>

// Motor steps per revolution. Most steppers are 200 steps or 1.8 degrees/step
#define MOTOR_STEPS 200
// Microstepping mode. If you hardwired it to save pins, set to the same value here.
#define MICROSTEPS 16

#define DIR 8
#define STEP 9
#define ENABLE 7 // optional (just delete ENABLE from everywhere if not used)

// Choose the section below matching your board

// #include "BasicStepperDriver.h"
// 2-wire basic config, microstepping is hardwired on the driver
// BasicStepperDriver stepper(DIR, STEP);

#include "DRV8834.h"
#define M0 10
#define M1 11
DRV8834 stepper(MOTOR_STEPS, DIR, STEP, ENABLE, M0, M1);

//#include "A4988.h"
// #define MS1 10
// #define MS2 11
// #define MS3 12
// A4988 stepper(MOTOR_STEPS, DIR, STEP, ENABLE, MS1, MS2, MS3);

// #include "DRV8825.h"
// #define MODE0 10
// #define MODE1 11
// #define MODE2 12
// DRV8825 stepper(MOTOR_STEPS, DIR, STEP, ENABLE, MODE0, MODE1, MODE2);

// this pin should connect to Ground when want to stop the motor
#define STOPPER_PIN 4

void setup() {
    Serial.begin(115200);

    // Configure stopper pin to read HIGH unless grounded
    pinMode(STOPPER_PIN, INPUT_PULLUP);

    stepper.begin(120, MICROSTEPS);
    stepper.enable();

    Serial.println("START");

    // set the motor to move continuously for a reasonable time to hit the stopper
    stepper.startMove(20000);     // 20000 full steps = 100 full rotations
    // stepper.startRotate(36000);   // 36000 degrees = 100 rotations
}

void loop() {
    // first, check if stopper was hit
    if (digitalRead(STOPPER_PIN) == LOW){
        Serial.println("STOPPER REACHED");
        /*
         * In constant speed mode, startBrake() is an immediate stop but in accelerated modes
         * the motor will go a little past the stopper while braking. For immediate stop
         * we can just stop calling nextAction()
         */
         stepper.startBrake();
    }

    // motor control loop - send pulse and return how long to wait until next pulse
    unsigned wait_time_micros = stepper.nextAction();

    // 0 wait time indicates the motor has stopped
    if (wait_time_micros <= 0) {
        stepper.disable();       // comment out to keep motor powered
        delay(3600000);
    }

    // (optional) execute other code if we have enough time
    if (wait_time_micros > 100){
        // other code here
    }
}

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


Module pince : anglex2

Module pince : anglex2

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