Added a level sensor to test tilt using the MPU6050

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

--- CreatedCode/Arduino/LevelerSensor/LevelerSensor.ino
+++ CreatedCode/Arduino/LevelerSensor/LevelerSensor.ino
@@ -0,0 +1,348 @@
+// I2C device class (I2Cdev) demonstration Arduino sketch for MPU6050 class using DMP (MotionApps v2.0)
+// 6/21/2012 by Jeff Rowberg <jeff@rowberg.net>
+// Updates should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib
+
+// I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files
+// for both classes must be in the include path of your project
+#include "I2Cdev.h"
+
+#include "MPU6050_6Axis_MotionApps20.h"
+//#include "MPU6050.h" // not necessary if using MotionApps include file
+
+// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
+// is used in I2Cdev.h
+#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
+    #include "Wire.h"
+#endif
+
+// class default I2C address is 0x68
+// specific I2C addresses may be passed as a parameter here
+// AD0 low = 0x68 (default for SparkFun breakout and InvenSense evaluation board)
+// AD0 high = 0x69
+MPU6050 mpu;
+//MPU6050 mpu(0x69); // <-- use for AD0 high
+
+/* =========================================================================
+   NOTE: In addition to connection 3.3v, GND, SDA, and SCL, this sketch
+   depends on the MPU-6050's INT pin being connected to the Arduino's
+   external interrupt #0 pin. On the Arduino Uno and Mega 2560, this is
+   digital I/O pin 2.
+ * ========================================================================= */
+
+/* =========================================================================
+   NOTE: Arduino v1.0.1 with the Leonardo board generates a compile error
+   when using Serial.write(buf, len). The Teapot output uses this method.
+   The solution requires a modification to the Arduino USBAPI.h file, which
+   is fortunately simple, but annoying. This will be fixed in the next IDE
+   release. For more info, see these links:
+
+   http://arduino.cc/forum/index.php/topic,109987.0.html
+   http://code.google.com/p/arduino/issues/detail?id=958
+ * ========================================================================= */
+
+
+#define LED_PIN 13 // (Arduino is 13, Teensy is 11, Teensy++ is 6)
+#define calibrateCount 1250
+bool blinkState = false;
+int tilted = 12;    // Red LED
+int moving = 11;    // Yellow LED
+int level = 10;     // Green LED
+int count = 0;      // Counts to a number while calibrating sensor (10 secs)
+int refX, refY, refZ;     // Reference value after calibration
+int dx, dy, dz, tempx, tempy, tempz;
+int accelX, accelY, accelZ;
+bool setRef = false;      // false until reference values are set
+
+// MPU control/status vars
+bool dmpReady = false;  // set true if DMP init was successful
+uint8_t mpuIntStatus;   // holds actual interrupt status byte from MPU
+uint8_t devStatus;      // return status after each device operation (0 = success, !0 = error)
+uint16_t packetSize;    // expected DMP packet size (default is 42 bytes)
+uint16_t fifoCount;     // count of all bytes currently in FIFO
+uint8_t fifoBuffer[64]; // FIFO storage buffer
+
+// orientation/motion vars
+Quaternion q;           // [w, x, y, z]         quaternion container
+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
+VectorFloat gravity;    // [x, y, z]            gravity vector
+float euler[3];         // [psi, theta, phi]    Euler angle container
+float ypr[3];           // [yaw, pitch, roll]   yaw/pitch/roll container and gravity vector
+
+// packet structure for InvenSense teapot demo
+uint8_t teapotPacket[14] = { '$', 0x02, 0,0, 0,0, 0,0, 0,0, 0x00, 0x00, '\r', '\n' };
+
+
+
+// ================================================================
+// ===               INTERRUPT DETECTION ROUTINE                ===
+// ================================================================
+
+volatile bool mpuInterrupt = false;     // indicates whether MPU interrupt pin has gone high
+void dmpDataReady() {
+    mpuInterrupt = true;
+}
+
+
+
+// ================================================================
+// ===                      INITIAL SETUP                       ===
+// ================================================================
+
+void setup() {
+    // 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
+
+    // initialize serial communication
+    // (115200 chosen because it is required for Teapot Demo output, but it's
+    // really up to you depending on your project)
+    Serial.begin(57600);
+    while (!Serial); // wait for Leonardo enumeration, others continue immediately
+
+    // NOTE: 8MHz or slower host processors, like the Teensy @ 3.3v or Ardunio
+    // Pro Mini running at 3.3v, cannot handle this baud rate reliably due to
+    // the baud timing being too misaligned with processor ticks. You must use
+    // 38400 or slower in these cases, or use some kind of external separate
+    // crystal solution for the UART timer.
+
+    // initialize device
+    Serial.println(F("Initializing I2C devices..."));
+    mpu.initialize();
+
+    // verify connection
+    Serial.println(F("Testing device connections..."));
+    Serial.println(mpu.testConnection() ? F("MPU6050 connection successful") : F("MPU6050 connection failed"));
+
+    // wait for ready
+    Serial.println(F("\nSend any character to begin DMP programming and demo: "));
+    while (Serial.available() && Serial.read()); // empty buffer
+    Serial.write('j');
+    while (Serial.available() && Serial.read()); // empty buffer again
+
+    // load and configure the DMP
+    Serial.println(F("Initializing DMP..."));
+    devStatus = mpu.dmpInitialize();
+
+    // supply your own gyro offsets here, scaled for min sensitivity
+    mpu.setXGyroOffset(220);
+    mpu.setYGyroOffset(76);
+    mpu.setZGyroOffset(-85);
+    mpu.setZAccelOffset(1788); // 1688 factory default for my test chip
+
+    // make sure it worked (returns 0 if so)
+    if (devStatus == 0) {
+        // turn on the DMP, now that it's ready
+        Serial.println(F("Enabling DMP..."));
+        mpu.setDMPEnabled(true);
+
+        // enable Arduino interrupt detection
+        Serial.println(F("Enabling interrupt detection (Arduino external interrupt 0)..."));
+        attachInterrupt(0, dmpDataReady, RISING);
+        mpuIntStatus = mpu.getIntStatus();
+
+        // set our DMP Ready flag so the main loop() function knows it's okay to use it
+        Serial.println(F("DMP ready! Waiting for first interrupt..."));
+        dmpReady = true;
+
+        // get expected DMP packet size for later comparison
+        packetSize = mpu.dmpGetFIFOPacketSize();
+    } else {
+        // ERROR!
+        // 1 = initial memory load failed
+        // 2 = DMP configuration updates failed
+        // (if it's going to break, usually the code will be 1)
+        Serial.print(F("DMP Initialization failed (code "));
+        Serial.print(devStatus);
+        Serial.println(F(")"));
+    }
+
+    // configure LED for output
+    pinMode(LED_PIN, OUTPUT);
+    pinMode(tilted, OUTPUT);
+    pinMode(moving, OUTPUT);
+    pinMode(level, OUTPUT);
+}
+
+
+
+// ================================================================
+// ===                    MAIN PROGRAM LOOP                     ===
+// ================================================================
+
+void loop() {
+    // if programming failed, don't try to do anything
+    if (!dmpReady) return;
+
+    // wait for MPU interrupt or extra packet(s) available
+    while (!mpuInterrupt && fifoCount < packetSize) {
+        // other program behavior stuff here
+        // .
+        // .
+        // .
+        // if you are really paranoid you can frequently test in between other
+        // stuff to see if mpuInterrupt is true, and if so, "break;" from the
+        // while() loop to immediately process the MPU data
+        // .
+        // .
+        // .
+    }
+
+    // reset interrupt flag and get INT_STATUS byte
+    mpuInterrupt = false;
+    mpuIntStatus = mpu.getIntStatus();
+
+    // get current FIFO count
+    fifoCount = mpu.getFIFOCount();
+
+    // check for overflow (this should never happen unless our code is too inefficient)
+    if ((mpuIntStatus & 0x10) || fifoCount == 1024) {
+        // reset so we can continue cleanly
+        mpu.resetFIFO();
+        Serial.println(F("FIFO overflow!"));
+
+    // otherwise, check for DMP data ready interrupt (this should happen frequently)
+    } else if (mpuIntStatus & 0x02) {
+        // wait for correct available data length, should be a VERY short wait
+        while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount();
+
+        // read a packet from FIFO
+        mpu.getFIFOBytes(fifoBuffer, packetSize);
+
+        // track FIFO count here in case there is > 1 packet available
+        // (this lets us immediately read more without waiting for an interrupt)
+        fifoCount -= packetSize;
+
+
+            // display Euler angles in degrees
+            mpu.dmpGetQuaternion(&q, fifoBuffer);
+            mpu.dmpGetEuler(euler, &q);
+            int xDeg = euler[0] * 180/M_PI;
+            int yDeg = euler[1] * 180/M_PI;
+            int zDeg = euler[2] * 180/M_PI;
+            Serial.print("euler\t");
+            Serial.print(xDeg);
+            Serial.print("\t");
+            Serial.print(yDeg);
+            Serial.print("\t");
+            Serial.print(zDeg);
+            Serial.print("\t");
+
+            Serial.print("\tXRef: ");
+            Serial.print(refX);
+            Serial.print("\tYRef: ");
+            Serial.print(refY);
+            Serial.print("\tZRef: ");
+            Serial.print(refZ);
+            Serial.print("\tCount: ");
+            Serial.println(count);
+
+/*
+            // display real acceleration, adjusted to remove gravity
+            mpu.dmpGetQuaternion(&q, fifoBuffer);
+            mpu.dmpGetAccel(&aa, fifoBuffer);
+            mpu.dmpGetGravity(&gravity, &q);
+            mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
+            Serial.print("areal\t");
+            Serial.print(aaReal.x);
+            Serial.print("\t");
+            Serial.print(aaReal.y);
+            Serial.print("\t");
+            Serial.print(aaReal.z);
+            Serial.print("\t");
+
+            Serial.print("Count: ");
+            Serial.println(count);
+
+        // Set acceleration values here
+        dx = aaReal.x - tempx;
+        dy = ay - tempy;
+        dz = az - tempz;
+        dx = (dx/10);
+        int modx = dx%10;
+        dx = dx-modx;
+        dy = (dy/10);
+        int mody = dy%10;
+        dy = dy-mody;
+        dz = (dz/10);
+        int modz = dz%10;
+        dz = dz-modz;
+
+        tempx = ax;
+        tempy = ay;
+        tempz = az;
+ */
+        if(count < calibrateCount) {
+          count++;
+          if(count%100 < 50) {
+            digitalWrite(tilted, HIGH);
+            digitalWrite(moving, HIGH);
+            digitalWrite(level, HIGH);
+          } else {
+            digitalWrite(tilted, LOW);
+            digitalWrite(moving, LOW);
+            digitalWrite(level, LOW);
+          }
+        } else if (!setRef) {
+          // Play a speaker tone when calibrated for feedback?
+          refX = xDeg;
+          refY = yDeg;
+          refZ = zDeg;
+          digitalWrite(tilted, LOW);
+          digitalWrite(moving, LOW);
+          digitalWrite(level, LOW);
+          setRef = true;
+        } else {
+          //Test to see if moving here
+
+          if(abs(abs(xDeg)-abs(refX)) < 8 && abs(abs(zDeg)-abs(refZ)) < 8) {
+            digitalWrite(tilted, LOW);
+            digitalWrite(moving, LOW);
+            digitalWrite(level, HIGH);
+          } else {
+            digitalWrite(tilted, HIGH);
+            digitalWrite(moving, LOW);
+            digitalWrite(level, LOW);
+          }
+        }
+
+            /*
+             // display real acceleration, adjusted to remove gravity
+            mpu.dmpGetQuaternion(&q, fifoBuffer);
+            mpu.dmpGetAccel(&aa, fifoBuffer);
+            mpu.dmpGetGravity(&gravity, &q);
+            mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
+            Serial.print("areal\t");
+            Serial.print(aaReal.x);
+            Serial.print("\t");
+            Serial.print(aaReal.y);
+            Serial.print("\t");
+            Serial.println(aaReal.z);
+            */
+
+            /*
+            // display initial world-frame acceleration, adjusted to remove gravity
+            // and rotated based on known orientation from quaternion
+            mpu.dmpGetQuaternion(&q, fifoBuffer);
+            mpu.dmpGetAccel(&aa, fifoBuffer);
+            mpu.dmpGetGravity(&gravity, &q);
+            mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
+            mpu.dmpGetLinearAccelInWorld(&aaWorld, &aaReal, &q);
+            Serial.print("aworld\t");
+            Serial.print(aaWorld.x);
+            Serial.print("\t");
+            Serial.print(aaWorld.y);
+            Serial.print("\t");
+            Serial.println(aaWorld.z);
+            */
+
+        // blink LED to indicate activity
+        blinkState = !blinkState;
+        digitalWrite(LED_PIN, blinkState);
+    }
+}


remove debug blinks

remove debug blinks

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/dave-ausbone/TJU-SST.git/'


Using pulse in function

Using pulse in function

Using pulse in function. More accurate.

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


fixes to detectwater and pin declarations

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


Processing supported

Processing supported

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/WSPCrea/2017-aki-kada.git/'


Create simplemodbusslave.ino

Create simplemodbusslave.ino

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

--- simplemodbusslave.ino
+++ simplemodbusslave.ino
@@ -0,0 +1,120 @@
+#include <SimpleModbusSlave.h>
+
+/*
+   SimpleModbusSlaveV10 supports function 3, 6 & 16.
+
+   This example code will receive the adc ch0 value from the arduino master.
+   It will then use this value to adjust the brightness of the led on pin 9.
+   The value received from the master will be stored in address 1 in its own
+   address space namely holdingRegs[].
+
+   In addition to this the slaves own adc ch0 value will be stored in
+   address 0 in its own address space holdingRegs[] for the master to
+   be read. The master will use this value to alter the brightness of its
+   own led connected to pin 9.
+
+   The modbus_update() method updates the holdingRegs register array and checks
+   communication.
+
+   Note:
+   The Arduino serial ring buffer is 64 bytes or 32 registers.
+   Most of the time you will connect the arduino to a master via serial
+   using a MAX485 or similar.
+
+   In a function 3 request the master will attempt to read from your
+   slave and since 5 bytes is already used for ID, FUNCTION, NO OF BYTES
+   and two BYTES CRC the master can only request 58 bytes or 29 registers.
+
+   In a function 16 request the master will attempt to write to your
+   slave and since a 9 bytes is already used for ID, FUNCTION, ADDRESS,
+   NO OF REGISTERS, NO OF BYTES and two BYTES CRC the master can only write
+   54 bytes or 27 registers.
+
+   Using a USB to Serial converter the maximum bytes you can send is
+   limited to its internal buffer which differs between manufactures.
+*/
+#define baud 9600
+#define timeout 1000
+#define polling 200 // the scan rate
+#define retry_count 10
+
+// used to toggle the receive/transmit pin on the driver
+#define TxEnablePin 2
+#define  LED 9
+
+// Using the enum instruction allows for an easy method for adding and
+// removing registers. Doing it this way saves you #defining the size
+// of your slaves register array each time you want to add more registers
+// and at a glimpse informs you of your slaves register layout.
+
+//////////////// registers of your slave ///////////////////
+enum
+{
+  // just add or remove registers and your good to go...
+  // The first register starts at address 0
+  ADC_VAL,
+  PWM_VAL,
+  HOLDING_REGS_SIZE // leave this one
+  // total number of registers for function 3 and 16 share the same register array
+  // i.e. the same address space
+};
+
+unsigned int holdingRegs[HOLDING_REGS_SIZE]; // function 3 and 16 register array
+////////////////////////////////////////////////////////////
+
+void setup()
+{
+  /* parameters(HardwareSerial* SerialPort,
+                long baudrate,
+		unsigned char byteFormat,
+                unsigned char ID,
+                unsigned char transmit enable pin,
+                unsigned int holding registers size,
+                unsigned int* holding register array)
+  */
+
+  /* Valid modbus byte formats are:
+     SERIAL_8N2: 1 start bit, 8 data bits, 2 stop bits
+     SERIAL_8E1: 1 start bit, 8 data bits, 1 Even parity bit, 1 stop bit
+     SERIAL_8O1: 1 start bit, 8 data bits, 1 Odd parity bit, 1 stop bit
+
+     You can obviously use SERIAL_8N1 but this does not adhere to the
+     Modbus specifications. That said, I have tested the SERIAL_8N1 option
+     on various commercial masters and slaves that were suppose to adhere
+     to this specification and was always able to communicate... Go figure.
+
+     These byte formats are already defined in the Arduino global name space.
+  */
+
+  modbus_configure(&Serial, 115200, SERIAL_8N2, 1, 2, HOLDING_REGS_SIZE, holdingRegs);
+
+  // modbus_update_comms(baud, byteFormat, id) is not needed but allows for easy update of the
+  // port variables and slave id dynamically in any function.
+  modbus_update_comms(9600, SERIAL_8N2, 1);
+
+  pinMode(LED, OUTPUT);
+}
+
+void loop()
+{
+  // modbus_update() is the only method used in loop(). It returns the total error
+  // count since the slave started. You don't have to use it but it's useful
+  // for fault finding by the modbus master.
+
+  modbus_update();
+
+  holdingRegs[ADC_VAL] = analogRead(A0); // update data to be read by the master to adjust the PWM
+
+ analogWrite(LED, holdingRegs[1]); // constrain adc value from the arduino master to 255
+  //digitalWrite(LED,holdingRegs[PWM_VAL]);
+
+  /* Note:
+     The use of the enum instruction is not needed. You could set a maximum allowable
+     size for holdinRegs[] by defining HOLDING_REGS_SIZE using a constant and then access
+     holdingRegs[] by "Index" addressing.
+     I.e.
+     holdingRegs[0] = analogRead(A0);
+     analogWrite(LED, holdingRegs[1]/4);
+  */
+
+}


POST http client example (#2704)

POST http client example (#2704)

* POST http client example

* avoid deprecated api

* Update PostHttpClient.ino

style, comments

* Update PostHttpClient.ino

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

--- libraries/ESP8266HTTPClient/examples/PostHttpClient/PostHttpClient.ino
+++ libraries/ESP8266HTTPClient/examples/PostHttpClient/PostHttpClient.ino
@@ -0,0 +1,84 @@
+/**
+   PostHTTPClient.ino
+
+    Created on: 21.11.2016
+
+*/
+
+#include <ESP8266WiFi.h>
+#include <ESP8266HTTPClient.h>
+
+#define USE_SERIAL Serial
+
+/* this can be run with an emulated server on host:
+        cd esp8266-core-root-dir
+        cd tests/host
+        make ../../libraries/ESP8266WebServer/examples/PostServer/PostServer
+        bin/PostServer/PostServer
+   then put your PC's IP address in SERVER_IP below, port 9080 (instead of default 80):
+*/
+//#define SERVER_IP "10.0.1.7:9080" // PC address with emulation on host
+#define SERVER_IP "192.168.1.42"
+
+#ifndef STASSID
+#define STASSID "your-ssid"
+#define STAPSK  "your-password"
+#endif
+
+void setup() {
+
+  USE_SERIAL.begin(115200);
+
+  USE_SERIAL.println();
+  USE_SERIAL.println();
+  USE_SERIAL.println();
+
+  WiFi.begin(STASSID, STAPSK);
+
+  while (WiFi.status() != WL_CONNECTED) {
+    delay(500);
+    USE_SERIAL.print(".");
+  }
+  USE_SERIAL.println("");
+  USE_SERIAL.print("Connected! IP address: ");
+  USE_SERIAL.println(WiFi.localIP());
+
+}
+
+void loop() {
+  // wait for WiFi connection
+  if ((WiFi.status() == WL_CONNECTED)) {
+
+    WiFiClient client;
+    HTTPClient http;
+
+    USE_SERIAL.print("[HTTP] begin...\n");
+    // configure traged server and url
+    http.begin(client, "http://" SERVER_IP "/postplain/"); //HTTP
+    http.addHeader("Content-Type", "application/json");
+
+    USE_SERIAL.print("[HTTP] POST...\n");
+    // start connection and send HTTP header and body
+    int httpCode = http.POST("{\"hello\":\"world\"}");
+
+    // httpCode will be negative on error
+    if (httpCode > 0) {
+      // HTTP header has been send and Server response header has been handled
+      USE_SERIAL.printf("[HTTP] POST... code: %d\n", httpCode);
+
+      // file found at server
+      if (httpCode == HTTP_CODE_OK) {
+        const String& payload = http.getString();
+        USE_SERIAL.println("received payload:\n<<");
+        USE_SERIAL.println(payload);
+        USE_SERIAL.println(">>");
+      }
+    } else {
+      USE_SERIAL.printf("[HTTP] POST... failed, error: %s\n", http.errorToString(httpCode).c_str());
+    }
+
+    http.end();
+  }
+
+  delay(10000);
+}


controller writing to serial port

controller writing to serial port

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


Add STM32F103 Blue Pill example

Add STM32F103 Blue Pill example

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

--- examples/Boards_USB_Serial/Blue_Pill_STM32F103C8/Blue_Pill_STM32F103C8.ino
+++ examples/Boards_USB_Serial/Blue_Pill_STM32F103C8/Blue_Pill_STM32F103C8.ino
@@ -0,0 +1,47 @@
+/**************************************************************
+ * 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.
+ *
+ **************************************************************
+ * This example shows how to use ordinary Arduino Serial
+ * to connect your project to Blynk.
+ * Feel free to apply it to any other example. It's simple!
+ *
+ * Requires STM32duino: https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/Installation
+ *
+ **************************************************************
+ *            USB HOWTO: http://tiny.cc/BlynkUSB
+ **************************************************************/
+
+#define BLYNK_PRINT Serial2
+#include <BlynkSimpleStream.h>
+
+// You should get Auth Token in the Blynk App.
+// Go to the Project Settings (nut icon).
+char auth[] = "YourAuthToken";
+
+void setup()
+{
+  // Debug console
+  Serial2.begin(9600);
+
+  // Blynk will work through Serial
+  Serial.begin(9600);
+  Blynk.begin(auth, Serial);
+}
+
+void loop()
+{
+  Blynk.run();
+}
+


Create SHRUN.ino

Create SHRUN.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/TEAMarg/ID-15-Shadow-Runner.git/'


add neopixel, single frame read example

add neopixel, single frame read example

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

--- examples/DMXInputNeoPixel/DMXInputNeoPixel.ino
+++ examples/DMXInputNeoPixel/DMXInputNeoPixel.ino
@@ -0,0 +1,136 @@
+/**************************************************************************/
+/*!
+    @file     DMXInputTest.ino
+    @author   Claude Heintz
+    @license  BSD (see LXESP8266DMX LICENSE)
+    @copyright 2019 by Claude Heintz
+
+    Control Neo-Pixels with DMX input
+    Demonstrates single frame read using ESP8266DMX.isReceiving()
+
+    @section  HISTORY
+
+    v1.00 - First release
+*/
+/**************************************************************************/
+#include <LXESP8266UARTDMX.h>
+
+#include <Adafruit_NeoPixel.h>
+#ifdef __AVR__
+  #include <avr/power.h>
+#endif
+
+#define DIRECTION_PIN 4
+
+// data pin for NeoPixels
+#define PIN 14
+// NUM_OF_NEOPIXELS, max of 170/RGB or 128/RGBW
+#define NUM_OF_NEOPIXELS 12
+// LEDS_PER_NEOPIXEL, RGB = 3, RGBW = 4
+#define LEDS_PER_NEOPIXEL 3
+// see Adafruit NeoPixel Library for options to pass to Adafruit_NeoPixel constructor
+Adafruit_NeoPixel ring = Adafruit_NeoPixel(NUM_OF_NEOPIXELS, PIN, NEO_GRB + NEO_KHZ800);
+
+// min sometimes raises compile error. see https://github.com/esp8266/Arduino/issues/263 solution seems to be using _min
+const int total_pixels = _min(512, LEDS_PER_NEOPIXEL * NUM_OF_NEOPIXELS);
+byte pixels[NUM_OF_NEOPIXELS][LEDS_PER_NEOPIXEL];
+
+// flag for dmx data received
+int got_dmx = 0;
+
+void setup() {
+  pinMode(DIRECTION_PIN, OUTPUT);		// pin allows control of tranceiver chip direction
+  digitalWrite(DIRECTION_PIN, LOW);		// low is input
+
+  ESP8266DMX.setDataReceivedCallback(&gotDMXCallback);
+  delay(1000);        //avoid boot print??
+
+  ring.begin();
+  setPixel(0,255);   // initial power up indicator 1 red pixel
+  sendPixels();
+}
+
+
+// ***************** input callback function *************
+
+void gotDMXCallback(int slots) {
+  got_dmx = slots;
+}
+
+// ***************** DMX read single frame *************
+
+#define DMX_READ_TIMEOUT_COUNT 10000
+
+void readDMXFrame() {   // <- Attempt to read a single DMX frame
+  ESP8266DMX.startInput();
+
+  uint32_t t_o_ct = 0;  // timeout counter should wait no more than 2 frames of DMX
+                        // (? good value for limit)
+                        // --will delay animation if too long
+                        // --will prevent read if too short
+  while ( (got_dmx == 0 ) && (t_o_ct < DMX_READ_TIMEOUT_COUNT) ) {
+    t_o_ct++;
+    if ( ESP8266DMX.isReceiving() ) {       // if started to read packet, wait until done
+      t_o_ct = 0;                           // still timeout in case of DMX signal interruption
+      while ( ESP8266DMX.isReceiving() && (got_dmx == 0 ) && (t_o_ct < DMX_READ_TIMEOUT_COUNT) ) {
+        t_o_ct++;
+      }
+
+      t_o_ct = 0;
+    }   //<- receiving
+  }     //<- ! got_dmx || timeout
+
+  ESP8266DMX.stop();
+}
+
+
+// ***************** sends pixel buffer to ring *************
+
+void sendPixels() {
+  uint16_t r,g,b;
+  for (int p=0; p<NUM_OF_NEOPIXELS; p++) {
+    r = pixels[p][0];
+    g = pixels[p][1];
+    b = pixels[p][2];
+    r = (r*r)/255;    //gamma correct
+    g = (g*g)/255;
+    b = (b*b)/255;
+    if ( LEDS_PER_NEOPIXEL == 3 ) {
+    	ring.setPixelColor(p, r, g, b);		//RGB
+    } else if ( LEDS_PER_NEOPIXEL == 4 ) {
+    	uint16_t w = pixels[p][3];
+    	w = (w*w)/255;
+    	ring.setPixelColor(p, r, g, b, w);	//RGBW
+    }
+  }
+  ring.show();
+}
+
+// ***************** set the dmx value in the pixel buffer *************
+
+void setPixel(uint16_t index, uint8_t value) {
+  uint8_t pixel = index/LEDS_PER_NEOPIXEL;
+  uint8_t color = index%LEDS_PER_NEOPIXEL;
+  pixels[pixel][color] = value;
+}
+
+/************************************************************************
+
+  The main loop tries to read a single DMX frame
+  It then checks to see if slots were read (got_dmx>0)
+  If so, it sends the values to the NEoPixels
+
+*************************************************************************/
+
+void loop() {
+  readDMXFrame();
+
+  if ( got_dmx ) {
+    for (int i=0; i<total_pixels; i++) {
+    	setPixel(i, ESP8266DMX.getSlot(i+1));
+    }
+    sendPixels();
+    got_dmx = 0;
+  }
+
+}


Arduino script to time a run

Arduino script to time a run

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

--- quick_release.ino
+++ quick_release.ino
@@ -0,0 +1,100 @@
+/*  quick_release
+    Control a quick release data acquisition run
+    communicate over serial to start a run, taking as inputs
+     - pre-delay (time to wait before changing length)
+     - step-to-exposure delay
+     - exposure duration
+     - post-exposure time before length is reset
+    Created by CDW on 2014.12.02
+*/
+
+
+// Timing variables
+const int PREDELAY  = 100;    // in ms
+const int STEPDELAY = 10;     // in µs
+const int EXPOSUREDUR = 100;  // in µs
+const int POSTEXPOSURE = 100; // in ms
+
+// Non-global variable declaration
+int stepdelay = STEPDELAY;
+bool run_now = false;
+
+// Pin configuration
+int LEN_OUT    = 2; // to length controller
+int LEN_LED    = 3;
+int SHUT_OUT   = 4; // to quick shutter
+int SHUT_LED   = 5;
+int EXPOSE_OUT = 6; // to exposure trigger
+int EXPOSE_LED = 7;
+
+// Begin setup of board
+void setup()
+{
+    // Initialize serial interface
+    Serial.begin(115200); // Start serial connection
+    while (!Serial) {
+        ; // wait for serial (for Leonardo only)
+    }
+    Serial.println("Hi"); // Demonstrate serial connection
+    // Set pin modes
+    pinMode(LEN_OUT, OUTPUT);
+    pinMode(LEN_LED, OUTPUT);
+    pinMode(SHUT_OUT, OUTPUT);
+    pinMode(SHUT_LED, OUTPUT);
+    pinMode(EXPOSE_OUT, OUTPUT);
+    pinMode(EXPOSE_LED, OUTPUT);
+    // Initial pin states
+    digitalWrite(LEN_OUT, LOW);
+    digitalWrite(LEN_LED, LOW);
+    digitalWrite(SHUT_OUT, LOW);
+    digitalWrite(SHUT_LED, LOW);
+    digitalWrite(EXPOSE_OUT, LOW);
+    digitalWrite(EXPOSE_LED, LOW);
+    // Close out setup
+    Serial.println("Setup complete");
+}
+
+// Loop through
+void loop()
+{
+    check_serial(); // read input if it exists
+    if (run_now) {
+        run(PREDELAY, stepdelay, EXPOSUREDUR, POSTEXPOSURE);
+        Serial.println("Run complete"); // tag that we've done a run
+        run_now = false; // reset the run flag
+    }
+}
+
+// Read data from serial, just the step-to-exposure delay
+void check_serial()
+{
+    if(Serial.available() >= 2) {      // only when something is available
+        stepdelay = Serial.parseInt(); // first int is delay
+        Serial.println(stepdelay);     // echo back as sanity check
+        char ending = (char)Serial.read();
+        if (ending == '\n') {          // ignore out-of-format commands
+            run_now = true;
+        }
+    }
+}
+
+// Control a run
+void run(int predelay, int stepdelay, int exposureduration, int postexposure)
+{
+    delay(predelay);
+    digitalWrite(SHUT_OUT, HIGH); // shutter opened before step delay
+    digitalWrite(SHUT_LED, HIGH); // may open during pre-delay in future
+    digitalWrite(LEN_OUT, HIGH);
+    digitalWrite(LEN_LED, HIGH);
+    delayMicroseconds(stepdelay);
+    digitalWrite(EXPOSE_OUT, HIGH);
+    digitalWrite(EXPOSE_LED, HIGH);
+    delayMicroseconds(exposureduration);
+    digitalWrite(EXPOSE_OUT, LOW);
+    digitalWrite(EXPOSE_LED, LOW);
+    digitalWrite(SHUT_OUT, LOW);
+    digitalWrite(SHUT_LED, LOW);
+    delay(postexposure);
+    digitalWrite(LEN_OUT, LOW);
+    digitalWrite(LEN_LED, LOW);
+}


new file for main app code

new file for main app code

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

--- Turnstyle/Turnstyle.ino
+++ Turnstyle/Turnstyle.ino
@@ -0,0 +1,107 @@
+#include <CurieIMU.h>
+#include <MadgwickAHRS.h>
+#include <NewPing.h>
+
+// ULTRASONIC
+#define TRIGGER_PIN_1  12  // Arduino pin tied to trigger pin on the ultrasonic sensor.
+#define ECHO_PIN_1     11  // Arduino pin tied to echo pin on the ultrasonic sensor.
+#define TRIGGER_PIN_2  10  // Arduino pin tied to trigger pin on the ultrasonic sensor.
+#define ECHO_PIN_2     9  // Arduino pin tied to echo pin on the ultrasonic sensor.
+
+#define DETECTION_THRESH 50 // Distance cutoff for passing
+#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
+
+NewPing sonar_1(TRIGGER_PIN_1, ECHO_PIN_1, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
+NewPing sonar_2(TRIGGER_PIN_2, ECHO_PIN_2, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
+
+// MADGEWICK
+Madgwick filter;
+unsigned long microsPerReading, microsPrevious;
+float accelScale, gyroScale;
+
+// SETUP
+void setup() {
+  Serial.begin(9600);
+
+  // start the IMU and filter
+  CurieIMU.begin();
+  CurieIMU.setGyroRate(25);
+  CurieIMU.setAccelerometerRate(25);
+  filter.begin(25);
+
+  // Set the accelerometer range to 2G
+  CurieIMU.setAccelerometerRange(2);
+  // Set the gyroscope range to 250 degrees/second
+  CurieIMU.setGyroRange(250);
+
+  // initialize variables to pace updates to correct rate
+  microsPerReading = 1000000 / 25;
+  microsPrevious = micros();
+}
+
+void loop() {
+  int aix, aiy, aiz;
+  int gix, giy, giz;
+  float ax, ay, az;
+  float gx, gy, gz;
+  float doorAngle;
+  int ping_1, ping_2;
+  unsigned long microsNow;
+
+  // check if it's time to read data and update the filter
+  microsNow = micros();
+  if (microsNow - microsPrevious >= microsPerReading) {
+
+    // read raw data from CurieIMU
+    CurieIMU.readMotionSensor(aix, aiy, aiz, gix, giy, giz);
+
+    // convert from raw data to gravity and degrees/second units
+    ax = convertRawAcceleration(aix);
+    ay = convertRawAcceleration(aiy);
+    az = convertRawAcceleration(aiz);
+    gx = convertRawGyro(gix);
+    gy = convertRawGyro(giy);
+    gz = convertRawGyro(giz);
+
+    // update the filter, which computes orientation
+    filter.updateIMU(gx, gy, gz, ax, ay, az);
+
+    // print the heading, pitch and roll
+    doorAngle = filter.getYaw();
+    Serial.print("Door Angle: ");
+    Serial.println(doorAngle);
+
+    ping_1 = sonar_1.ping_cm();
+    ping_2 = sonar_2.ping_cm();
+    printpings(ping_1, ping_2);
+
+    // increment previous time, so we keep proper pace
+    microsPrevious = microsPrevious + microsPerReading;
+  }
+}
+
+float convertRawAcceleration(int aRaw) {
+  // since we are using 2G range
+  // -2g maps to a raw value of -32768
+  // +2g maps to a raw value of 32767
+
+  float a = (aRaw * 2.0) / 32768.0;
+  return a;
+}
+
+float convertRawGyro(int gRaw) {
+  // since we are using 250 degrees/seconds range
+  // -250 maps to a raw value of -32768
+  // +250 maps to a raw value of 32767
+
+  float g = (gRaw * 250.0) / 32768.0;
+  return g;
+}
+
+void printpings(int ping_1, int ping_2) {
+  Serial.print("Ping 1: ");
+  Serial.print(ping_1); // Send ping, get distance in cm and print result (0 = outside set distance range)
+  Serial.print(" cm | Ping 2: ");
+  Serial.print(ping_2); // Send ping, get distance in cm and print result (0 = outside set distance range)
+  Serial.println(" cm");
+}


add Catch Unit example

add Catch Unit example

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

--- examples/Unit/CATCH/CATCH.ino
+++ examples/Unit/CATCH/CATCH.ino
@@ -0,0 +1,32 @@
+/*
+    Description: Control Catch Unit through PWM.
+*/
+
+#include <M5Stack.h>
+
+const int servoPin = 26;
+int freq = 50;
+int ledChannel = 0;
+int resolution = 10;
+void setup() {
+  // put your setup code here, to run once:
+  M5.begin();
+  M5.Power.begin();
+  M5.Lcd.setCursor(100, 50, 4);
+  M5.Lcd.println("Catch Unit");
+  M5.Lcd.setCursor(40, 120, 4);
+  M5.Lcd.println("Connect to the Port B");
+  ledcSetup(ledChannel, freq, resolution);
+  ledcAttachPin(servoPin, ledChannel);
+}
+
+void loop() {
+  // High level 0.5ms is angle 0°
+  // duty = 0.5/20ms = 0.025, 0.025*1023≈25
+    ledcWrite(ledChannel, 25);
+    delay(2000);
+  // High level 1ms is angle 45°
+  // duty = 1/20ms = 0.05, 0.05*1023≈50
+    ledcWrite(ledChannel, 50);
+    delay(2000);
+}