Add programm to control AK60-6 motor

Add programm to control AK60-6 motor

error: pathspec 'Arduino/AK60-6/AK60-6.ino' did not match any file(s) known to git

--- Arduino/AK60-6/AK60-6.ino
+++ Arduino/AK60-6/AK60-6.ino
@@ -0,0 +1,201 @@
+#include <CAN.h>
+#include <ServoInput.h> // github.com/dmadison/ServoInput
+
+
+int tab[8];
+int8_t myIndex;
+int packetSize;
+// limit data to be within bounds
+float P_MIN = -12.5;
+float P_MAX = 12.5 ;
+float V_MIN = -41.87;
+float V_MAX = 41.87;
+float T_MIN = -9;
+float T_MAX = 9;
+float Kp_MIN = 0;
+float Kp_MAX = 500;
+float Kd_MIN = 0;
+float Kd_MAX = 5;
+float Test_Pos = 0.0;
+
+ float pos = 0;
+ServoInputPin<6> servo;
+void setup() {
+  Serial.begin(9600);
+  //while (!Serial);
+  delay(3000);
+
+  Serial.println("CAN Sender");
+
+  // start the CAN bus at 500 kbps
+  if (!CAN.begin(1000E3)) {
+    Serial.println("Starting CAN failed!");
+    while (1);
+  }
+
+  setMotormode(0x01);
+  setZero(0x01);
+  //exitMotormode(0x01);
+}
+
+float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
+{
+  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
+}
+
+void loop() {
+  float angle = servo.getAngle();  // get angle of servo (0 - 180)
+
+
+  pos = mapfloat(angle, 0, 180, P_MIN, P_MAX);
+  Serial.println(pos);
+  setCommand(0x01, pos, 0.0, 3, 1, 0*pos);
+  readCAN();
+  delay(100);
+  //
+}
+
+int setMotormode(int id){
+
+  CAN.beginPacket(id);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFC);
+
+  CAN.endPacket();
+
+  return 1;
+}
+
+int exitMotormode(int id){
+  CAN.beginPacket(id);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFD);
+
+  CAN.endPacket();
+  return 1;
+}
+
+int setZero(int id){
+  CAN.beginPacket(id);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFF);
+  CAN.write(0xFE);
+
+  CAN.endPacket();
+  return 1;
+}
+
+void setCommand(int id, float p_des, float v_des, float kp, float kd, float t_ff)
+{
+
+
+  p_des = fminf(fmaxf(P_MIN, p_des), P_MAX);
+  v_des = fminf(fmaxf(V_MIN, v_des), V_MAX);
+  kp = fminf(fmaxf(Kp_MIN, kp), Kp_MAX);
+  kd = fminf(fmaxf(Kd_MIN, kd), Kd_MAX);
+  t_ff=fminf(fmaxf(T_MIN, t_ff), T_MAX);
+
+//convert float to unsigned ints
+  int p_int = float_to_uint(p_des, P_MIN, P_MAX, 16);
+  int v_int = float_to_uint(v_des,V_MIN, V_MAX, 12);
+  int kp_int = float_to_uint(kp, Kp_MIN, Kp_MAX, 12);
+  int kd_int = float_to_uint(kd, Kd_MIN, Kd_MAX, 12);
+  int t_int = float_to_uint(t_ff, T_MIN, T_MAX, 12);
+
+  // send to CAN bus
+
+  CAN.beginPacket(id);
+  CAN.write(p_int>>8);
+  CAN.write(p_int&0xFF);
+  CAN.write(v_int>>4);
+  CAN.write(((v_int&0xF)<<4)|(kp_int>>8));
+  CAN.write(kp_int&0xFF);
+  CAN.write(kd_int>>4);
+  CAN.write(((kd_int&0xF)<<4)|(t_int>>8));
+  CAN.write(t_int&0xff);
+
+  CAN.endPacket();
+
+}
+
+
+int float_to_uint(float x, float x_min, float x_max, unsigned int bits)
+{
+  // Converts a float to an unsigned int, given range and number of bits
+  float span = x_max - x_min;
+  if (x<x_min)
+  {
+    x= x_min;
+  }
+  else if (x>x_max)
+  {
+    x = x_max;
+    }
+  return (int) ((x-x_min)*((float)((1<<bits)-1)/span));
+}
+
+void readCAN()
+{
+  int packetSize = CAN.parsePacket();
+
+  if (packetSize)
+  {
+    myIndex = 0;
+      while (CAN.available())
+      {
+        tab[myIndex]=(CAN.read());
+        myIndex++;
+      }
+      getData(tab);
+  }
+}
+
+void getData(int tab[8])
+{
+
+  int id = tab[0];
+  int p_int = tab[1]<<8|tab[2];
+  int v_int = (tab[3]<<4)|(tab[4]>>4);
+  int i_int = ((tab[4]&0xF)<<8)|tab[5];
+
+  float p = uint_to_float(p_int, P_MIN, P_MAX, 16);
+  float v = uint_to_float(v_int, V_MIN, V_MAX, 12);
+  float i = uint_to_float(i_int, -T_MAX, T_MAX, 12);
+  if (id==1)
+  {
+   float position = p;
+
+   float speed = v;
+   float torque = i;
+   Serial.print(position);
+   Serial.print("rad ");
+   Serial.print(speed);
+   Serial.print("rad/s ");
+   Serial.print(torque);
+   Serial.println("A");
+   }
+ }
+
+float uint_to_float(int x_int, float x_min, float x_max, int bits)
+{
+  float span = x_max - x_min;
+  float offset = x_min;
+  return ((float)x_int)*span/((float)((1<<bits)-1)) + offset;
+}


adds esp digital out example

adds esp digital out example

error: pathspec 'esp8266/digital-out/digital-out.ino' did not match any file(s) known to git

--- esp8266/digital-out/digital-out.ino
+++ esp8266/digital-out/digital-out.ino
@@ -0,0 +1,163 @@
+/***************************************************
+  Adafruit MQTT Library ESP8266 Example
+
+  Must use ESP8266 Arduino from:
+    https://github.com/esp8266/Arduino
+
+  Works great with Adafruit's Huzzah ESP board:
+  ----> https://www.adafruit.com/product/2471
+  Adafruit invests time and resources providing this open source code,
+  please support Adafruit and open-source hardware by purchasing
+  products from Adafruit!
+
+  Written by Tony DiCola for Adafruit Industries.
+  Adafruit IO example additions by Todd Treece.
+  MIT license, all text above must be included in any redistribution
+ ****************************************************/
+#include <ESP8266WiFi.h>
+#include "Adafruit_MQTT.h"
+#include "Adafruit_MQTT_Client.h"
+
+/****************************** Pins ******************************************/
+
+#define LAMP            2  // power switch tail
+
+/************************* WiFi Access Point *********************************/
+
+#define WLAN_SSID       "...your SSID..."
+#define WLAN_PASS       "...your password..."
+
+/************************* Adafruit.io Setup *********************************/
+
+#define AIO_SERVER      "io.adafruit.com"
+#define AIO_SERVERPORT  1883
+#define AIO_USERNAME    "...your AIO username (see https://accounts.adafruit.com)..."
+#define AIO_KEY         "...your AIO key..."
+
+/************ Global State (you don't need to change this!) ******************/
+
+// Create an ESP8266 WiFiClient class to connect to the MQTT server.
+WiFiClient client;
+
+// Store the MQTT server, client ID, username, and password in flash memory.
+// This is required for using the Adafruit MQTT library.
+const char MQTT_SERVER[] PROGMEM    = AIO_SERVER;
+// Set a unique MQTT client ID using the AIO key + the date and time the sketch
+// was compiled (so this should be unique across multiple devices for a user,
+// alternatively you can manually set this to a GUID or other random value).
+const char MQTT_CLIENTID[] PROGMEM  = AIO_KEY __DATE__ __TIME__;
+const char MQTT_USERNAME[] PROGMEM  = AIO_USERNAME;
+const char MQTT_PASSWORD[] PROGMEM  = AIO_KEY;
+
+// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
+Adafruit_MQTT_Client mqtt(&client, MQTT_SERVER, AIO_SERVERPORT, MQTT_CLIENTID, MQTT_USERNAME, MQTT_PASSWORD);
+
+/****************************** Feeds ***************************************/
+
+// Setup a feed called 'lamp' for subscribing to changes.
+// Notice MQTT paths for AIO follow the form: <username>/feeds/<feedname>
+const char LAMP_FEED[] PROGMEM = AIO_USERNAME "/feeds/lamp";
+Adafruit_MQTT_Subscribe lamp = Adafruit_MQTT_Subscribe(&mqtt, LAMP_FEED);
+
+/*************************** Sketch Code ************************************/
+
+void setup() {
+
+  // set power switch tail pin as an output
+  pinMode(LAMP, OUTPUT);
+
+  Serial.begin(115200);
+
+  Serial.println(F("Adafruit IO Example:"));
+  Serial.print(F("Free RAM: ")); Serial.println(getFreeRam(), DEC);
+
+  // Connect to WiFi access point.
+  Serial.println(); Serial.println();
+  delay(10);
+  Serial.print(F("Connecting to "));
+  Serial.println(WLAN_SSID);
+
+  WiFi.begin(WLAN_SSID, WLAN_PASS);
+  while (WiFi.status() != WL_CONNECTED) {
+    delay(500);
+    Serial.print(F("."));
+  }
+  Serial.println();
+
+  Serial.println(F("WiFi connected"));
+  Serial.println(F("IP address: "));
+  Serial.println(WiFi.localIP());
+
+  // listen for events on the lamp feed
+  mqtt.subscribe(&lamp);
+
+  // connect to adafruit io
+  connect();
+
+}
+
+void loop() {
+
+  Adafruit_MQTT_Subscribe *subscription;
+
+  // Make sure to reset watchdog every loop iteration!
+  Watchdog.reset();
+
+  // ping adafruit io a few times to make sure we remain connected
+  if(! mqtt.ping(3)) {
+    // reconnect to adafruit io
+    if(! mqtt.connected())
+      connect();
+  }
+
+  // this is our 'wait for incoming subscription packets' busy subloop
+  while (subscription = mqtt.readSubscription(1000)) {
+
+    // we only care about the lamp events
+    if (subscription == &lamp) {
+
+      // convert mqtt ascii payload to int
+      char *value = lamp.lastread;
+      Serial.print(F("Received: "));
+      Serial.println(value);
+      int current = atoi(value);
+
+      // write the current state to the power switch tail
+      digitalWrite(LAMP, current == 1 ? HIGH : LOW);
+
+    }
+
+  }
+
+}
+
+// connect to adafruit io via MQTT
+void connect() {
+
+  Serial.print(F("Connecting to Adafruit IO... "));
+
+  int8_t ret;
+
+  while ((ret = mqtt.connect()) != 0) {
+
+    switch (ret) {
+      case 1: Serial.println(F("Wrong protocol")); break;
+      case 2: Serial.println(F("ID rejected")); break;
+      case 3: Serial.println(F("Server unavail")); break;
+      case 4: Serial.println(F("Bad user/pass")); break;
+      case 5: Serial.println(F("Not authed")); break;
+      case 6: Serial.println(F("Failed to subscribe")); break;
+      default: Serial.println(F("Connection failed")); break;
+    }
+
+    if(ret >= 0)
+      mqtt.disconnect();
+
+    Serial.println(F("Retrying connection..."));
+    delay(5000);
+
+  }
+
+  Serial.println(F("Adafruit IO Connected!"));
+
+}


modified to read 4ch upon dPIN8=LOW and 1ch upon dPIN8=HIGH - rate rx will be changed depending on verification test

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/reynal74/sensor_projects.git/'


New file MicroGirs.ino.

New file MicroGirs.ino.

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

--- examples/MicroGirs/MicroGirs.ino
+++ examples/MicroGirs/MicroGirs.ino
@@ -0,0 +1,312 @@
+/*
+This is a minimalistic Girs server (http://harctoolbox.org/Girs.html).
+It only depends on (a subset of) IRremote
+(https://github.com/z3t0/Arduino-IRremote), It can be used with
+IrScrutinizer (Sending/Capturing hw = Girs Client) and Lirc 0.9.4 and
+later (driver girs http://lirc.org/html/girs.html).  (Authors of
+similar software are encourage to implement support.)
+
+It consists of an interacive IR server, taking one-line commands from
+the "user" (which is typically not a person but another program), and
+responds with a one-line response. In the language of the Girs
+specifications, the modules "base", receive, and transmit are
+implemented. (The two latter can be disabled by not defining two
+corresponding CPP symbols.)
+
+It understands the following commands:
+
+* The "version" command returns the program name and version,
+* The "modules" command returns the modules implemented, normally base, receive and transmit.
+* The "receve" command reads an IR signal using the deployed sensor.
+* The "send" commands transmits a supplied raw signal the requested number of times.
+
+Only the first character of the command is evaluated in this implementation.
+
+The "receive" command returns the received IR sequence as a sequence
+of durations, including a (dummy) trailing silence.  On-periods
+("marks", "flashes") are prefixed by "+", while off-periods ("spaces",
+"gaps") are prefixed by "-". The present version never times out.
+
+The "send" command takes the following parameters:
+
+      send noSends frequencyHz introLength repeatLength endingLength durations...
+
+      where
+
+* frequencyHz denotes the modulation frequency in Hz
+  (NOT khz, as is commonly used in IRremote)
+* introLength denotes the length of the intro sequence, must be even,
+* repeatLength denotes the length of the repeat sequence, must be even,
+* endingLength denotes the length of the ending sequence (normally 0), must be even.
+* duration... denotes the microsecond durations to send,
+  starting with the first on-period, ending with a (possibly dummy) trailing silence
+
+Semantics: first the intro sequence will be sent once (i.e., the first
+repeatLength durations) (if non-empty).  Then the repeat sequence will
+be sent (noSends-1) times, unless the intro sequence was empty, in
+which case it will be send noSends times.  Finally, the ending
+sequence will be send once (if non-empty).
+
+Weaknesses of the IRremote implementation:
+* Reception never times out.
+* The IRrecv class does its own decoding which is irrelevant for us. It cannot be disabled.
+* The timeout at the end on a signal reception is not configurable.
+  For example, a NEC1 type signal will cut after the intro sequence,
+  and the repeats will be considered independent signals.
+* IR reception cannot be turned of.
+* The size of the data is platform dependent (unsigned int).
+*/
+
+#include <IRremote.h>
+#include <limits.h>
+
+// Define the ones that should be enabled
+#define RECEIVE
+#define TRANSMIT
+
+// Change the following if desired
+
+// Pin used by the receiver
+#define INPUTPIN 11
+
+// (The sending pin is in general not configurable, see the documentation of IRremote.)
+
+// Character that ends the command lines. Do not change unless you known what
+// you are doing. IrScrutinizer and Lirc expects \r.
+#define EOLCHAR '\r'
+
+// Baud rate for the serial/USB connection.
+// 115200 is the default for IrScrutinizer and Lirc.
+#define BAUDRATE 115200
+
+////// End of user configurable variables ////////////////////
+
+#define modulesSupported "base transmit receive"
+#ifndef PROGNAME
+#define PROGNAME "MicroGirs"
+#endif
+#ifndef VERSION
+#define VERSION "2017-04-23"
+#endif
+#define okString "OK"
+#define errorString "ERROR"
+#define timeoutString "."
+
+// For compatibility with IRremote, we deliberately use
+// the platform dependent types.
+typedef unsigned frequency_t;
+typedef unsigned microseconds_t;
+
+static const microseconds_t DUMMYENDING = 40000U;
+static const frequency_t FREQUENCY_T_MAX = UINT16_MAX;
+static const frequency_t MICROSECONDS_T_MAX = UINT16_MAX;
+
+#ifdef RECEIVE
+IRrecv irRecv(INPUTPIN);
+#endif
+#ifdef TRANSMIT
+IRsend irSend;
+#endif
+
+///////// Tokenizer class. Breaks the command line into tokens. //////
+class Tokenizer {
+private:
+    static const int invalidIndex = -1;
+
+    int index; // signed since invalidIndex is possible
+    const String& payload;
+    void trim();
+
+public:
+    Tokenizer(const String &str);
+    virtual ~Tokenizer();
+
+    String getToken();
+    String getRest();
+    String getLine();
+    long getInt();
+    microseconds_t getMicroseconds();
+    frequency_t getFrequency();
+
+    static const int invalid = INT_MAX;
+};
+
+Tokenizer::Tokenizer(const String& str) : index(0), payload(str) {
+}
+
+Tokenizer::~Tokenizer() {
+}
+
+String Tokenizer::getRest() {
+    String result = index == invalidIndex ? String("") : payload.substring(index);
+    index = invalidIndex;
+    return result;
+}
+
+String Tokenizer::getLine() {
+    if (index == invalidIndex)
+        return String("");
+
+    int i = payload.indexOf('\n', index);
+    String s = (i > 0) ? payload.substring(index, i) : payload.substring(index);
+    index = (i > 0) ? i+1 : invalidIndex;
+    return s;
+}
+
+String Tokenizer::getToken() {
+    if (index < 0)
+        return String("");
+
+    int i = payload.indexOf(' ', index);
+    String s = (i > 0) ? payload.substring(index, i) : payload.substring(index);
+    index = (i > 0) ? i : invalidIndex;
+    if (index != invalidIndex)
+    if (index != invalidIndex)
+        while (payload.charAt(index) == ' ')
+            index++;
+    return s;
+}
+
+long Tokenizer::getInt() {
+    String token = getToken();
+    return token == "" ? (long) invalid : token.toInt();
+}
+
+microseconds_t Tokenizer::getMicroseconds() {
+    long t = getToken().toInt();
+    return (microseconds_t) ((t < MICROSECONDS_T_MAX) ? t : MICROSECONDS_T_MAX);
+}
+
+frequency_t Tokenizer::getFrequency() {
+    long t = getToken().toInt();
+    return (frequency_t) ((t < FREQUENCY_T_MAX) ? t : FREQUENCY_T_MAX);
+}
+///////////////// end Tokenizer /////////////////////////////////
+
+#ifdef TRANSMIT
+static inline unsigned hz2khz(frequency_t hz) {
+    return (hz + 500)/1000;
+}
+
+static void sendRaw(const microseconds_t intro[], unsigned lengthIntro,
+        const microseconds_t repeat[], unsigned lengthRepeat,
+        const microseconds_t ending[], unsigned lengthEnding,
+        frequency_t frequency, unsigned times) {
+    if (lengthIntro > 0U)
+        irSend.sendRaw(intro, lengthIntro, hz2khz(frequency));
+    if (lengthRepeat > 0U)
+        for (unsigned i = 0U; i < times - (lengthIntro > 0U); i++)
+            irSend.sendRaw(repeat, lengthRepeat, hz2khz(frequency));
+    if (lengthEnding > 0U)
+        irSend.sendRaw(ending, lengthEnding, hz2khz(frequency));
+}
+#endif // TRANSMIT
+
+#ifdef RECEIVE
+static void receive(Stream& stream) {
+    irRecv.resume(); // Receive the next value
+
+    decode_results results;
+    while (!irRecv.decode(&results)) {
+    }
+
+    dump(stream, &results);
+}
+
+static void dump(Stream& stream, decode_results* results) {
+    unsigned int count = results->rawlen;
+    for (unsigned int i = 1; i < count; i++) {
+        stream.write(i & 1 ? '+' : '-');
+        stream.print(results->rawbuf[i] * USECPERTICK, DEC);
+        stream.print(" ");
+    }
+    stream.print('-');
+    stream.println(DUMMYENDING);
+}
+#endif // RECEIVE
+
+void setup() {
+    Serial.begin(BAUDRATE);
+    while (!Serial)
+        ; // wait for serial port to connect. "Needed for Leonardo only"
+
+    Serial.println(F(PROGNAME " " VERSION));
+    //Serial.setTimeout(SERIALTIMEOUT);
+#ifdef RECEIVE
+    // There is unfortunately no disableIRIn in IRremote.
+    // Therefore, turn it on, and leave it on.
+    // We _hope_ that it will not interfere with sending.
+    irRecv.enableIRIn();
+#endif
+}
+
+
+static String readCommand(Stream& stream) {
+    while (stream.available() == 0) {
+    }
+
+    String line = stream.readStringUntil(EOLCHAR);
+    line.trim();
+    return line;
+}
+
+static void processCommand(const String& line, Stream& stream) {
+    Tokenizer tokenizer(line);
+    String cmd = tokenizer.getToken();
+
+    // Decode the command in cmd
+    if (cmd.length() == 0) {
+        // empty command, do nothing
+        stream.println(F(okString));
+        return;
+    }
+
+    switch (cmd[0]) {
+        case 'm':
+            stream.println(F(modulesSupported));
+            break;
+
+#ifdef RECEIVE
+        case 'r': // receive
+        case 'a':
+        case 'c':
+            receive(stream);
+            break;
+#endif // RECEIVE
+
+#ifdef TRANSMIT
+        case 's': // send
+        {
+            // TODO: handle unparsable data gracefully
+            unsigned noSends = (unsigned) tokenizer.getInt();
+            frequency_t frequency = tokenizer.getFrequency();
+            unsigned introLength = (unsigned) tokenizer.getInt();
+            unsigned repeatLength = (unsigned) tokenizer.getInt();
+            unsigned endingLength = (unsigned) tokenizer.getInt();
+            microseconds_t intro[introLength];
+            microseconds_t repeat[repeatLength];
+            microseconds_t ending[endingLength];
+            for (unsigned i = 0; i < introLength; i++)
+                intro[i] = tokenizer.getMicroseconds();
+            for (unsigned i = 0; i < repeatLength; i++)
+                repeat[i] = tokenizer.getMicroseconds();
+            for (unsigned i = 0; i < endingLength; i++)
+                ending[i] = tokenizer.getMicroseconds();
+            sendRaw(intro, introLength, repeat, repeatLength, ending, endingLength, frequency, noSends);
+            stream.println(F(okString));
+        }
+            break;
+#endif // TRANSMIT
+
+        case 'v': // version
+            stream.println(F(PROGNAME " " VERSION));
+            break;
+        default:
+            stream.println(F(errorString));
+    }
+}
+
+void loop() {
+    String line = readCommand(Serial);
+    processCommand(line, Serial);
+}


Arduino File.

Arduino File.

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

--- monitor_client/monitor_client.ino
+++ monitor_client/monitor_client.ino
@@ -0,0 +1,44 @@
+#include <sim900_Suli.h>
+#include <SoftwareSerial.h>
+#include <Wire.h>
+#include "Suli.h"
+#include "DHT11.h"
+#define DHT11PIN 2
+const int pin_tx = 7;
+const int pin_rx = 8;
+SoftwareSerial gprs(pin_tx,pin_rx);//TX,RX
+
+//char http_cmd[162];
+dht11 DHT11;
+void setup(){
+  Serial.begin(9600);
+  sim900_init(&gprs, -1, 9600);
+  int a = DHT11.read(DHT11PIN);
+
+  Serial.print("Temperature (oC): ");
+  Serial.println((float)DHT11.temperature, 2);
+  Serial.print("Humidity (%): ");
+  Serial.println((float)DHT11.humidity, 2);
+  //snprintf(http_cmd,sizeof(http_cmd),"GET monitor.ourjnu.com/submit.php?device_index=13726247339&longitude=113.540718&latitude=22.256467&temperature=%03d&humidity=%03d&particulate_matter=25 HTTP/1.0\r\n\r\n",DHT11.temperature,DHT11.humidity);
+  //sprintf(http_cmd,"GET /submit.php?device_index=13726247339&longitude=113.540718&latitude=22.256467&temperature=%03d&humidity=%03d&particulate_matter=25 HTTP/1.0\r\n\r\n",DHT11.temperature,DHT11.humidity);
+  //Serial.println(http_cmd);
+  while(!gprs.available()) {
+      sim900_send_cmd("AT+CGATT?");
+      delay(2000);
+  }
+  Serial.println(gprs.read());
+}
+
+void loop(){
+  /*
+  while(!gprs.available()) {
+      gprs.write("AT+CGATT?");
+      delay(2000);
+  }
+  Serial.println(gprs.read());*/
+  delay(100000);
+}
+
+
+
+


worked on PID method:

worked on PID method:

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


moved old arduino files...

moved old arduino files...

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

--- STAB_1_code/Old_Arduino_Code/STAB_1_code.ino
+++ STAB_1_code/Old_Arduino_Code/STAB_1_code.ino
@@ -0,0 +1,1427 @@
+
+
+
+
+<!DOCTYPE html>
+
+
+    <meta charset='utf-8'>
+
+
+    <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/frameworks-f58b8d6de8bc9fde24688085829036adf401072bd89acbbe4897816112552904.css" integrity="sha256-9YuNbei8n94kaICFgpA2rfQBByvYmsu+SJeBYRJVKQQ=" media="all" rel="stylesheet" />
+    <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-fdb2407fecf3baa8ae269dd4233bd00902837267eaba4424be96b8213c5fcb03.css" integrity="sha256-/bJAf+zzuqiuJp3UIzvQCQKDcmfqukQkvpa4ITxfywM=" media="all" rel="stylesheet" />
+
+
+
+
+
+    <link as="script" href="https://assets-cdn.github.com/assets/frameworks-88471af1fec40ff9418efbe2ddd15b6896af8d772f8179004c254dffc25ea490.js" rel="preload" />
+
+    <link as="script" href="https://assets-cdn.github.com/assets/github-ca183c0805d4b38ee9b2df6ddaa0b91b72b4d8e24c9ebfb011952905a89a79d4.js" rel="preload" />
+
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta http-equiv="Content-Language" content="en">
+    <meta name="viewport" content="width=device-width">
+
+    <title>stab/STAB_1_code.ino at master · glen-costigan/stab</title>
+    <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">
+    <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
+    <link rel="apple-touch-icon" href="/apple-touch-icon.png">
+    <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png">
+    <link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png">
+    <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png">
+    <link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png">
+    <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png">
+    <link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png">
+    <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png">
+    <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png">
+    <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png">
+    <meta property="fb:app_id" content="1401488693436528">
+
+      <meta content="https://avatars3.githubusercontent.com/u/18294414?v=3&s=400" name="twitter:image:src" /><meta content="@github" name="twitter:site" /><meta content="summary" name="twitter:card" /><meta content="glen-costigan/stab" name="twitter:title" /><meta content="stab - Arduino Controlled Rocket Stabilization" name="twitter:description" />
+      <meta content="https://avatars3.githubusercontent.com/u/18294414?v=3&s=400" property="og:image" /><meta content="GitHub" property="og:site_name" /><meta content="object" property="og:type" /><meta content="glen-costigan/stab" property="og:title" /><meta content="https://github.com/glen-costigan/stab" property="og:url" /><meta content="stab - Arduino Controlled Rocket Stabilization" property="og:description" />
+      <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
+    <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
+    <link rel="assets" href="https://assets-cdn.github.com/">
+    <link rel="web-socket" href="wss://live.github.com/_sockets/MTgyOTQ0MTQ6Y2UyOGI4YjE1MDM4YmM5MzUyNTlkMDQ0ODIyNDFkNmM6YjI3YWNhMDIyZDE4NTVjZmJmYzI2N2JkYmMzZDU0ZWNlNzUwY2IxNDMwMTI2NTcxYmRjNDRiNjhhNGRlZmYzOA==--98e54b32397368c1f8fc96f320544e8cb6be37ea">
+    <meta name="pjax-timeout" content="1000">
+    <link rel="sudo-modal" href="/sessions/sudo_modal">
+    <meta name="request-id" content="4583916C:1B47:4474020:57D58F0C" data-pjax-transient>
+
+    <meta name="msapplication-TileImage" content="/windows-tile.png">
+    <meta name="msapplication-TileColor" content="#ffffff">
+    <meta name="selected-link" value="repo_source" data-pjax-transient>
+
+    <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU">
+<meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA">
+    <meta name="google-analytics" content="UA-3769691-2">
+
+<meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="4583916C:1B47:4474020:57D58F0C" name="octolytics-dimension-request_id" /><meta content="18294414" name="octolytics-actor-id" /><meta content="glen-costigan" name="octolytics-actor-login" /><meta content="3678eef58ff8a9b0f5fb2b6e78e799aeaf2d2768bb304db6cc2b1a128d59848d" name="octolytics-actor-hash" />
+<meta content="/<user-name>/<repo-name>/blob/show" data-pjax-transient="true" name="analytics-location" />
+
+
+
+  <meta class="js-ga-set" name="dimension1" content="Logged In">
+
+
+
+        <meta name="hostname" content="github.com">
+    <meta name="user-login" content="glen-costigan">
+
+        <meta name="expected-hostname" content="github.com">
+      <meta name="js-proxy-site-detection-payload" content="NzEyNzFkNTVkZTFhNWRjODg3ZWZjNjBjYjJkZTFlMTJlZmExNDM0ZDY2MDllMjc4NTQ5N2IzYzcwOTZjZmIzMXx7InJlbW90ZV9hZGRyZXNzIjoiNjkuMTMxLjE0NS4xMDgiLCJyZXF1ZXN0X2lkIjoiNDU4MzkxNkM6MUI0Nzo0NDc0MDIwOjU3RDU4RjBDIiwidGltZXN0YW1wIjoxNDczNjEzNTg3fQ==">
+
+
+      <link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#4078c0">
+      <link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico">
+
+    <meta name="html-safe-nonce" content="ed981e73bd96ff8447c5939ede878d97dcb7b7e1">
+    <meta content="18c8ed46826ad983230813bc2d9570f9a329836c" name="form-nonce" />
+
+    <meta http-equiv="x-pjax-version" content="baa71878952ccac0e832fb0164e6b45b">
+
+
+
+  <meta name="description" content="stab - Arduino Controlled Rocket Stabilization">
+  <meta name="go-import" content="github.com/glen-costigan/stab git https://github.com/glen-costigan/stab.git">
+
+  <meta content="18294414" name="octolytics-dimension-user_id" /><meta content="glen-costigan" name="octolytics-dimension-user_login" /><meta content="57298531" name="octolytics-dimension-repository_id" /><meta content="glen-costigan/stab" name="octolytics-dimension-repository_nwo" /><meta content="true" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="57298531" name="octolytics-dimension-repository_network_root_id" /><meta content="glen-costigan/stab" name="octolytics-dimension-repository_network_root_nwo" />
+  <link href="https://github.com/glen-costigan/stab/commits/master.atom" rel="alternate" title="Recent Commits to stab:master" type="application/atom+xml">
+
+
+      <link rel="canonical" href="https://github.com/glen-costigan/stab/blob/master/STAB_1_code/STAB_1_code.ino" data-pjax-transient>
+
+
+
+
+

+    Skip to content
+
+
+
+
+
+
+
+

+

+
+
+  <svg aria-hidden="true" class="octicon octicon-mark-github" height="28" version="1.1" viewBox="0 0 16 16" width="28"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>
+
+
+
+

+  <form accept-charset="UTF-8" action="/glen-costigan/stab/search" class="js-site-search-form" data-scoped-search-url="/glen-costigan/stab/search" data-unscoped-search-url="/search" method="get">
<input name="utf8" type="hidden" value="✓" />

+
+
This repository

+      <input type="text"
+        class="form-control header-search-input js-site-search-focus js-site-search-field is-clearable"
+        data-hotkey="s"
+        name="q"
+        placeholder="Search"
+        aria-label="Search this repository"
+        data-unscoped-placeholder="Search GitHub"
+        data-scoped-placeholder="Search"
+        autocapitalize="off">
+
+</form>

+
+
+

+

+
+            Pull requests
+

+

+
+            Issues
+

+

+            Gist
+

+

+
+
+

+

+
+
+

+
+

+
+      <svg aria-hidden="true" class="octicon octicon-plus float-left" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path d="M12 9H7v5H5V9H0V7h5V2h2v5h5z"></path></svg>
+
+
+
+

+

+
+
+  New repository
+
+
+
+    Import repository
+
+
+
+
+    New organization
+
+
+
+
+

+

+    This repository
+

+
+      New issue
+
+
+      New collaborator
+
+
+

+

+

+
+

+
+
+
+
+
+

+

+

+          Signed in as glen-costigan
+

+
+

+
+
+          Your profile
+
+
+            Your stars
+
+
+          Explore
+
+
+            Integrations
+
+
+          Help
+
+
+
+

+
+
+          Settings
+
+
+        <form accept-charset="UTF-8" action="/logout" class="logout-form" data-form-nonce="18c8ed46826ad983230813bc2d9570f9a329836c" method="post">
<input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="QtQyerwYIR+C60mT2k+yoq8OtQeJABY6ueE9qfma1WpU198R5O8NVWX/wAA+LK3kHB1/Qc0CZ2DtuR8ao7jWag==" />

+          <button class="dropdown-item dropdown-signout" data-ga-click="Header, sign out, icon:logout">
+            Sign out
+          </button>
+</form>

+

+

+

+
+
+
+

+

+
+
+
+
+
+

+
+

+

+
+
+

+

+

+
+

+

+
+
+
+

+
+

+        <form accept-charset="UTF-8" action="/notifications/subscribe" class="js-social-container" data-autosubmit="true" data-form-nonce="18c8ed46826ad983230813bc2d9570f9a329836c" data-remote="true" method="post">
<input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="MagT346pXtIiaqR3oTdNx2MLVav7aefgoPtnMNMdZEzsfQYNsDXTaTmubnOtIB9Jv4IBmRjqwMGRAclX/pIi1w==" />
      <input class="form-control" id="repository_id" name="repository_id" type="hidden" value="57298531" />
+
+

+
+
+              <svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"></path></svg>
+              Unwatch
+
+
+
+            1
+
+
+

+

+

+              <svg aria-label="Close" class="octicon octicon-x js-menu-close" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path></svg>
+              Notifications
+

+
+

+
+

+                  <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"></path></svg>
+

+                    <input id="do_included" name="do" type="radio" value="included" />
+                    Not watching
+                    Be notified when participating or @mentioned.
+
+                      <svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"></path></svg>
+                      Watch
+
+

+

+
+

+                  <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"></path></svg>
+

+                    <input checked="checked" id="do_subscribed" name="do" type="radio" value="subscribed" />
+                    Watching
+                    Be notified of all conversations.
+
+                      <svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"></path></svg>
+                      Unwatch
+
+

+

+
+

+                  <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"></path></svg>
+

+                    <input id="do_ignore" name="do" type="radio" value="ignore" />
+                    Ignoring
+                    Never be notified.
+
+                      <svg aria-hidden="true" class="octicon octicon-mute" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path d="M8 2.81v10.38c0 .67-.81 1-1.28.53L3 10H1c-.55 0-1-.45-1-1V7c0-.55.45-1 1-1h2l3.72-3.72C7.19 1.81 8 2.14 8 2.81zm7.53 3.22l-1.06-1.06-1.97 1.97-1.97-1.97-1.06 1.06L11.44 8 9.47 9.97l1.06 1.06 1.97-1.97 1.97 1.97 1.06-1.06L13.56 8l1.97-1.97z"></path></svg>
+                      Stop ignoring
+
+

+

+
+

+
+

+

+

+</form>
+

+
+

+
+

+
+    <form accept-charset="UTF-8" action="/glen-costigan/stab/unstar" class="starred" data-form-nonce="18c8ed46826ad983230813bc2d9570f9a329836c" data-remote="true" method="post">
<input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="mLnA3SykuizQeldpK4mcLCooh3kJYRxQ1SfITpu9p70pRNX4R81Z5PHHLaFCjBiLHp+g90AzHToSLKVpXBxnVw==" />

+      <button
+        class="btn btn-sm btn-with-count js-toggler-target"
+        aria-label="Unstar this repository" title="Unstar glen-costigan/stab"
+        data-ga-click="Repository, click unstar button, action:blob#show; text:Unstar">
+        <svg aria-hidden="true" class="octicon octicon-star" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74z"></path></svg>
+        Unstar
+      </button>
+
+          0
+
+</form>
+    <form accept-charset="UTF-8" action="/glen-costigan/stab/star" class="unstarred" data-form-nonce="18c8ed46826ad983230813bc2d9570f9a329836c" data-remote="true" method="post">
<input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="Th8H1VC3CmavIEcTahkHHYWNf5gEnFBzsbtjraYM2ijKabMNoUnBTf9TMAPRILQSX61gqCrtMXfDewN6i7ohGw==" />

+      <button
+        class="btn btn-sm btn-with-count js-toggler-target"
+        aria-label="Star this repository" title="Star glen-costigan/stab"
+        data-ga-click="Repository, click star button, action:blob#show; text:Star">
+        <svg aria-hidden="true" class="octicon octicon-star" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74z"></path></svg>
+        Star
+      </button>
+
+          0
+
+</form>

+
+

+
+

+          <form accept-charset="UTF-8" action="/glen-costigan/stab/fork" class="btn-with-count" data-form-nonce="18c8ed46826ad983230813bc2d9570f9a329836c" method="post">
<input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="QAuu5esKMyzjd+lg/QCEUGllgFO67cet38e7kMpPsz5L3zk2Nh96hGldIa5B2MV7ZzXTaQldGWAF9gieZUMr7Q==" />

+            <button
+                type="submit"
+                class="btn btn-sm btn-with-count"
+                data-ga-click="Repository, show fork modal, action:blob#show; text:Fork"
+                title="Fork your own copy of glen-costigan/stab to your account"
+                aria-label="Fork your own copy of glen-costigan/stab to your account">
+              <svg aria-hidden="true" class="octicon octicon-repo-forked" height="16" version="1.1" viewBox="0 0 10 16" width="10"><path d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></svg>
+              Fork
+            </button>
+</form>
+
+      0
+
+

+

+
+

+  <svg aria-hidden="true" class="octicon octicon-repo" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"></path></svg>
+  glen-costigan/stab
+
+

+
+

+

+
+
+
+
+
+      <svg aria-hidden="true" class="octicon octicon-code" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path d="M9.5 3L8 4.5 11.5 8 8 11.5 9.5 13 14 8 9.5 3zm-5 0L0 8l4.5 5L6 11.5 2.5 8 6 4.5 4.5 3z"></path></svg>
+      Code
+      <meta itemprop="position" content="1">
+
+
+
+
+        <svg aria-hidden="true" class="octicon octicon-issue-opened" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg>
+        Issues
+        0
+        <meta itemprop="position" content="2">
+
+
+
+
+      <svg aria-hidden="true" class="octicon octicon-git-pull-request" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path d="M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></svg>
+      Pull requests
+      0
+      <meta itemprop="position" content="3">
+
+
+
+
+      <svg aria-hidden="true" class="octicon octicon-book" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path d="M3 5h4v1H3V5zm0 3h4V7H3v1zm0 2h4V9H3v1zm11-5h-4v1h4V5zm0 2h-4v1h4V7zm0 2h-4v1h4V9zm2-6v9c0 .55-.45 1-1 1H9.5l-1 1-1-1H2c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h5.5l1 1 1-1H15c.55 0 1 .45 1 1zm-8 .5L7.5 3H2v9h6V3.5zm7-.5H9.5l-.5.5V12h6V3z"></path></svg>
+      Wiki
+
+
+
+    <svg aria-hidden="true" class="octicon octicon-pulse" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path d="M11.5 8L8.8 5.4 6.6 8.5 5.5 1.6 2.38 8H0v2h3.6l.9-1.8.9 5.4L9 8.5l1.6 1.5H14V8z"></path></svg>
+    Pulse
+
+
+    <svg aria-hidden="true" class="octicon octicon-graph" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path d="M16 14v1H0V0h1v14h15zM5 13H3V8h2v5zm4 0H7V3h2v10zm4 0h-2V6h2v7z"></path></svg>
+    Graphs
+
+
+      <svg aria-hidden="true" class="octicon octicon-gear" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path d="M14 8.77v-1.6l-1.94-.64-.45-1.09.88-1.84-1.13-1.13-1.81.91-1.09-.45-.69-1.92h-1.6l-.63 1.94-1.11.45-1.84-.88-1.13 1.13.91 1.81-.45 1.09L0 7.23v1.59l1.94.64.45 1.09-.88 1.84 1.13 1.13 1.81-.91 1.09.45.69 1.92h1.59l.63-1.94 1.11-.45 1.84.88 1.13-1.13-.92-1.81.47-1.09L14 8.75v.02zM7 11c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z"></path></svg>
+      Settings
+
+
+
+

+

+
+

+

+
+
+
+Permalink
+
+
+
+

+
+

+  <button class="btn btn-sm select-menu-button js-menu-target css-truncate" data-hotkey="w"
+
+    type="button" aria-label="Switch branches or tags" tabindex="0" aria-haspopup="true">
+    Branch:
+    master
+  </button>
+
+

+
+

+

+        <svg aria-label="Close" class="octicon octicon-x js-menu-close" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path></svg>
+        Switch branches/tags
+

+
+

+

+          <input type="text" aria-label="Find or create a branch…" id="context-commitish-filter-field" class="form-control js-filterable-field js-navigation-enable" placeholder="Find or create a branch…">
+

+

+

+

+              Branches
+

+

+              Tags
+

+

+

+

+
+

+
+

+
+
+
+              <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"></path></svg>
+
+                master
+
+
+

+
+          <form accept-charset="UTF-8" action="/glen-costigan/stab/branches" class="js-create-branch select-menu-item select-menu-new-item-form js-navigation-item js-new-item-form" data-form-nonce="18c8ed46826ad983230813bc2d9570f9a329836c" method="post">
<input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="Tow9LE7+ScI4krTq8x2LiJoCFIZTubz0QW8rRPFqphb0HVHOl4f+j6dyNe96nrnn7wUlebpDhSgRHRYxwvhbxA==" />

+          <svg aria-hidden="true" class="octicon octicon-git-branch select-menu-item-icon" height="16" version="1.1" viewBox="0 0 10 16" width="10"><path d="M10 5c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v.3c-.02.52-.23.98-.63 1.38-.4.4-.86.61-1.38.63-.83.02-1.48.16-2 .45V4.72a1.993 1.993 0 0 0-1-3.72C.88 1 0 1.89 0 3a2 2 0 0 0 1 1.72v6.56c-.59.35-1 .99-1 1.72 0 1.11.89 2 2 2 1.11 0 2-.89 2-2 0-.53-.2-1-.53-1.36.09-.06.48-.41.59-.47.25-.11.56-.17.94-.17 1.05-.05 1.95-.45 2.75-1.25S8.95 7.77 9 6.73h-.02C9.59 6.37 10 5.73 10 5zM2 1.8c.66 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2C1.35 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2zm0 12.41c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm6-8c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></svg>
+

+              Create branch:
+              from ‘master’
+

+            <input type="hidden" name="name" id="name" class="js-new-item-value">
+            <input type="hidden" name="branch" id="branch" value="master">
+            <input type="hidden" name="path" id="path" value="STAB_1_code/STAB_1_code.ino">
+</form>
+

+
+

+

+
+
+

+
+
Nothing to show

+

+
+

+

+

+
+

+
+      Find file
+
+    <button aria-label="Copy file path to clipboard" class="js-zeroclipboard btn btn-sm zeroclipboard-button tooltipped tooltipped-s" data-copied-hint="Copied!" type="button">Copy path</button>
+

+

+    stab/STAB_1_code/STAB_1_code.ino
+

+

+
+
+

+
+
+          7e91ed2
+
+        <relative-time datetime="2016-04-28T12:24:17Z">Apr 28, 2016</relative-time>
+
+

+
+        glen-costigan
+          Adding in current arduino code
+

+
+

+      <button type="button" class="btn-link muted-link contributors-toggle" data-facebox="#blob_contributors_box">
+        1
+         contributor
+      </button>
+
+

+
+

+
Users who have contributed to this file

+

+

+
+            glen-costigan
+

+

+

+

+
+

+

+

+
+

+      Raw
+        Blame
+      History
+

+
+
+            <svg aria-hidden="true" class="octicon octicon-device-desktop" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path d="M15 2H1c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h5.34c-.25.61-.86 1.39-2.34 2h8c-1.48-.61-2.09-1.39-2.34-2H15c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm0 9H1V3h14v8z"></path></svg>
+
+
+        <form accept-charset="UTF-8" action="/glen-costigan/stab/edit/master/STAB_1_code/STAB_1_code.ino" class="inline-form js-update-url-with-hash" data-form-nonce="18c8ed46826ad983230813bc2d9570f9a329836c" method="post">
<input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="sO/bpOm1YYJJencocw1h8KlrxWuT2rGXakQSSX7V/mGncCa7XKHkfI/b+HJEUfed89HTvCS89lrj1W4J5B9R2Q==" />

+          <button class="btn-octicon tooltipped tooltipped-nw" type="submit"
+            aria-label="Edit this file" data-hotkey="e" data-disable-with>
+            <svg aria-hidden="true" class="octicon octicon-pencil" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path d="M0 12v3h3l8-8-3-3-8 8zm3 2H1v-2h1v1h1v1zm10.3-9.3L12 6 9 3l1.3-1.3a.996.996 0 0 1 1.41 0l1.59 1.59c.39.39.39 1.02 0 1.41z"></path></svg>
+          </button>
+</form>        <form accept-charset="UTF-8" action="/glen-costigan/stab/delete/master/STAB_1_code/STAB_1_code.ino" class="inline-form" data-form-nonce="18c8ed46826ad983230813bc2d9570f9a329836c" method="post">
<input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="fdfo8Nqum5f5LDwsa1D8W9BinyBvnqK/uBGaqXKVA5G3e7d111gJOZ3DnjURUY6FsvHocsrWmnpPs4GV3J3xmg==" />

+          <button class="btn-octicon btn-octicon-danger tooltipped tooltipped-nw" type="submit"
+            aria-label="Delete this file" data-disable-with>
+            <svg aria-hidden="true" class="octicon octicon-trashcan" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path d="M11 2H9c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1H2c-.55 0-1 .45-1 1v1c0 .55.45 1 1 1v9c0 .55.45 1 1 1h7c.55 0 1-.45 1-1V5c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm-1 12H3V5h1v8h1V5h1v8h1V5h1v8h1V5h1v9zm1-10H2V3h9v1z"></path></svg>
+          </button>
+</form>

+
+

+      173 lines (147 sloc)
+
+    6.64 KB
+

+

+
+
+
+

+

+

+
+        #include <SD.h> //Load the SD library
+

+

+
+        #include <SPI.h> //Load the SPI comm library
+

+

+
+
+
+

+

+
+        int chipSelect=4; //Set chipselct = 4
+

+

+
+        File mySensorData; //Variable for working with our file object
+

+

+
+
+
+

+

+
+        #include "Wire.h"    // imports the wire library for talking over I2C
+

+

+
+        #include "Adafruit_BMP085.h"  // import the Pressure Sensor Library
+

+

+
+        Adafruit_BMP085 mySensor;  // create sensor object called mySensor
+

+

+
+
+
+

+

+
+        float tempC;  // Variable for holding temp in C
+

+

+
+        float tempF;  // Variable for holding temp in F
+

+

+
+        float pressure; //Variable for holding pressure reading
+

+

+
+
+
+

+

+
+        #include "I2Cdev.h" // import I2Cdev library required for MPU6050 library
+

+

+
+        #include "MPU6050.h" // import MPU6050 accel/gyro 6DOF sensor library
+

+

+
+        MPU6050 accelgyro; //create sensor object called accelgyro
+

+

+
+        int16_t ax, ay, az; //Variables for accel x-dir, y-dir, and z-dir
+

+

+
+        int16_t gx, gy, gz; //Variables for gyro x-dir, y-dir, and z-dir
+

+

+
+        #define OUTPUT_READABLE_ACCELGYRO //Output data as readable data
+

+

+
+
+
+

+

+
+        #include <HMC5883L.h> //import library for HMC5883L magnetometer (NEEDS 'Wire' library)
+

+

+
+        HMC5883L compass; //create sensor object called compass
+

+

+
+
+
+

+

+
+        #include <Servo.h> //import Servo library
+

+

+
+        Servo myservo; //create servo object called myservo
+

+

+
+
+
+

+

+
+        unsigned long time; //include time variable
+

+

+
+
+
+

+

+
+        void setup(){
+

+

+
+        pinMode(8, OUTPUT);
+

+

+
+        digitalWrite(8, HIGH);
+

+

+
+
+
+

+

+
+        //Serial.begin(9600); //turn on serial monitor (Uncomment when not testing)
+

+

+
+        mySensor.begin();   //initialize mySensor
+

+

+
+
+
+

+

+
+        #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE // join I2C bus (I2Cdev library doesn't do this automatically)
+

+

+
+        Wire.begin();
+

+

+
+        #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
+

+

+
+        Fastwire::setup(400, true);
+

+

+
+        #endif
+

+

+
+        accelgyro.initialize();
+

+

+
+
+
+

+

+
+        compass.begin(); // Initialize Initialize HMC5883L
+

+

+
+        compass.setRange(HMC5883L_RANGE_1_3GA); // Set measurement range
+

+

+
+        compass.setMeasurementMode(HMC5883L_CONTINOUS); // Set measurement mode
+

+

+
+        compass.setDataRate(HMC5883L_DATARATE_30HZ); // Set data rate
+

+

+
+        compass.setSamples(HMC5883L_SAMPLES_8); // Set number of samples averaged
+

+

+
+        compass.setOffset(0, 0); // Set calibration offset. See HMC5883L_calibration.ino
+

+

+
+
+
+

+

+
+        myservo.attach(9); //Pin 9 for servo 1 and 2 (share same output angles)
+

+

+
+
+
+

+

+
+        pinMode(10, OUTPUT); //Reserve 10 as an output (SD LIBRAY REQUIREMENT)
+

+

+
+        SD.begin (chipSelect); //Initialize the SD card with chipSelect connected to pin 4
+

+

+
+
+
+

+

+
+        pinMode(2, OUTPUT); //Loop check LED
+

+

+
+        }
+

+

+
+
+
+

+

+
+        void loop() {
+

+

+
+        time = millis(); // find current time since program began
+

+

+
+
+
+

+

+
+        //Temperature and Pressure
+

+

+
+        tempC = mySensor.readTemperature(); //  Read Temperature
+

+

+
+        tempF = tempC*1.8 + 32.; // Convert degrees C to F
+

+

+
+        pressure=mySensor.readPressure(); //Read Pressure
+

+

+
+
+
+

+

+
+        //Accel and Gyro
+

+

+
+        accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); //read accel/gyro data
+

+

+
+
+
+

+

+
+        //Compass
+

+

+
+        Vector norm = compass.readNormalize();
+

+

+
+        float heading = atan2(norm.YAxis, norm.XAxis); // Calculate heading
+

+

+
+        // Set declination angle on your location and fix heading
+

+

+
+        // You can find your declination on: http://magnetic-declination.com/
+

+

+
+        // (+) Positive or (-) for negative
+

+

+
+        // For Bytom / Poland declination angle is 4'26E (positive)
+

+

+
+        // Formula: (deg + (min / 60.0)) / (180 / M_PI);
+

+

+
+        float declinationAngle = (4.0 + (26.0 / 60.0)) / (180 / M_PI);
+

+

+
+        heading += declinationAngle;
+

+

+
+        if (heading < 0) // Correct for heading < 0deg and heading > 360deg
+

+

+
+        {
+

+

+
+        heading += 2 * PI;
+

+

+
+        }
+

+

+
+        if (heading > 2 * PI)
+

+

+
+        {
+

+

+
+        heading -= 2 * PI;
+

+

+
+        }
+

+

+
+        float headingDegrees = heading * 180/M_PI; // Convert to degrees
+

+

+
+
+
+

+

+
+        // Servo
+

+

+
+        float a = 60; //max angle of attack
+

+

+
+        float d = 90;
+

+

+
+        float x = headingDegrees; //floored headingDegrees
+

+

+
+        //float b = x % 180; //new range of repeated values from 0 to 179. (alpha(theta=0) = aplha(theta=180))
+

+

+
+        float b = x; //adjusted heading
+

+

+
+        if (x > 180 && x <= 360){
+

+

+
+          b = x - 180;
+

+

+
+        }
+

+

+
+        float c; //output angle of attack
+

+

+
+        if (b >= 15 && b <= 90){
+

+

+
+          c = -a*sin((PI/150)*x-PI/10) + d;
+

+

+
+        }
+

+

+
+        else if (b > 90 && b <= 165){
+

+

+
+          c = a*cos((PI/150)*x-3*PI/5) + d;
+

+

+
+        }
+

+

+
+        //else if (b >= 95 && b <= 130){
+

+

+
+        //  c = a*sin((PI/70)*x-19*PI/14) + d;
+

+

+
+        //}
+

+

+
+        //else if (b >= 140 && b <= 175){
+

+

+
+        //  c = -a*cos((PI/70)*x) + d;
+

+

+
+        //}
+

+

+
+        else{
+

+

+
+        c = d;
+

+

+
+        }
+

+

+
+        myservo.write(c); //write to servo 1 and 2
+

+

+
+
+
+

+

+
+        mySensorData= SD.open("Data2.txt", FILE_WRITE); //Open PTData.txt on the SD card as a file to write.
+

+

+
+
+
+

+

+
+        if (mySensorData) { //Only do these things if data file opened successfully
+

+

+
+        /*
+

+

+
+        Serial.print("The Temp is: "); //Print Your results of BMP180 data (Uncomment when not testing)
+

+

+
+        Serial.print(tempF); //(Uncomment when not testing)
+

+

+
+        Serial.println(" degrees F"); //(Uncomment when not testing)
+

+

+
+        Serial.print("The Pressure is: "); //(Uncomment when not testing)
+

+

+
+        Serial.print(pressure); //(Uncomment when not testing)
+

+

+
+        Serial.println(" Pa."); //(Uncomment when not testing)
+

+

+
+        Serial.println("");  //(Uncomment when not testing)
+

+

+
+
+

+

+
+        Serial.print("a/g:\t");  //Print results of MPU6050 data (Uncomment when not testing)
+

+

+
+        Serial.print(ax); Serial.print("\t");  //(Uncomment when not testing)
+

+

+
+        Serial.print(ay); Serial.print("\t");  //(Uncomment when not testing)
+

+

+
+        Serial.print(az); Serial.print("\t");  //(Uncomment when not testing)
+

+

+
+        Serial.print(gx); Serial.print("\t");  //(Uncomment when not testing)
+

+

+
+        Serial.print(gy); Serial.print("\t");  //(Uncomment when not testing)
+

+

+
+        Serial.println(gz);  //(Uncomment when not testing)
+

+

+
+        Serial.println("");  //(Uncomment when not testing)
+

+

+
+
+

+

+
+        Serial.print(" Heading = ");  //Print results of HMC5883L data (Uncomment when not testing)
+

+

+
+        Serial.print(heading);  //(Uncomment when not testing)
+

+

+
+        Serial.print(" Degress = ");  //(Uncomment when not testing)
+

+

+
+        Serial.print(headingDegrees);  //(Uncomment when not testing)
+

+

+
+        Serial.println("");  //(Uncomment when not testing)
+

+

+
+        */
+

+

+
+
+
+

+

+
+        digitalWrite(2, HIGH); //Loop check LED on
+

+

+
+        delay(100); //Pause between readings.
+

+

+
+        digitalWrite(2, LOW); //Loop check LED off
+

+

+
+
+
+

+

+
+        mySensorData.print(time); //Write tempF to the SD card
+

+

+
+        mySensorData.print(","); //Write comma to the line
+

+

+
+        mySensorData.print(tempF); //Write tempF to the SD card
+

+

+
+        mySensorData.print(","); //Write comma to the line
+

+

+
+        mySensorData.print(pressure); //Write pressure data
+

+

+
+        mySensorData.print(","); //Write comma to the line
+

+

+
+        mySensorData.print(ax); //Write ax to the SD card
+

+

+
+        mySensorData.print(","); //Write comma to the line
+

+

+
+        mySensorData.print(ay); //Write ay to the SD card
+

+

+
+        mySensorData.print(","); //Write comma to the line
+

+

+
+        mySensorData.print(az); //Write az to the SD card
+

+

+
+        mySensorData.print(","); //Write comma to the line
+

+

+
+        mySensorData.print(gx); //Write gx to the SD card
+

+

+
+        mySensorData.print(","); //Write comma to the line
+

+

+
+        mySensorData.print(gy); //Write gy to the SD card
+

+

+
+        mySensorData.print(","); //Write comma to the line
+

+

+
+        mySensorData.print(gz); //Write gz to the SD card
+

+

+
+        mySensorData.print(","); //Write comma to the line
+

+

+
+        mySensorData.print(heading); //Write heading to the SD card
+

+

+
+        mySensorData.print(","); //Write comma to the line
+

+

+
+        mySensorData.println(headingDegrees); //Write headingDegrees to the SD card and go to next line
+

+

+
+        mySensorData.close(); //Close the file
+

+

+
+        }
+

+

+
+        }
+

+

+
+

+
+

+
+<button type="button" data-facebox="#jump-to-line" data-facebox-class="linejump" data-hotkey="l" class="d-none">Jump to Line</button>
+

+  <form accept-charset="UTF-8" action="" class="js-jump-to-line-form" method="get">
<input name="utf8" type="hidden" value="✓" />

+    <input class="form-control linejump-input js-jump-to-line-field" type="text" placeholder="Jump to line…" aria-label="Jump to line" autofocus>
+    <button type="submit" class="btn">Go</button>
+</form>

+
+

+

+

+
+
+

+

+
+

+
+

+

+

+
Contact GitHub

+
API

+
Training

+
Shop

+
Blog

+
About

+
+

+
+
+      <svg aria-hidden="true" class="octicon octicon-mark-github" height="24" version="1.1" viewBox="0 0 16 16" width="24"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>
+
+

+
© 2016 GitHub, Inc.

+
Terms

+
Privacy

+
Security

+
Status

+
Help

+

+

+

+
+
+
+
+
+

+      <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"></path></svg>
+      <button type="button" class="flash-close js-flash-close js-ajax-error-dismiss" aria-label="Dismiss error">
+        <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path></svg>
+      </button>
+      You can't perform that action at this time.
+

+
+
+
+
+
+
+
+
+
+
+
+

+      <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"></path></svg>
+      You signed in with another tab or window. Reload to refresh your session.
+      You signed out in another tab or window. Reload to refresh your session.
+

+

+

+

+

+    <button type="button" class="facebox-close js-facebox-close" aria-label="Close modal">
+      <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path></svg>
+    </button>
+

+

+
+
+
+


that should give the value

that should give the value

but somehow does not

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


for communication. update print to println

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


Code clean-up.

Code clean-up.

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/spoollord/MyOurWeather.git/'


Removed one of the programs. Arduino is now our only main program.

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/upperman/Wireless-Led-Display.git/'


initial commit

initial commit

SensorProject - Receiver

--- SensorProject_Receiver.ino
+++ SensorProject_Receiver.ino
@@ -0,0 +1,73 @@
+#include <SPI.h>
+#include <Ethernet.h>
+#include <Phant.h>
+
+char server[] = "data.sparkfun.com";
+Phant phant("data.sparkfun.com", "public_key", "private_key");
+int randNumber;
+int randNumber2;
+int randNumber3;
+int randNumber4;
+
+byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
+// the dns server ip
+IPAddress dnServer(192, 168, 1, 254);
+// the router's gateway address:
+IPAddress gateway(192, 168, 1, 254);
+// the subnet:
+IPAddress subnet(255, 255, 255, 0);
+//the IP address is dependent on your network
+IPAddress ip(192, 168, 1, 23);
+
+EthernetClient client;
+
+void setup() {
+  Serial.begin(9600);
+  delay(2000);
+  // initialize the ethernet device
+  Ethernet.begin(mac, ip, dnServer, gateway, subnet);
+  //print out the IP address
+  Serial.print("IP = ");
+  Serial.println(Ethernet.localIP());
+  randomSeed(analogRead(0));
+}
+
+void loop() {
+  randNumber = random(300);
+  randNumber2 = random(300);
+  randNumber3 = random(300);
+  randNumber4 = random(300);
+
+  Serial.println("Starting...");
+  httppost();
+  Serial.println("disconnecting.");
+  client.stop();
+  delay(10000);
+
+}
+
+void httppost()
+{
+  //if (!(client.connect(server, 80)))
+  if (client.connect(server, 80))
+  {
+    phant.add("light", "Random Numbers:");
+    phant.add("random1", randNumber4);
+    phant.add("random2", randNumber3);
+    phant.add("room", randNumber2);
+    phant.add("temp", randNumber);
+    client.println(phant.post());
+
+    Serial.println("----POSTED TEST URL:----");
+    //Serial.println(phant.url());
+
+    //Serial.println("----POSTED POST:----");
+    //Serial.println(phant.post());
+
+    //client.println(phant.post());
+  }
+  else
+  {
+    Serial.println("Nothing happening...");
+  }
+}


New file - driven pendulum using electromagnet and photogate control

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

--- VernierPendulumDriver/VernierPendulumDriver.ino
+++ VernierPendulumDriver/VernierPendulumDriver.ino
@@ -0,0 +1,78 @@
+/*
+VernierPendulumDriver (v 2015.03)
+This sketch assumes that a Vernier Photogate is connected to BTD 1 and a
+Vernier Digital Control Unit (DCU) is connected to BTD2.
+
+The sketch is designed to drive a pendulum with a magnetic bob to
+keep it swinging "forever". When the pendulum passes through the Photogate, it
+triggers a short digital output from the DCU to an electromagnet. The
+electromagnet should be situated just below the low point of the pendulum bob's
+swing. The photogate should be situated so that the bob goes through it as it
+moves downward. The electromagnet will go on to pull the bob downward to add
+energy to the pendulumn system.
+
+The sketch also flashes an LED connected to D13 when the photogate is blocked,
+and notes the times at which the pendulum blocks the photogate.
+
+Start the sketch and then start the pendulum swinging with the bob going
+through the photogate before it reaches the bottom of the swing.
+
+See www.vernier.com/arduino for more information.
+
+ */
+unsigned long Timems = 0; //Time in ms
+unsigned long PreviousTime= 0;// remember the previous time
+int PhotogatePin =2; //
+int Photogate = HIGH;// not blocked is HIGH
+int PreviousPhotogate=HIGH;
+
+int Count=1; //used to determine which direction the pendulum is swinging
+int LEDpin =13;/// line for LED to turn on when photogate is blocked
+int DCUline = 6;//This line will turn on the first line of the DCU, if
+// the DCU is connected to BTD2
+void setup()
+  {
+    Serial.begin(9600);           // set up Serial library at 9600 bps
+    pinMode (PhotogatePin,INPUT);
+    pinMode(DCUline, OUTPUT);
+    pinMode(LEDpin, OUTPUT);
+    Serial.println("Vernier Format 2");
+    Serial.println("Photogate periods taken using Ardunio");
+    Serial.print("Swing");
+    Serial.print("\t"); //tab character
+    Serial.println ("Time"); //change to match sensor
+    Serial.print("#");
+    Serial.print("\t"); // tab character
+    Serial.println ("milliseconds");
+  };// end of setup
+
+void loop ()
+{
+  Photogate = digitalRead(PhotogatePin);//low when blocked
+  if (Photogate == LOW) //low when blocked
+   {
+     digitalWrite(LEDpin, HIGH);
+     if (PreviousPhotogate == HIGH)  // if the photogate has just gone to the blocked state
+         {
+          Count++; //increment count of times photogate has been blocked
+          if (Count % 2 == 0)// if the bob is moving in the right direction
+            {
+              Timems = millis() ;
+              digitalWrite(DCUline, HIGH); // turn on DCU line 1 and the electromagnet DCU line
+              // and print out the swing number and period
+              Serial.print(Count);
+              Serial.print("\t"); // tab character
+              Serial.println(Timems-PreviousTime);
+              PreviousTime= Timems; // remember the previous time
+             }// end of the section for action take at the end of the complete swing
+           } // end of photogate just gone blocked section
+      }// end of if photogate blocked
+      else //photogate not blocked:
+        {
+          digitalWrite(DCUline, LOW);// turn off DCU line 1 and the electromagnet
+          digitalWrite(LEDpin, LOW);// turn off LED
+         }
+       PreviousPhotogate = Photogate;
+     } ;// end of loop
+
+


Create setupFunctions.ino

Create setupFunctions.ino

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

--- arduino/setupFunctions.ino
+++ arduino/setupFunctions.ino
@@ -0,0 +1,9 @@
+void startPins(){
+
+}
+
+void initialize(){
+	//panServo.attach(panPin);
+	//panServo.attach(tiltPin);
+	mpuSetup();
+}


undo test

undo test

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/csgregg/maker.git/'


Adding a new cylon eye type example

Adding a new cylon eye type example

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

--- examples/Cylon/Cylon.ino
+++ examples/Cylon/Cylon.ino
@@ -0,0 +1,43 @@
+#include "FastLED.h"
+
+// How many leds in your strip?
+#define NUM_LEDS 6
+
+// For led chips like Neopixels, which have a data line, ground, and power, you just
+// need to define DATA_PIN.  For led chipsets that are SPI based (four wires - data, clock,
+// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
+#define DATA_PIN 11
+#define CLOCK_PIN 13
+
+// Define the array of leds
+CRGB leds[NUM_LEDS];
+
+void setup() {
+	FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
+}
+
+void loop() {
+	// First slide the led in one direction
+	for(int i = 0; i < NUM_LEDS; i++) {
+		// Set the i'th led to red
+		leds[i] = CRGB::Red;
+		// Show the leds
+		FastLED.show();
+		// now that we've shown the leds, reset the i'th led to black
+		leds[i] = CRGB::Black;
+		// Wait a little bit before we loop around and do it again
+		delay(30);
+	}
+
+	// Now go in the other direction.
+	for(int i = NUM_LEDS-1; i >= 0; i--) {
+		// Set the i'th led to red
+		leds[i] = CRGB::Red;
+		// Show the leds
+		FastLED.show();
+		// now that we've shown the leds, reset the i'th led to black
+		leds[i] = CRGB::Black;
+		// Wait a little bit before we loop around and do it again
+		delay(30);
+	}
+}


Initial commit

Initial commit

--- teensy_octo.ino
+++ teensy_octo.ino
@@ -0,0 +1,86 @@
+/**
+http://www.pjrc.com/teensy/td_libs_Bounce.html
+http://www.pjrc.com/teensy/pinout.html
+**/
+
+#include <Bounce.h>
+
+#define DEBOUNCE 10  // Number of ms to debounce
+
+#define NUMBER_OF_BUTTONS 8
+
+// Define pins for the buttons
+const byte BUTTON_PINS[] = {0, 1, 2, 3, 13, 16, 17, 18};
+
+Bounce buttons[NUMBER_OF_BUTTONS] = {
+  Bounce( BUTTON_PINS[0], DEBOUNCE),
+  Bounce( BUTTON_PINS[1], DEBOUNCE),
+  Bounce( BUTTON_PINS[2], DEBOUNCE),
+  Bounce( BUTTON_PINS[3], DEBOUNCE),
+  Bounce( BUTTON_PINS[4], DEBOUNCE),
+  Bounce( BUTTON_PINS[5], DEBOUNCE),
+  Bounce( BUTTON_PINS[6], DEBOUNCE),
+  Bounce( BUTTON_PINS[7], DEBOUNCE)
+};
+
+// Define pins for the RGB LED
+const int RGB_RED = 4;
+const int RGB_GREEN = 20;
+const int RGB_BLUE = 21;
+
+void setup()   {
+  Serial.begin(38400);
+
+  // Initialize pushbutton pins
+  for (int i = 0; i < NUMBER_OF_BUTTONS; i++) {
+      pinMode(BUTTON_PINS[i], INPUT_PULLUP);
+  }
+
+  pinMode(RGB_RED, OUTPUT);
+  pinMode(RGB_GREEN, OUTPUT);
+  pinMode(RGB_BLUE, OUTPUT);
+
+  analogWrite(RGB_RED, 250);
+  analogWrite(RGB_GREEN, 255);
+  analogWrite(RGB_BLUE, 255);
+
+  pinMode(11, OUTPUT);
+}
+
+void checkButtons() {
+    for (int i = 0; i < NUMBER_OF_BUTTONS; i++) {
+      if (buttons[i].update() && buttons[i].read()) {
+        Serial.println(i);
+    }
+}
+}
+
+void loop()
+{
+
+  checkButtons();
+
+  // Blink LED for debugging, just to see that it works
+  digitalWrite(11, HIGH);
+  delay(100);
+  digitalWrite(11, LOW);
+  delay(300);
+}
+
+
+
+void buttonPress(int buttonNumber) {
+  Serial.println(buttonNumber);
+  switch (buttonNumber){
+   case 0:
+     analogWrite(RGB_RED, 200);
+     break;
+   case 1:
+     analogWrite(RGB_GREEN, 200);
+     break;
+   case 2:
+     analogWrite(RGB_BLUE, 200);
+     break;
+  }
+}
+


Snow Crash Dual Mode

Snow Crash Dual Mode

error: pathspec 'Mod/E-Stim/TCDS__Dual-State-Pot/TCDS__Dual-State-Pot.ino' did not match any file(s) known to git

--- Mod/E-Stim/TCDS__Dual-State-Pot/TCDS__Dual-State-Pot.ino
+++ Mod/E-Stim/TCDS__Dual-State-Pot/TCDS__Dual-State-Pot.ino
@@ -0,0 +1,95 @@
+/* Snow Crash: TcDS
+
+
+based mostly off blinkwithoutdelay:
+ created 2005
+ by David A. Mellis
+ modified 8 Feb 2010
+ by Paul Stoffregen
+
+ This example code is in the public domain.
+ */
+
+// constants won't change. Used here to
+// set pin numbers:
+const int ledPin =  6;      // This is the Analog input
+const int inputPin = 9;
+// Variables will change:
+int ledState = LOW;             // ledState used to set the LED
+long previousMillis = 0;        // will store last time LED was updated
+
+// the follow variables is a long because the time, measured in miliseconds,
+// will quickly become a bigger number than can be stored in an int.
+long interval =120;           // interval at which to blink (milliseconds)
+
+int brightness = 0;    // how bright the LED is
+int fadeAmount = 5;    // how many points to fade the LED by
+
+void setup() {
+  // set the digital pin as output:
+  pinMode(ledPin, OUTPUT);
+  Serial.begin(9600);
+    pinMode(5, OUTPUT);
+
+
+        //Set up the multiplexer to choose the correct style of inputs on hacker port
+  pinMode(8, OUTPUT);
+  pinMode(12, OUTPUT);
+    digitalWrite(8, LOW);
+  digitalWrite(12, LOW);
+
+  //For some CRAZY REASON A8 is called pin 9
+  pinMode(9, INPUT);
+
+}
+
+void loop()
+{
+
+   int sensorValue = analogRead(inputPin); //Hooked up to potentiometer
+   Serial.println(sensorValue);
+
+//Split how the band functions at the halfway point
+
+//From 0 - 512 the control will change the frequency of the pulsing
+if(sensorValue<=512){
+  interval = map(sensorValue, 0,512,0,180);
+ unsigned long currentMillis = millis();
+
+  if(currentMillis - previousMillis > interval) {
+    // save the last time you blinked the LED
+    previousMillis = currentMillis;
+
+    // if the LED is off turn it on and vice-versa:
+    if (ledState == LOW)
+      ledState = HIGH;
+    else
+      ledState = LOW;
+
+    // set the LED with the ledState of the variable:
+    digitalWrite(ledPin, ledState);
+  }
+
+}
+
+if(sensorValue>512){
+    interval = map(sensorValue, 512,1023,10000,0);
+  // set the brightness of pin 9:
+  analogWrite(ledPin, brightness);
+
+
+  // change the brightness for next time through the loop:
+  brightness = brightness + fadeAmount;
+  // reverse the direction of the fading at the ends of the fade:
+  if (brightness == 0 || brightness == 255) {
+    fadeAmount = -fadeAmount ;
+  }
+
+  // wait for 30 milliseconds to see the dimming effect
+  delayMicroseconds(interval);
+}
+
+
+
+}
+


Add string equivalent example for teensy

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

--- platformio/src_str/adc_string.ino
+++ platformio/src_str/adc_string.ino
@@ -0,0 +1,75 @@
+/*
+Prototypical arduino/teensy code.
+This one sends things as chars, which allows it to be a bit more flexible,
+at the cost of efficiency. For example, sending the timestamp + two analog
+channels takes 8 bytes in the more efficient code, but ~15 bytes in this code.
+Additionally, you would need to parse the string on the other side.
+The plus is that the output is human-readable.
+*/
+
+#include "ADC.h"
+#include "IntervalTimer.h"
+
+// only the lines below needs to change
+// first line does which analog channels to read,
+// second line sets the sampling interval (in microseconds)
+const unsigned int channel_array[2] = {A0, A7};
+const unsigned long period_0 = 100000;
+const unsigned int array_size = sizeof(channel_array) / sizeof(int);
+
+unsigned int value_array[array_size];
+unsigned int ii = 0;
+volatile bool go_flag = false;
+bool go_flag_copy = false;
+elapsedMicros current_time;
+unsigned long current_time_copy = 0;
+IntervalTimer timer_0;
+
+ADC *adc = new ADC();
+
+void setup() {
+  for(ii = 0; ii < array_size; ii++) {
+    pinMode(channel_array[ii], INPUT);
+  }
+
+  Serial.begin(9600);
+  delay(1000);
+
+  adc->setReference(ADC_REF_3V3, ADC_0);
+  adc->setAveraging(8);
+  adc->setResolution(12);
+  adc->setConversionSpeed(ADC_HIGH_SPEED);
+  adc->setSamplingSpeed(ADC_HIGH_SPEED);
+  timer_0.priority(10);
+  timer_0.begin(timerCallback, period_0);
+  delay(500);
+}
+
+FASTRUN void timerCallback(void) {
+  go_flag = true;
+}
+
+void loop() {
+
+  while(!go_flag_copy) {
+    noInterrupts();
+    go_flag_copy = go_flag;
+    interrupts();
+  }
+  go_flag_copy = false;
+  go_flag = false;
+
+  current_time_copy = current_time;
+  for (ii = 0; ii < array_size; ii++) {
+    value_array[ii] = adc->analogRead(channel_array[ii]);
+  }
+
+  Serial.print(current_time_copy);
+  Serial.print(" ");
+
+  for (ii = 0; ii < array_size; ii++) {
+    Serial.print(value_array[ii]);
+    Serial.print(" ");
+  }
+  Serial.print("\n");
+}


testing atmega

testing atmega

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


a piece for a game I made at GHP

a piece for a game I made at GHP

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

--- led_button_timer.ino
+++ led_button_timer.ino
@@ -0,0 +1,70 @@
+#include "Arduino.h"
+#include <inttypes.h>
+
+#define BUTTON_PIN 4
+#define BUZZ_PIN 5
+
+#define RED_LED_PIN 8
+#define GREEN_LED_PIN 9
+
+
+BiLED_pwm ind(9,8);
+
+void setup(){
+  pinMode(BUTTON_PIN, INPUT);
+  pinMode(BUZZ_PIN, OUTPUT);
+
+  pinMode(RED_LED_PIN, OUTPUT);
+  pinMode(GREEN_LED_PIN, OUTPUT);
+
+  Serial.begin(9600);
+
+}
+
+void loop(){
+
+  static uint8_t timeRemaining = 255;
+
+  // wait until the button is pressed
+  if (digitalRead(BUTTON_PIN)) {
+
+    // wait until button is released
+    while (digitalRead(BUTTON_PIN))
+      delay(5);
+
+    // start the timer
+    digitalWrite(RED_LED_PIN, LOW);
+    digitalWrite(GREEN_LED_PIN, HIGH);
+
+    // wait until time runs out
+    for (uint8_t timeRemaining = 0; timeRemaining < 255; timeRemaining++) {
+
+      // change the LED color
+      analogWrite(GREEN_LED_PIN, 255 - timeRemaining);
+      analogWrite(RED_LED_PIN, timeRemaining);
+
+      // they answered the question in time
+      for (uint8_t wait = 0; wait < 4; wait++) {
+        if (digitalRead(BUTTON_PIN))
+          goto finished_question;
+        delay(10);
+      }
+    }
+
+    // they ran out of time
+    tone(BUZZ_PIN, 500, 750);
+  }
+
+// the question was answered or they ran out of time
+finished_question:
+
+  // turn off the LEDs
+  digitalWrite(RED_LED_PIN, LOW);
+  digitalWrite(GREEN_LED_PIN, LOW);
+
+  // wait until the button is pressed again
+  while (digitalRead(BUTTON_PIN))
+    delay(5);
+
+
+}


Create slave_lcd_grove.ino

Create slave_lcd_grove.ino

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

--- au/slave_lcd_grove.ino
+++ au/slave_lcd_grove.ino
@@ -0,0 +1,78 @@
+#include <SoftwareSerial.h>
+#include "RS485_protocol.h"
+#include <Wire.h>
+#include "rgb_lcd.h"
+
+rgb_lcd lcd;
+
+const int colorR = 255;
+const int colorG = 0;
+const int colorB = 0;
+
+SoftwareSerial rs485 (2, 3);  // receive pin, transmit pin
+const byte ENABLE_PIN = 4;
+
+void fWrite (const byte what)
+  {
+  rs485.write (what);
+  }
+
+int fAvailable ()
+  {
+  return rs485.available ();
+  }
+
+int fRead ()
+  {
+  return rs485.read ();
+  }
+
+void setup()
+{
+  rs485.begin (38400);
+  pinMode (ENABLE_PIN, OUTPUT);  // driver output enable
+  lcd.begin(16, 2);
+
+    lcd.setRGB(colorR, colorG, colorB);
+
+    // Print a message to the LCD.
+    lcd.print("hello, world!");
+}
+
+void loop()
+{
+  byte buf [100];
+
+  byte received = recvMsg (fAvailable, fRead, buf, sizeof (buf));
+
+  if (received)
+    {
+    if (buf [0] != 1)
+      return;  // not my device
+
+    if (buf [1] != 2)
+      return;  // unknown command
+
+    byte msg [] = {
+       0,  // device 0 (master)
+       3,  // turn light on command received
+    };
+
+    delay (100);  // give the master a moment to prepare to receive
+    digitalWrite (ENABLE_PIN, HIGH);  // enable sending
+    sendMsg (fWrite, msg, sizeof msg);
+    digitalWrite (ENABLE_PIN, LOW);  // disable sending
+
+  //  analogWrite (11, buf [2]);  // set light level
+
+
+lcd.setCursor(0, 1);
+    // print the number of seconds since reset:
+    lcd.print(buf [2]);
+
+    lcd.setCursor(10, 1);
+    lcd.print(buf [1]);
+
+   }  // end if something received
+
+}  // end of loop


Create sumo_hc_sr04.ino

Create sumo_hc_sr04.ino

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

--- sumo_hc_sr04.ino
+++ sumo_hc_sr04.ino
@@ -0,0 +1,62 @@
+#define leftEcho 2  // left Echo Pin
+#define leftTrig 4  // left Trigger Pin
+#define rightEcho 7 // right Echo Pin
+#define rightTrig 6 // right Trigger Pin
+
+int maximumRange = 200; // Maximum range needed
+int minimumRange = 0; // Minimum range needed
+long duration, leftDistance, rightDistance; // Duration used to calculate distance
+
+void calcDistance() {
+/* The following trigPin/echoPin cycle is used to determine the
+ distance of the nearest object by bouncing soundwaves off of it. */
+ digitalWrite(leftTrig, LOW);
+ delayMicroseconds(2);
+ digitalWrite(leftTrig, HIGH);
+ delayMicroseconds(10);
+ digitalWrite(leftTrig, LOW);
+ duration = pulseIn(leftEcho, HIGH);
+ //Calculate the distance (in cm) based on the speed of sound.
+ leftDistance = duration/58.2;
+
+ digitalWrite(rightTrig, LOW);
+ delayMicroseconds(2);
+ digitalWrite(rightTrig, HIGH);
+ delayMicroseconds(10);
+ digitalWrite(rightTrig, LOW);
+ duration = pulseIn(rightEcho, HIGH);
+ //Calculate the distance (in cm) based on the speed of sound.
+ rightDistance = duration/58.2;
+}
+
+void setup() {
+ Serial.begin (9600);
+ pinMode(leftTrig, OUTPUT);
+ pinMode(leftEcho, INPUT);
+ pinMode(rightTrig, OUTPUT);
+ pinMode(rightEcho, INPUT);
+}
+
+void loop() {
+ calcDistance();
+
+ if (leftDistance >= maximumRange || leftDistance <= minimumRange){
+  Serial.print("Left: ");
+  Serial.println("-1");
+ }
+ else {
+  Serial.print("Left: ");
+  Serial.println(leftDistance);
+ }
+
+ if (rightDistance >= maximumRange || rightDistance <= minimumRange){
+  Serial.print("Right: ");
+  Serial.println("-1");
+ }
+ else {
+  Serial.print("Right: ");
+  Serial.println(rightDistance);
+ }
+
+ delay(50);
+}


added for 3 motors

added for 3 motors

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


sbr preliminary code

sbr preliminary code

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

--- SBR/SBR.ino
+++ SBR/SBR.ino
@@ -0,0 +1,196 @@
+#include <Wire.h>
+#include <Adafruit_RGBLCDShield.h>
+#include <utility/Adafruit_MCP23017.h>
+#include "RTClib.h"
+RTC_DS3231 rtc;
+Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
+#define RED 0x1
+#define YELLOW 0x3
+#define GREEN 0x2
+#define TEAL 0x6
+#define BLUE 0x4
+#define VIOLET 0x5
+#define WHITE 0x7
+int en1 = 2; //1 is fill
+int step1 = 3;
+int dir1 = 4;
+int en2 = 5;//2 is decant
+int step2 = 6;
+int dir2 = 7;
+int air = 9;
+int stir = 8;
+int depth = A0;
+float tank;
+void setup() {
+  pinMode(en1, OUTPUT);
+  pinMode(en2, OUTPUT);
+  pinMode(step1, OUTPUT);
+  pinMode(step2, OUTPUT);
+  pinMode(dir1, OUTPUT);
+  pinMode(dir2, OUTPUT);
+  pinMode(air, OUTPUT);
+  pinMode(stir, OUTPUT);
+  pinMode(depth, INPUT);
+  digitalWrite(en1, HIGH);
+  digitalWrite(en2, HIGH);
+  lcd.begin(16, 2);
+   if (! rtc.begin()) {
+    lcd.print("Couldn't find RTC");
+    while (1);
+  }
+
+  if (rtc.lostPower()) {
+    lcd.print("RTC lost power, lets set the time!");
+    // following line sets the RTC to the date & time this sketch was compiled
+    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
+    // This line sets the RTC with an explicit date & time, for example to set
+    // January 21, 2014 at 3am you would call:
+    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
+  }
+  // Print a message to the LCD. We track how long it takes since
+  // this library has been optimized a bit and we're proud of it :)
+  lcd.print("start!");
+  lcd.setBacklight(WHITE);
+  delay(5000);
+}
+uint8_t i=0;
+void loop() {
+  // put your main code here, to run repeatedly:
+  DateTime now = rtc.now();
+  lcd.setCursor(0, 0);
+  lcd.print(now.unixtime());
+  lcd.setCursor(0, 1);
+  lcd.print(millis()/1000);
+delay(1000);
+  uint8_t buttons = lcd.readButtons();
+
+  if (buttons) {
+    lcd.clear();
+    lcd.setCursor(0,0);
+    if (buttons & BUTTON_UP) {
+      lcd.print("UP ");
+      lcd.setBacklight(RED);
+    }
+    if (buttons & BUTTON_DOWN) {
+      lcd.print("DOWN ");
+      lcd.setBacklight(YELLOW);
+    }
+    if (buttons & BUTTON_LEFT) {
+      lcd.print("LEFT ");
+      lcd.setBacklight(GREEN);
+    }
+    if (buttons & BUTTON_RIGHT) {
+      lcd.print("RIGHT ");
+      lcd.setBacklight(TEAL);
+    }
+    if (buttons & BUTTON_SELECT) {
+      lcd.print("SELECT ");
+      lcd.setBacklight(VIOLET);
+    }
+  }
+  //write conditions for running sequence here and add functions
+  /*fill();
+  delay(5000);
+  aeration();
+  delay(5000);
+  settle();
+  delay(5000);
+  decant();
+  delay(5000);
+  rest();
+  delay(5000);*/
+  decant();
+}
+void fill(){//check depth and fill until level is 25gal plus stir
+  lcd.clear();
+  lcd.setCursor(0,0);
+  lcd.print("FILL ");
+  lcd.setBacklight(TEAL);
+  measurevol();
+  lcd.setCursor(0,1);
+  lcd.print(tank);
+  stepper(400, 1, 2);
+}
+void aeration(){//check depth and keep air on and pumps off for time period
+  lcd.clear();
+  lcd.setCursor(0,0);
+  lcd.print("Aeration ");
+  lcd.setBacklight(GREEN);
+  measurevol();
+  lcd.setCursor(0,1);
+  lcd.print(tank);
+  int starttime = millis();
+  while ((millis()-starttime)<10000){
+    digitalWrite(air, HIGH);}
+    digitalWrite(air, LOW);
+}
+void settle(){//everything off just timer
+  lcd.clear();
+  lcd.setCursor(0,0);
+  lcd.print("Settle ");
+  lcd.setBacklight(YELLOW);
+  measurevol();
+  lcd.setCursor(0,1);
+  lcd.print(tank);
+}
+void decant(){ // empty through decant pump checking volume
+  lcd.clear();
+  lcd.setCursor(0,0);
+  lcd.print("Decant ");
+  lcd.setBacklight(RED);
+  measurevol();
+  lcd.setCursor(0,1);
+  lcd.print(tank);
+  stepper(20000, 2, 1);
+}
+void rest(){ //everything off except maybe stir
+  lcd.clear();
+  lcd.setCursor(0,0);
+  lcd.print("REST ");
+  lcd.setBacklight(VIOLET);
+  measurevol();
+  lcd.setCursor(0,1);
+  lcd.print(tank);
+}
+void stepper(int num, int motor, int direct){
+  if (motor == 1){
+    digitalWrite(en1, LOW);
+    if (direct == 1){
+      digitalWrite(dir1, HIGH);}//empty
+      else if (direct ==2){
+        digitalWrite(dir1, LOW);}// fill
+    for (int i=0; i<num; i++){
+      digitalWrite(step1, HIGH);
+      delay(3);
+      digitalWrite(step1, LOW);
+      delay(3);
+  }
+  digitalWrite(en1, HIGH);
+}
+else if (motor ==2){
+    digitalWrite(en2, LOW);
+    if (direct == 1){
+      digitalWrite(dir2, HIGH);}//empty
+      else if (direct ==2){
+        digitalWrite(dir2, LOW);}// fill
+    for (int i=0; i<=num; i++){
+      digitalWrite(step2, HIGH);
+      delay(2);
+      digitalWrite(step2, LOW);
+      delay(2);
+  }
+  digitalWrite(en2, HIGH);
+}
+}
+void measurevol(){
+  int junk = analogRead(depth);
+  float tank1 = analogRead(depth)*0.438596-30.7018;
+  float tank2 = analogRead(depth)*0.438596-30.7018;
+  float tank3 = analogRead(depth)*0.438596-30.7018;
+  float tank4 = analogRead(depth)*0.438596-30.7018;
+  float tank5 =analogRead(depth)*0.438596-30.7018;
+  float tank6 = analogRead(depth)*0.438596-30.7018;
+  float tank7 =analogRead(depth)*0.438596-30.7018;
+  float tank8 = analogRead(depth)*0.438596-30.7018;
+  tank = (tank1 + tank2 + tank3 + tank4 + tank5 + tank6 + tank7 + tank8)/8;
+}


changed the test for the squares

changed the test for the squares

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

--- tictactoe/testSquare/testSquare.ino
+++ tictactoe/testSquare/testSquare.ino
@@ -0,0 +1,57 @@
+int redPin = 46;
+int greenPin = 47;
+int colorPin = 0;
+int color = 0;
+
+void setup()
+{
+  pinMode(redPin, OUTPUT);
+  pinMode(greenPin, OUTPUT);
+  Serial.begin(9600);
+}
+
+void red()
+{
+  digitalWrite(redPin, HIGH);
+  digitalWrite(greenPin, LOW);
+}
+
+void green()
+{
+  digitalWrite(redPin, LOW);
+  digitalWrite(greenPin, HIGH);
+}
+
+void none()
+{
+  digitalWrite(redPin, LOW);
+  digitalWrite(greenPin, LOW);
+}
+
+
+void loop()
+{
+  color = analogRead(colorPin);
+  Serial.println(color);
+  //Piezas plastico pintadas
+
+  if (color < 560 && color > 510 ){
+    green();
+  } else if(color < 510 && color > 450 ){
+    red();
+  }else{
+    none();
+  }
+
+
+  //Piezas esca imprimidas
+  /*
+  if (color < 265 && color > 250 ){
+    green();
+  } else if(color < 250 && color > 240 ){
+    red();
+  }else{
+    none();
+  }
+  */
+}


Create candy_cane_stripes.ino

Create candy_cane_stripes.ino

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

--- candy_cane_stripes.ino
+++ candy_cane_stripes.ino
@@ -0,0 +1,92 @@
+//***************************************************************
+// "candy cane" stripes
+// Original code concept by Christopher Kirkman
+// https://plus.google.com/118127046082317810519/posts/WfEcTXiroke
+//
+// Modified to use EVERY_N timer, added option to travel in
+// reverse, and added a third color option.
+//
+// Marc Miller, Dec 2017
+// Add randomness for number of colors and length, Dec 2018
+//***************************************************************
+
+#include "FastLED.h"
+#define LED_TYPE LPD8806
+#define DATA_PIN 11
+#define CLOCK_PIN 13
+#define NUM_LEDS 32
+#define COLOR_ORDER GRB
+CRGB leds[NUM_LEDS];
+#define BRIGHTNESS 70
+
+//---------------------------------------------------------------
+void setup() {
+  Serial.begin(115200);  // Allows serial monitor output (check baud rate)
+  delay(1500);  // Startup delay
+  FastLED.addLeds<LED_TYPE, DATA_PIN, CLOCK_PIN, COLOR_ORDER>(leds, NUM_LEDS);
+  FastLED.setBrightness(BRIGHTNESS);
+}
+
+//---------------------------------------------------------------
+void loop()
+{
+  candyCane();
+
+}//end_main_loop
+
+
+//---------------------------------------------------------------
+//Draw alternating bands of color, 2 or 3 colors.
+//When using three colors, color1 is used between the other two colors.
+void candyCane(){
+  CRGB color1 = CRGB::White;  // color used between color 2 (and 3 if used)
+  CRGB color2 = CRGB::Red;
+  //CRGB color3 = CHSV(0,170,255);  //optional 3rd color
+  CRGB color3 = CRGB(0,255,0);  //optional 3rd color
+  const uint16_t travelSpeed = 150;
+  int shiftBy = 1;  //shiftBy can be positive or negative (to change direction)
+  static uint8_t numColors = 3;  // Can be either 2 or 3
+  static uint8_t stripeLength = 5;  //number of pixels per color
+  static int offset;
+
+  EVERY_N_SECONDS(5) {
+    numColors = random8(2,4);  //picks either 2 or 3
+    stripeLength = random8(3,6);  //picks random length
+  }
+
+  EVERY_N_MILLISECONDS(travelSpeed) {
+    if (numColors==2) {
+      for (uint8_t i=0; i<NUM_LEDS; i++){
+        if ( (i+offset)%((numColors)*stripeLength)<stripeLength ) {
+          leds[i] = color2;
+        } else {
+          leds[i] = color1;
+        }
+      }
+    }
+
+    if (numColors==3) {
+      for (uint8_t i=0; i<NUM_LEDS; i++){
+        if ( (i+offset)%((numColors+1)*stripeLength)<stripeLength ) {
+          leds[i] = color2;
+        }
+        else if ( (i+offset+(2*stripeLength))%((numColors+1)*stripeLength)<stripeLength ) {
+          leds[i] = color3;
+        } else {
+          leds[i] = color1;
+        }
+      }
+    }
+
+    FastLED.show();
+
+    offset = offset + shiftBy;
+    if (shiftBy>0) {  //for positive shiftBy
+      if (offset>=NUM_LEDS) offset = 0;
+    } else {  //for negitive shiftBy
+      if (offset<0) offset = NUM_LEDS;
+    }
+
+  }//end EVERY_N
+}//end candyCane
+


Add Timer NTP sketch

Add Timer NTP sketch

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


Debug serial prints

Debug serial prints

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/PAAW/mAEWing1.git/'