first version

first version

/*
MIT License

Copyright (c) 2016 Susumu Yamazaki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

#include <functional-vlpp.h>

#include <limits.h>

//#define DEBUG

#define LED1 9
#define LED2 10
#define LED3 11

#define TIC 100

void null_func() {
}

class Schedule {
  private:
    static Schedule *_queue;
    int _delay_time;
    Schedule *_prev;
    Schedule *_next;
    vl::Func<void(void)> _function;

  public:
    static void init() {
      _queue = new Schedule(0, null_func);
      _queue->link(new Schedule(INT_MAX, null_func));
    }

    static Schedule *queue() {
      return _queue;
    }

    Schedule(int delay_time, vl::Func<void(void)> func) {
      this->_delay_time = delay_time;
      this->_function = func;
      this->_prev = NULL;
      this->_next = NULL;
    }

    void link(Schedule *next) {
      this->_next = next;
      next->_prev = this;
    }

    int delay_time() {
      return _delay_time;
    }

    static Schedule *first() {
      return _queue->_next;
    }

    static int is_empty() {
      return _queue->_next->is_end();
    }

    Schedule *next() {
      return _next;
    }

    Schedule *prev() {
      return _prev;
    }

    void wait() {
      delay(this->_delay_time);
    }

    void call() {
      _function();
    }

    static void add(int delay_time, vl::Func<void(void)> func) {
      Schedule *s;
      for (s = queue(); delay_time >= s->_delay_time; s = s->_next) {
        delay_time -= s->_delay_time;
      }
      Schedule *n = new Schedule(delay_time, func);
      Schedule *p = s->_prev;
      p->link(n);
      n->link(s);
      if (!s->is_end()) {
        s->_delay_time -= delay_time;
      }
    }

    static Schedule *pull() {
      Schedule *ret_value = queue()->_next;
      if (ret_value->is_end()) {
        return ret_value;
      }
      Schedule *p = ret_value->_prev;
      Schedule *n = ret_value->_next;
      p->link(n);
      ret_value->_next = NULL;
      ret_value->_prev = NULL;
      return ret_value;
    }

    int is_end() {
      return (this->_next == NULL);
    }

};

Schedule* Schedule::_queue;

void print_queue() {
  Serial.print("q:");
  for(Schedule *s = Schedule::first(); !(s->is_end()); s = s->next()) {
     Serial.print(s->delay_time());
     Serial.print(',');
  }
  Serial.print('\n');
}

void dispatch() {
  while(!Schedule::is_empty()) {
    #ifdef DEBUG
    print_queue();
    #endif
    Schedule *s = Schedule::pull();
    s->wait();
    s->call();
    delete s;
  }
}

void sleep(int time, vl::Func<void(void)> func) {
  Schedule::add(time, func);
  dispatch();
}

void fork(vl::Func<void(void)> func1, vl::Func<void(void)> func2) {
  Schedule::add(0, func1);
  Schedule::add(0, func2);
  dispatch();
}

void setup() {
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
  Schedule::init();
  Serial.begin(9600);
}

void led1() {
  digitalWrite(LED1, HIGH);
  sleep(TIC, [&] {
     digitalWrite(LED1, LOW);
     sleep(TIC, [&] {
       digitalWrite(LED1, HIGH);
       sleep(TIC, [&] {
         digitalWrite(LED1, LOW);
         sleep(TIC, [&] {});
       });
     });
  });
}

void led2() {
  digitalWrite(LED2, HIGH);
  sleep(TIC * 2, [&] {
     digitalWrite(LED2, LOW);
     sleep(TIC * 2, [&] {});
  });
}

void led3() {
  digitalWrite(LED3, LOW);
  sleep(TIC * 2, [&] {
     digitalWrite(LED3, HIGH);
     sleep(TIC * 2, [&] {});
  });
}

void loop() {
  fork(led1, [&] { fork(led2, led3); });
}

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


Removed a reference to an LED in serial loopback that we dont' use

 - was breaking the build of the serial loopback example

error: pathspec 'examples/LightBlue' did not match any file(s) known to git
error: pathspec 'Bean/01.Basics/SerialLoopback/SerialLoopback.ino' did not match any file(s) known to git


Create simplemodbusmaster.ino

Create simplemodbusmaster.ino

#include <SimpleModbusMaster.h>

/*
   The example will use packet1 to read a register from address 0 (the adc ch0 value)
   from the arduino slave (id=1). It will then use this value to adjust the brightness
   of an led on pin 9 using PWM.
   It will then use packet2 to write a register (its own adc ch0 value) to address 1
   on the arduino slave (id=1) adjusting the brightness of an led on pin 9 using PWM.
*/

//////////////////// Port information ///////////////////
#define baud 9600
#define timeout 1000
#define polling 200 // the scan rate
#define retry_count 10

// used to toggle the receive/transmit pin on the driver
#define TxEnablePin 2

#define LED 9
long randNumber;
// The total amount of available memory on the master to store data
#define TOTAL_NO_OF_REGISTERS 1

// This is the easiest way to create new packets
// Add as many as you want. TOTAL_NO_OF_PACKETS
// is automatically updated.
enum
{
  PACKET1,
  PACKET2,
  TOTAL_NO_OF_PACKETS // leave this last entry
};

// Create an array of Packets to be configured
Packet packets[TOTAL_NO_OF_PACKETS];

// Masters register array
unsigned int regs[TOTAL_NO_OF_REGISTERS];

void setup()
{
  // Initialize each packet
  modbus_construct(&packets[PACKET1], 1, READ_HOLDING_REGISTERS, 0, 1, 0);
  modbus_construct(&packets[PACKET2], 1, PRESET_MULTIPLE_REGISTERS, 1, 1, 0);

  // Initialize the Modbus Finite State Machine
  modbus_configure(&Serial, baud, SERIAL_8N2, timeout, polling, retry_count, TxEnablePin, packets, TOTAL_NO_OF_PACKETS, regs);

  pinMode(LED, OUTPUT);
}

void loop()
{randNumber = random(200,255);

  modbus_update();

  //regs[0] = analogRead(0); // update data to be written to arduino slave
  regs[0] = randNumber;

  //analogWrite(LED, regs[0]>>2); // constrain adc value from the arduino slave to 255
}

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


ok, this 'optimization' is destroying the roundings …

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


add ds18b20 sensor source code

add ds18b20 sensor source code

#include <OneWire.h>
#include <DallasTemperature.h>

//the pin you connect the ds18b20 to
#define DS18B20 2

OneWire ourWire(DS18B20);
DallasTemperature sensors(&ourWire);

void setup()
{
  Serial.begin(9600);
  delay(1000);
  //start reading
  sensors.begin();
}

void loop()
{
  //read temperature and output via serial
  sensors.requestTemperatures();
  Serial.print(sensors.getTempCByIndex(0));
  Serial.println(" degrees C");
}

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


Initial commit

Initial commit

#include <Wire.h>
#include <SoftwareSerial.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <dht.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>
#include <LowPower.h>

/* Datapins for DS18B20, DHT22 and software serial
The BMP180 must be connected to the I2C interface */
#define ONE_WIRE_PIN 9  //DS18B20
#define DHT22_PIN 6   //DHT22
#define softSer_RX 10   //SoftwareSerial RX
#define softSer_TX 11 //SoftwareSerial TX

//Create entitis for the sensors and the software serial interface
OneWire oneWire(ONE_WIRE_PIN);
DallasTemperature sensors(&oneWire);
dht DHT;
Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);
SoftwareSerial bluetooth(softSer_RX, softSer_TX);

void setup(){
    //Start software serial with 9600 baud
    bluetooth.begin(9600);

    //Initialize the BMP180
    bmp.begin();
    sensor_t sensor;
    bmp.getSensor(&sensor);
    sensors.begin();
}

void loop(){
  //Read temperature (DS18S20)
  sensors.requestTemperatures();

  //Read humidity (DHT22)
  uint32_t start = micros();
  int chk = DHT.read22(DHT22_PIN);
  uint32_t stop = micros();

  //Read pressure (BMP180)
  sensors_event_t event;
  bmp.getEvent(&event);

  //Write data to the bluetooth module
  bluetooth.print(sensors.getTempCByIndex(0), 1);
  bluetooth.print(";");
  bluetooth.print(DHT.humidity, 1);
  bluetooth.print(";");
  bluetooth.print(event.pressure);
  bluetooth.println();

  //Sleep for 10 minutes
  sleep();
}

void sleep() {
  for (int i = 0; i < 75; i++) {
    LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
  }
}

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


prototipagem para enviar

prototipagem para enviar

#include <SPI.h>
#include <Ethernet.h>
#include <PubSubClient.h>

long int TTS = 0;
// Update these with values suitable for your network.
byte mac[]    = {  0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
IPAddress ip(10, 210, 1, 21);
IPAddress server(10,  210, 1, 20);

void callback(char* topic, byte* payload, unsigned int length) {
  Serial.print("Message arrived [");
  Serial.print(topic);
  Serial.print("] ");
  for (int i=0;i<length;i++) {
    Serial.print((char)payload[i]);
  }
  Serial.println();
}

EthernetClient ethClient;
PubSubClient client(ethClient);

void reconnect() {
  char mensagem[] = "";
  // Loop until we're reconnected
  while (!client.connected()) {
    Serial.print("Attempting MQTT connection...");
    // Attempt to connect
    if (client.connect("arduinoClient")) {
      Serial.println("connected");
      while (true) {
      Serial.println(TTS);
      if (TTS % 2) {
       client.publish("teste", "digital reconhecida");
      } else { client.publish("teste", "digital desconhecida");}
      delay(5000);
      client.subscribe("inTopic");
      TTS++;
      }
      // ... and resubscribe
    } else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      // Wait 5 seconds before retrying
      delay(5000);
    }
  }
}

void setup()
{
  Serial.begin(57600);

  client.setServer(server, 1883);
  client.setCallback(callback);

  Ethernet.begin(mac, ip);
  // Allow the hardware to sort itself out
  delay(1500);
}

void loop()
{
  if (!client.connected()) {
    reconnect();
  }
  client.loop();
}

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


Nightly

Nightly

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/rniemand/ArduinoProjects.git/'


Implemented average/mean and standard deviation calculations, used on measurements. Will have to extend these to get mean and std. dev. from means and std. devs. of successive waveforms. This will do, for now. Implemented data_ready flag to prevent overwriting volatile vdata[] while doing calculations, without disabling/detaching interrupts. It's clean and quick. The lasts tests, measuring ISR timing in relation to the motor emf signal and PWM waveform, were perfect. Now, back to the lab to test the actual ADC measurements, to see if they agree with the oscilloscope!

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


Adds first draft of Light Shield Arduino-side code.

Former-commit-id: 1fc5c1a00a6fde018c7f9df5f0b404e96cede603

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/jondolan/igvc-software.git/'


RFduino implementation works correctly.

RFduino implementation works correctly.

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/Ossit/SenseBack.git/'


fixed to match the top cover

fixed to match the top cover

again, instead of 1023 -> 0, it changes the threshold value from 0 ->
1023 so that it would match the top cover that we designed.

error: pathspec 'Modifier' did not match any file(s) known to git
error: pathspec 'Modules/Threshold/ThresholdATtiny/ThresholdATtiny.ino' did not match any file(s) known to git


Added Bluetooth Testing library.

Added Bluetooth Testing library.

#include <SoftwareSerial.h>

// Here's a bluetooth device connect to pins 6 and 5
 SoftwareSerial bt(5,4);
 char btt = '0';
 char srl = '0';

void setup()
{
 Serial.begin(115200);
 Serial.println("System Up: BLUETOOTH SLAVE");
 bt.begin(9600);
}

void loop()
{
 if (bt.available())
 {
   String command; //string to store entire command line
   while (bt.available())
   {
     btt = bt.read();
     Serial.print(btt);
     delay(50);
   }
 }

 if (Serial.available())
 {
   String command; //string to store entire command line
   while (Serial.available())
   {
     srl = Serial.read();
     Serial.print(srl);
     bt.write(srl);
     delay(50);
     command += srl; //iterates char into string
   }
   if (command == "mucho") //this compares catched string vs. expected command string
   {
     Serial.print("COMMAND!");
     bt.print("COMMAND!");
   }
     Serial.println("");
     bt.println("");
 }
}

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


Added basic code template.

Added basic code template.

/*
 * This is the CS-11M program template. Change this text to
 * be the title of the assignment and a short description
 * of what it does.
 *
 * Author: Michael Matera
 * Date: 8/16/2016
 *
 */

void setup() {

}

void loop() {

}

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


LiteHaus

LiteHaus

Main INO File

#include "application.h"
#include "captouch.h"
#include "neopixel/neopixel.h"

SYSTEM_MODE(AUTOMATIC);

//PRODUCT_ID and PRODUCT_VERSION required for Particle's "Products" feature
PRODUCT_ID(639);
PRODUCT_VERSION(12);

CapTouch Touch(D3, D4);

#define PIXEL_COUNT 60
#define PIXEL_PIN D2
#define PIXEL_TYPE WS2812

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

////
// User Variables
////

uint32_t decayTime = 2835;                  // Start dimming light after elapsed seconds
uint32_t decayDelay = 3;                    // Seconds between decay fade-out steps
uint8_t nightHours[2] = {6,      21};       // Night mode starts at nightHours[1], ends at nightHours[0]
uint8_t duskHours[2] =  {  7,  19  };       // Dusk mode starts at duskHours[1], ends at duskHours[0].  Needs to be inside nightHours' times.
                                            // Day mode starts at duskHours[0], ends at duskHours[1]
uint16_t maxDayBrightness = 180;            // 0 - 255, lamp will not exceed this during the day
uint16_t maxDuskBrightness = 70;            // 0 - 255, lamp will not exceed this during dusk
uint16_t maxNightBrightness = 30;           // 0 - 255, lamp will not exceed this during the night
float fadeRate = 0.95;                      // Fireworks Variable: 0.01-0.99, controls decay speed

////
// End User Variables
////

double lastColorUpdate = 0;                 // Epoch of last color update (local or remote)
String colorFromID;                         // String, Tracks who sent the color (for debug)
uint16_t colorRecieved;                     // 0 - 255, Tracks the color received from another lamp
bool lampOn = 0;                            // Tracks if the lamp is lit
uint8_t activeColor = 0;                    // 0 - 255, Tracks what color is currently active (start at red)
uint8_t activeR = 255;                      // 0 - 255, Red component of activeColor;
uint8_t activeG = 0;                        // 0 - 255, Green component of activeColor;
uint8_t activeB = 0;                        // 0 - 255, Blue component of activeColor;
double lastDecayDelay = 0;                  // Time Tracker for decayDelay
uint16_t lampBrightness = 0;                // 0 - 255, Tracks current lamp brightness
uint16_t maxBrightness = maxDayBrightness;  // Assigned the current max brightness
uint8_t dayTrack = 0;                       // Track day/dusk/night condition
uint8_t fadeColor = 0;                      // Track color for special events
byte activePixels = 0;                      // Tracks number of active pixels, 0 is first pixel
float redStates[PIXEL_COUNT];               // Fireworks Variable
float blueStates[PIXEL_COUNT];              // Fireworks Variable
float greenStates[PIXEL_COUNT];             // Fireworks Variable
uint8_t heartbeatDirector = 0;              // Heartbeat Tracking
uint8_t heartbeatColor = 0;                 // Heartbeat Tracking
CapTouch::Event touchEvent;

void setup() {
    strip.begin();
    strip.show();
    rainbowFull(5, 0); // 5ms Delay, 0 is fade in
    rainbowFull(5, 2); // 5ms Delay, 2 is fade out

    Touch.setup();

    Time.zone(-5);
    //Listen for other lamps to send a particle.publish()
    Particle.subscribe("FamiLamp_Update", gotColorUpdate, MY_DEVICES);
}

void loop() {
    dayTracking();
    touchEvent = Touch.getEvent();

    if (touchEvent == CapTouch::TouchEvent) {
		whileTouching();
	}
    if (Time.now() - lastColorUpdate > decayTime && lampOn == 1) {
        if (Time.now() - lastDecayDelay >= decayDelay) {
            extinguish();
            lastDecayDelay = Time.now();
        }
    }

    // Special idle functions
    if (lampOn == 0) {
        // Christmas Day
        if (Time.day() == 25 && Time.month() == 12) {
            idleColorFader(0,85);
        }
        // St. Patricks Day
        if (Time.day() == 17 && Time.month() == 3) {
            idleColorFlicker(21);
        }
        // Valentines Day
        if (Time.day() == 14 && Time.month() == 2) {
            idleColorFlicker(106);
        }
        // 4th of July
        if ( Time.day() == 4 && Time.month() == 7 ) {
            idleFireworks(0);
        }
        // New Years Day
        if ( Time.day() == 1 && Time.month() == 1 ) {
            idleFireworks(1);
        }
        // Birthdays
        if (
            (Time.day() == 22 && Time.month() == 2)
            ) {
            idleDisco();
        }
        // Clear any previous day's special idles
        if (lampBrightness != 0 && Time.hour() == 0 && Time.minute() == 0 && Time.second() <= 3) {
            for (uint16_t i = 0; i < strip.numPixels(); i++) {
                strip.setPixelColor(i, 0, 0, 0);
            }
            strip.show();
            lampBrightness = 0;
        }
    }
}

void whileTouching() {
    byte previousBrightness = lampBrightness; // Store the previous brightness in case we need it later
    uint16_t pixelBrightness = lampBrightness; // Tracks the given pixel's brightness.  Needs to track > 255, so uint16_t
	uint8_t testColor = activeColor; // Start with the current color
    activePixels = 0;
    while (touchEvent != CapTouch::ReleaseEvent) {
        for (byte i = 0; i <= activePixels; i++) {
            pixelBrightness = lampBrightness + i; //Fade to full brightness
			if (pixelBrightness > maxBrightness) pixelBrightness = maxBrightness; //catch overflow
            // "activePixels - i" reverses the direction
            strip.setPixelColor(activePixels - i, wheelColor(((i * 60 / strip.numPixels()) + testColor) & 255, pixelBrightness)); // "& 255" AKA bitwise and prevents overflow
	    }
        strip.show();
        testColor++; //because testColor is uint8_t, automatically loops at 256
        if(activePixels < (strip.numPixels() - 1)) activePixels++; //Add 1 for next iteration, but prevent looping around
        if(lampBrightness < maxBrightness) lampBrightness++;
        touchEvent = Touch.getEvent();
        delay(3);
    }
	if (activePixels >= (strip.numPixels() - 10)) {
	    lampOn = 1;
		activeColor = testColor;
		sendColorUpdate();
		lastColorUpdate = Time.now();
	} else {
	    lampBrightness = previousBrightness;
	    setColor(activeColor);
	}
}

void sendColorUpdate() {
    String sColor = String(activeColor);
    Particle.publish("FamiLamp_Update", System.deviceID() + "~" + sColor, 60, PRIVATE);
}

void gotColorUpdate(const char *name, const char *data) {

    String str = String(data);
    char strBuffer[40] = "";
    str.toCharArray(strBuffer, 40);
    colorFromID = strtok(strBuffer, "~");
    colorRecieved = atof(strtok(NULL, "~"));
    lampBrightness = maxBrightness;
    setColor(colorRecieved);
    // DEBUG
    String sColorRecieved = String(colorRecieved);
    Particle.publish("Color_Recieved", System.deviceID() + "~" + sColorRecieved);
    // END DEBUG
	lampOn = 1;
	lastColorUpdate = Time.now();
}

void setColor(byte c) { // c is color.  This function does a smooth fade new color
    if (((Time.month() * Time.day()) % 256) == c) { // Semi-random formula to trigger easter egg
        rainbowEasterEgg();
    } else {
        uint8_t newR, newG, newB, startR, startG, startB, endR, endG, endB;
        uint32_t color = wheelColor(c, lampBrightness);
        endR = (uint8_t)((color >> 16) & 0xff); // Splits out new color into separate R, G, B
        endG = (uint8_t)((color >> 8) & 0xff);
        endB = (uint8_t)(color & 0xff);
        for (uint16_t fade = 0; fade < 255; fade++) {
            for (uint16_t j = 0; j < strip.numPixels(); j++) {
                long startRGB = strip.getPixelColor(j); // Get pixel's current color
                startR = (uint8_t)((startRGB >> 16) & 0xff); // Splits out current color into separate R, G, B
                startG = (uint8_t)((startRGB >> 8) & 0xff);
                startB = (uint8_t)(startRGB & 0xff);
                newR = startR + (endR - startR) * fade / 255; // Color mixer
                newG = startG + (endG - startG) * fade / 255;
                newB = startB + (endB - startB) * fade / 255;
                strip.setPixelColor(j, newR, newG, newB);
            }
            strip.show();
            delay(10);
        }
    }
    activeColor = c;
}

void extinguish() { //Dims the lamp by one unit until lampBrightness is 0 and lampOn is 0
    lampBrightness--;
    uint32_t color = wheelColor(activeColor, lampBrightness);
    for (byte j = 0; j <= strip.numPixels(); j++) {
		strip.setPixelColor(j, color);
    }
    strip.show();
    if (lampBrightness <= 0) {
        lampOn = 0; //If the lamp is completely off, set lampOn to 0
        lampBrightness = 0; // Make sure this number isn't negative somehow
    }
}

uint32_t wheelColor(uint16_t WheelPos, uint16_t iBrightness) {
	float R, G, B;
	float brightness = iBrightness / 255.0;

	if (WheelPos < 85) {
		R = WheelPos * 3;
		G = 255 - WheelPos * 3;
		B = 0;
	} else if (WheelPos < 170) {
		WheelPos -= 85;
		R = 255 - WheelPos * 3;
		G = 0;
		B = WheelPos * 3;
	} else {
		WheelPos -= 170;
		R = 0;
		G = WheelPos * 3;
		B = 255 - WheelPos * 3;
	}
	activeR = R * brightness;// + .5;
	activeG = G * brightness;// + .5;
	activeB = B * brightness;// + .5;
	return strip.Color((byte) activeR,(byte) activeG,(byte) activeB);
}

void rainbowFull(byte wait, byte fade) {
  uint16_t i, j, k;
  if(fade == 0) k = 0;
  else k = maxBrightness;

  for(j = 0; j <= 255; j++) {
    for(i = 0; i < strip.numPixels(); i++) {
      strip.setPixelColor((strip.numPixels() - 1) - i, wheelColor(((i * 60 / strip.numPixels()) + j) & 255, k));
    }
    strip.show();
    delay(wait);
    if(fade == 0 && k < maxBrightness) {
        k++;
    }
    if(fade == 2 && k > 0) {
        k--;
    }
  }
}

void rainbowEasterEgg() {
    for(uint8_t i = 0; i <= strip.numPixels(); i++) {
      strip.setPixelColor(i, wheelColor((i * 256 / strip.numPixels()) & 255, lampBrightness));
    }
    strip.show();
}

void dayTracking() {
    if (Time.hour() < nightHours[0] || Time.hour() >= nightHours[1]) { // Night hours
        if (dayTrack != 2) {
            maxBrightness = maxNightBrightness;
            if (lampBrightness > maxBrightness) lampBrightness = maxBrightness;
            setColor(activeColor);
            dayTrack = 2;
        }
    } else if (Time.hour() < duskHours[0] || Time.hour() >= duskHours[1]) { // Dusk hours
        if (dayTrack != 1) {
            maxBrightness = maxDuskBrightness;
            if (lampBrightness > maxBrightness) lampBrightness = maxBrightness;
            setColor(activeColor);
            dayTrack = 1;
        }
    } else { // Everything else is day
        if (dayTrack != 0) {
            maxBrightness = maxDayBrightness;
            if (lampBrightness > maxBrightness) lampBrightness = maxBrightness;
            setColor(activeColor);
            dayTrack = 0;
        }
    }
}

void idleColorFader(uint8_t c1, uint8_t c2) {
    lampBrightness = 100;
    uint16_t currR, currG, currB, endR, endG, endB;
    uint32_t color = wheelColor(fadeColor, lampBrightness);
    endR = (uint16_t)((color >> 16) & 0xff); // Splits out new color into separate R, G, B
    endG = (uint16_t)((color >> 8) & 0xff);
    endB = (uint16_t)(color & 0xff);
    for (uint16_t j = 0; j < activePixels; j++) {
        long startRGB = strip.getPixelColor(j); // Get pixel's current color
        currR = (uint16_t)((startRGB >> 16) & 0xff); // Splits out current color into separate R, G, B
        currG = (uint16_t)((startRGB >> 8) & 0xff);
        currB = (uint16_t)(startRGB & 0xff);
        if ( currR > endR ) {
            currR = currR - 10;
        } else if ( currR < endR ) {
            currR = currR + 10;
        } else {
            currR = endR;
        }
        if ( currG > endG ) {
            currG = currG - 10;
        } else if ( currG < endG ) {
            currG = currG + 10;
        } else {
            currG = endG;
        }
        if ( currB > endB ) {
            currB = currB - 10;
        } else if ( currB < endB ) {
            currB = currB + 10;
        } else {
            currB = endB;
        }

        //Catch overflows
        currR %= 255;
        currG %= 255;
        currB %= 255;

        strip.setPixelColor(j, currR, currG, currB);
void whileTouching() {
    byte previousBrightness = lampBrightness; // Store the previous brightness in case we need it later
    uint16_t pixelBrightness = lampBrightness; // Tracks the given pixel's brightness.  Needs to track > 255, so uint16_t
	uint8_t testColor = activeColor; // Start with the current color
    activePixels = 0;
    while (touchEvent != CapTouch::ReleaseEvent) {
        for (byte i = 0; i <= activePixels; i++) {
            pixelBrightness = lampBrightness + i; //Fade to full brightness
			if (pixelBrightness > maxBrightness) pixelBrightness = maxBrightness; //catch overflow
            // "activePixels - i" reverses the direction
            strip.setPixelColor(activePixels - i, wheelColor(((i * 60 / strip.numPixels()) + testColor) & 255, pixelBrightness)); // "& 255" AKA bitwise and prevents overflow
	    }
        strip.show();
        testColor++; //because testColor is uint8_t, automatically loops at 256
        if(activePixels < (strip.numPixels() - 1)) activePixels++; //Add 1 for next iteration, but prevent looping around
        if(lampBrightness < maxBrightness) lampBrightness++;
        touchEvent = Touch.getEvent();
        delay(3);
    }
	if (activePixels >= (strip.numPixels() - 10)) {
	    lampOn = 1;
		activeColor = testColor;
		sendColorUpdate();
		lastColorUpdate = Time.now();
	} else {
	    lampBrightness = previousBrightness;
	    setColor(activeColor);
	}
}

void sendColorUpdate() {
    String sColor = String(activeColor);
    Particle.publish("FamiLamp_Update", System.deviceID() + "~" + sColor, 60, PRIVATE);
}

void gotColorUpdate(const char *name, const char *data) {

    String str = String(data);
    char strBuffer[40] = "";
    str.toCharArray(strBuffer, 40);
    colorFromID = strtok(strBuffer, "~");
    colorRecieved = atof(strtok(NULL, "~"));
    lampBrightness = maxBrightness;
    setColor(colorRecieved);
    // DEBUG
    String sColorRecieved = String(colorRecieved);
    Particle.publish("Color_Recieved", System.deviceID() + "~" + sColorRecieved);
    // END DEBUG
	lampOn = 1;
	lastColorUpdate = Time.now();
}

void setColor(byte c) { // c is color.  This function does a smooth fade new color
    if (((Time.month() * Time.day()) % 256) == c) { // Semi-random formula to trigger easter egg
        rainbowEasterEgg();
    } else {
        uint8_t newR, newG, newB, startR, startG, startB, endR, endG, endB;
        uint32_t color = wheelColor(c, lampBrightness);
        endR = (uint8_t)((color >> 16) & 0xff); // Splits out new color into separate R, G, B
        endG = (uint8_t)((color >> 8) & 0xff);
        endB = (uint8_t)(color & 0xff);
        for (uint16_t fade = 0; fade < 255; fade++) {
            for (uint16_t j = 0; j < strip.numPixels(); j++) {
                long startRGB = strip.getPixelColor(j); // Get pixel's current color
                startR = (uint8_t)((startRGB >> 16) & 0xff); // Splits out current color into separate R, G, B
                startG = (uint8_t)((startRGB >> 8) & 0xff);
                startB = (uint8_t)(startRGB & 0xff);
                newR = startR + (endR - startR) * fade / 255; // Color mixer
                newG = startG + (endG - startG) * fade / 255;
                newB = startB + (endB - startB) * fade / 255;
                strip.setPixelColor(j, newR, newG, newB);
            }
            strip.show();
            delay(10);
        }
    }
    activeColor = c;
}

void extinguish() { //Dims the lamp by one unit until lampBrightness is 0 and lampOn is 0
    lampBrightness--;
    uint32_t color = wheelColor(activeColor, lampBrightness);
    for (byte j = 0; j <= strip.numPixels(); j++) {
		strip.setPixelColor(j, color);
    }
    strip.show();
    if (lampBrightness <= 0) {
        lampOn = 0; //If the lamp is completely off, set lampOn to 0
        lampBrightness = 0; // Make sure this number isn't negative somehow
    }
}

uint32_t wheelColor(uint16_t WheelPos, uint16_t iBrightness) {
	float R, G, B;
	float brightness = iBrightness / 255.0;

	if (WheelPos < 85) {
		R = WheelPos * 3;
		G = 255 - WheelPos * 3;
		B = 0;
	} else if (WheelPos < 170) {
		WheelPos -= 85;
		R = 255 - WheelPos * 3;
		G = 0;
		B = WheelPos * 3;
	} else {
		WheelPos -= 170;
		R = 0;
		G = WheelPos * 3;
		B = 255 - WheelPos * 3;
	}
	activeR = R * brightness;// + .5;
	activeG = G * brightness;// + .5;
	activeB = B * brightness;// + .5;
	return strip.Color((byte) activeR,(byte) activeG,(byte) activeB);
}

void rainbowFull(byte wait, byte fade) {
  uint16_t i, j, k;
  if(fade == 0) k = 0;
  else k = maxBrightness;

  for(j = 0; j <= 255; j++) {
    for(i = 0; i < strip.numPixels(); i++) {
      strip.setPixelColor((strip.numPixels() - 1) - i, wheelColor(((i * 60 / strip.numPixels()) + j) & 255, k));
    }
    strip.show();
    delay(wait);
    if(fade == 0 && k < maxBrightness) {
        k++;
    }
    if(fade == 2 && k > 0) {
        k--;
    }
  }
}

void rainbowEasterEgg() {
    for(uint8_t i = 0; i <= strip.numPixels(); i++) {
      strip.setPixelColor(i, wheelColor((i * 256 / strip.numPixels()) & 255, lampBrightness));
    }
    strip.show();
}

void dayTracking() {
    if (Time.hour() < nightHours[0] || Time.hour() >= nightHours[1]) { // Night hours
        if (dayTrack != 2) {
            maxBrightness = maxNightBrightness;
            if (lampBrightness > maxBrightness) lampBrightness = maxBrightness;
            setColor(activeColor);
            dayTrack = 2;
        }
    } else if (Time.hour() < duskHours[0] || Time.hour() >= duskHours[1]) { // Dusk hours
        if (dayTrack != 1) {
            maxBrightness = maxDuskBrightness;
            if (lampBrightness > maxBrightness) lampBrightness = maxBrightness;
            setColor(activeColor);
            dayTrack = 1;
        }
    } else { // Everything else is day
        if (dayTrack != 0) {
            maxBrightness = maxDayBrightness;
            if (lampBrightness > maxBrightness) lampBrightness = maxBrightness;
            setColor(activeColor);
            dayTrack = 0;
        }
    }
}

void idleColorFader(uint8_t c1, uint8_t c2) {
    lampBrightness = 40;
    uint16_t currR, currG, currB, endR, endG, endB;
    uint32_t color = wheelColor(fadeColor, lampBrightness);
    endR = (uint16_t)((color >> 16) & 0xff); // Splits out new color into separate R, G, B
    endG = (uint16_t)((color >> 8) & 0xff);
    endB = (uint16_t)(color & 0xff);
    for (uint16_t j = 0; j < activePixels; j++) {
        long startRGB = strip.getPixelColor(j); // Get pixel's current color
        currR = (uint16_t)((startRGB >> 16) & 0xff); // Splits out current color into separate R, G, B
        currG = (uint16_t)((startRGB >> 8) & 0xff);
        currB = (uint16_t)(startRGB & 0xff);
        if ( currR > endR ) {
            currR = currR - 1;
        } else if ( currR < endR ) {
            currR = currR + 1;
        } else {
            currR = endR;
        }
        if ( currG > endG ) {
            currG = currG - 1;
        } else if ( currG < endG ) {
            currG = currG + 1;
        } else {
            currG = endG;
        }
        if ( currB > endB ) {
            currB = currB - 1;
        } else if ( currB < endB ) {
            currB = currB + 1;
        } else {
            currB = endB;
        }

        //Catch overflows
        currR %= 255;
        currG %= 255;
        currB %= 255;

        strip.setPixelColor(j, currR, currG, currB);
        if ( j >= strip.numPixels() - 1 && endR == currR && endG == currG && endB == currB) {
            if ( fadeColor == c1 ) {
                fadeColor = c2;
            } else {
                fadeColor = c1;
            }
            activePixels = 0;
        }
    }
    strip.show();
    if ( activePixels < strip.numPixels() ) activePixels++;
    delay(20);
}

void idleFireworks(uint8_t w) {
    // w = 0 for mulitcolor, w = 1 for all white flashes
    lampBrightness = 40;
    if (random(20) == 1) {
        uint16_t i = random(strip.numPixels());
        if (redStates[i] < 1 && greenStates[i] < 1 && blueStates[i] < 1) {
            if (w == 0){
                redStates[i] = random(lampBrightness);
                greenStates[i] = random(lampBrightness);
                blueStates[i] = random(lampBrightness);
            } else {
                redStates[i] = lampBrightness;
                greenStates[i] = lampBrightness;
                blueStates[i] = lampBrightness;
            }
        }
    }
    for(uint16_t l = 0; l < strip.numPixels(); l++) {
        if (redStates[l] > 1 || greenStates[l] > 1 || blueStates[l] > 1) {
            strip.setPixelColor(l, redStates[l], greenStates[l], blueStates[l]);
            if (redStates[l] > 1) {
                redStates[l] = redStates[l] * fadeRate;
            } else {
                redStates[l] = 0;
            }

            if (greenStates[l] > 1) {
                greenStates[l] = greenStates[l] * fadeRate;
            } else {
                greenStates[l] = 0;
            }

            if (blueStates[l] > 1) {
                blueStates[l] = blueStates[l] * fadeRate;
            } else {
                blueStates[l] = 0;
            }

        } else {
            strip.setPixelColor(l, 0, 0, 0);
        }
    }
    strip.show();
}
void idleDisco() {
    lampBrightness = 20;
    for(int i=0; i<strip.numPixels(); i++) {
        int randr = random(0,lampBrightness);
        int randg = random(0,lampBrightness);
        int randb = random(0,lampBrightness);
        int randi = random(0,(strip.numPixels() - 1));
        strip.setPixelColor(randi, randr, randg, randb);
        strip.show();
        delay(5);
    }
}
void idleColorFlicker(uint8_t c) {
    lampBrightness = 20;
    uint32_t color = wheelColor(c, lampBrightness);

    for(uint8_t i=0; i<strip.numPixels(); i++) {
        uint8_t flicker = random(0,10);
        int flickerR = (uint16_t)((color >> 16) & 0xff) - flicker; // Splits out new color into separate R, G, B
        int flickerG = (uint16_t)((color >> 8) & 0xff) - flicker;
        int flickerB = (uint16_t)(color & 0xff) - flicker;
        if(flickerR<0) flickerR=0;
        if(flickerG<0) flickerG=0;
        if(flickerB<0) flickerB=0;
        strip.setPixelColor(i, flickerR, flickerG, flickerB);
    }
    strip.show();
    delay(30);
}
void idleHeartbeat() {
    lampBrightness = 20;
    uint8_t endColor = 0;

    if( heartbeatDirector == 0 ) {
        endColor = lampBrightness * 0.6;
    }else if( heartbeatDirector == 1 ) {
        endColor = lampBrightness * 0.2;
    }else if( heartbeatDirector == 2 ) {
        endColor = lampBrightness;
    }else if( heartbeatDirector == 3 ) {
        endColor = lampBrightness * 0.12;
    } else {
        //do nothing, this will delay
    }

    if( heartbeatColor < endColor ) {
        for(int j=heartbeatColor; j<endColor; j+=4) {
            for(int i=25; i<35; i++) {
                strip.setPixelColor(i, j, 0, 0);

            }
        strip.show();
        delay(15);
        }
    } else if ( heartbeatColor > endColor ) {
        for(int j=heartbeatColor; j>endColor; j--) {
            for(int i=25; i<35; i++) {
                strip.setPixelColor(i, j, 0, 0);

            }
        strip.show();
        delay(30);
        }
    } else {
        delay(15);
        delay(15);
        delay(15);
        delay(15);
        delay(15);
        delay(15);
        delay(15);
    }

    heartbeatColor = endColor;

    heartbeatDirector++;
    heartbeatDirector%=4;
}

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


Drive a 4x7segment with a 74HC164 Ser-to-Par

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


Added WebClientRepeating example

Added WebClientRepeating example

/*
  Repeating Web client

 This sketch connects to a a web server and makes a request
 using a Wiznet Ethernet shield. You can use the Arduino Ethernet shield, or
 the Adafruit Ethernet shield, either one will work, as long as it's got
 a Wiznet Ethernet module on board.

 This example uses the String library, which is part of the Arduino core from
 version 0019. It also uses DNS, by assigning the Ethernet client with a MAC address,
 IP address, and DNS address.

 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13

 created 19 Apr 2012
 by Tom Igoe

 http://arduino.cc/en/Tutorial/WebClientRepeating
 This code is in the public domain.

 */

#include <SPI.h>
#include <Ethernet.h>

// assign a MAC address for the ethernet controller.
// fill in your address here:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
// fill in an available IP address on your network here,
// for manual configuration:
IPAddress ip(10,0,0,20);

// fill in your Domain Name Server address here:
IPAddress myDns(1,1,1,1);

// initialize the library instance:
EthernetClient client;

char server[] = "www.arduino.cc";

unsigned long lastConnectionTime = 0;          // last time you connected to the server, in milliseconds
boolean lastConnected = false;                 // state of the connection last time through the main loop
const unsigned long postingInterval = 60*1000;  // delay between updates, in milliseconds

void setup() {
  // start serial port:
  Serial.begin(9600);
  // give the ethernet module time to boot up:
  delay(1000);
  // start the Ethernet connection using a fixed IP address and DNS server:
  Ethernet.begin(mac, ip, myDns);
  // print the Ethernet board/shield's IP address:
  Serial.print("My IP address: ");
  Serial.println(Ethernet.localIP());
}

void loop() {
  // if there's incoming data from the net connection.
  // send it out the serial port.  This is for debugging
  // purposes only:
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  // if there's no net connection, but there was one last time
  // through the loop, then stop the client:
  if (!client.connected() && lastConnected) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
  }

  // if you're not connected, and ten seconds have passed since
  // your last connection, then connect again and send data:
  if(!client.connected() && (millis() - lastConnectionTime > postingInterval)) {
    httpRequest();
  }
  // store the state of the connection for next time through
  // the loop:
  lastConnected = client.connected();
}

// this method makes a HTTP connection to the server:
void httpRequest() {
  // if there's a successful connection:
  if (client.connect(server, 80)) {
    Serial.println("connecting...");
    // send the HTTP PUT request:
    client.println("GET /latest.txt HTTP/1.1");
    client.println("Host: www.arduino.cc");
    client.println("User-Agent: arduino-ethernet");
    client.println("Connection: close");
    client.println();

    // note the time that the connection was made:
    lastConnectionTime = millis();
  }
  else {
    // if you couldn't make a connection:
    Serial.println("connection failed");
    Serial.println("disconnecting.");
    client.stop();
  }
}

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


Add simple demo stuff for 2x2x2 cube

Add simple demo stuff for 2x2x2 cube

#define REP(x,n) for(int x=0;x<n;x++)
#define ALL REP(i,2) REP(j,2) REP(k,2)

const int DELAY = 10;
int cube[2][2][2];

int cols[2][2] = {{8, 9}, {10, 11}};
int rows[2] = {6, 7};

void clear() {
  ALL cube[i][j][k] = 0;
}

void setup() {
  REP(i,2) pinMode(rows[i], OUTPUT);
  REP(i,2) REP(j,2) pinMode(cols[i][j], OUTPUT);
}

void randomIn(int time) {
  int count = 8;
  while(count > 0){
    int x = random(2);
    int y = random(2);
    int z = random(2);
    if(cube[y][x][z]==0){
      cube[y][x][z]=1;
      count--;
      show(time);
    }
  }
}

void layerSpiral(int i, int time) {
  REP(j,2) {
    cube[i][0][j] = 1;
    show(time);
    clear();
  }
  REP(j,2) {
    cube[i][1][1-j] = 1;
    show(time);
    clear();
  }
}

void layer(int i, int time) {
  REP(j,2) REP(k,2) cube[i][j][k] = 1;
  show(time);
  clear();
}

void loop() {
  const int t = 100;

  REP(x,4)
  REP(l,2){
    layer(l, 500);
  }

  REP(x,3) ALL {
    cube[i][j][k] = 1;
    show(t);
    clear();
  }

  REP(x,3){
    randomIn(t);
    clear();
  }

  REP(i,3){
    REP(l,2){
      REP(x,3) layerSpiral(l, t);
    }
  }
}

void show(int time){
  REP(t,time/DELAY/2){
    REP(i,2){
      digitalWrite(rows[i], LOW);
      REP(j,2) REP(k,2){
        digitalWrite(cols[j][k], cube[i][j][k] ? HIGH : LOW);
      }
      delay(DELAY);
      digitalWrite(rows[i], HIGH);
    }
  }
}

error: pathspec 'arduino/2x2x2-cube.ino' did not match any file(s) known to git


Start of arduinoCOM

Start of arduinoCOM

String comData = "";

#define MAX_COMMANDS 2
#define MAX_PARAM 2
#define COMMAND_SEPARATOR ',';

void (*CommandList[MAX_COMMANDS])(const String[MAX_PARAM]);

int registerd_commands = 0;

enum commands
{
	led_on,
	led_off,
};

void setup()
{
	Serial.begin(9600);
}

void loop()
{
	GetSerialInput();
}

void GetSerialInput()
{
	if (Serial.available())
	{
		char inputbyte = (char)Serial.read();

		//If not-static
		if ((int)inputbyte > 31)
		{
			static bool mayRead = false;

			//add to input
			switch (inputbyte)
			{
			case '{':
			{
						mayRead = true;
						comData = "";
						break;
			}
			case '}':
			{
						mayRead = false;
						validateCommand(comData);
						break;
			}
			default:
			{
					   if (mayRead)
					   {
						   comData += inputbyte;
					   }
			}
			}
		}
	}
}

	void validateCommand(String command)
	{
		int commandID = command.toInt();

		if (commandID >= registerd_commands || commandID < 1)
		{
			//Populate params with comma separated values (Exception to comma's between double quotes)
			String params[MAX_PARAM];//NOTE, values not initialised, will cause error

			//initialise all possible parameters, even the ones that are not used
			for (int indexer = 0; indexer < MAX_PARAM; indexer++)
			{
				params[indexer] = "";
			}

			//TODO take apart Command with exception to the length of CommandID
			//Loop each string index and check for separator COMMAND_SEPARATOR
			//For each separator found, check the length of buffered text.
			//If longer than 0 (NOT 0), then set value for params[index++] = paramtext

			CommandList[commandID](params);
		}

	}

	bool AddCommand(int CommandID, void (*command)(const String[MAX_PARAM]))
	{
		if (registerd_commands == MAX_COMMANDS)
		{
			return false;
		}

		CommandList[registerd_commands] = command;

		registerd_commands++;
	}

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


Arduino-Ethernet-DHT11

#include <dht.h> //DHT11 LIBRARY
#include <UIPEthernet.h> //UIPE ETHERNT LIBRARY FOR THE ETHERNET MODULE ENC28J60
#define DHT11_PIN 9 // DHT11 IS CONNECTED TO PIN NUMBER 9 (ARDUINO UNO BOARD), OR SPECIFY ANY OTHER PIN
#define DEBUG // TURN DEBUGGING ON OR OFF, TO TURN IT OFF JUST COMMENT THIS LINE
dht DHT; // DEFINE A "dht" OBJECT INSTANCE WITH THE NAME "DHT"
/* ETHERNET SETTINGS
ARDUINO UNO PINS USED FOR THE ENC28J60 MODULE: 10=CS, 11=MOSI, 12=MISO, 13=SCK
THE ETHERNET MAC ADDRESS MUST BE UNIQUE IN THE PRIVATE LOCAL NETWORK
REMEMBER THAT THE MAC ADDRESS IS IN HEXADECIMAL FORMAT
IN THIS EXAMPLE WE USE THE FOLLOWING MAC ADDRESS : OE:96:03:38:94:92 */
byte mac[] = { 0x0E, 0x96, 0x03, 0x38, 0x94, 0x92 };
EthernetClient client; // CREATES A CLIENT WHICH CAN CONNECT TO A SPECIFIED INTERNET IP ADDRESS AND PORT
char server[] = "192.168.1.4"; /// IP ADDRESS OF THE LOCAL SERVER WE CONNECT AND SEND DATA TO
int  interval = 5000; // DELAY INTERVAL TO SAVE THE DATA IN THE DATABSE
long myinterval = 6000; //3 Minutes-> 180000ms INTERVAL BETWEEN DATA READINGS, I SET IT IN 6 SECONDS FOR TESTING PURPOSES
long previousMillis = 0;
int status = -2; // INITIALIZE THE CONNECTION STATUS VARIABLE
void setup() {
  Serial.begin(9600); // OPEN SERIAL COMMUNICATIONS AND WAIT FOR A PORT TO OPEN
  Ethernet.begin(mac); // INITIALIZES THE ETHERNET LIBRARY AND NETWORK SETTINGS
  /* ETHERNET SERIAL PRINTS
  INFORMATION ABOUT CLIENTS IP ADDRESS, THE SUBNET MASK OF THE NETWORK, THE GATEWAYS
  IP ADDRESS AND FINALLY THE DNS SERVER IP ADDRESS WHICH IS THE SAME AS THE GATEWAYS IP
  THESE INFORMATION WILL ONLY BE VISIBLE WHEN DEBUGGING IS ON */
#ifdef DEBUG
  Serial.println("Temperature Logger");
  Serial.println("*********************");
  Serial.print("IP Address   : ");
  Serial.println(Ethernet.localIP());
  Serial.print("Subnet Mask  : ");
  Serial.println(Ethernet.subnetMask());
  Serial.print("Default Gateway IP: ");
  Serial.println(Ethernet.gatewayIP());
  Serial.print("DNS Server IP     : ");
  Serial.println(Ethernet.dnsServerIP());
#endif
}

void loop() {
  unsigned long currentMillis = millis();
  // RESET ENC28J60 IN CASE OF FAILURE TO CONNECT WITH THE LOCAL SERVER
  if (!client.connect(server, 80)) {
#ifdef DEBUG
    Serial.println("Connection Failure: Resetting ENC28j60!");
#endif
    Enc28J60.init(mac); //RESET AND INITIALIZE THE ENC28J60 AND STARTS PACKET TRANSMISSION-RECEPTION
  } else {
    client.stop();
  }
  /* CONNECT TO THE SPECIFIED IP ADDRESS AND PORT
   IF A CONNECTION IS ESTABLISHED START SENDING DATA EVERY 3 MINUTES
   DATA WILL BE SENT AFTER THE FIRST 3 MINUTES
   ALSO WE CHECK THE STATUS OF THE SERVER
   THE FUNCTION CONNECT() RETURNS AN INT INDICATING CONNECTION STATUTS:
   SUCCESS (1)
   TIMED_OUT (-1)
   INVALID SERVER (-2)
   TRUNCATED (-3)
   INVALID RESPONSE (-4)*/
  status = client.connect(server, 80);
  if (status == 1) {
#ifdef DEBUG
    Serial.println("\nConnection Success");
#endif
    if (currentMillis - previousMillis > myinterval) {
      previousMillis = currentMillis;
      //READ DATA FROM THE DHT11 SENSOR
      int chk = DHT.read11(DHT11_PIN);
      /* THE READ11() FUNCTION RETURNS:
      DHTLIB_OK (0): THE SENSOR SAMPLE AND ITS CHECKSUM ARE OK
      DHTLIB_ERROR_CHECKSUM (-1): THE CHECKSUM TEST FAILED. THIS MEANS THE DATA WAS RECEIVED BUT MAY NOT BE CORRECT
      DHTLIB_ERROR_TIMEOUT (-2): A TIME OUT OCCURRED AND COMMUNICATION HAS FAILED
      BELOW WE CHECK THE STATUS OF THE SENSOR */
#ifdef DEBUG
      switch (chk) {
        case 0:
          Serial.print("Sensor OK");
          break;
        case -1:
          Serial.print("Checksum Test Failed");
          break;
        case -2:
          Serial.print("Time out Occurred, Communication Failed");
          break;
        default:
          Serial.print("Unknown Error");
          break;
      }
#endif
      // PRINT THE HUMIDITY AND TEMPERATURE VALUES IN THE SERIAL MONITOR
#ifdef DEBUG
      Serial.print("\nValues: ");
      Serial.print(DHT.humidity, 1);
      Serial.print(",\t");
      Serial.println(DHT.temperature, 1);
      Serial.println("Connected...sendingData");
#endif
      // MAKE A HTTP REQUEST
      // SPECIFY THE PHP FILE LOCATION IN THE SERVER
      //PRINT DATA TO THE SERVER THE CLIENT IS CONNECTED TO
      //STRUCTURE: "GET /filepath/yourfile.php?"
      client.print( "GET /arduEth/write_data.php?");
      client.print("hum="); //DATABASE VARIABLE IS USED
      client.print(DHT.humidity, 1); //THE VALUE TO WRITE IN THE DATABSE FOR HUMIDITY
      client.print("&&");
      client.print("temp=");
      client.print(DHT.temperature, 1); //THE VALUE TO WRITE IN THE DATABSE FOR TEMPERATURE
      client.println( " HTTP/1.1");
      client.print( "Host: " );
      client.println(server);
      client.println( "Connection: close" );
      client.println();
      client.println();
      client.stop(); // DISCONNECT FROM THE SERVER
      delay(interval); //SOME INTERVAL FOR THE DATA TO BE WRITTEN IN THE DATABASE
    }
  }
  // IN CASE OF A TIME_OUT
  else if (status == -1) {
#ifdef DEBUG
    Serial.println("Connection Timed Out !");
#endif
  }
  // IN CASE OF AN INVALID SERVER
  else if (status == -2) {
#ifdef DEBUG
    Serial.println("Invalid Server !");
#endif
  }
  // IN CASE OF TRUNCATION
  else if (status == -3) {
#ifdef DEBUG
    Serial.println("Truncated !");
#endif
  }
  // IN CASE OF AN INVALID RESPONCE
  else if (status == -4) {
#ifdef DEBUG
    Serial.println("Invalid Response !");
#endif
  }
  // IN CASE OF AN UNKNOWN ERROR
  else {
#ifdef DEBUG
    Serial.println("Unknown Error !");
#endif
  }
}

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


Ready for staff card updates

Ready for staff card updates

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


Create AmbientLight.ino

Create AmbientLight.ino

#include "microbit_Screen.h"

void setup() {
  SCREEN.begin();
}

void loop() {
  if (SCREEN.ambientLight() > 10)
    SCREEN.showIcon(IconNames::Happy); // dazzling!
  else
    SCREEN.showIcon(IconNames::Sad);
}

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


arduino code

arduino code

#define EN1 5  //DECLARANDO O ENABLE 1
#define EN2 6  //DECLARANDO O ENABLE 2
#define IN1 4  //DECLARANDO O MOTOR DIREITO DA FRENTE
#define IN2 7  //DECLARANDO O MOTOR DIREITO DE TRAS
#define IN3 8  //DECLARANDO O MOTOR ESQUERDO DA FRENTE
#define IN4 12 //DECLARANDO O MOTOR ESQUERDO DE TRAS
#define SE1 A5 //DECLARANDO O SENSOR ESQUERDO DO MEIO
#define SD1 A4 //DECLARANDO O SENSOR DIREITO DO MEIO
#define SE2 A3 //DECLARANDO O SENSOR ESQUERDO DA BORDA
#define SD2 A2 //DECLARANDO O SENSOR DIREITO DA BORDA

int V = 0;
int x = 0;
int i = 0;
int comando = 0;

void setup() {
  //DECLARANDO SE SÃO ENTRADAS OU SAIDA
  pinMode (EN1, OUTPUT);
  pinMode (EN2, OUTPUT);
  pinMode (IN1, OUTPUT);
  pinMode (IN2, OUTPUT);
  pinMode (IN3, OUTPUT);
  pinMode (IN4, OUTPUT);
  Serial.begin (9600);
  Serial.println ("Bem vindo ao programa de teste do robô do PI da primeira fase!");
  Serial.println ("Digite uma velocidade para o robô: ");
  Serial.println ("1 para 0% ");
  Serial.println ("2 para 25% ");
  Serial.println ("3 para 50% ");
  Serial.println ("4 para 100% ");

  while (comando == 0){
    comando = Serial.read();
       if (comando == '1')
          V = 0;
      else if (comando == '2')
          V = 64;
      else if (comando == '3')
          V = 127;
      else if (comando == '4')
          V = 255;
     else
          comando = 0;
 }

   Serial.println (comando);

    analogWrite (EN1, V);
    analogWrite (EN2, V);

//  analogWrite (EN1, 255);
//  analogWrite (EN2, 255);

}
void loop() {

      Serial.println ("Andando para frente: ");
      digitalWrite (IN1, HIGH); digitalWrite (IN2, LOW);
      digitalWrite (IN3, HIGH); digitalWrite (IN4,LOW);
      delay (4000);
      digitalWrite (IN1, LOW); digitalWrite (IN2, LOW);
      digitalWrite (IN3, LOW); digitalWrite (IN4,LOW);
      delay (1000);
      Serial.println ("Andando para Tras: ");
      digitalWrite (IN1, LOW); digitalWrite (IN2, HIGH);
      digitalWrite (IN3, LOW); digitalWrite (IN4,HIGH);
      delay (4000);
      digitalWrite (IN1, LOW); digitalWrite (IN2, LOW);
      digitalWrite (IN3, LOW); digitalWrite (IN4,LOW);
      delay (1000);
      Serial.println ("Andando para esquerda: ");
      digitalWrite (IN1, LOW); digitalWrite (IN2, HIGH);
      digitalWrite (IN3, HIGH); digitalWrite (IN4,LOW);
      delay (4000);
      digitalWrite (IN1, LOW); digitalWrite (IN2, LOW);
      digitalWrite (IN3, LOW); digitalWrite (IN4,LOW);
      delay (1000);
      Serial.println ("Andando para direita: ");
      digitalWrite (IN1, HIGH); digitalWrite (IN2, LOW);
      digitalWrite (IN3, LOW); digitalWrite (IN4,HIGH);
      delay (4000);
      digitalWrite (IN1, LOW); digitalWrite (IN2, LOW);
      digitalWrite (IN3, LOW); digitalWrite (IN4,LOW);
      delay (1000);
      //Fazer 5 leituras dos sensores, Aproveitar para colocar na linha branca e preta uma a cada leitura
      for (i = 0; i <= 5; i += 1){
       Serial.print ("Sensor esquerdo 1: ");
      Serial.println (analogRead(SE1));
      Serial.print ("Sensor direito 1: ");
      Serial.println (analogRead(SD1));
      Serial.print ("Sensor esquerdo 2: ");
      Serial.println (analogRead(SE2));
      Serial.print ("Sensor direito 2: ");
      Serial.println (analogRead(SD2));
      Serial.println (" ");
      delay (3000);
    }
}

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


Slower motorspeed forward.

Slower motorspeed forward.

error: pathspec 'Arduino/Motor' did not match any file(s) known to git
error: pathspec 'Controller/MotorController_NewHardware/MotorController_V04/MotorController_V04.ino' did not match any file(s) known to git


Added new Keyboard and mouse combined control

build/shared/examples/09. USB (Leonardo only)/KeyboardAndMouseControl/KeyboardAndMouseControl.ino

/bin/sh: 1: Syntax error: "(" unexpected


Simple Stat Start!

Simple Stat Start!

error: pathspec 'Firmware/Experimental' did not match any file(s) known to git
error: pathspec 'Versions/simplestat/simplestat.ino' did not match any file(s) known to git


slight cosmetics

slight cosmetics

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


step1 we reach the target with each step


Arduino Files

Arduino Files

/*

Data logger with serial output for fast/live plotting on python

Analog input on pin A0 is read-in at a sampling rate of ~xyz kS/s
The sampling rate can be adjusted for more channels, or slower sampling rate,
[channels must be enabled/disabled by setting the registers in the setup() method below],
by adjusting the sampling_time variable

The ADC data is buffered then sent quickly via SerialUSB. Since there is some overhead
involved with Serial transfer, the data should be transferred in large quantities ( > 1 kB) so
as to minimise total transmission time. Buffering will be memory-limited at some point. The
largest buffer possible is currently untested!

PySerial is used to grab the data from the serial port and read it into python. For this,
the python module SixChannelReader.py has been written (in the same directory as this file),
which provides class-based methods of reading in the data, as well as a method of
synchronisation for triggering purposes.

************
** NOTE: the USB connection to the Arduino must be to the NATIVE port, not the programming port!
************

Author: James Keaveney
19/05/2015

*/

// set up variables
const int buffer_length = 2000; // length of data chunks sent at a time via SerialUSB

//const long acquisition_time = 90000; // in ms (~2 minutes in real experiment)
//const long settling_time_ms = 15000; // in ms

const int sampling_time_sleep = 0; // in micros

//const int TempAdjustPin = 2;

String strTime = "";
String strOut = "";
String strC1 = "";

unsigned long current_time;

void setup() {

  // set ADC resolution
  analogReadResolution(12);

  // manually set registers for faster analog reading than the normal arduino methods
  ADC->ADC_MR |= 0xC0; // set free running mode (page 1333 of the Sam3X datasheet)
  ADC->ADC_CHER = 0x80;  // enable channels  (see page 1338 of datasheet) on adc 7 (pin A0)
                       // see also http://www.arduino.cc/en/Hacking/PinMappingSAM3X for the pin mapping between Arduino names and SAM3X pin names
  ADC->ADC_CHDR = 0xFF7F; // disable all other channels
  ADC->ADC_CR=2;       // begin ADC conversion

  // initialise serial port
  SerialUSB.begin(115200); // baud rate is ignored for USB - always at 12 Mb/s
  while (!SerialUSB); // wait for USB serial port to be connected - wait for pc program to open the serial port

}

void loop() {

  // data acquisition will start with a synchronisation step:
  // python should send a single byte of data, the arduino will send one back to sync timeouts
  int incoming = 0;
  if (SerialUSB.available() > 0) // polls whether anything is ready on the read buffer - nothing happens until there's something there
  {
    incoming = SerialUSB.read();
    // after data received, send the same back
    SerialUSB.println(incoming);

    // measure start time - then acquire data for an amount of time set by the acquisition_time variable
    unsigned long start_micros = micros();
    unsigned long start_time = millis();

    // generate and concatenate strings
    for (int jj = 0; jj < buffer_length; jj++)
    {

      // ADC acquisition

      // can put this in a small loop for some averaging if required - takes ~ 60 microsec per read/concatenate cycle
      while((ADC->ADC_ISR & 0x80)!=0x80); // wait for conversion to complete - see page 1345 of datasheet

      // concatenate strings
      current_time = micros()-start_micros;
      strTime.concat(current_time); // time axis
      strTime.concat(',');
      strC1.concat(ADC->ADC_CDR[7]); // read data from the channel data register
      strC1.concat(',');

      //Serial.print(current_time);
      //Serial.print(",");

      delayMicroseconds(sampling_time_sleep); // limit sampling rate to something reasonable - a few kS/s
    }

    // send data via SerialUSB
    // perform a flush first to wait for the previous buffer to be sent, before overwriting it
    SerialUSB.flush();
    strOut = strTime + strC1;
    SerialUSB.print(strOut); // doesn't wait for write to complete before moving on

    // clear string data - re-initialise
    strTime = "";
    strC1 = "";

    // finally, print end-of-data and end-of-line character to signify no more data will be coming
    SerialUSB.println("\0");

  }
}

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


Delete main.ino

Delete main.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/bitinstitute/irobot.git/'


Create PC_v099b0325.ino

Create PC_v099b0325.ino

add channel id to particle publish msg

error: pathspec 'Particle' did not match any file(s) known to git
error: pathspec 'Photon' did not match any file(s) known to git
error: pathspec 'based/code/PC_v099b0325.ino' did not match any file(s) known to git


added tone piezo

added tone piezo

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


Vetor de objetos com voto

Vetor de objetos com voto

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/ciandt-dev/garage-kelvin-celsius.git/'


Add reading inputs

Add reading inputs

// První oktáva
int laserIN01 = 21;
int laserIN02 = 22;
int laserIN03 = 23;
int laserIN04 = 24;
int laserIN05 = 25;
int laserIN06 = 26;
int laserIN07 = 27;
int laserIN08 = 28;

// Druhá oktáva
int laserIN09 = 29;
int laserIN10 = 30;
int laserIN11 = 31;
int laserIN12 = 32;
int laserIN13 = 33;
int laserIN14 = 34;
int laserIN15 = 35;
int laserIN16 = 36;

// Třetí oktáva
int laserIN17 = 37;
int laserIN18 = 38;
int laserIN19 = 39;
int laserIN20 = 40;
int laserIN21 = 41;
int laserIN22 = 42;
int laserIN23 = 43;
int laserIN24 = 44;

// První oktáva
int laser01;
int laser02;
int laser03;
int laser04;
int laser05;
int laser06;
int laser07;
int laser08;

// Druhá oktáva
int laser09;
int laser10;
int laser11;
int laser12;
int laser13;
int laser14;
int laser15;
int laser16;

// Třetí oktáva
int laser17;
int laser18;
int laser19;
int laser20;
int laser21;
int laser22;
int laser23;
int laser24;

int oktava1[8] = {laser01, laser02, laser03, laser04, laser05, laser06, laser07, laser08};
int oktava2[8] = {laser09, laser10, laser11, laser12, laser13, laser14, laser15, laser16};
int oktava3[8] = {laser17, laser18, laser19, laser20, laser21, laser22, laser23, laser24};

void setup() {
  Serial.begin(9600);
  pinMode(laserIN01, INPUT);
  pinMode(laserIN02, INPUT);
  pinMode(laserIN03, INPUT);
  pinMode(laserIN04, INPUT);
  pinMode(laserIN05, INPUT);
  pinMode(laserIN06, INPUT);
  pinMode(laserIN07, INPUT);
  pinMode(laserIN08, INPUT);

  pinMode(laserIN09, INPUT);
  pinMode(laserIN10, INPUT);
  pinMode(laserIN11, INPUT);
  pinMode(laserIN12, INPUT);
  pinMode(laserIN13, INPUT);
  pinMode(laserIN14, INPUT);
  pinMode(laserIN15, INPUT);
  pinMode(laserIN16, INPUT);

  pinMode(laserIN17, INPUT);
  pinMode(laserIN18, INPUT);
  pinMode(laserIN19, INPUT);
  pinMode(laserIN20, INPUT);
  pinMode(laserIN21, INPUT);
  pinMode(laserIN22, INPUT);
  pinMode(laserIN23, INPUT);
  pinMode(laserIN24, INPUT);
}

void loop() {

oktava1[0] = digitalRead(laserIN01);
oktava1[1] = digitalRead(laserIN02);
oktava1[2] = digitalRead(laserIN03);
oktava1[3] = digitalRead(laserIN04);
oktava1[4] = digitalRead(laserIN05);
oktava1[5] = digitalRead(laserIN06);
oktava1[6] = digitalRead(laserIN07);
oktava1[7] = digitalRead(laserIN08);

oktava2[0] = digitalRead(laserIN09);
oktava2[1] = digitalRead(laserIN10);
oktava2[2] = digitalRead(laserIN11);
oktava2[3] = digitalRead(laserIN12);
oktava2[4] = digitalRead(laserIN13);
oktava2[5] = digitalRead(laserIN14);
oktava2[6] = digitalRead(laserIN15);
oktava2[7] = digitalRead(laserIN16);

oktava3[0] = digitalRead(laserIN17);
oktava3[1] = digitalRead(laserIN18);
oktava3[2] = digitalRead(laserIN19);
oktava3[3] = digitalRead(laserIN20);
oktava3[4] = digitalRead(laserIN21);
oktava3[5] = digitalRead(laserIN22);
oktava3[6] = digitalRead(laserIN23);
oktava3[7] = digitalRead(laserIN24);

}

error: pathspec 'ArduinoSW/Laser-harp/Laser-harp.ino' did not match any file(s) known to git


First commit

First commit

int SER_Pin = 8;   //pin 14 on the 75HC595
int RCLK_Pin = 9;  //pin 12 on the 75HC595
int SRCLK_Pin = 10; //pin 11 on the 75HC595

//How many of the shift registers - change this
#define number_of_74hc595s 1

//do not touch
#define numOfRegisterPins number_of_74hc595s * 8

boolean registers[numOfRegisterPins];

void setup(){
  pinMode(SER_Pin, OUTPUT);
  pinMode(RCLK_Pin, OUTPUT);
  pinMode(SRCLK_Pin, OUTPUT);

  //reset all register pins
  clearRegisters();
  writeRegisters();
}

//set all register pins to LOW
void clearRegisters(){
  for(int i = numOfRegisterPins - 1; i >=  0; i--){
     registers[i] = LOW;
  }
}

//Set and display registers
//Only call AFTER all values are set how you would like (slow otherwise)
void writeRegisters(){

  digitalWrite(RCLK_Pin, LOW);

  for(int i = numOfRegisterPins - 1; i >=  0; i--){
    digitalWrite(SRCLK_Pin, LOW);

    int val = registers[i];

    digitalWrite(SER_Pin, val);
    digitalWrite(SRCLK_Pin, HIGH);

  }
  digitalWrite(RCLK_Pin, HIGH);

}

//set an individual pin HIGH or LOW
void setRegisterPin(int index, int value){
  registers[index] = value;
}

void loop(){

  setRegisterPin(0, HIGH);
  setRegisterPin(1, HIGH);
  setRegisterPin(2, HIGH);
  setRegisterPin(3, HIGH);
  setRegisterPin(4, HIGH);
  setRegisterPin(5, HIGH);
  setRegisterPin(6, HIGH);
  setRegisterPin(7, HIGH);
  writeRegisters();
  delay(1000);

  setRegisterPin(0, LOW);
  setRegisterPin(1, LOW);
  setRegisterPin(2, LOW);
  setRegisterPin(3, LOW);
  setRegisterPin(4, LOW);
  setRegisterPin(5, LOW);
  setRegisterPin(6, LOW);
  setRegisterPin(7, LOW);
  writeRegisters();
  delay(1000);
}

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


Created first Arduino transmitter test program.

// One Arduino controls transmitters on pins 3 and 11, alternately
// sending out pings from the two of them, simulating two synchronized
// transmitter stations sending out pings in turn.

enum {
  tx_pin_1 = 3,
  tx_pin_2 = 11,
};

void setup() {
  pinMode(tx_pin_1, OUTPUT);
  pinMode(tx_pin_2, OUTPUT);
}

void loop() {
  tone(tx_pin_1, 25000u, 1u);
  delay(100u);
  tone(tx_pin_2, 25000u, 1u);
  delay(1000u);
}

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


Flashing rather than fading blue and orange LEDs

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


Create InterleavedContinuous.ino

Create InterleavedContinuous.ino

/* This example demonstrates how to use interleaved mode to
take continuous range and ambient light measurements. The
datasheet recommends using interleaved mode instead of
running "range and ALS continuous modes simultaneously (i.e.
asynchronously)".

In order to attain a faster update rate (10 Hz), the max
convergence time for ranging and integration time for
ambient light measurement are reduced from the normally
recommended defaults. See section 2.4.4 ("Continuous mode
limits") and Table 6 ("Interleaved mode limits (10 Hz
operation)") in the VL6180X datasheet for more details.

Raw ambient light readings can be converted to units of lux
using the equation in datasheet section 2.13.4 ("ALS count
to lux conversion").

Example: A VL6180X gives an ambient light reading of 613
with the default gain of 1 and an integration period of
50 ms as configured in this sketch (reduced from 100 ms as
set by configureDefault()). With the factory calibrated
resolution of 0.32 lux/count, the light level is therefore
(0.32 * 613 * 100) / (1 * 50) or 392 lux.

The range readings are in units of mm. */

#include <Wire.h>
#include <VL6180X.h>

VL6180X sensor;

void setup()
{
  Wire.begin();

  sensor.init();
  sensor.configureDefault();

  // Reduce range max convergence time and ALS integration
  // time to 30 ms and 50 ms, respectively, to allow 10 Hz
  // operation (as suggested by Table 6 ("Interleaved mode
  // limits (10 Hz operation)") in the datasheet).
  sensor.writeReg(VL6180X::SYSRANGE__MAX_CONVERGENCE_TIME, 30);
  sensor.writeReg16Bit(VL6180X::SYSALS__INTEGRATION_PERIOD, 50);

  sensor.setTimeout(500);

   // stop continuous mode if already active
  sensor.stopContinuous();
  // in case stopContinuous() triggered a single-shot
  // measurement, wait for it to complete
  delay(300);
  // start interleaved continuous mode with period of 100 ms
  sensor.startInterleavedContinuous(100);

}

void loop()
{
  Serial.print("Ambient: ");
  Serial.print(sensor.readAmbientContinuous());
  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

  Serial.print("\tRange: ");
  Serial.print(sensor.readRangeContinuous());
  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

  Serial.println();
}

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


Update mappings

Update mappings

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/mvines/futboard.git/'


Added an example of using the AS5055 chip found on the arduino forums

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/10to7/AS5055A_Nema17_Breakout.git/'


vl53L0x test

vl53L0x test

#include <Wire.h>
#include <VL53L0X.h>

VL53L0X Sensor1;
VL53L0X Sensor2;

const uint8_t Sensor1_xshut = 4;
const uint8_t Sensor2_xshut = 5;

const uint8_t Sensor1_address = 22;
const uint8_t Sensor2_address = 25;

void setup()
{
  pinMode(Sensor1_xshut, OUTPUT);
  pinMode(Sensor2_xshut, OUTPUT);
  digitalWrite(Sensor1_xshut, LOW);
  digitalWrite(Sensor2_xshut, LOW);

  Wire.begin();
  Serial.begin (9600);

  pinMode(Sensor1_xshut, INPUT);
  Sensor1.init(true);
  Sensor1.setAddress(Sensor1_address);
  Sensor1.setTimeout(500);
  Sensor1.startContinuous();

  pinMode(Sensor2_xshut, INPUT);
  Sensor2.init(true);
  Sensor2.setAddress(Sensor2_address);
  Sensor2.setTimeout(500);
  Sensor2.startContinuous();
}

void loop()
{
  Serial.println(Sensor1.readRangeContinuousMillimeters());
  Serial.println(Sensor2.readRangeContinuousMillimeters());

  //if (Sensor1.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

  Serial.println("---");
}

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


Updated Files

Updated Files

// This #include statement was automatically added by the Particle IDE.
#include "neopixel/neopixel.h"

/*
 * This is a minimal example, see extra-examples.cpp for a version
 * with more explantory documentation, example routines, how to
 * hook up your pixels and all of the pixel types that are supported.
 *
 */

SYSTEM_MODE(AUTOMATIC);

// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_PIN D2
#define PIXEL_COUNT 24
#define PIXEL_TYPE WS2812B

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

// Prototypes for local build, ok to leave in for Build IDE
void rainbow(uint8_t wait);
uint32_t Wheel(byte WheelPos);

int led2 = D7;

void setup()
{

   Serial.begin(9600);
   pinMode(led2, OUTPUT);
   Particle.function("led",ledToggle);
   digitalWrite(led2, LOW);

   strip.begin();
   strip.setBrightness(2);
   strip.show(); // Initialize all pixels to 'off'
   uint16_t i;
   uint32_t noColor=strip.Color(0,0,0); //noColor
   for(i=0; i<24; i++)
        {
            strip.setPixelColor(i, noColor);
            strip.show();
        }
}

void loop()
{

}

int ledToggle(String command) {

    Serial.print("Got command: ");
    Serial.println(command);

    uint16_t i, j;
    uint32_t red=strip.Color(255,0,0); //red
    uint32_t green=strip.Color(0, 255, 0); //green
    uint32_t blue=strip.Color(0,0,255); //blue
    uint32_t noColor=strip.Color(0,0,0); //noColor

    if (command=="red") {
        digitalWrite(led2,HIGH);//check photon connection
        for(i=0; i<24; i++) // 24 is the number of pixels; we use this instead of strip.numPixels
        {
            strip.setPixelColor(i, red);
            strip.show();
        }
        Serial.print("Game");
        return 1;
    }
     else if (command=="green") {
        digitalWrite(led2,HIGH);//check photon connection
        for(i=0; i<24; i++)
        {
            strip.setPixelColor(i, green);
            strip.show();
        }
        Serial.print("People");
        return 1;
    }
    else if (command=="blue") {
        digitalWrite(led2,HIGH);//check photon connection
        for(i=0; i<24; i++)
        {
            strip.setPixelColor(i, blue);
            strip.show();
        }
        Serial.print("No Data");
        return 1;
    }
    else if (command=="off") {
        digitalWrite(led2,LOW);
        for(i=0; i<24; i++)
        {
            strip.setPixelColor(i, noColor);
            strip.show();
        }
        Serial.print("Switching off LED");
        return 0;
    }
    else {
        return -1;
    }

}

error: pathspec 'IA-2/ia2output.ino' did not match any file(s) known to git


saymon_says

//saymon says http://it.wikipedia.org/wiki/Simon_(gioco)
#include "pitches.h"

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_MOSI   9
#define OLED_CLK   10
#define OLED_DC    11
#define OLED_CS    12
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

const int redLed = 7;
const int greenLed = 6;
const int yellowLed = 5;
const int blueLed = 4;

const int tonePin = 8;

const int redButton = 3;
const int greenButton = 2;
const int yellowButton = 1;
const int blueButton = 0;
const int maxLength = 100; //max level
const int statePrepare = 0;
const int statePlay = 1;
const int stateEnd = 2;

int lastRedButtonValue;
int sequenceLength;
int state;
int sequence[maxLength];
int currentPlayingSeqIndex;

void setup() {
  Serial.begin(9600);

  display.begin(SSD1306_SWITCHCAPVCC);
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(yellowLed, OUTPUT);
  pinMode(blueLed, OUTPUT);

  pinMode(redButton, INPUT);
  digitalWrite(redButton, LOW);
  pinMode(greenButton, INPUT);
  digitalWrite(greenButton, LOW);
  pinMode(yellowButton, INPUT);
  digitalWrite(yellowButton, LOW);
  pinMode(blueButton, INPUT);
  digitalWrite(blueButton, LOW);

  sequenceLength = 1;
  state = statePrepare;

  randomSeed(analogRead(A5));
}

void loop() {

  if (state == statePrepare) {
    //set
    for (int i = 0; i < sequenceLength; i++) {
      int button = random(4);
      if (button == 0) sequence[i] = redButton;
      if (button == 1) sequence[i] = greenButton;
      if (button == 2) sequence[i] = yellowButton;
      if (button == 3) sequence[i] = blueButton;
    }

    //play
    diplayWrite("memorizza");
    for (int i = 0; i < sequenceLength; i++) {
    int button = sequence[i];
      delay(300);
      digitalWrite(button, HIGH);
      if (button == redButton) { tone(tonePin, NOTE_C4); digitalWrite(redLed, HIGH); }
      if (button == greenButton) { tone(tonePin, NOTE_D4); digitalWrite(greenLed, HIGH); }
      if (button == yellowButton) { tone(tonePin, NOTE_E4); digitalWrite(yellowLed, HIGH); }
      if (button == blueButton) { tone(tonePin, NOTE_F4); digitalWrite(blueLed, HIGH); }

      delay(1000);
      noTone(tonePin);
      allLedOff();

    }
    state = statePlay;
    diplayWrite("ripeti");
    currentPlayingSeqIndex = 0;

  }

  if (pressed(redButton) && (state == statePlay)) {
     checkPressing(redLed, NOTE_C4, redButton);
  } else if (pressed(greenButton) && (state == statePlay)) {
    checkPressing(greenLed, NOTE_D4, greenButton);
  } else if (pressed(yellowButton) && (state == statePlay)) {
    checkPressing(yellowLed, NOTE_E4, yellowButton);
  } else if (pressed(blueButton) && (state == statePlay)) {
    checkPressing(blueLed, NOTE_F4, blueButton);
  }

}

void checkPressing(int led, unsigned int note, int button) {
       digitalWrite(led, HIGH);
       tone(tonePin, note);
       if (sequence[currentPlayingSeqIndex] == button) {
         diplayWrite("OK !");
         currentPlayingSeqIndex ++;
       } else {
         diplayWrite("sbagliato");
         state = stateEnd;
       }
      delay(1000);
      noTone(tonePin);
      allLedOff();

}

void allLedOff() {
  digitalWrite(redLed, LOW);
  digitalWrite(greenLed, LOW);
  digitalWrite(yellowLed, LOW);
  digitalWrite(blueLed, LOW);
}

boolean pressed(int button) {
  delay(10);
  return digitalRead(button) == HIGH;
}

void diplayWrite(char* text) {
  display.clearDisplay();
  display.setTextSize(4);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.print(text);
  display.display();
}

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