BLE_iBeacon

error: pathspec 'cpp_utils/tests/BLETests/Arduino/BLE_iBeacon/BLE_iBeacon.ino' did not match any file(s) known to git

--- cpp_utils/tests/BLETests/Arduino/BLE_iBeacon/BLE_iBeacon.ino
+++ cpp_utils/tests/BLETests/Arduino/BLE_iBeacon/BLE_iBeacon.ino
@@ -0,0 +1,104 @@
+/*
+   Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleScan.cpp
+   Ported to Arduino ESP32 by pcbreflux
+*/
+
+
+/*
+   Create a BLE server that will send periodic iBeacon frames.
+   The design of creating the BLE server is:
+   1. Create a BLE Server
+   2. Create advertising data
+   3. Start advertising.
+   4. wait
+   5. Stop advertising.
+   6. deep sleep
+
+*/
+#include "sys/time.h"
+
+#include "BLEDevice.h"
+#include "BLEServer.h"
+#include "BLEUtils.h"
+#include "BLEBeacon.h"
+#include "esp_sleep.h"
+
+#define GPIO_DEEP_SLEEP_DURATION     10  // sleep x seconds and then wake up
+RTC_DATA_ATTR static time_t last;        // remember last boot in RTC Memory
+RTC_DATA_ATTR static uint32_t bootcount; // remember number of boots in RTC Memory
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+uint8_t temprature_sens_read();
+//uint8_t g_phyFuns;
+
+#ifdef __cplusplus
+}
+#endif
+
+// See the following for generating UUIDs:
+// https://www.uuidgenerator.net/
+BLEAdvertising *pAdvertising;
+struct timeval now;
+
+#define BEACON_UUID           "8ec76ea3-6668-48da-9866-75be8bc86f4d" // UUID 1 128-Bit (may use linux tool uuidgen or random numbers via https://www.uuidgenerator.net/)
+
+void setBeacon() {
+
+  BLEBeacon oBeacon = BLEBeacon();
+  oBeacon.setManufacturerId(0x4C00); // fake Apple 0x004C LSB (ENDIAN_CHANGE_U16!)
+  oBeacon.setProximityUUID(BLEUUID(BEACON_UUID));
+  oBeacon.setMajor((bootcount & 0xFFFF0000) >> 16);
+  oBeacon.setMinor(bootcount&0xFFFF);
+  BLEAdvertisementData oAdvertisementData = BLEAdvertisementData();
+  BLEAdvertisementData oScanResponseData = BLEAdvertisementData();
+
+  oAdvertisementData.setFlags(0x04); // BR_EDR_NOT_SUPPORTED 0x04
+
+  std::string strServiceData = "";
+
+  strServiceData += (char)26;     // Len
+  strServiceData += (char)0xFF;   // Type
+  strServiceData += oBeacon.getData();
+  oAdvertisementData.addData(strServiceData);
+
+  pAdvertising->setAdvertisementData(oAdvertisementData);
+  pAdvertising->setScanResponseData(oScanResponseData);
+
+}
+
+void setup() {
+
+
+  Serial.begin(115200);
+  gettimeofday(&now, NULL);
+
+  Serial.printf("start ESP32 %d\n",bootcount++);
+
+  Serial.printf("deep sleep (%lds since last reset, %lds since last boot)\n",now.tv_sec,now.tv_sec-last);
+
+  last = now.tv_sec;
+
+  // Create the BLE Device
+  BLEDevice::init("");
+
+  // Create the BLE Server
+  BLEServer *pServer = BLEDevice::createServer();
+
+  pAdvertising = pServer->getAdvertising();
+
+  setBeacon();
+   // Start advertising
+  pAdvertising->start();
+  Serial.println("Advertizing started...");
+  delay(100);
+  pAdvertising->stop();
+  Serial.printf("enter deep sleep\n");
+  esp_deep_sleep(1000000LL * GPIO_DEEP_SLEEP_DURATION);
+  Serial.printf("in deep sleep\n");
+}
+
+void loop() {
+}


First changes to support different HTTP Protocols

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/tomwagner1999/SmartHome.git/'


Adding basic file system support

Adding basic file system support


Mia's working version - very messy, needs to be cleaned up

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


Configure on switch example. If there is no SSID in memory set up a configuration portal otherwise connect with existing SSID data. If a button is pushed go into configuration portal mode. Stay in configuration portal mode until user closes configuration portal or 3 minutes have passed.

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

--- examples/ConfigOnSwitch/ConfigOnSwitch.ino
+++ examples/ConfigOnSwitch/ConfigOnSwitch.ino
@@ -0,0 +1,112 @@
+#include <ESP8266WiFi.h>          //https://github.com/esp8266/Arduino
+
+//needed for library
+#include <ESP8266WebServer.h>
+#include <DNSServer.h>
+#include <WiFiManager.h>          //https://github.com/kentaylor/WiFiManager
+// select wich pin will trigger the configuraton portal when set to LOW
+// ESP-01 users please note: the only pins available (0 and 2), are shared
+// with the bootloader, so always set them HIGH at power-up
+// Onboard LED I/O pin on NodeMCU board
+const int PIN_LED = 16;      // Controls the onboard LED.
+/*Trigger for inititating config mode Pin D3 and also flash button on NodeMCU
+ * Flash button is convenient to use but if it is pressed it will stuff up the serial port device driver
+ * until the computer is rebooted on windows machines.
+ */
+const int TRIGGER_PIN = D3;
+/*
+ * Alternative trigger pin. Needs to be connected to a button to use this pin. It must be a momentary connection
+ * not connected permanently to ground. Either trigger pin will work.
+ */
+const int TRIGGER_PIN2 = D7;
+
+void setup() {
+  // put your setup code here, to run once:
+  // initialize the LED digital pin as an output.
+  pinMode(PIN_LED, OUTPUT);
+  Serial.begin(115200);
+  Serial.println("\n Starting");
+  WiFi.printDiag(Serial);
+  Serial.print("Stored Password: ");
+  Serial.println(WiFi.psk());
+  Serial.print("Stored PSSID: ");
+  Serial.println(WiFi.SSID());
+  if (WiFi.SSID()==""){
+    Serial.println("We never ever got access point credentials, so get them now");
+    digitalWrite(PIN_LED, LOW); // turn the LED on by making the voltage LOW to tell us we are in configuration mode.
+    //Local intialization. Once its business is done, there is no need to keep it around
+    WiFiManager wifiManager;
+    if (!wifiManager.startConfigPortal()) {
+      Serial.println("failed to connect and should not get here");
+      delay(3000);
+      //reset and try again, or maybe put it to deep sleep
+      ESP.reset();
+      delay(5000);
+    }
+  }
+  else{
+  digitalWrite(PIN_LED, HIGH); // Turn led off as we are not in configuration mode.
+  Serial.print("local ip: ");
+  Serial.println(WiFi.localIP());
+  unsigned long startedAt = millis();
+  while(millis() - startedAt < 10000)
+        {
+        delay(100);
+        if (WiFi.status()==WL_CONNECTED) {
+          float waited = (millis()- startedAt);
+          Serial.print("After waiting ");
+          Serial.print(waited/1000);
+          Serial.print(" secs in setup() local ip: ");
+          Serial.println(WiFi.localIP());
+          break;
+          }
+       }
+  }
+  pinMode(TRIGGER_PIN, INPUT_PULLUP);
+  pinMode(TRIGGER_PIN2, INPUT_PULLUP);
+  /*Serial.print("Pin ");
+  Serial.print(TRIGGER_PIN);
+  Serial.print(": ");
+  Serial.println(digitalRead(TRIGGER_PIN));*/
+  if (WiFi.status()!=WL_CONNECTED){
+    Serial.println("failed to connect, finnishing setup anyway");
+  }
+}
+
+
+void loop() {
+  // is configuration portal requested?
+  if ( (digitalRead(TRIGGER_PIN) == LOW) || (digitalRead(TRIGGER_PIN2) == LOW)) {
+     Serial.println("Configuration portal requested.");
+     digitalWrite(PIN_LED, LOW); // turn the LED on by making the voltage LOW to tell us we are in configuration mode.
+    //Local intialization. Once its business is done, there is no need to keep it around
+    WiFiManager wifiManager;
+
+    //reset settings - for testing
+    //wifiManager.resetSettings();
+
+    //sets timeout until configuration portal gets turned off
+    //useful to make it all retry or go to sleep
+    //in seconds
+    wifiManager.setConfigPortalTimeout(120);
+
+    //it starts an access point with the specified name
+    //here  "AutoConnectAP"
+    //and goes into a blocking loop awaiting configuration
+
+    //WITHOUT THIS THE AP DOES NOT SEEM TO WORK PROPERLY WITH SDK 1.5 , update to at least 1.5.1
+    //WiFi.mode(WIFI_STA);
+
+    if (!wifiManager.startConfigPortal()) {
+      Serial.println("Hit ConfigPortal timeout. Continue with existing credentials");
+    } else {
+      //if you get here you have connected to the WiFi
+      Serial.println("connected...yeey :)");
+    }
+    digitalWrite(PIN_LED, HIGH); // Turn led off as we are not in configuration mode.
+  }
+
+
+  // put your main code here, to run repeatedly:
+
+}


redBoard

redBoard

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


Included another example

Included another example

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/Phrosten/ArduinoSonar.git/'


Update Esp8266_standalone.ino

Update Esp8266_standalone.ino

--- examples/Transports/Esp8266_standalone/Esp8266_standalone.ino
+++ examples/Transports/Esp8266_standalone/Esp8266_standalone.ino
@@ -32,7 +32,7 @@
 void setup()
 {
   Serial.begin(9600);
-  Blynk.begin(auth, "ssid", "pass", WLAN_SEC_WPA2);
+  Blynk.begin(auth, "ssid", "pass");
 }

 void loop()


Acrescenta pasta para código do arduino e arquivo com código da primeira prova para servir de consulta.

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

--- arduino/prova.ino
+++ arduino/prova.ino
@@ -0,0 +1,146 @@
+// Carrega a biblioteca do sensor ultrassonico
+#include <Ultrasonic.h>
+
+// Carrega bibliotecas para a shield ethernet
+#include <SPI.h>
+#include <Ethernet.h>
+#include <PubSubClient.h>
+
+// Carrega biblioteca para economia de energia
+#include <Narcoleptic.h>
+
+// Define os pinos para o trigger e echo
+#define PINO_TRIGGER 4
+#define PINO_ECHO 5
+#define LED_VERMELHO 8
+#define LED_VERDE 9
+
+// Endereco MAC da shield ethernet
+byte mac[] = {
+  0x64, 0x1c, 0x67, 0x79, 0xc5, 0xb3
+};
+bool ocupado = true;
+IPAddress ip(10, 30, 2, 226);
+IPAddress server(10, 30, 2, 127);
+EthernetClient ethClient;
+PubSubClient client(ethClient);
+
+// Inicializa o sensor nos pinos definidos acima
+Ultrasonic ultrasonic(PINO_TRIGGER, PINO_ECHO);
+
+// Metodo para conexao com o broker
+void reconnect()
+{
+  while (!client.connected()) {
+    Serial.print("Attempting MQTT connection...");
+    if (client.connect("garagem", "m", "m"))
+    {
+      Serial.println("connected");
+    }
+    else
+    {
+      Serial.print("failed, rc=");
+      Serial.print(client.state());
+      Serial.println(" try again in 5 seconds");
+      delay(5000); // Wait 5 seconds before retrying
+    }
+  }
+}
+
+void setup()
+{
+  Serial.begin(9600);
+  pinMode(LED_VERMELHO,OUTPUT);
+  pinMode(LED_VERDE,OUTPUT);
+
+  Narcoleptic.disableTimer1();
+  Narcoleptic.disableTimer2();
+//  Narcoleptic.disableSerial();
+  Narcoleptic.disableADC();
+  Narcoleptic.disableWire();
+//  Narcoleptic.disableSPI();
+
+  // Inicializa conexao Ethernet
+  if (Ethernet.begin(mac) == 0)
+  {
+    Serial.println("Failed to configure Ethernet using DHCP");
+    for (;;);
+  }
+
+  // print your local IP address:
+  printIPAddress();
+
+  client.setServer(server, 8883);
+}
+
+void loop()
+{
+  if (!client.connected())
+  {
+    reconnect();
+  }
+  client.loop();
+
+  // Le as informacoes do sensor, em cm e pol
+  float cmMsec;
+  long microsec = ultrasonic.timing();
+  cmMsec = ultrasonic.convert(microsec, Ultrasonic::CM);
+
+  if(cmMsec > 10)
+  {
+    if(ocupado) controlarLeds(LOW, HIGH);
+  }
+  else
+  {
+    if(!ocupado) controlarLeds(HIGH, LOW);
+  }
+
+//  delay(1000);
+
+  Narcoleptic.delay(500); // During this time power consumption is minimised
+}
+
+void controlarLeds(int vermelho, int verde)
+{
+  ocupado = !ocupado;
+  digitalWrite(LED_VERDE,verde);
+  digitalWrite(LED_VERMELHO,vermelho);
+  client.publish("casa/garagem/situacao", ocupado ? "1" : "0");
+}
+
+void printIPAddress()
+{
+  Serial.print("My IP address: ");
+  for (byte thisByte = 0; thisByte < 4; thisByte++)
+  {
+    Serial.print(Ethernet.localIP()[thisByte], DEC);
+    Serial.print(".");
+  }
+  Serial.println();
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


new way to handle movement instructions and some debugging

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

--- v2/06oct/06oct.ino
+++ v2/06oct/06oct.ino
@@ -0,0 +1,414 @@
+/*
+SharpDistSensorBasic.ino
+Source: https://github.com/DrGFreeman/SharpDistSensor
+MIT License
+Copyright (c) 2017 Julien de la Bruere-Terreault <drgfreeman@tuta.io>
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+/*
+This example shows how to use the SharpDistSensor library to continuously
+read the sensor and display the analog value and the corrseponding distance
+in mm.
+The library default values corresponding to the Sharp GP2Y0A60SZLF 5V sensor
+are used.
+See the library README for how to use pre-defined sensor models or custom
+fit functions.
+*/
+
+#include <SharpDistSensor.h>
+
+// Analog pin to which the sensor is connected
+const byte sensorPin = A0; //right IR sensor
+const byte sensorPin2 = A1; //left IR sensor
+const byte backleft = A6; //back-left line sensor
+const byte backright = A7; //back-right line sensor
+const byte frontright = A2; //front-left line sensor
+const byte frontleft = A3; //front-right line sensor
+const byte sensorPin4 = A4; //A4: left peripheral sensor
+const byte sensorPin3 = A5;//A5: right peripheral sensor
+
+// Window size of the median filter (odd number, 1 = no filtering)
+const byte mediumFilterWindowSize = 5;
+int rightDist; //distance from right sensor
+int leftDist; //distance from left sensor
+int perRightDist; //distance from peripheral right sensor
+int perLeftDist; //distance from peripheral left sensor
+
+// Create an object instance of the SharpDistSensor class
+SharpDistSensor sensor(sensorPin, mediumFilterWindowSize); //right sensor
+SharpDistSensor sensor2(sensorPin2, mediumFilterWindowSize); //left sensor
+SharpDistSensor sideright(sensorPin3, mediumFilterWindowSize); //right peripheral sensor
+SharpDistSensor sideleft(sensorPin4, mediumFilterWindowSize); //left peripheral sensor
+int STBY = 10; //standby
+
+//Right Motor (? I'm not too sure about this)
+int PWMA = 3; //Speed control
+int AIN1 = 9; //Direction
+int AIN2 = 8; //Direction
+
+//Left Motor (? also not too sure about this)
+int PWMB = 5; //Speed control
+int BIN1 = 11; //Direction
+int BIN2 = 12; //Direction
+
+char past; //what direction the robot was moving previously
+int count; //counter for how long before the rebot gives up searching in one direction
+int threshold; //threshold for line sensors
+int prevIR;
+int cur;
+int prevFlag;
+int prevLine;
+short iter;
+int state;
+int rangeThresh;
+boolean start;
+int lineFlag;
+boolean pivotFlag;
+
+int near = 200;
+int far = 500;
+int degreesMin = 20;
+int degrees90 = 50;
+int degrees180 = 100;
+int dist = 150;
+int maxS = 128;
+int minS = 20;
+int startSpinR = 1000;
+int startTurnL = 2000;
+int startSpinL = 1000;
+int pivotBack = 500;
+int pivotSpinR = 1000;
+int pivotTurnL = 1000;
+int pivotSpinL = 1000;
+
+void setup() {
+  Serial.begin(9600);
+  pinMode(STBY, OUTPUT);
+
+  pinMode(PWMA, OUTPUT);
+  pinMode(AIN1, OUTPUT);
+  pinMode(AIN2, OUTPUT);
+
+  pinMode(PWMB, OUTPUT);
+  pinMode(BIN1, OUTPUT);
+  pinMode(BIN2, OUTPUT);
+
+  //initialising values
+  past = 'f'; //set default move to forward
+  start = true; //set startup flag
+  count = 0;
+  iter = 0;
+  threshold = analogRead(backleft) - 200;
+  rightDist = sensor.getDist();
+  leftDist = sensor2.getDist();
+  perRightDist = sideright.getDist();
+  perLeftDist = sideleft.getDist();
+  prevLine = millis();
+  prevIR = prevLine;
+  lineFlag = 0;
+  pivotFlag = true;
+  prevFlag = prevLine;
+  state = 11;
+}
+
+void loop() {
+  cur = millis();
+  movement(state);
+
+  //print out values from sensors and motors to the console
+  Serial.print(past);
+  Serial.print(", ");
+  Serial.print(rightDist);
+  Serial.print(", ");
+  Serial.print(leftDist);
+  Serial.print(", ");
+  Serial.print(perRightDist);
+  Serial.print(", ");
+  Serial.print(perLeftDist);
+  Serial.print(", ");
+  Serial.print(analogRead(backleft));
+  Serial.print(", ");
+  Serial.print(analogRead(backright));
+  Serial.print(", ");
+  Serial.print(analogRead(frontleft));
+  Serial.print(", ");
+  Serial.println(analogRead(frontright));
+  Serial.print(", ");
+  Serial.println(cur - prevLine);
+
+  if ((cur - prevLine) >= 5) {
+    prevLine = cur;
+    if (analogRead(backleft) < threshold || analogRead(backright) < threshold && lineFlag != 1) { //first read from line sensors before doing anything else
+      //if line detected by back line sensors, turn left a bit
+      state = 0;
+      lineFlag = 1;
+      prevFlag = cur;
+      pivotFlag = false;
+    } else if (analogRead(frontleft) < threshold && past == 'l' && lineFlag != 2) {
+      state = 6;
+      lineFlag = 2;
+      prevFlag = cur;
+      pivotFlag = false;
+    } else if (analogRead(frontleft) < threshold && past == 'r' || analogRead(frontleft) < threshold && past == 'f' && lineFlag != 3) {
+      state = 7;
+      lineFlag = 3;
+      prevFlag = cur;
+      pivotFlag = false;
+    } else if (analogRead(frontright) < threshold && past == 'l' && lineFlag != 4) {
+      state = 8;
+      lineFlag = 4;
+      prevFlag = cur;
+      pivotFlag = false;
+    } else if (analogRead(frontright) < threshold && past == 'r' || analogRead(frontright) < threshold && past == 'f' && lineFlag != 5) {
+      state = 9;
+      lineFlag = 5;
+      prevFlag = cur;
+      pivotFlag = false;
+    } else if (analogRead(frontright) < threshold && analogRead(frontleft) < threshold && lineFlag != 6) {
+      state = 10;
+      lineFlag = 6;
+      prevFlag = cur;
+      pivotFlag = false;
+    } else if ((cur - prevIR) >= 25) {
+      prevIR = cur;
+      // Get distance from sensors
+      rightDist = sensor.getDist();
+      leftDist = sensor2.getDist();
+      perRightDist = sideright.getDist();
+      perLeftDist = sideleft.getDist();
+
+      //attack code with sensors
+
+      if (!pivotFlag) {
+        //other attack cases
+
+        if (perLeftDist <= near) {
+          //if there is an object within nearmm of the left peripheral sensor, move left
+          //turn left in place
+          state = 4;
+          past = 'l'; //set past movement to left
+          count = 0; //reset abandon search count because the robot has found an object
+        } else if (perRightDist <= near) {
+          //if there is an object within nearmm of the right peripheral sensor, move right
+          //turn right in place
+          state = 5;
+          past = 'r'; //set past movement to left
+          count = 0; //reset abandon search count because the robot has found an object
+        } else if (perRightDist <= near && perLeftDist <= near) {
+          //if there is an object within nearmm of both peripheral sensors, move forward
+          state = 0;
+          past = 'f'; //set past movement to left
+          count = 0; //reset abandon search count because the robot has found an object
+        } else if (lineFlag == 0) {
+          if ((abs(rightDist - leftDist) <= 150)
+                || ((past == 'f' || count >= 100) && (rightDist > far && leftDist > far && perRightDist > far && perLeftDist > far))) {
+            //if (robot moved forward in the past OR it's been searching for 100 iterations) AND (there isn't an object within far of any IR sensor))
+            //OR there is an object within near of both sensors
+            //OR the difference between the two distances measured by the IR sensors is within 150mm of each other
+            //move forward
+            state = 0;
+            past = 'f'; //set past movement to forward
+            count = 0; //reset abandon search count
+          } else if ((leftDist <= far || perLeftDist <= far) || leftDist - rightDist < -dist) {
+            //if there is an object beyond farmm of the right sensors (i.e. there is something closer in the left sensors), move left
+            state = 2;
+            past = 'l'; //set past movement to left
+            count = 0; //reset abandon search count because the robot has found an object
+          } else if ((rightDist <= far || perRightDist <= far) || leftDist - rightDist > dist) {
+            //if there is an object beyond farmm of the left sensors (i.e. there is something closer in the right sensors), move right
+            state = 3;
+            past = 'r'; //set past movement to right
+            count = 0; //reset abandon search count because the robot has found an object
+          } else if (past == 'l') {
+            //if robot has been moving left in the past, move left more
+            state = 2;
+            past = 'l'; //set past movement to left
+            count++; //increment abandon search count
+          } else if (past == 'r') {
+            //if robot has been moving right in the past, move right
+            state = 3;
+            past = 'r'; //set past movement to right
+            count++; //increment abandon search count
+          }
+        }
+
+
+//        } else if (past == 'l' && (rightDist > far && leftDist > far && perRightDist > far && perLeftDist > far)) {
+//          //if robot has been moving left in the past, move left more
+//          left();
+//          past = 'l'; //set past movement to left
+//          count++; //increment abandon search count
+//        } else if (past == 'r' && (rightDist > far && leftDist > far && perRightDist > far && perLeftDist > far)) {
+//          //if robot has been moving right in the past, move right
+//          right();
+//          past = 'r'; //set past movement to right
+//          count++; //increment abandon search count
+//        }
+      }
+    }
+  }
+}
+
+void move(int motor, int speed, int direction){
+  //Move specific motor at speed and direction
+  //motor: 1 for right, 2 for left
+  //speed: 0 is off, and 255 is full speed
+  //direction: 0 clockwise, 1 counter-clockwise
+
+  digitalWrite(STBY, HIGH); //disable standby
+
+  boolean inPin1 = LOW;
+  boolean inPin2 = HIGH;
+
+  if(direction == 1){
+    inPin1 = HIGH;
+    inPin2 = LOW;
+  }
+
+  if(motor == 1){
+    digitalWrite(AIN1, inPin1);
+    digitalWrite(AIN2, inPin2);
+    analogWrite(PWMA, speed);
+  } else {
+    digitalWrite(BIN1, inPin1);
+    digitalWrite(BIN2, inPin2);
+    analogWrite(PWMB, speed);
+  }
+}
+
+void stop(){
+  //enable standby
+  digitalWrite(STBY, LOW);
+}
+
+void movement(int state) {
+  switch (state) {
+    case 0: //forward
+      move(1, maxS, 1); //right, full speed, counter clockwise
+      move(2, maxS, 0); //left, full speed, clockwise
+      break;
+    case 1: //attack
+      move(1, 255, 1); //right, full speed, counter clockwise
+      move(2, 255, 0); //left, full speed, clockwise
+      break;
+    case 2: //left
+      move(1, minS, 1); //right, min speed, counter clockwise
+      move(2, maxS, 0); //left, full speed, clockwise
+      break;
+    case 3: //right
+      move(1, maxS, 1); //right, full speed, counter clockwise
+      move(2, minS, 0); //left, full speed, clockwise
+      break;
+    case 4: //left in place
+      move(1, maxS, 0); //right, full speed, clockwise
+      move(2, maxS, 0); //left, full speed, clockwise
+      break;
+    case 5: //right in place
+      move(1, maxS, 1); //right, full speed, counter clockwise
+      move(2, maxS, 1); //left, full speed, counter clockwise
+      break;
+    case 6: //back right and left
+      if (cur - prevFlag < degreesMin) {
+        move(1, maxS, 0); //right, full speed, counter clockwise
+        move(2, minS, 1); //left, full speed, clockwise
+      } else if (cur - prevFlag < degrees90) {
+        move(1, maxS, 0); //right, full speed, clockwise
+        move(2, maxS, 0); //left, full speed, clockwise
+      } else {
+        lineFlag = 0;
+      }
+      break;
+    case 7: //back right and right
+      if (cur - prevFlag < degreesMin) {
+        move(1, maxS, 0); //right, full speed, counter clockwise
+        move(2, minS, 1); //left, full speed, clockwise
+      } else if (cur - prevFlag < degrees90) {
+        move(1, maxS, 1); //right, full speed, counter clockwise
+        move(2, maxS, 1); //left, full speed, counter clockwise
+      } else {
+        lineFlag = 0;
+      }
+      break;
+    case 8: //back left and right
+      if (cur - prevFlag < degreesMin) {
+        move(1, minS, 0); //right, min speed, counter clockwise
+        move(2, maxS, 1); //left, full speed, clockwise
+      } else if (cur - prevFlag < degrees90) {
+        move(1, maxS, 1); //right, full speed, counter clockwise
+        move(2, maxS, 1); //left, full speed, counter clockwise
+      } else {
+        lineFlag = 0;
+      }
+      break;
+    case 9: //back left and left
+      if (cur - prevFlag < degreesMin) {
+        move(1, minS, 0); //right, min speed, counter clockwise
+        move(2, maxS, 1); //left, full speed, clockwise
+      } else if (cur - prevFlag < degrees90) {
+        move(1, maxS, 0); //right, full speed, clockwise
+        move(2, maxS, 0); //left, full speed, clockwise
+      } else {
+        lineFlag = 0;
+      }
+      break;
+    case 10: //back and spin 180
+      if (cur - prevFlag < degreesMin) {
+        move(1, maxS, 0); //right, full speed, clockwise
+        move(2, maxS, 0); //left, full speed, clockwise
+      } else if (cur - prevFlag < degrees180) {
+        move(1, maxS, 0); //right, full speed, clockwise
+        move(2, maxS, 0); //left, full speed, clockwise
+      } else {
+        lineFlag = 0;
+      }
+      break;
+    case 11: //startup movement: spin right, turn left, spin left
+      if (cur - prevFlag < startSpinR) {
+        move(1, maxS, 1); //right, full speed, counter clockwise
+        move(2, maxS, 1); //left, full speed, counter clockwise
+      } else if (cur - prevFlag < startTurnL) {
+        move(1, minS, 1); //right, min speed, counter clockwise
+        move(2, maxS, 0); //left, full speed, clockwise
+      } else if (cur - prevFlag < startSpinL) {
+        move(1, maxS, 0); //right, full speed, clockwise
+        move(2, maxS, 0); //left, full speed, clockwise
+      } else {
+        past = 'f';
+        pivotFlag = false;
+      }
+      break;
+    case 12: //pivot:
+      if (cur - prevFlag < pivotBack) {
+        move(1, maxS, 0); //right, full speed, clockwise
+        move(2, maxS, 0); //left, full speed, clockwise
+      } else if (cur - prevFlag < pivotSpinR) {
+        move(1, maxS, 1); //right, full speed, counter clockwise
+        move(2, maxS, 1); //left, full speed, counter clockwise
+      } else if (cur - prevFlag < pivotTurnL) {
+        move(1, minS, 1); //right, min speed, counter clockwise
+        move(2, maxS, 0); //left, full speed, clockwise
+      } else if (cur - prevFlag < pivotSpinL) {
+        move(1, maxS, 0); //right, full speed, clockwise
+        move(2, maxS, 0); //left, full speed, clockwise
+      } else {
+        past = 'f';
+        pivotFlag = false;
+      }
+      break;
+  }
+}


Clock example is added

Clock example is added

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

--- examples/direct_draw/clock/clock.ino
+++ examples/direct_draw/clock/clock.ino
@@ -0,0 +1,105 @@
+/*
+    MIT License
+
+    Copyright (c) 2018, Alexey Dynda
+
+    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.
+*/
+/**
+ *   Attiny85 PINS
+ *             ____
+ *   RESET   -|_|  |- 3V
+ *   SCL (3) -|    |- (2)
+ *   SDA (4) -|    |- (1)
+ *   GND     -|____|- (0)
+ *
+ *   Atmega328 PINS: connect LCD to A4/A5
+ */
+
+#include "ssd1306.h"
+
+uint32_t lastMillis;
+uint8_t  hours = 10;
+uint8_t  minutes = 35;
+uint8_t  seconds = 0;
+
+void printSeconds()
+{
+    if (seconds & 1)
+    {
+        ssd1306_printFixed(54,  8, ":", STYLE_NORMAL);
+    }
+    else
+    {
+        ssd1306_printFixed(54,  8, " ", STYLE_NORMAL);
+    }
+}
+
+void printMinutes()
+{
+    char minutesStr[3] = "00";
+    minutesStr[0] = '0' + minutes / 10;
+    minutesStr[1] = '0' + minutes % 10;
+    ssd1306_printFixed(78,  8, minutesStr, STYLE_NORMAL);
+}
+
+void printHours()
+{
+    char hoursStr[3] = "00";
+    hoursStr[0] = '0' + hours / 10;
+    hoursStr[1] = '0' + hours % 10;
+    ssd1306_printFixed(6,  8, hoursStr, STYLE_NORMAL);
+}
+
+void setup() {
+    /* Replace the line below with ssd1306_128x32_i2c_init() if you need to use 128x32 display */
+    ssd1306_128x64_i2c_init();
+    ssd1306_fillScreen(0x00);
+    ssd1306_setFixedFont(comic_sans_font24x32_123);
+    lastMillis = millis();
+    printHours();
+    printMinutes();
+}
+
+void loop()
+{
+    if ((uint32_t)(millis() - lastMillis) >= 1000)
+    {
+        lastMillis += 1000;
+        if (++seconds > 59)
+        {
+            seconds = 0;
+            if (++minutes > 59)
+            {
+                minutes = 0;
+                if (++hours > 23)
+                {
+                    hours = 0;
+                }
+                printHours();
+            }
+            printMinutes();
+        }
+        printSeconds();
+    }
+}
+
+
+
+


Programmering opgave 2 lektion 3 opryddet

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


adding relay sample sketch

adding relay sample sketch

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

--- switch_ino/switch_ino.ino
+++ switch_ino/switch_ino.ino
@@ -0,0 +1,103 @@
+char inchar; //Will hold the incoming character from the Serial Port.
+
+
+ int led1 = 8;
+ int led2 = 9;
+ int relay1=7;
+ int relay2=6;
+ void setup()
+ {
+ // prepare the digital output pins
+ pinMode(led1, OUTPUT);
+ pinMode(led2, OUTPUT);
+ digitalWrite(led1, LOW);
+ digitalWrite(led2, LOW);
+ Serial.begin(9600);
+ pinMode(relay1, OUTPUT);
+ pinMode(relay2, OUTPUT);
+ digitalWrite(7,HIGH);
+ digitalWrite(6,HIGH);
+ Serial.print("pin state low\n");
+ delay(3000); // give time for GSM module to register on network.
+ Serial.println("AT+CMGF=1"); // set SMS mode to text
+ delay(200);
+ Serial.println("AT+CNMI=2,2,0,0,0"); // set module to send SMS data to serial out upon receipt
+ delay(200);
+ }
+ void loop()
+ {
+
+ if(Serial.available() >0)
+ {
+ inchar=Serial.read();
+       if (inchar=='#')
+        {
+            delay(10);
+            inchar=Serial.read();
+            //first led
+            if (inchar=='a')//closed
+             {
+               delay(10);
+               inchar=Serial.read();
+               if (inchar=='0')//closed
+                   {
+                    digitalWrite(led1, LOW);
+                    delay(1000);
+                    digitalWrite(relay1,HIGH);
+                    Serial.print("Relay 1 LOW\n");
+                    delay(500);
+                    Serial.println("AT+CMGF=1");
+                    delay(500);
+                    Serial.println("AT+CMGS=\"9894273273\"");//Change the receiver phone number
+                    delay(500);
+                    Serial.print("Power OFF");    //the message you want to send
+                    delay(500);
+                    Serial.write(26);
+                    delay(500);
+                    }
+                       else if (inchar=='1')
+                          {
+                          digitalWrite(led1, HIGH);
+                          delay(1000);
+                          digitalWrite(relay1, LOW);
+                          Serial.print("Relay 1 HIGH\n");
+                          delay(500);
+                          Serial.println("AT+CMGF=1");
+                          delay(500);
+                          Serial.println("AT+CMGS=\"9894273273\"");//Change the receiver phone number
+                          delay(500);
+                          Serial.print("Power ON");    //the message you want to send
+                          delay(500);
+                          Serial.write(26);
+                          delay(500);
+                          }
+
+        delay(10);
+        inchar=Serial.read();
+        if(inchar=='b')
+        {
+        delay(10);
+        inchar=Serial.read();
+          if (inchar=='0')
+            {
+             digitalWrite(led2, LOW);
+             delay(500);
+             digitalWrite(relay2,HIGH);
+             Serial.print("Relay 2 LOW\n");
+             }
+               else if (inchar=='1')
+                 {
+                    digitalWrite(led2, HIGH);
+                    delay(500);
+                    digitalWrite(relay2, LOW);
+                    Serial.print("Relay 2 HIGH\n");
+                  }
+                }
+             }
+              Serial.println("AT+CMGD=1,4");
+        }
+
+    }
+}
+
+


Create env_sensosrs.ino

Create env_sensosrs.ino

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

--- env_sensosrs.ino
+++ env_sensosrs.ino
@@ -0,0 +1,151 @@
+#include "DHT.h"
+#include <SPI.h>
+#include <Ethernet.h>
+byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
+char server[] = "bubblestack.io";    // name address for Google (using DNS)
+IPAddress ip(2, 2, 2, 226);
+EthernetClient client;
+
+long previousMillis = 0;
+unsigned long currentMillis = 0;
+unsigned long lastConnectionTime = 0;             // last time you connected to the server, in milliseconds
+const unsigned long postingInterval = 10L * 1000L; // delay between updates, in milliseconds
+long interval = 150000; // READING INTERVAL
+
+float cistern_temp;
+
+
+#define DHT1PIN 2     // what pin we're connected to
+#define DHT2PIN 3
+#define DHT1TYPE DHT11   // DHT 11
+#define DHT2TYPE DHT11
+
+DHT dht1(DHT1PIN, DHT1TYPE);
+DHT dht2(DHT2PIN, DHT2TYPE);
+
+String data;
+
+void setup() {
+  Serial.begin(9600);
+  pinMode(4, OUTPUT);
+  dht1.begin();
+  dht2.begin();
+  delay(4000);
+  float h1 = dht1.readHumidity();
+  float t1 = dht1.readTemperature();
+  float h2 = dht2.readHumidity();
+  float t2 = dht2.readTemperature();
+
+
+    // start the Ethernet connection:
+  if (Ethernet.begin(mac) == 0) {
+    Serial.println("Failed to configure Ethernet using DHCP");
+    Ethernet.begin(mac, ip);
+  }
+}
+
+
+
+void loop() {
+
+   cistern_temp = read_temp();
+ Serial.println(cistern_temp);
+
+  float h1 = dht1.readHumidity();
+  float t1 = dht1.readTemperature();
+  float h2 = dht2.readHumidity();
+  float t2 = dht2.readTemperature();
+delay(1000);
+
+
+  if (isnan(t1) || isnan(h1)) {
+    Serial.println("Failed to read from DHT #1");
+  } else {
+    Serial.print("Humidity 1: ");
+    Serial.print(h1);
+    Serial.print(" %\t");
+    Serial.print("Temperature 1: ");
+    Serial.print(t1);
+    Serial.println(" *C");
+  }
+  if (isnan(t2) || isnan(h2)) {
+    Serial.println("Failed to read from DHT #2");
+  } else {
+    Serial.print("Humidity 2: ");
+    Serial.print(h2);
+    Serial.print(" %\t");
+    Serial.print("Temperature 2: ");
+    Serial.print(t2);
+    Serial.println(" *C");
+  }
+  Serial.println();
+
+  data = "&temp1=" + String(t1)+  "&hum1="+ String(h1)+ "&temp2=" +String(t2)+ "&hum2=" +String(h2)+ "&cistern_tmp=" +String(cistern_temp);
+
+    if (client.available()) {
+    char c = client.read();
+    Serial.write(c);
+  }
+
+  // if ten seconds have passed since your last connection,
+  // then connect again and send data:
+  if (millis() - lastConnectionTime > postingInterval) {
+    httpRequest();
+  }
+
+}
+
+// this method makes a HTTP connection to the server:
+void httpRequest() {
+  // close any connection before send a new request.
+  // This will free the socket on the WiFi shield
+  client.stop();
+
+  // if there's a successful connection:
+  if (client.connect(server, 80)) {
+    Serial.println("connecting...");
+    // send the HTTP PUT request:
+    client.println("POST /greenhouse/env.php HTTP/1.1");
+    client.println("Host: bubblestack.io");
+    client.println("User-Agent: arduino-ethernet");
+    client.println("Content-Type: application/x-www-form-urlencoded");
+    client.print("Content-Length: ");
+    client.println(data.length());
+    client.println();
+    client.print(data);
+    client.println();
+
+
+
+    // note the time that the connection was made:
+    lastConnectionTime = millis();
+  }
+  else {
+    // if you couldn't make a connection:
+    Serial.println("connection failed");
+  }
+ if (client.connected()) {
+
+client.stop();// DISCONNECT FROM THE SERVER
+
+}
+
+}
+
+
+
+float read_temp(void){
+ float v_out;
+ float cistern_temp;
+ digitalWrite(A0, LOW);
+ digitalWrite(4, HIGH);
+ delay(2);
+ v_out = analogRead(0);
+ digitalWrite(4, LOW);
+ v_out*=.0048;
+ v_out*=1000;
+ cistern_temp= 0.0512 * v_out -20.5128;
+return cistern_temp;
+}
+
+


光センサー追加(arduino)

光センサー追加(arduino)

光センサーの値をjson形式で3000ループ毎に送信

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

--- util/doorLight.ino
+++ util/doorLight.ino
@@ -0,0 +1,60 @@
+void setup(){
+    Serial.begin(9600);
+    //pinMode(13, OUTPUT);
+    pinMode(2, INPUT_PULLUP);
+    //digitalWrite(13, 1);
+}
+
+int lastSwitchVal = 0;
+//int lastButtonVal = 0;
+
+int doorCount = 0;
+//int judge = 1;//on:1,off:0
+
+int lightCount = 0;
+int lightVal = 0;
+
+void loop() {
+    int switchVal;//doorSensor
+    /*int buttonVal;
+
+    buttonVal = digitalRead(4);
+    if(buttonVal == 1 && buttonVal != lastButtonVal){
+        if(doorCount%2 == 0){
+            judge = 1;
+            digitalWrite(13, 1);
+        }else{
+            judge = 0;
+            digitalWrite(13, 0);
+        }
+        doorCount++;
+    }
+    lastButtonVal = buttonVal;*/
+
+    switchVal = digitalRead(2);
+    //if(judge == 1){
+    if (switchVal != lastSwitchVal){
+        if (switchVal == 0){//ドアが閉まった
+            Serial.print("0\n");
+        }
+        else {//ドアが開いた
+            Serial.print("1\n");
+        }
+    }
+    //}
+    lastSwitchVal = switchVal;
+
+    //lightSensor
+    lightCount++;
+    if(lightCount > 3000){
+        lightVal = analogRead(0)/4;
+        Serial.print("{lightSensor: ");
+        Serial.print(lightVal);//センサの値
+        Serial.print("}\n");
+
+        lightCount = 0;
+    }
+
+    Serial.flush();
+    delay(100);
+}


- initial HID keyboard example

- initial HID keyboard example

ported from Nordic example
(https://github.com/NordicSemiconductor/ble-sdk-arduino/tree/master/libr
aries/BLE/examples/ble_HID_keyboard_template)

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

--- examples/HID_keyboard/HID_keyboard.ino
+++ examples/HID_keyboard/HID_keyboard.ino
@@ -0,0 +1,188 @@
+// Import libraries (BLEPeripheral depends on SPI)
+#include <SPI.h>
+#include <BLEPeripheral.h>
+
+// define pins (varies per shield/board)
+#define BLE_REQ   6
+#define BLE_RDY   7
+#define BLE_RST   4
+
+// create peripheral instance, see pinouts above
+BLEPeripheral blePeripheral = BLEPeripheral(BLE_REQ, BLE_RDY, BLE_RST);
+BLEBondStore bleBondStore;
+
+const unsigned char hidReportReferenceDescriptorValue1[] = { 0x00, 0x01 };
+const unsigned char hidInformationCharacteriticValue[]   = { 0x11, 0x01, 0x00, 0x03 };
+
+// https://github.com/NordicSemiconductor/ble-sdk-arduino/blob/master/libraries/BLE/examples/ble_HID_keyboard_template/USD%20HID%20Report%20Descriptor%20-%20Keyboard.txt
+const unsigned char hidReportDescriptorValue[] = {
+  0x05, 0x01,                         // Usage Page (Generic Desktop)
+  0x09, 0x06,                         // Usage (Keyboard)
+  0xA1, 0x01,                         // Collection (Application)
+  0x05, 0x07,                         //     Usage Page (Key Codes)
+  0x19, 0xe0,                         //     Usage Minimum (224)
+  0x29, 0xe7,                         //     Usage Maximum (231)
+  0x15, 0x00,                         //     Logical Minimum (0)
+  0x25, 0x01,                         //     Logical Maximum (1)
+  0x75, 0x01,                         //     Report Size (1)
+  0x95, 0x08,                         //     Report Count (8)
+  0x81, 0x02,                         //     Input (Data, Variable, Absolute)
+
+  0x95, 0x01,                         //     Report Count (1)
+  0x75, 0x08,                         //     Report Size (8)
+  0x81, 0x01,                         //     Input (Constant) reserved byte(1)
+
+  0x95, 0x05,                         //     Report Count (5)
+  0x75, 0x01,                         //     Report Size (1)
+  0x05, 0x08,                         //     Usage Page (Page# for LEDs)
+  0x19, 0x01,                         //     Usage Minimum (1)
+  0x29, 0x05,                         //     Usage Maximum (5)
+  0x91, 0x02,                         //     Output (Data, Variable, Absolute), Led report
+  0x95, 0x01,                         //     Report Count (1)
+  0x75, 0x03,                         //     Report Size (3)
+  0x91, 0x01,                         //     Output (Data, Variable, Absolute), Led report padding
+
+  0x95, 0x06,                         //     Report Count (6)
+  0x75, 0x08,                         //     Report Size (8)
+  0x15, 0x00,                         //     Logical Minimum (0)
+  0x25, 0x65,                         //     Logical Maximum (101)
+  0x05, 0x07,                         //     Usage Page (Key codes)
+  0x19, 0x00,                         //     Usage Minimum (0)
+  0x29, 0x65,                         //     Usage Maximum (101)
+  0x81, 0x00,                         //     Input (Data, Array) Key array(6 bytes)
+
+
+  0x09, 0x05,                         //     Usage (Vendor Defined)
+  0x15, 0x00,                         //     Logical Minimum (0)
+  0x26, 0xFF, 0x00,                   //     Logical Maximum (255)
+  0x75, 0x08,                         //     Report Count (2)
+  0x95, 0x02,                         //     Report Size (8 bit)
+  0xB1, 0x02,                         //     Feature (Data, Variable, Absolute)
+
+  0xC0                                // End Collection (Application)
+};
+const unsigned char hidReportReferenceDescriptorValue2[] = {0x00, 0x02};
+
+
+BLEService                       hidService                              = BLEService("1812");
+BLECharacteristic                hidReportCharacteristic                 = BLECharacteristic("2A4D", BLERead | BLENotify, 8);
+BLEDescriptor                    reportReferenceDescriptor1              = BLEDescriptor("2908", hidReportReferenceDescriptorValue1, sizeof(hidReportReferenceDescriptorValue1));
+BLEConstantCharacteristic        hidInformationCharacteristic            = BLEConstantCharacteristic("2a4a", hidInformationCharacteriticValue, sizeof(hidInformationCharacteriticValue));
+BLEUnsignedCharCharacteristic    hidProtocolModeCharacteristic           = BLEUnsignedCharCharacteristic("2a4e", BLERead | BLEWriteWithoutResponse);
+BLEUnsignedCharCharacteristic    hidControlPointCharacteristic           = BLEUnsignedCharCharacteristic("2a4c",BLEWriteWithoutResponse);
+BLEConstantCharacteristic        hidReportDescriptor                     = BLEConstantCharacteristic("2a4b", hidReportDescriptorValue, sizeof(hidReportDescriptorValue));
+BLEUnsignedCharCharacteristic    hidReportOutputCharacteristic           = BLEUnsignedCharCharacteristic("2a4f", BLERead | BLEWrite | BLEWriteWithoutResponse);
+BLEDescriptor                    reportReferenceDescriptor2              = BLEDescriptor("2908", hidReportReferenceDescriptorValue2, sizeof(hidReportReferenceDescriptorValue2));
+BLECharacteristic                bootKeyboardInputReportCharacateristic  = BLECharacteristic("2A22", BLERead | BLENotify, 8);
+BLEUnsignedCharCharacteristic    bootKeyboardOutputReportCharacateristic = BLEUnsignedCharCharacteristic("2A23", BLERead | BLEWrite | BLEWriteWithoutResponse);
+
+
+void setup() {
+  Serial.begin(9600);
+#if defined (__AVR_ATmega32U4__)
+  delay(5000);  //5 seconds delay for enabling to see the start up comments on the serial board
+#endif
+
+  // clears bond data on every boot
+  blePeripheral.setBondStore(bleBondStore);
+
+  blePeripheral.setDeviceName("Arduino Keyboard");
+  blePeripheral.setAppearance(961);
+
+  blePeripheral.setLocalName("HID-keyboard");
+  blePeripheral.setAdvertisedServiceUuid(hidService.uuid());
+
+  // add attributes (services, characteristics, descriptors) to peripheral
+  blePeripheral.addAttribute(hidService);
+  blePeripheral.addAttribute(hidReportCharacteristic);
+  blePeripheral.addAttribute(reportReferenceDescriptor1);
+  blePeripheral.addAttribute(hidInformationCharacteristic);
+  blePeripheral.addAttribute(hidProtocolModeCharacteristic);
+  blePeripheral.addAttribute(hidControlPointCharacteristic);
+  blePeripheral.addAttribute(hidReportDescriptor);
+  blePeripheral.addAttribute(hidReportOutputCharacteristic);
+  blePeripheral.addAttribute(reportReferenceDescriptor2);
+  blePeripheral.addAttribute(bootKeyboardInputReportCharacateristic);
+  blePeripheral.addAttribute(bootKeyboardOutputReportCharacateristic);
+
+  // initialize characteristics values
+  hidProtocolModeCharacteristic.setValue(0x01);
+
+  unsigned char bootKeyboardInputReportCharacateristicValue[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+  bootKeyboardInputReportCharacateristic.setValue(bootKeyboardInputReportCharacateristicValue, sizeof(bootKeyboardInputReportCharacateristicValue));
+
+  // begin initialization
+  blePeripheral.begin();
+
+  Serial.println(F("BLE HID Keyboard Peripheral"));
+}
+
+void loop() {
+  BLECentral central = blePeripheral.central();
+
+  if (central) {
+    // central connected to peripheral
+    Serial.print(F("Connected to central: "));
+    Serial.println(central.address());
+
+    while (central.connected()) {
+      uint8_t keyPress[8]= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+      if (Serial.available() > 0) {
+        // read the ascii character
+        unsigned char ascii = Serial.read();
+
+        Serial.print(F("ascii = "));
+        Serial.println(ascii);
+
+        // https://github.com/SFE-Chris/UNO-HIDKeyboard-Library/blob/master/HIDKeyboard.h
+        const static uint8_t HIDTable[] =  {
+      	  0x00, // 0
+          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x00, // 10
+      	  0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 20
+      	  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, // 30
+      	  0x00, 0x2c, 0x1e, 0x34, 0x20, 0x21, 0x22, 0x24, 0x34, 0x26, // 40
+      	  0x27, 0x25, 0x2e, 0x36, 0x2d, 0x37, 0x38, 0x27, 0x1e, 0x1f, // 50
+      	  0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x33, 0x33, 0x36, // 60
+      	  0x2e, 0x37, 0x38, 0x1f, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, // 70
+      	  0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, // 80
+      	  0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, // 90
+      	  0x2f, 0x31, 0x30, 0x23, 0x2d, 0x35, 0x04, 0x05, 0x06, 0x07, // 100
+      	  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, // 110
+      	  0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, // 120
+      	  0x1c, 0x1d, 0x2f, 0x31, 0x30, 0x35, 127 // 127
+        };
+
+        if (ascii < sizeof(HIDTable)) {
+
+          unsigned char hid = HIDTable[ascii];
+
+          Serial.print(F("hid = "));
+          Serial.println(hid);
+
+          // wait until we can notify
+          while(!hidReportCharacteristic.canNotify()) {
+            blePeripheral.poll();
+          }
+
+          // send hid key code
+          keyPress[2] = hid;
+          hidReportCharacteristic.setValue(keyPress, sizeof(keyPress));
+
+          // wait until we can notify
+          while(!hidReportCharacteristic.canNotify()) {
+            blePeripheral.poll();
+          }
+
+          // send cleared hid code
+          keyPress[2] = 0x00;
+          hidReportCharacteristic.setValue(keyPress, sizeof(keyPress));
+        }
+      }
+    }
+
+    // central disconnected
+    Serial.print(F("Disconnected from central: "));
+    Serial.println(central.address());
+  }
+}


Added DSLR_Controller.ino, has skeleton of code for three commands (expose, cancel, query), but needs query and cancel to be written.

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

--- DSLR_Controller.ino
+++ DSLR_Controller.ino
@@ -0,0 +1,92 @@
+/*
+Canon DSLR Camera Control
+
+To activate cameras send a serial tring to the board.  The string should
+consist of three integers.  The first and second indicate which cameras
+should be activated.  Any non-zero, positive integer in the first field
+will activate the first camera and any non-zero integer in the second
+field will activate the second camera.  The third value is the exposure
+time in milliseconds.
+
+Serial Commands to Board:
+E,n,n,nnn -- Expose camera.
+C,n,n     -- Cancel exposure.
+Q         -- Query which cameras are exposing.
+*/
+
+// Constants for Camera Relay
+const int camera1_pin = 2;
+const int camera2_pin = 3;
+
+//-----------------------------------------------------------------------------
+// SETUP
+//-----------------------------------------------------------------------------
+void setup() {
+    // Open serial communications and wait for port to open:
+    Serial.begin(9600);
+    while (!Serial) {
+    ; // wait for serial port to connect. Needed for Leonardo only
+    }
+
+    Serial.print("Setup Camera Relay Pins ... ");
+    pinMode(camera1_pin, OUTPUT);
+    pinMode(camera2_pin, OUTPUT);
+    digitalWrite(camera1_pin, LOW);
+    digitalWrite(camera2_pin, LOW);
+    Serial.println("done!");
+}
+
+//-----------------------------------------------------------------------------
+// MAIN LOOP
+//-----------------------------------------------------------------------------
+void loop() {
+    // if there's any serial available, read it:
+    while (Serial.available() > 0) {
+        int command = Serial.parseInt();
+        // Based on the command, parse the rest of the serial string differently.
+        if (command == 69) {
+            // Expose (E=69) command
+            int camera1 = Serial.parseInt();
+            int camera2 = Serial.parseInt();
+            int exptime_ms = Serial.parseInt();
+            // look for the newline. That's the end of your
+            // sentence:
+            if (Serial.read() == '\n') {
+                // expose camera for exptime_ms milliseconds
+                Serial.print("Starting ");
+                Serial.print(exptime_ms/1000.0);
+                Serial.print(" second exposure");
+                if (camera1 >= 1) {
+                    Serial.print(" on camera1 ");
+                    digitalWrite(camera1_pin, HIGH);
+                    if (camera2 >= 1) { Serial.print("and"); }
+                }
+                if (camera2 >= 1) {
+                    Serial.print(" on camera2 ");
+                    digitalWrite(camera2_pin, HIGH);
+                }
+                Serial.print("... ");
+                // Now go in to loop waiting for exposure time to finish
+                // If a cancel command is received, cancel exposure.
+                int total_exptime = 0
+                int remainder = total_exptime % 100;
+                int n_loops = (total_exptime - remainder) / 100;
+                for (int index = 0; index < n_loops; index++) {
+                    delay(100);
+                    total_exptime = total_exptime + 100;
+                    // Look for cancel command
+                }
+                delay(remainder);
+                // Set pins low (stop exposure)
+                digitalWrite(camera1_pin, LOW);
+                digitalWrite(camera2_pin, LOW);
+                Serial.println("done");
+            }
+        }
+        if (command == 67) or (command == 81) {
+        // Cancel (C=67) or Query (Q=81) command
+        }
+    }
+    delay(100);
+}
+


Changed sendPinValues() to send the most significant byte first.

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/RichoM/Uzi.git/'


Rewritten firmware

Rewritten firmware

Progress on serial parsing and PWM output
To be added is radio network support etc

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/snowdenator/EarlHomeAutomation.git/'


ArduSound

ArduSound

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

--- ArduSound/ArduSound.ino
+++ ArduSound/ArduSound.ino
@@ -0,0 +1,32 @@
+#include <Ultrasonic.h> // This library is licensed under Creative Commons Share alike and Attribution by J.Rodrigo. See: https://github.com/JRodrigoTech/Ultrasonic-HC-SR04
+
+Ultrasonic ultraleft(11,3, 25000);   // (Trig PIN, Echo PIN, Time Out in milliseconds- A lower value will limit the maximum distance reading.)
+Ultrasonic ultraright(6,5, 25000);  // (Trig PIN, Echo PIN, Time Out in milliseconds- A lower value will limit the maximum distance reading.)
+
+int pwmleft;
+int pwmright;
+
+void setup(){
+  pinMode(2, OUTPUT); // GND pin
+  digitalWrite(2, LOW);  // GND mode
+  Serial.begin(9600);
+}
+
+void loop(){
+  Serial.print("Left: ");
+  Serial.print(ultraleft.Ranging(CM)); // CM or INC
+  Serial.print(" cm     " );
+  delay(50);
+  Serial.print("Right: ");
+  Serial.print(ultraright.Ranging(CM)); // CM or INC
+  Serial.println(" cm" );
+  delay(50);
+
+
+  pwmleft = map(ultraleft.Ranging(CM), 0, 431, 0, 70); // Map the distance value to the analogue output.
+  pwmright = map(ultraright.Ranging(CM), 0, 431, 0, 70); // Map the distance value to the analogue output.
+  analogWrite(10, pwmleft); // Output the pwm value as analog output
+  analogWrite(9, pwmright); // Output the pwm value as analog output
+
+}
+


Delete ESPArto_timer_functions.ino

Delete ESPArto_timer_functions.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/philbowles/esparto.git/'


Create LORA_chat.ino

Create LORA_chat.ino

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

--- LORA_chat/LORA_chat.ino
+++ LORA_chat/LORA_chat.ino
@@ -0,0 +1,111 @@
+#include <RHReliableDatagram.h>
+#include <RH_RF95.h>
+#include <SPI.h>
+
+#define MY_ADDRESS 1
+#define TARGET_ADDRESS 2
+#define MAX_LEN 40
+
+RH_RF95 driver;
+RHReliableDatagram manager(driver, MY_ADDRESS);
+
+bool check = 0;
+uint8_t data[MAX_LEN];
+uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
+
+char outstr[MAX_LEN];
+byte i;
+byte SNR;
+byte cont = 0;
+
+void setup() {
+
+  Serial.begin(9600);
+
+  if (!manager.init()) {
+    Serial.println("init failed");
+  }
+
+  driver.setTxPower(23, false);
+
+  Serial.println("---- LORA chat modulo A ----");
+  Serial.println("Digita il messaggio e premi INVIO per spedire.");
+}
+
+void loop() {
+
+  //**********************************SPEDIZIONE
+
+  if (Serial.available()) {
+
+    delay(100); // Non togliere questo delay!!
+    i = 0;
+
+    while(Serial.available()){
+
+      outstr[i] = Serial.read();
+      //Serial.println(outstr[i]);
+      i++;
+
+      if(i == MAX_LEN){
+        break;
+      }
+
+    }
+
+    String(outstr).getBytes(data, i);         // Inserisco il dato nell'array da
+                                                //   spedire.
+    Serial.print("Messaggio da spedire: \t\t\t\t\t\t");
+    Serial.println((char*)data);
+    Serial.println("Provo a spedire...");
+
+    // Spedisco la stringa all'indirizzo e vedo se l'invio è andato a buon fine
+    check = manager.sendtoWait(data, sizeof(data), TARGET_ADDRESS);
+
+    if (check) {
+
+      Serial.println("Invio riuscito!");
+      Serial.println("Digita il messaggio e premi INVIO per spedire di nuovo");
+
+    } else {
+
+      Serial.println("Invio fallito!");
+      Serial.println("Digita il messaggio e premi INVIO per spedire di nuovo");
+
+    }
+  }
+
+  //**********************************RICEZIONE
+
+  if (manager.available()) {
+
+    Serial.println("Manager available");
+
+    uint8_t len = sizeof(buf);
+    uint8_t from;
+
+    check = manager.recvfromAckTimeout(buf, &len, 2000, &from);
+
+    if (check) {
+
+      cont++;
+      Serial.print("Ricevuto messaggio da : 0x");
+      Serial.print(from, HEX);
+      Serial.print(": \t\t\t\t\t");
+      Serial.print(cont);
+      Serial.print("\t");
+      Serial.println((char*)buf);
+
+      SNR = driver.lastSNR();
+      Serial.print("SNR : ");
+      Serial.println(SNR);
+
+    } else {
+
+      Serial.print("Ricezione fallita");
+
+    }
+
+  } // Manager available
+
+}


Arduino sketch added

Arduino sketch added

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

--- sketches/Rookvat.ino
+++ sketches/Rookvat.ino
@@ -0,0 +1,566 @@
+//Own libraries
+#include <Menu.h>
+#include <RGBLed.h>
+#include <Speaker.h>
+#include <GasValve.h>
+#include <TemperatureSensors.h>
+#include <Logger.h>
+#include <MyTFT.h>
+
+//3rd party libraries
+#include <Encoder.h>
+
+#include <DallasTemperature.h>
+#include <OneWire.h>
+
+#include <mmc.h>
+#include <tinyFAT.h>
+
+#include "SPI.h"
+#include <Adafruit_GFX.h>
+#include <Adafruit_ILI9341.h>
+
+#include <DS1307RTC.h>
+#include <Time.h>
+#include <Wire.h>
+
+#include <Servo.h>
+#include <Stepper.h>
+
+const int TARGET_TEMP_BARREL = 0;
+const int TARGET_TEMP_MEAT = 1;
+
+const int menuSelectorRE_A = 19;
+const int menuSelectorRE_B = 27;
+
+const int menuButton = 18;
+const int pauseButton = A3;
+
+const int oneWireTempSensors_pin = 3;
+
+const int gasValveMotorRotationCheck_RE_A = A2;
+const int gasValveMotorRotationCheck_RE_B = 38;
+
+const int gasValveMotorA = 23;
+const int gasValveMotorB = 24;
+const int gasValveMotorC = 25;
+const int gasValveMotorD = 26;
+
+const int speaker_pin = 37;
+
+const int led1_R = 12;
+const int led1_G = 11;
+const int led1_B = 10;
+
+const int smokeValveServoPin = 9;
+const int smokeValveMin = 0;
+const int smokeValveMax = 180;
+
+const int smokerRegulationInterval = 60; // Every minute. Hope it is ok.
+
+const int meatTempPin = A4;
+const int barrelTempPin = A5;
+
+const int TFT_CS = 53;
+const int TFT_DC = 49;
+const int TFT_MOSI = 51;
+const int TFT_MISO = 50;
+const int TFT_CLK = 52;
+const int TFT_RST = 48;
+const int SD_CS = 47;
+
+/* Initialize the one wire sensors*/
+TemperatureSensors tempSensors(oneWireTempSensors_pin, barrelTempPin, meatTempPin);
+
+/* Initialize the RGB Led */
+RGBLed led1(led1_R,led1_G,led1_B);
+
+/* Initialize the speaker */
+Speaker speaker(speaker_pin);
+
+/* Initialize the Rotary Encoders */
+Encoder menuSelector(menuSelectorRE_A, menuSelectorRE_B);
+Encoder gasValveMotorRotationCheck(gasValveMotorRotationCheck_RE_A, gasValveMotorRotationCheck_RE_B);
+
+/* Initialize the LCD Panel */
+//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
+MyTFT *tft;
+
+/* Initialize the RTC (Real Time Clock) */
+// nothing?!
+
+/* Initialize the gas valve; it uses a rotary encoder to check if the gas valve is at the end */
+GasValve gasValve(&gasValveMotorRotationCheck, gasValveMotorA, gasValveMotorB, gasValveMotorC, gasValveMotorD);
+
+/* Initialize the servo */
+SmokeValve *smokeValve;
+
+/* Initialize the menu */
+Menu *mainMenu = new Menu(menuButton);
+
+/* Initialize the logger to the SD card*/
+Logger logger(SD_CS);
+
+/* Here are all the parameters for the application */
+float target_temp = 30.0; // The target temperature
+int target_temp_location = TARGET_TEMP_BARREL;
+int rooktijd=120; //smoketime in minutes
+
+int current_hour=10;
+int current_minute=30;
+int current_second=30;
+int current_month=2;
+int current_day=3;
+int current_year=2014;
+
+int smoking_started = 0; //Is the barrel up-and-running, or are we in 'setup mode'?
+long encvalue=0; // used for the menu-rotary encoder
+volatile bool wasInSelected=false;
+
+time_t starttime, lastregulation; // times for start and lastregulation
+boolean firstSmokeLoop=true;
+float lasttemp, lasttempdif;
+
+/*
+ *Here is all the setup of the project done
+ */
+void setup() {
+  // initialize Serial device to support debugging
+  Serial.begin(9600);
+
+  //initialize the LCD
+  tft = new MyTFT(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
+  //initialize the menu
+  createMenu();
+
+  //Close the smoke valve with the servo
+  smokeValve = new SmokeValve(smokeValveServoPin, smokeValveMin, smokeValveMax);
+  smokeValve->fullyClose();
+
+  //Close the gasvalve
+  gasValve.fullyClose();
+
+  //blink light to indicate start
+  led1.changeColor(&COLOR_GREEN);
+  delay(100);
+  led1.changeColor(&COLOR_BLUE);
+  delay(100);
+  led1.changeColor(&COLOR_RED);
+  //test speaker
+  speaker.on();
+  delay(20);
+  speaker.off();
+
+  // Initialize the rotary encoder
+  encvalue = menuSelector.read();
+
+  // Initialize the menubutton
+  pinMode(menuButton, INPUT);
+  attachInterrupt(getInterruptForPin(menuButton), bPressed, FALLING);
+
+  // Create a new file
+  logger.createUniqueFileName();
+}
+
+/*
+ * This is the main of the arduino application
+ */
+void loop() {
+  long gasValvePos, smokeValvePos;
+  float barrelTemp, meatTemp, ambientTemp;
+
+
+  tmElements_t tm;
+
+  long newvalue;
+  bool selected = false;
+  int steps = 0;
+
+  // Get the time from the RTC
+  if (RTC.read(tm)) {
+    current_hour=tm.Hour;
+    current_minute=tm.Minute;
+    current_second=tm.Second;
+    current_month=tm.Month;
+    current_day=tm.Day;
+    current_year=tmYearToCalendar(tm.Year);
+  };
+
+  // Do menu things if necessary
+  mainMenu->display(tft->getTFT());
+  wasInSelected = false;
+  selected=false;
+  while (!selected && !wasInSelected) {
+    newvalue = menuSelector.read();
+    if ((newvalue - encvalue) % 4 != 0) {
+      continue;
+    }
+    if (newvalue > encvalue) {
+      steps = (newvalue - encvalue)/4;
+      for (int i=0;i<steps;i++) {
+        mainMenu->highlightNext();
+      };
+      encvalue=newvalue;
+      selected=true;
+    }
+    else {
+      if (newvalue < encvalue) {
+        steps = (encvalue - newvalue)/4;
+        for (int i=0;i<steps;i++) {
+          mainMenu->highlightPrevious();
+        };
+        encvalue=newvalue;
+        selected=true;
+      }
+      else {
+        delay(100);
+        //the same so wait for a new value
+      }
+    }
+  }
+
+  // Check the temps
+  barrelTemp = tempSensors.getBarrelTemperature();
+  meatTemp = tempSensors.getMeatTemperature();
+  ambientTemp = tempSensors.getAmbientTemperature();
+
+  RTC.read(tm);
+  // display the temps and time at the LCD
+  tft->displayTemps(ambientTemp, meatTemp, barrelTemp, target_temp, target_temp_location == TARGET_TEMP_MEAT);
+  tft->displayTime(&tm);
+//  tft->displayTimeRemaining(seconds_smoking_left, smoking_started);
+
+  // Now check if the smoking is started
+  if (smoking_started) {
+    if (firstSmokeLoop) {
+      logger.writeln("Smoking started");
+      starttime = RTC.get();
+      // now determine the endtime for the smoking.
+      firstSmokeLoop = false;
+      lasttemp = 0;
+      lasttempdif = 0;
+      // Change led to green to indicate that smoking is started
+      led1.changeColor(&COLOR_GREEN);
+    }
+    // Do all the regulating one every x seconds. Else there is to much turning on all the knobs
+    time_t current = RTC.get();
+    if (current - lastregulation > smokerRegulationInterval) {
+
+      // Check the temps
+      barrelTemp = tempSensors.getBarrelTemperature();
+      meatTemp = tempSensors.getMeatTemperature();
+      ambientTemp = tempSensors.getAmbientTemperature();
+      if (ambientTemp > target_temp) {
+        logger.writeln("Error: ambient temperature higher than target temperature. Aborting!");
+        led1.changeColor(&COLOR_MAGENTA);
+        smoking_started = false;
+      }
+      // Get the positions of the gasvalve steppermotor and smoke valve servo
+      gasValvePos = gasValve.getCurrentPosition();
+      smokeValvePos = smokeValve->getCurrentPosition();
+
+      // Also update the LCD display to show the current positions (temps are already done
+      tft->displayValveStatus(smokeValvePos, gasValvePos);
+
+      // Now determine which temperature to use and see what the diff is between the current temp and the target temp
+      float temp = (target_temp_location == TARGET_TEMP_BARREL)?barrelTemp:meatTemp;
+      float tempdif = target_temp - temp;
+
+      // Now write all the logging for later inspection
+      logger.writeLoggingInfo(ambientTemp, meatTemp, barrelTemp, target_temp, target_temp_location, temp, tempdif, lasttempdif, gasValvePos, smokeValvePos);
+
+      // tempdif > 0 betekent dat de temperatuur nog niet bereikt is. Er mag nog doorgestookt worden,
+      // alleen moet als de tempdif bijna bij 0 is wel opgelet worden dat de gaskraan niet meer hoog open blijft.
+
+      if (tempdif > 0) { // is it too cold. but how much? And was it to cold last time?
+        logger.writeln("1: tempdif > 0");
+        if (lasttempdif < 0) { // was it to hot last time?
+          logger.writeln("1.1: lasttempdif < 0");
+          if (tempdif < 1) { // is it just 1 degree to cold? Try to regulate it with the smoke valve
+            logger.writeln("1.1.1: tempdif < 1");
+            smokeValve->close(50); // close it and hope the temp will stabilize
+          } else if (tempdif < 3) { // 3 degrees to cold, but last time it was too hot, so the temp dropped a lot
+            logger.writeln("1.1.2: tempdif < 3");
+            smokeValve->fullyClose(); // close the smokevalve fully.
+            gasValve.open(1); // just 1 step open
+          } else { // more than 3 degrees temp drop in 1 minute. That is really strange.
+            logger.writeln("1.1.3: tempdif >= 3");
+            smokeValve->fullyClose(); // close the smokevalve
+            gasValve.open(3); // turn on the heat
+          }
+        } else { // it was not to hot last time
+          logger.writeln("1.2: lasttempdif >= 0");
+          // now determine how close we are
+          if (tempdif < 5) { // just 5 degrees? Look at the last value, so we know how much it was raised in 1 cycle
+            logger.writeln("1.2.1: tempdif < 5");
+            if (lasttempdif <= tempdif) { // it even got colder?
+              logger.writeln("1.2.1.1: lasttempdif <= tempdif");
+              gasValve.open(1); // open the gas a little bit
+              smokeValve->close(5); // and close the smokevalve;
+            } else if (lasttempdif < 10) { // it was 10 degrees to cold and now 5. So lets temper the fire and hope it will use the restwarmte
+              logger.writeln("1.2.1.2: lasttempdif < 10");
+              if (gasValve.close(5)) { // now fully closed?
+                // do something with the smokevalve? I don't know
+               logger.writeln("1.2.1.2.1: gasvalve.close == true");
+             }
+            } else if (lasttempdif < 20) {
+              logger.writeln("1.2.1.3: lasttempdif < 20");
+
+              // So it was almost 20 degrees in 1 cycle
+              if (gasValve.isFullyClosed()) { // is the gasvalve already closed and it still raised that much?
+               logger.writeln("1.2.1.3.1: gasValve.isFullyClosed()");
+               smokeValve->fullyOpen();
+              } else {
+               logger.writeln("1.2.1.3.2: !gasValve.isFullyClosed()");
+                gasValve.fullyClose(); //
+                smokeValve->open(20);
+              }
+            } else { // more than 20 degrees in one cycle. So vent it and hope the temp will not raise to much
+              logger.writeln("1.2.1.4: lasttempdif >= 20");
+              gasValve.fullyClose();
+              smokeValve->fullyOpen();
+            }
+          } else if (tempdif < 10) { // just 10 degrees to cold
+              logger.writeln("1.2.2: tempdif < 10");
+             if (lasttempdif < 10) { // but last time it was also 10 degrees to cold
+               logger.writeln("1.2.2.1: tempdif < 10");
+               if (gasValve.open(3)) {// turn on the gas
+                 logger.writeln("1.2.2.1.1: gasvalve.open == true");
+                 // it is now fully open.
+                 smokeValve->fullyClose(); // so close the smokevalve, if opened
+               }
+             } else {
+               logger.writeln("1.2.2.2: tempdif >= 10");
+               gasValve.close(3); // close the gas a little bit so it won't rise to fast
+             }
+
+          } else if (tempdif < 30) { // 30 degrees to cold.
+            logger.writeln("1.2.3: tempdif < 30");
+            if (lasttempdif < 30) { // but last time it was also 30 degrees to cold
+              logger.writeln("1.2.3.1: lasttempdif < 30");
+              if (gasValve.open(5)) {// turn on the gas
+                logger.writeln("1.2.3.1.1: gasvalve.open == true");
+                // it is now fully open.
+                smokeValve->fullyClose(); // so close the smokevalve, if opened
+              }
+            } else {
+              logger.writeln("1.2.3.2: lasttempdif >= 30");
+              gasValve.close(1); // close the gas a little bit so it won't rise to fast
+            }
+
+          } else {
+            logger.writeln("1.2.4: tempdif >= 30");
+            gasValve.fullyOpen();
+            smokeValve->fullyClose();
+          }
+        }
+
+      }
+
+
+
+      // als tempdif < 0 betekent dat de max-temp overschreden is. Afhankelijk van de grootte van de overschrijding
+      // zal de gaskraan helemaal dicht moeten en de rookklep open.
+      if (tempdif < 0) {
+        logger.writeln("2: tempdif < 0");
+        if (lasttempdif < 0) { // Hij was vorige keer ook al te warm.
+          logger.writeln("2.1: lasttempdif < 0");
+          // now check the position of the gasvalve
+          if (gasValve.isFullyClosed()) { // the GasValve is already totally closed
+            logger.writeln("2.1.1: gasValve.isFullyClosed()");
+            // So check the smokeValve
+            if (smokeValve->isFullyOpen()) { // Is the smokevalve totally open?
+              logger.writeln("2.1.1.1: smokeValve->isFullyClosed()");
+              // I don't know what to do now. Gas is off, smokevalve totally open. Just wait for the temp to drop.
+            } else {
+              logger.writeln("2.1.1.2: !smokeValve->isFullyClosed()");
+              if (tempdif > -1) { // just 1 degree to hot?
+                logger.writeln("2.1.1.2.1: tempdif > -1");
+                smokeValve->open(1); // just 1 step extra open
+              } else if (tempdif >-3) {
+                logger.writeln("2.1.1.2.2: tempdif > -3");
+                smokeValve->open(5); // 5 steps extra open
+              } else { // More than 3 degrees to hot? Open the smokevalve totally
+                logger.writeln("2.1.1.2.3: tempdif <= -3");
+                smokeValve->fullyOpen();
+              }
+            }
+          } else { // the gasvalve is not fully closed, but the temp is to hot. Just close it now
+            logger.writeln("2.1.2: !gasValve.isFullyClosed()");
+            gasValve.fullyClose();
+
+            if (tempdif >-3) { // 3 degrees to hot? Open the smokevalve so the temp can drop faster
+              logger.writeln("2.1.2.1: tempdif > -3");
+              smokeValve->open(10); // 10 steps extra open
+            } else { // More than 3 degrees to hot? Open the smokevalve totally
+              logger.writeln("2.1.2.2: tempdif <= -3");
+              smokeValve->fullyOpen();
+            }
+          }
+        } else { // last time it was not to hot, so it is just to hot
+          logger.writeln("2.2: lasttempdif >= 0");
+          if (gasValve.isFullyClosed()) { // is the gasvalve already closed?
+            logger.writeln("2.2.1: gasValve.isFullyClosed()");
+            if (smokeValve->isFullyOpen()) { // is the smokevalve already open?
+              logger.writeln("2.2.1.1: smokeValve->isFullyOpen()");
+              // Don't know what to do now. Both controls are exhausted
+            } else { // only the smokeValve is usable to regulate the temperature
+              logger.writeln("2.2.1.2: !smokeValve->isFullyOpen()");
+              if (tempdif > -1) { // just 1 degree to hot?
+                logger.writeln("2.2.1.2.1: tempdif > -1");
+                smokeValve->open(1); // just 1 step extra open
+              } else if (tempdif >-3) {
+                logger.writeln("2.2.1.2.2: tempdif > -3");
+                smokeValve->open(5); // 5 steps extra open
+              } else { // More than 3 degrees to hot? Open the smokevalve totally
+                logger.writeln("2.2.1.2.3: tempdif <= -3");
+                smokeValve->fullyOpen();
+              }
+            }
+          } else { // the gasvalve is not fully closed yet.
+           logger.writeln("2.2.2: !gasValve.isFullyClosed()");
+           if (tempdif > -1) { // just 1 degree to hot?
+              logger.writeln("2.2.2.1: tempdif > -1");
+              if (gasValve.close(2)) { // close 2 steps, but is it totally closed now?
+                logger.writeln("2.2.2.1.1: gasvalve.close == true");
+                smokeValve->open(5); // Open more, because gas is closed now
+              }  else {
+                logger.writeln("2.2.2.1.2: gasvalve.close != true");
+                smokeValve->open(1); // just 1 step extra open
+              }
+            } else if (tempdif >-3) {
+              logger.writeln("2.2.2.2: tempdif > -3");
+              if (gasValve.close(5)) {
+                logger.writeln("2.2.2.2.1: gasvalve.close == true");
+                smokeValve->open(20);
+              } else {
+                logger.writeln("2.2.2.2.2: gasvalve.close != true");
+                smokeValve->open(5); // 5 steps extra open
+              }
+            } else { // More than 3 degrees to hot? Open the smokevalve totally
+              logger.writeln("2.2.2.3: tempdif <= -3");
+              gasValve.fullyClose();
+              smokeValve->fullyOpen();
+            }
+          }
+        }
+      }
+
+      // store the current temps for the next round, so we can see how fast the temp is raising or dropping
+      lasttemp = temp;
+      lasttempdif = tempdif;
+
+      // now make sure the interval is reset
+      lastregulation = RTC.get();
+      // now check if the endtime is reached
+      long seconds_smoking_left = determineSmokingTimeLeftInSeconds(starttime, lastregulation, rooktijd);
+      tft->displayTimeRemaining(seconds_smoking_left, smoking_started);
+      if (seconds_smoking_left<0) {
+        smoking_started=false;
+        firstSmokeLoop=true;
+        logger.writeln("Smoking stopped because end time is reached");
+        for (int l = 0;l<10;l++) {
+          led1.changeColor(&COLOR_BLUE);
+          speaker.on();
+          delay(500);
+          led1.changeColor(&COLOR_GREEN);
+          speaker.off();
+          delay(500);
+        } // for
+        led1.changeColor(&COLOR_GREEN);
+      } // end time reached?
+    } // regulator cycle loop
+  } // smoking started
+} // main loop
+
+/*
+ * calculates the remaining time in seconds
+ */
+long determineSmokingTimeLeftInSeconds(time_t starttime, time_t currenttime, int smoketime_in_minutes) {
+  long timeSmokerActiveInSeconds = currenttime - starttime;
+  long totalSmokingTimeInSeconds = (long)smoketime_in_minutes * 60l;
+
+  return totalSmokingTimeInSeconds - timeSmokerActiveInSeconds;
+}
+
+/*
+ * this method writes the value to the console if the board is connected.
+ */
+void debug(char* str) {
+  logger.writeln(str);
+}
+
+/*
+ * This is the initialization code for the menu-class. This can be controlled by a rotary encoder and a button
+ */
+void createMenu() {
+  StringOption* opt = new StringOption("Vat\0");
+  opt->addOption("Vlees\0");
+
+  StringOption* startopties = new StringOption("Nee\0");
+  startopties->addOption("Ja\0");
+
+  FloatSelector *tempsel = new FloatSelector("Stel temperatuur in:\0", &target_temp, 0.5f, 10, 250);
+  StringSelector *valuesel = new StringSelector("Meet locatie:\0", &target_temp_location, opt);
+  TimeSelector *timesel = new TimeSelector("Rooktijd:\0", &rooktijd, 5);
+  StringSelector *smokestartsel = new StringSelector("Nu starten:\0", &smoking_started, startopties);
+
+  Menu *instellingen = new Menu();
+
+  IntSelector *hoursel = new IntSelector ("Selecteer huidige uur:\0", &current_hour, 1, 0, 23);
+  IntSelector *minutesel = new IntSelector ("Selecteer huidige minuut:\0", &current_minute, 1, 0, 59);
+  instellingen->addItem(20, "Stel uren in", false, NULL, hoursel);
+  instellingen->addItem(21, "Stel minuten in", false, NULL, minutesel);
+
+  IntSelector *daysel = new IntSelector ("Selecteer huidige dag:", &current_day, 1, 1, 31);
+  IntSelector *monthsel = new IntSelector ("Selecteer huidige maand:", &current_month, 1, 1, 12);
+  IntSelector *yearsel = new IntSelector ("Selecteer huidige jaar:", &current_year, 1, 2014, 2020);
+  instellingen->addItem(22, "Stel dag in", false, NULL, daysel);
+  instellingen->addItem(23, "Stel maand in", false, NULL, monthsel);
+  instellingen->addItem(24, "Stel jaar in", false, NULL, yearsel);
+
+  mainMenu->addItem(1, "Start roken\0", false, NULL, smokestartsel);
+  mainMenu->addItem(2, "Doel temperatuur\0", false, NULL, tempsel);
+  mainMenu->addItem(3, "Vlees of vat sensor\0", false, NULL, valuesel);
+  mainMenu->addItem(4, "Rooktijd\0", false, NULL, timesel);
+  mainMenu->addItem(5, "Instellingen\0", true, instellingen, NULL);
+}
+
+/*
+The interrupt routine for the button
+ */
+void bPressed() {
+  mainMenu->selectCurrent();
+  wasInSelected = true;
+};
+
+/*
+Map the pin to an interrupt number for the Arduino Mega
+ */
+int getInterruptForPin (uint8_t pin) {
+  int interrupt=-1;
+
+  switch (pin) {
+  case 2:
+    interrupt=0;
+    break;
+  case 3:
+    interrupt=1;
+    break;
+  case 18:
+    interrupt=5;
+    break;
+  case 19:
+    interrupt=4;
+    break;
+  case 20:
+    interrupt=3;
+    break;
+  case 21:
+    interrupt=2;
+    break;
+  }
+  return interrupt;
+}
+
+


fixed by Mark, + copyright notice

fixed by Mark, + copyright notice

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


Create pixy-rover.ino

Create pixy-rover.ino

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

--- pixy-rover.ino
+++ pixy-rover.ino
@@ -0,0 +1,165 @@
+// By Jeremy Ellis.
+// Rover should move slowly unless several seconds no response from the pixy then it should stop.
+// should move left or right based on where the object is.
+// should stop if the object gets to big a width ie it is close.
+
+
+#define FRAME_SKIP 25                // How many frames to skip. Lower numbers cause faster response
+
+/* Globals -------------------------------------------------------------------*/
+// Note my pololu big motor driver needs two digital and one analog PWM controls for the drive motor VNH5019
+//   https://www.pololu.com/product/1451
+
+int myForward          = D6;      // set or change these as needed
+int myBackward         = D5;      // set or change these as needed
+int myDriveMotor       = A0;
+
+
+
+// I am using the cheap pololu motor driver that only needs one digital and one analog pins for the turning motor DRV8835
+//    https://www.pololu.com/product/2135    note: this can drive two motors but I needed the bigger driver for the 2.3 amp drivemotor
+
+int myLeftRight        = D0;       // different motor driver does both left and right
+int myTurnMotor        = A1;   //A4;  // this one must be changed since it is used by the Pixy along with A3,A4,A5
+
+int myD7               = D7;      // to test if wifi is working
+int myLast             = Time.now();   // for emergency motor stop after 4 s  no activity from the pixy
+
+
+
+
+
+
+
+// Begin User Defined Defines
+#define FRAME_SKIP 25                // How many frames to skip. Lower numbers cause faster response
+// End User Defined Defines
+
+//      #include "SPI.h"        // got rid of this since it would not compile
+#include "Pixy.h"
+#include "TPixy.h"
+
+
+// Not sure how to flash new code so will not do this yet.
+//SYSTEM_MODE(MANUAL);                // Set the system mode to manual. We don't need the cloud for this code
+
+
+Pixy pixy;                          // Create our pixy object
+int i = 0;                          // Create an int to count for frame skipping. Frame skipping is used to artificially slow down the pixy loop
+
+// Setup - Runs Once @ Startup
+void setup() {
+//    Spark.function("my-main", myMain);
+    pinMode(myDriveMotor, OUTPUT);
+    pinMode(myForward, OUTPUT);
+    pinMode(myBackward, OUTPUT);
+
+    pinMode(myTurnMotor, OUTPUT);
+    pinMode(myLeftRight, OUTPUT);
+
+    pinMode(myD7, OUTPUT);
+
+
+
+    //Serial.begin(9600);             // Initalize the USB Serial port
+   // pixy.init();                    // Initalize the pixy object
+
+    //PUT YOUR SETUP CODE HERE. Note: Only three more functions allowed!
+    // test everything using the return int from a function!
+
+
+    //RGB.control(true);
+    //RGB.color(0, 255, 255);  //cyan
+    RGB.brightness(1);    // 1=very low light, 255 = max
+
+
+    Serial.begin(9600);             // Initalize the USB Serial port
+    pixy.init();                    // Initalize the pixy object
+}
+
+// Loop - Runs over and over
+void loop(){
+
+
+
+        RGB.brightness(1);
+    if (Time.now() >= myLast + 4){                // car may be out of control or wifi down or pixy down
+
+         analogWrite(myDriveMotor,  0);           // shut both motors down
+         analogWrite(myTurnMotor,   0);
+         RGB.brightness(100);                     // show that no processing lately
+    }
+
+
+
+    // Variable Creation
+    uint16_t blocks;                // Create an unsigned int to hold the number of found blocks
+    char buf[50];                   // Create a buffer for printing over serial
+
+    blocks = pixy.getBlocks();      // Do the pixy stuff. Grab the numbers of blocks the pixy finds
+
+  // If we have some blocks increment the frame counter (i) and if enough frames have passed print out data about the found blocks to the serial port
+  if (blocks) {
+    myLast = Time.now();           // update time to see if car still in wifi control
+
+
+    //  Deal with all the turning x = 0 - 319
+
+    if (pixy.blocks[0].x < 150){   //object on the left so car should turn right
+        digitalWrite(myLeftRight, 1);
+        analogWrite(myTurnMotor,  250);
+    }  else {
+
+       if (pixy.blocks[0].x > 190){   //object on the right so car should turn left
+         digitalWrite(myLeftRight, 0);
+         analogWrite(myTurnMotor,  250);
+
+       }  else {   // object in the middle so just go straight
+            analogWrite(myTurnMotor,  0);
+
+           }
+
+    }  // end turning  main if
+
+
+   // deal with the speed of the rover  width = 0 - 320
+
+    if (pixy.blocks[0].width < 30){   //Object is very far away so go faster
+
+        digitalWrite(myForward, 1);
+        digitalWrite(myBackward, 0);
+        analogWrite(myDriveMotor,  250);
+
+    } else {
+
+        if (pixy.blocks[0].width > 70){   //Object is very wide so it is too close so stop
+
+            analogWrite(myDriveMotor,  0);
+
+        }   else {   // object a good distance away go a medium speed 0-250
+                    digitalWrite(myForward, 1);
+                    digitalWrite(myBackward, 0);
+                    analogWrite(myDriveMotor,  100);
+           }
+        }
+
+
+
+
+
+  } // end blocks
+}   // end loop
+
+
+
+
+
+
+
+
+
+
+
+
+
+


Minor comments changes

Minor comments changes

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/bitbitbitbitbitbitbitbit/LineFollowing.git/'


Update lcd_1.ino

Update lcd_1.ino

error: pathspec 'LCD' did not match any file(s) known to git
error: pathspec 'TFT' did not match any file(s) known to git
error: pathspec 'Screen/lcd_1/lcd_1.ino' did not match any file(s) known to git


Changes in spider sketch.

Changes in spider sketch.

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/mamu7211/ArduinoSpider.git/'


Create digole_UART_20x4_test.ino

Create digole_UART_20x4_test.ino

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

--- firmware/examples/digole_UART_20x4_test.ino
+++ firmware/examples/digole_UART_20x4_test.ino
@@ -0,0 +1,101 @@
+/*----------NOTE----------
+new version of lib will save your compiled code size for the sample
+The size for 2 version(@Arduino V1.0.1):
+            UART  I2C    SPI
+OLD   8998  8988   9132
+NEW  6966  7566   6354
+------------------------*/
+#define _Digole_Serial_UART_  //To tell compiler compile the special communication only,
+//other available is: _Digole_Serial_I2C_ and _Digole_Serial_SPI_
+#include "DigoleGeo.h"
+//--------UART setup, if you don't use UART, use // to comment following line
+DigoleSerialDisp mydisp(&Serial1, 9600); //UART:Pin 1(TX)on arduino to RX on module
+//--------I2C setup, if you don't use I2C, use // to comment following 2 lines
+//#include <Wire.h>
+//DigoleSerialDisp mydisp(&Wire,'\x27');  //I2C:SDA (data line) is on analog input pin 4, and SCL (clock line) is on analog input pin 5
+//--------SPI setup, if you don't use SPI, use // to comment following line
+//DigoleSerialDisp mydisp(8,9,10);  //SPI:Pin 8: data, 9:clock, 10: SS, you can assign 255 to SS, and hard ground SS pin on module
+#define LCDCol 20//16
+#define LCDRow 4//2
+
+int ptr;
+const char a[] = "disp char array";
+const char b = 'Q';
+int c = 3456;
+String d = "I'm a string";
+//float pi = 3.1415926535;
+double lg10;
+
+void setup() {
+    mydisp.begin();
+    /*----------for text LCD adapter and graphic LCD adapter ------------*/
+    mydisp.clearScreen(); //CLear screen
+    //mydisp.displayConfig(1);    //set config display ON, 0=off
+    //mydisp.setI2CAddress(0x29);  //this function only working when you connect using I2C, from 1 to 127
+    //delay(1000);
+    //mydisp.setLCDColRow(16,2);  //set LCD Col and Row, only time set up is OK
+    mydisp.disableCursor(); //disable cursor, enable cursore use: enableCursor();
+    mydisp.drawStr(6, 0, "Demo now"); //display string at: x=4, y=0
+
+    //Test print function
+    mydisp.setPrintPos(0, 1);
+    mydisp.print(a); // display a char array
+    resetpos();
+    mydisp.print("display a char:");
+    mydisp.print(b); //display a char
+    resetpos();
+    mydisp.print("int as DEC:");
+    mydisp.print(c); //display 3456 in Dec
+    resetpos();
+    mydisp.print("as HEX:");
+    mydisp.print(c, HEX); //display 3456 in Hex
+    resetpos();
+    mydisp.print("as OCT:");
+    mydisp.print(c, OCT); //display 3456 in Oct
+    resetpos();
+    mydisp.print("BIN:");
+    mydisp.print(c, BIN); //display 3456 in Bin
+    resetpos();
+    mydisp.print(d); //display String object
+    resetpos();
+    mydisp.print("float pi=");
+    mydisp.print(pi); //display float of PI
+    resetpos();
+    mydisp.print("Pi6=");
+    mydisp.print(pi, 6); //display PI in 6 Accuracy
+    resetpos();
+    mydisp.print("Pi*3=");
+    mydisp.print(pi * 3, 6); //display PI time 3 in 6 Accuracy
+    resetpos();
+    mydisp.print("lg5=");
+    mydisp.print(log(5), 8); //display log(5) in 8 Accuracy
+    resetpos();
+    for (uint8_t j = 0; j < 4; j++) //making "Hello" string moving
+    {
+        for (uint8_t i = 0; i < 10; i++) //move string to right
+        {
+            mydisp.setPrintPos(i, 1);
+            mydisp.print(" Hello ");
+            delay(100); //delay 100ms
+        }
+        for (uint8_t i = 0; i < 10; i++) //move string to left
+        {
+            mydisp.setPrintPos(9 - i, 1);
+            mydisp.print(" Hello ");
+            delay(100);
+        }
+    }
+    mydisp.print("Enjoy it!");
+    mydisp.enableCursor(); //enable cursor
+}
+
+void resetpos(void) //for demo use, reset display position and clean the demo line
+{
+    mydisp.setPrintPos(0, 1);
+    delay(2000); //delay 2 seconds
+    mydisp.println("                "); //display space, use to clear the demo line
+    mydisp.setPrintPos(0, 1);
+}
+void loop() {
+}
+


main firmware file

main firmware file

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

--- arduino/controller/controller.ino
+++ arduino/controller/controller.ino
@@ -0,0 +1,124 @@
+/*
+  Created by Craig Wm. Versek, 2013-08-09
+  Released into the public domain.
+*/
+
+#include <SPI.h>
+#include <MCP4921_DAC12bit.h>
+#include <MCP320x_ADC12bit.h>
+//3rd Party Libraries
+#include <SerialCommand.h>
+
+#define V_REF  3.29
+#define V_VGND V_REF/2.0
+#define R_CURRSENSE 1000.0
+
+#define DELTA_V 0.1
+#define V_MIN (-V_REF/2.0 + DELTA_V)
+#define V_MAX ( V_REF/2.0 - DELTA_V)
+#define NUM_STEPS 100
+#define DELAY_ms 100
+
+//SerialCommand parser
+SerialCommand SCmd;
+
+//configure the DAC chip
+MCP4921_DAC12bitClass control_DAC(3,     //slaveSelectLowPin
+                                  3,     //ldacLowPin
+                                  V_VGND //reference voltage at mid-scale
+                                 );
+//configure the ADC chip
+MCP320x_ADC12bitClass sense_ADC(5,   //slaveSelectLowPin
+                                V_REF //reference voltage at full-scale
+                              );
+
+
+void setup() {
+  Serial.begin(9600);
+  //configure the serial commands
+  SCmd.addCommand("VCTRL", setControlVoltageCommand);
+  SCmd.addCommand("VSWEEP", doSweepCommand);
+  SCmd.setDefaultHandler(unrecognizedCommand);
+  //start up the SPI bus
+  SPI.begin();
+  SPI.setBitOrder(MSBFIRST);
+  SPI.setDataMode(SPI_MODE0);
+  //start controlling the voltage supply
+  control_DAC.begin();
+  //start controlling the sampling
+  sense_ADC.begin();
+}
+
+void loop() {
+  //process serial commands
+  SCmd.readSerial();
+}
+
+void doSweep() {
+  float voltage_step = (V_MAX - V_MIN)/NUM_STEPS;
+  float control_voltage;          //referenced to V_VGND
+  float RE_voltage;               //referenced to power rails
+  float WEtoRE_voltage;           //WE voltage referenced to RE
+  float WE_current_sense_voltage; //voltage across current follower sense resistor, ref. to power rails
+  float WE_current;               //compute current into WE
+  Serial.println("#BEGIN VSWEEP");
+  Serial.println("#COLUMNS control_voltage,WEtoRE_voltage,currentWE_in");
+  for (int i=0; i <= NUM_STEPS; i++){
+    control_voltage = V_MIN + voltage_step*i;
+    //change output voltage
+    control_DAC.setVoltageOutput(V_REF - (control_voltage + V_VGND)); //shift to center-rail and invert
+    //wait for settling
+    delay(DELAY_ms);
+    //read signals
+    RE_voltage               = sense_ADC.readSingle(0);
+    WE_current_sense_voltage = sense_ADC.readSingle(1);
+    //convert to centerline voltage and correct for inversion
+    WEtoRE_voltage =  (RE_voltage - V_VGND);
+    WE_current     = -(WE_current_sense_voltage - V_VGND)/R_CURRSENSE;
+    //format as YAML
+    Serial.print(control_voltage, 6);
+    Serial.print(',');
+    Serial.print(WEtoRE_voltage, 6);
+    Serial.print(',');
+    Serial.print(WE_current, 6);
+    Serial.print('\n');
+    //while (Serial.read() != '\n'){};
+  }
+  Serial.println("#END VSWEEP");
+}
+
+//------------------------------------------------------------------------------
+//COMMAND HANDLER FUNCTIONS - called by the SCmd dispatcher
+
+void setControlVoltgeCommand(){
+    float control_voltage;
+    char *arg;
+    arg = SCmd.next();
+    if (arg != NULL)
+    {
+        control_voltage = atof(arg);
+        control_DAC.setVoltageOutput(V_REF - (control_voltage + V_VGND)); //shift to center-rail and invert
+    }
+    else
+    {
+        Serial.println("### Error: VCTRL requires 1 argument (float control_voltage) ###");
+    }
+}
+
+void doSweepCommand(){
+    char *arg;
+    arg = SCmd.next();
+    if (arg != NULL)
+    {
+        Serial.println("### Error: VSWEEP requires 0 arguments ###");
+    }
+    else
+    {
+       doSweep();
+    }
+}
+
+void unrecognizedCommand(const char *command)
+{
+    Serial.println("### Error: command not recognized ###");
+}


dedicated coil-pin 9 and 8

dedicated coil-pin 9 and 8

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/radionics/OpenSourceRadionics.git/'