New file MicroGirs.ino.

New file MicroGirs.ino.

/*
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);
}

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


Arduino File.

Arduino File.

#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);
}

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


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...

<!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>

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


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

#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

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

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


Create setupFunctions.ino

Create setupFunctions.ino

void startPins(){

}

void initialize(){
	//panServo.attach(panPin);
	//panServo.attach(tiltPin);
	mpuSetup();
}

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


undo test

undo test

esp8266/projects/Blynk Light Switch v1/blynk_light_switch_01/blynk_light_switch_01.ino

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


Adding a new cylon eye type example

Adding a new cylon eye type example

#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);
	}
}

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


Initial commit

Initial commit

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

/* 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);
}

}

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


Add string equivalent example for teensy

/*
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");
}

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


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

#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);

}

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


Create slave_lcd_grove.ino

Create slave_lcd_grove.ino

#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

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


Create sumo_hc_sr04.ino

Create sumo_hc_sr04.ino

#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);
}

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


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

#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;
}

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


changed the test for the squares

changed the test for the squares

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();
  }
  */
}

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


Create candy_cane_stripes.ino

Create candy_cane_stripes.ino

//***************************************************************
// "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

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


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


Low latency logger sample for Teensy 3.5/3.6 SDIO SD slot.

/*
 * Distributed under the 2-clause BSD licence (See LICENCE.TXT file at the
 * repository root).
 *
 * Copyright (c) 2017 Tilo Nitzsche.  All rights reserved.
 *
 * https://github.com/tni/teensy-samples
 */

// Sample code for data logging. It uses a pre-allocated, pre-erased
// file to minimize latency from SD card writes. This can reduce
// the worst case write latency from 850ms down to 40ms, drastically
// reducing the required buffer size.
//
// It is intented for usage with SdFat beta:
// https://github.com/greiman/SdFat-beta
//
// with the Teensy 3.5 or 3.6 SDIO slot.
//
// The log data is captured in an ISR, triggered by an 'IntervalTimer'.
// An interrupt-safe FIFO is used for interrupt-safe communication
// with the main loop which is responsible for writing the captured data
// to the SD card.

#include <array>
#include <atomic>
#include <SdFat.h>

// Content for debugging purposes.
// Replace with something useful.
struct LogEntry {
    uint32_t counter;
    uint32_t record_offset;
    uint32_t time;
    uint32_t dummy;
};

// Buffer that holds our log entries. When a buffer is full,
// it is written to SD.
template<class entry_t, size_t entry_count>
class LogBuffer {
public:
    void addEntry(const entry_t& entry) {
        if(size < capacity) log_entries[size++] = entry;
    }
    bool full() { return size >= capacity; }

    static_assert(std::is_same<uint8_t, unsigned char>::value, "Aliasing rule violation.");
    uint8_t* rawData() { return (uint8_t*) log_entries.data(); }

    size_t rawSize() { return size * sizeof(entry_t); }
    void reset() { *this = {}; }
private:
    static constexpr size_t capacity = entry_count;
    std::array<entry_t, capacity> log_entries = {};
    size_t size = 0;
};

// Simple lock free single-producer, single-consumer FIFO. Interrupt-safe.
// It is intended for small entries.
// Note: atomic_signal_fence is a compiler barrier only. It requires a CPU
//       with memory order guarantees (like ARM Cortex M) to be sufficient.
template<class entry_t, size_t capacity_>
class FifoSpSc {
public:
    // Add entry to end of FIFO. FIFO must not be full.
    void push(const entry_t& elem) {
        atomic_signal_fence(std::memory_order_acq_rel);
        const size_t write_pos_ = write_pos;
        buffer[write_pos_] = elem;
        atomic_signal_fence(std::memory_order_acq_rel);
        write_pos = nextPos(write_pos_);
        atomic_signal_fence(std::memory_order_acq_rel);
    }
    // Remove and return first FIFO entry. FIFO must not be empty.
    entry_t pop() {
        atomic_signal_fence(std::memory_order_acq_rel);
        const size_t read_pos_ = read_pos;
        entry_t ret = buffer[read_pos_];
        atomic_signal_fence(std::memory_order_acq_rel);
        read_pos = nextPos(read_pos_);
        atomic_signal_fence(std::memory_order_acq_rel);
        return ret;
    }
    bool empty() const { atomic_signal_fence(std::memory_order_acq_rel); return read_pos == write_pos; }
    bool full() const { atomic_signal_fence(std::memory_order_acq_rel); return read_pos == nextPos(write_pos); }
    size_t size() const {
        atomic_signal_fence(std::memory_order_acq_rel);
        const size_t read_pos_ = read_pos;
        const size_t write_pos_ = write_pos;
        return write_pos_ - read_pos_ + (write_pos_ >= read_pos_ ? 0 : buffer_size);
    }
    static size_t capacity() { return capacity_; }
private:
    static size_t nextPos(size_t pos) { return pos + 1 < buffer_size ? pos + 1 : 0; }

    static constexpr size_t buffer_size = capacity_ + 1;
    std::array<entry_t, buffer_size> buffer;
    volatile size_t write_pos;
    volatile size_t read_pos;
};

// Class for pre-allocated, pre-erased file.
// It has an internal buffer that holds partial sector writes. This allows efficient writes
// of any size.
template<class sd_fat_t, class debuglog_t = void>
class PreallocatedFile {
public:
    enum Error {
        E_ok = 0,              // no error
        E_eof,                 // end of file reached
        E_create_contiguous,   // error allocating contiguous file
        E_erase,               // error erasing allocated block
        E_write_block,         // error writing data block
    };

    // Use SdFatSdio or SdFatSdioEX for sd_fat_t.
    // 'debuglog' is optionally used for printing debug messages. Use one of the Arduino Stream classes,
    // e.g. 'Serial'.
    PreallocatedFile(sd_fat_t& sd_fat, debuglog_t* debuglog = nullptr) : sd_fat(sd_fat), debuglog(debuglog) {}
    ~PreallocatedFile() { if(next_sector) close(); }

    // Create a pre-allocated, pre-erased contiguous file. Any existing file
    // with the same name, is erased.
    // Return true on success.
    bool create(const char* name, uint32_t size) {
        log("Creating file: %s\n", name);
        if(next_sector) close();
        last_error = E_ok;
        sd_fat.remove(name);
        if(!file.createContiguous(sd_fat.vwd(), name, size)) {
            log("ContigFile: createContiguous() failed");
            last_error = E_create_contiguous;
            return false;
        }
        uint32_t first_sector, last_sector;
        if(!file.contiguousRange(&first_sector, &last_sector)) {
            log("PreallocatedFile: contiguousRange() failed");
            last_error = E_create_contiguous;
            return false;
        }
        if(!sd_fat.card()->erase(first_sector, last_sector)) {
            log("PreallocatedFile: erase() failed");
            last_error = E_erase;
            return false;
        }
        log("First sector: %u     last sector: %u\n", first_sector, last_sector);
        this->first_sector = first_sector;
        this->last_sector = last_sector;
        next_sector = first_sector;

        file.flush();
        return true;
    }

    // Only full sectors can be written to disk. Partial sectors are automatically
    // buffered. Writes of any size are allowed.
    // sync_blocks == true closes the current multi-block write and allows the SD card to go
    // to sleep. Performance is much lower.
    bool write(const uint8_t* buffer, size_t size, bool sync_blocks = false) {
        last_error = E_ok;
        if(!next_sector || next_sector > last_sector) {
            last_error = E_eof;
            return false;
        }
        if(partial_sector_len) {
            size_t copy_len = std::min(512 - partial_sector_len, size);
            memcpy(partial_sector_buffer + partial_sector_len, buffer, copy_len);
            partial_sector_len += copy_len;
            if(partial_sector_len < 512) return true;
            if(!sd_fat.card()->writeBlocks(next_sector, partial_sector_buffer, 1)) {
                last_error = E_write_block;
                log("Error writing log file. Current sector: %u\n", next_sector);
            }
            next_sector++;
            buffer += copy_len;
            size -= copy_len;
            partial_sector_len = 0;
        }
        const size_t sector_count = size / 512;
        if(sector_count) {
            if(!sd_fat.card()->writeBlocks(next_sector, buffer, sector_count)) {
                last_error = E_write_block;
                log("Error writing log file. Current sector: %u\n", next_sector);
            }
            next_sector += sector_count;
            size -= sector_count * 512;
            buffer += sector_count * 512;
        }
        if(size) {
            memcpy(partial_sector_buffer, buffer, size);
            partial_sector_len = size;
        }
        if(sync_blocks) sd_fat.card()->syncBlocks();
        return last_error == E_ok;
    }

    // Buffered data is written to disk, the file is truncated to the amount of data
    // that was written and then closed.
    void close() {
        last_error = E_ok;
        if(next_sector && partial_sector_len) {
            if(!sd_fat.card()->writeBlocks(next_sector, partial_sector_buffer, 1)) {
                last_error = E_write_block;
                log("Error writing log file. Current sector: %u\n", next_sector);
            }
        }
        if(next_sector) file.truncate((next_sector - first_sector - 1) * 512 + partial_sector_len);
        file.close();
        partial_sector_len = 0;
        first_sector = 0;
        last_sector = 0;
        next_sector = 0;
    }

    size_t getWriteSector() { return next_sector; }
    Error getLastError() { return last_error; }

private:
    void log(const char* msg) { if(debuglog) debuglog->println(msg); }

    template<class... args_t>
    void log(args_t... args) { if(debuglog) debuglog->printf(args...); }

    File file;
    sd_fat_t& sd_fat;
    debuglog_t* debuglog = nullptr;
    uint32_t first_sector = 0;
    uint32_t last_sector = 0;
    uint32_t next_sector = 0;
    uint8_t partial_sector_buffer[512] __attribute__ ((aligned (4))) = {};
    size_t partial_sector_len = 0;
    Error last_error = E_ok;
};

// Store 'LogEntry's in 'LogBuffer'. Each buffer holds around 4200 bytes.
using MyLogBuffer = LogBuffer<LogEntry, 4200 / sizeof(LogEntry)>;

constexpr size_t log_buffer_count = 40;
const char* log_file_name = "log.bin";
uint8_t sensor_pin = A0;
uint32_t log_file_size = 2ull * 1024 * 1024 * 1024;  // 2GB
// PIT timer interval for invoking our data capture ISR.
uint32_t capture_interval = 10;  // in microseconds

// Allocate storage for log buffers.
std::array<MyLogBuffer, log_buffer_count> log_buffers;
// FIFO that holds pointers our empty log_buffers.
FifoSpSc<MyLogBuffer*, log_buffer_count> empty_log_buffers;
// Put all allocated log buffers into 'empty_log_buffers' FIFO.
char empty_log_buffers_init = [](){
    for(size_t i = 0; i < log_buffer_count; i++) empty_log_buffers.push(&log_buffers[i]);
    return 0;
}();
// Filled log buffer FIFO.
FifoSpSc<MyLogBuffer*, log_buffer_count> filled_log_buffers;

auto& serial = Serial;
// Count the number of times our log buffers overflow.
std::atomic<size_t> buffer_overflow_counter;

SdFatSdioEX sd_fat;
bool logging_finished = false;
size_t written_bytes = 0;
size_t max_buffers_used = 0;

// Add log entry to log buffers.
void logEntry(const LogEntry& log_entry) {
    static MyLogBuffer* log_buffer = nullptr;
    if(!log_buffer) {
        if(empty_log_buffers.empty()) {
            buffer_overflow_counter++;
            return;
        } else {
            log_buffer = empty_log_buffers.pop();
        }
    }
    log_buffer->addEntry(log_entry);
    if(log_buffer->full()) {
        filled_log_buffers.push(log_buffer);
        log_buffer = nullptr;
    }
}

// ISR, periodically triggered by PIT timer. It creates some dummy
// log entries. Put your data capturing here.
void captureData() {
    uint32_t time = micros();
    static uint32_t counter = 0;
    static uint32_t record_offset = 0;

    logEntry( { counter, record_offset, time, 0x42424242 } );
    counter++;
    record_offset += sizeof(LogEntry);
}

void setup() {
    pinMode(LED_BUILTIN, OUTPUT);
    serial.begin(115200);
    delay(2000);
    serial.println("Initializing SD.");

    if (!sd_fat.begin()) {
        serial.println("SD init failed.");
        return;
    }
    serial.println("SD init done.");

    using file_t = PreallocatedFile<decltype(sd_fat), std::remove_reference<decltype(serial)>::type>;
    file_t file(sd_fat, &serial);
    file.create(log_file_name, log_file_size);
    serial.println("Log file allocated and pre-erased.");
    serial.println("\nPress 'c' to terminate logging.\n");

    elapsedMillis report_timer;
    IntervalTimer data_capture_timer;
    data_capture_timer.begin(captureData, capture_interval);

    while(true) {
        // If we have a filled log buffer, write it to SD.
        if(!filled_log_buffers.empty()) {
            max_buffers_used = std::max(max_buffers_used, empty_log_buffers.capacity() - empty_log_buffers.size());
            MyLogBuffer* log_buffer = filled_log_buffers.pop();
            if(!file.write(log_buffer->rawData(), log_buffer->rawSize())) {
                if(file.getLastError() == file.E_eof) {
                    file.close();
                    serial.println("Log file full. Logging finished.");
                    return;
                }
                // ignore other write errors, hopefully subsequent writes will succeed
            }
            written_bytes += log_buffer->rawSize();
            *log_buffer = {};
            empty_log_buffers.push(log_buffer);
        }
        if(report_timer > 5000) {
            serial.printf("elapsed: %us     bytes written: %u     buffer overflow count: %u\n",
                           millis() / 1000, written_bytes, buffer_overflow_counter.load());
            serial.printf("next write sector: %u    max buffers used during last 5s: %u\n",
                          file.getWriteSector(), max_buffers_used);
            report_timer = 0;
            max_buffers_used = 0;
        }
        if(serial.available()) {
            if(serial.read() == 'c') {
                file.close();
                serial.println("Logging finished.");
                return;
            }
        }
    }
}

// Running when an error is encountered or when logging is finished.
void loop() {
    digitalWrite(LED_BUILTIN, HIGH);
    delay(200);
    digitalWrite(LED_BUILTIN, LOW);
    delay(200);
}

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


Added SHT heating code.

Added SHT heating code.

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


xBee_2.0

#include <Dynamixel_Serial.h>
//#include <readxBee.h>

int x, y, z, emg1, emg2;
int infoPk[24];

int actualName(){
  if(Serial1.available() >= 24){
    if (Serial1.read() == 0x7E){
          for (int i = 0; i < 22 ; i++){
            byte jelly = Serial1.read();
            infoPk[i] = jelly;
          }
          for(int a = 13; a < 22; a++) {
            x = infoPk[15] + (infoPk[14] << 8);
            y = infoPk[13] + (infoPk[12] << 8);
            z = infoPk[17] + (infoPk[16] << 8);
            emg1 = infoPk[11] + (infoPk[10] << 8);
            emg2 = infoPk[19] + (infoPk[18] << 8);
          }
          Serial.print(" X = ");
          Serial.print(x);
          Serial.print(" Y = ");
          Serial.print(y);
          Serial.print(" Z = ");
          Serial.print(z);
          Serial.print(" EMG Ch.1 = ");
          Serial.print(emg1);
          Serial.print(" EMG Ch.2 = ");
          Serial.print(emg2);
          Serial.println();

    }
  }
}
void setup() {
  Serial.begin(115200);
  Serial1.begin(115200);
}

void loop() {
  actualName();
}

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


_08_kidSerie_sketch_01.No_Bluetooth.ino.ino

_08_kidSerie_sketch_01.No_Bluetooth.ino.ino

/*
  Project name:
     Park Assist I w/ MIT App Inventor 2 - Bluetooth + Arduino + MIT App + HC-SR04 Sonar #kidSerie —08
     Flavour I - With Bluetooth
     Hex File: _08_kidSerie_sketch_01.No_Bluetooth.ino
   Revision History:
     14/05/2017:
Description:
        How about that, sound and vibrate your cell? There you are!
        Here is a Golpe de Vista circuit for building garages that are getting tighter and tighter.

    MCU:                     Arduino 1.8.2 - @16MHz       http://www.arduino.cc/
IC Chip:                     Bluetooth Datasheet - HC-06   https://goo.gl/s9ZcNC
Connections:
      See Official youtube channel vids: https://goo.gl/pj20lS

Based on:  see bellow

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License v3 as published by the Free Software Foundation

*/
/*
  HC-SR04 Ping distance sensor]
  VCC to arduino 5v GND to arduino GND
  Echo to Arduino pin 13 Trig to Arduino pin 12
  Red POS to Arduino pin 11
  Green POS to Arduino pin 10
  560 ohm resistor to both LED NEG and GRD power rail
  More info at: http://goo.gl/kJ8Gl
  Original code improvements to the Ping sketch sourced from Trollmaker.com
  Some code and wiring inspired by http://en.wikiversity.org/wiki/User:Dstaub/robotcar
*/

#define trigPin 13
#define echoPin 12
#define stop_LED 11
#define go_LED 10

void setup() {

  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(stop_LED, OUTPUT);
  pinMode(go_LED, OUTPUT);
}

void loop() {
  long duration, distance;
  digitalWrite(trigPin, LOW);     // Added this line
  delayMicroseconds(2);           // Added this line
  digitalWrite(trigPin, HIGH);
                                  //  delayMicroseconds(1000); - Removed this line
  delayMicroseconds(10);          // Added this line
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration ) / 58.2;
  if (distance < 5) {             // This is where the LED On/Off happens
    digitalWrite(stop_LED, HIGH); // When the Red condition is met, the Green LED should turn off
    digitalWrite(go_LED, LOW);
  }
  else {
    digitalWrite(stop_LED, LOW);
    digitalWrite(go_LED, HIGH);
  }
  delay(500);
}

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


Add ArduCAM mini 5MP Low Power example

Add ArduCAM mini 5MP Low Power example

#include <Wire.h>
#include <ArduCAM.h>
#include <SPI.h>
#include "memorysaver.h"

// set pin 4 as the slave select for the digital pot:
const int CS = 4;

ArduCAM myCAM(OV5642,CS);

void setup() {
  uint8_t vid,pid;
  uint8_t temp;
#if defined (__AVR__)
  Wire.begin();
#endif
#if defined(__arm__)
  Wire1.begin();
#endif
  Serial.begin(921600);
  Serial.println("ArduCAM Start!");

  // set the SPI_CS as an output:
  pinMode(CS, OUTPUT);

  // initialize SPI:
  SPI.begin();
  //Check if the ArduCAM SPI bus is OK
  myCAM.write_reg(ARDUCHIP_TEST1, 0x55);
  temp = myCAM.read_reg(ARDUCHIP_TEST1);
  //Serial.println(temp);
  if(temp != 0x55)
  {
    Serial.println("SPI1 interface Error!");
    //while(1);
  }

  //Check if the camera module type is OV5642
  myCAM.rdSensorReg16_8(OV5642_CHIPID_HIGH, &vid);
  myCAM.rdSensorReg16_8(OV5642_CHIPID_LOW, &pid);
  if((vid != 0x56) || (pid != 0x42))
    Serial.println("Can't find OV5642 module!");
  else
    Serial.println("OV5642 detected.");

  //Change to JPEG capture mode and initialize the OV5642 module
  myCAM.set_format(JPEG);
  myCAM.InitCAM();
  myCAM.write_reg(ARDUCHIP_TIM, VSYNC_LEVEL_MASK);

  myCAM.clear_fifo_flag();
  myCAM.write_reg(ARDUCHIP_FRAMES,0x00);
  myCAM.set_bit(ARDUCHIP_GPIO,GPIO_PWDN_MASK);//enable low power
}

void loop() {
  uint8_t temp,temp_last;
  uint8_t start_capture = 0;

  temp = Serial.read();
  switch(temp)
  {
    case 0:
      myCAM.clear_bit(ARDUCHIP_GPIO,GPIO_PWDN_MASK);
      myCAM.OV5642_set_JPEG_size(OV5642_320x240);
      myCAM.set_bit(ARDUCHIP_GPIO,GPIO_PWDN_MASK);
      break;
    case 1:
      myCAM.clear_bit(ARDUCHIP_GPIO,GPIO_PWDN_MASK);
      myCAM.OV5642_set_JPEG_size(OV5642_640x480);
      myCAM.set_bit(ARDUCHIP_GPIO,GPIO_PWDN_MASK);
      break;
    case 2:
      myCAM.clear_bit(ARDUCHIP_GPIO,GPIO_PWDN_MASK);
      myCAM.OV5642_set_JPEG_size(OV5642_1280x720);
      myCAM.set_bit(ARDUCHIP_GPIO,GPIO_PWDN_MASK);
      break;
    case 3:
      myCAM.clear_bit(ARDUCHIP_GPIO,GPIO_PWDN_MASK);
      myCAM.OV5642_set_JPEG_size(OV5642_1920x1080);
      myCAM.set_bit(ARDUCHIP_GPIO,GPIO_PWDN_MASK);
      break;
    case 4:
      myCAM.clear_bit(ARDUCHIP_GPIO,GPIO_PWDN_MASK);
      myCAM.OV5642_set_JPEG_size(OV5642_2048x1563);
      myCAM.set_bit(ARDUCHIP_GPIO,GPIO_PWDN_MASK);
      break;
    case 5:
      myCAM.clear_bit(ARDUCHIP_GPIO,GPIO_PWDN_MASK);
      myCAM.OV5642_set_JPEG_size(OV5642_2592x1944);
      myCAM.set_bit(ARDUCHIP_GPIO,GPIO_PWDN_MASK);
      break;
    case 0x10:
      start_capture = 1;
      Serial.println("CAM1 start single shot.");
      myCAM.clear_bit(ARDUCHIP_GPIO,GPIO_PWDN_MASK);//disable low power

      delay(800);
      break;
    default:
      break;
  }
  if(start_capture == 1)
  {
    myCAM.flush_fifo();
    myCAM.clear_fifo_flag();
    //Start capture
    myCAM.start_capture();
    start_capture = 0;
  }
  if(myCAM.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK))
  {
    myCAM.set_bit(ARDUCHIP_GPIO,GPIO_PWDN_MASK);
    Serial.println("CAM1 Capture Done!");
    temp = 0;
    while( (temp != 0xD9) | (temp_last != 0xFF) )
    {
      temp_last = temp;
      temp = myCAM.read_fifo();
      Serial.write(temp);
      delayMicroseconds(10);
    }
    //Clear the capture done flag
    myCAM.clear_fifo_flag();
  }
}

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


Tidy up

Tidy 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/freephases/lenr-logger.git/'


FIX night and PWM flickering on pins that use timer3

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


Add new piano revision from Tim with adjustable volume knob

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


Remise en place des commande moteur

Remise en place des commande moteur

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