Arduino code upload. Requires Arduino version 1.6.9 for some reason.

#include <Adafruit_NeoPixel.h>
#include <Wire.h>

#ifdef __AVR__
  #include <avr/power.h>
#endif

// Disables i2c pullup resistors. Disable this if you don't have any on the i2c bus.
// It is recommended to use external pullups based on the capacitance of your i2c bus.
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif

// PIN is the digital output pin used for LED control
// NUM_LEDS is the number of LEDS on the string
#define PIN 3
#define NUM_LEDS 29

#define I2C_ADDRESS 0x10            // Slave i2c address

// Command codes. Set these to whatever you want, just make sure to update the master as well
// 0x01 to 0xFF are available

//Permanent Set
#define SET_SINGLE_COLOR      0x15

//Temporary Set
#define COLOR_WIPE            0x20

//Long Animations
#define RAINBOW               0x50
#define RAINBOW_CYCLE         0x51
#define THEATER_CHASE         0x52
#define THEATER_CHASE_RAINBOW 0x53

//Short Animations
#define FLASHER               0x60

//Infinite Animations
#define FLASHINF              0x71
#define FLASHALT              0x72
#define SPARKLE               0x73
#define SPARKLE_FADE          0x74
#define FLAME                 0x75
#define GLOW                  0x76

//Utilities
#define RESTORE_STATE         0xFD
#define SET_ALL               0xFE
#define CLEAR_ALL             0xFF

//FIRE 2012 Defines
#define SPARKING 120
#define COOLING  55

// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);

// Global Variables
int x = 0;
byte mode = 0;
byte led = 0;
byte r = 0;
byte g = 0;
byte b = 0;
byte del = 0;
byte rep = 0;

uint32_t blank = strip.Color(0, 0, 0);
uint32_t currColor = strip.Color(0, 0, 0);

// Backup storage for LEDs to restore former state before short animations play
byte ledMatrix[NUM_LEDS][5];
uint32_t ledTime[NUM_LEDS];

void setup() {
  // LED Strip Init
  strip.begin();
  strip.setBrightness(64); // 25% brightness for now
  strip.show(); // Initialize all pixels to 'off'

  // I2C Init Code
  Wire.begin(I2C_ADDRESS);                // join i2c bus with address #8

  cbi(PORTC, 4);
  cbi(PORTC, 5);

  Wire.onReceive(receiveEvent); // register event

  randomSeed(analogRead(0));

  Serial.begin(9600);

  //Initialize with blank LED string
  for(int i = 0; i < NUM_LEDS; i++){
   for(int j = 0; j < 5; j++){
    ledMatrix[i][j] = 0;
   }
  }
}

void loop() {

  currColor = strip.Color(r, g, b);

  switch(mode) {
    case RESTORE_STATE:         restoreState();                             break;
    case COLOR_WIPE:            colorWipe();                                break;
    case RAINBOW:               rainbow();                                  break;
    case RAINBOW_CYCLE:         rainbowCycle();                             break;
    case THEATER_CHASE:         theaterChase();                             break;
    case THEATER_CHASE_RAINBOW: theaterChaseRainbow();                      break;
    case FLASHER:               flasher();                                  break;
    case FLASHINF:              flashinf();                                 break;
    case FLASHALT:              flashalt();                                 break;
    case SPARKLE:               sparkle();                                  break;
    case SPARKLE_FADE:          sparkleFade();                              break;
    case FLAME:                 flame();                                    break;
    case GLOW:                  glow();                                     break;

    case SET_ALL:
      for(uint16_t i=0; i < NUM_LEDS; i++) {
        strip.setPixelColor(i, currColor);
      }
      break;

    case CLEAR_ALL:
      for(uint16_t i=0; i < NUM_LEDS; i++) {
        strip.setPixelColor(i, blank);
      }
      break;

    default:
      refresh();
      break;
  }

  strip.show();
}

// Read 7 bytes as command over i2c
void receiveEvent(int bytes) {
  while(Wire.available()) {
    mode = Wire.read();
    led = Wire.read();
    r = Wire.read();
    g = Wire.read();
    b = Wire.read();
    del = Wire.read();
    rep = Wire.read();
  }
  if(mode == SET_SINGLE_COLOR) {
      ledMatrix[led][0] = r;
      ledMatrix[led][1] = g;
      ledMatrix[led][2] = b;
      ledMatrix[led][3] = del;
      ledMatrix[led][4] = rep;
      mode = 0x00;
  }
}

void refresh() {
  for(int i = 0; i < NUM_LEDS; i++){
    if(ledMatrix[i][4] == 1) {
      uint32_t diff = millis() - ledTime[i];
      if(diff <= ledMatrix[i][3]) {
        strip.setPixelColor(i, strip.Color(ledMatrix[i][0], ledMatrix[i][1], ledMatrix[i][2]));
      }
      else if(diff > ledMatrix[i][3] && diff < ledMatrix[i][3]*2) {
        strip.setPixelColor(i, strip.Color(0, 0, 0));
      }
      else {
        ledTime[i] = millis();
      }
    }
    else {
      strip.setPixelColor(i, strip.Color(ledMatrix[i][0], ledMatrix[i][1], ledMatrix[i][2]));
    }
  }
  strip.show();
}

// Restore back to individually set configuration
void restoreState() {
  mode = 0x00;
}

void flasher() {
  for(uint16_t j=0; j < rep; j++){
    for(uint16_t i=0; i < NUM_LEDS; i++) {
      if(mode != FLASHER) { return; }
      strip.setPixelColor(i, strip.Color(r, g, b));
      strip.show();
    }
    delay(del);
    for(uint16_t k=0; k < NUM_LEDS; k++) {
      if(mode != FLASHER) { return; }
      strip.setPixelColor(k, blank);
      strip.show();
    }
    delay(del);
  }
  mode = 0x00;  // Run once only
  restoreState();
}

void flashinf() {
  while(mode == FLASHINF) {
    for(uint16_t i = 0; i < NUM_LEDS; i++) {
      strip.setPixelColor(i, strip.Color(r, g, b));
      strip.show();
    }
    delay(del);
    for(uint16_t k = 0; k < NUM_LEDS; k++) {
      strip.setPixelColor(k, blank);
      strip.show();
    }
    delay(del);
  }
}

void flashalt() {
  byte start = 0;
  while(mode == FLASHALT) {
    start = start ^ 1;
    for(uint16_t i = start; i < NUM_LEDS; i += 2) {
      strip.setPixelColor(i, strip.Color(r, g, b));
      strip.show();
    }
    delay(del);
    for(uint16_t k = 0; k < NUM_LEDS; k++) {
      strip.setPixelColor(k, blank);
      strip.show();
    }
    delay(del);
  }
}

void sparkle() {
  while(mode == SPARKLE) {
    for(uint16_t i = 0; i <  NUM_LEDS; i++) {
      byte col = (random(10)==0);
      strip.setPixelColor(i, strip.Color(col*r, col*g, col*b));
      strip.show();
    }
    delay(del);
  }
}

void sparkleFade() {
  static byte leds[NUM_LEDS][3];
  memset(leds,0,sizeof(leds));

  while(mode == SPARKLE_FADE) {
    for(uint16_t i = 0; i <  NUM_LEDS; i++) {
      if(random(rep*10) == 0) {
        leds[i][0] = r;
        leds[i][1] = g;
        leds[i][2] = b;
      }
     leds[i][0] = constrain(leds[i][0] - 3, 0, 255);
     leds[i][1] = constrain(leds[i][1] - 3, 0, 255);
     leds[i][2] = constrain(leds[i][2] - 3, 0, 255);
     strip.setPixelColor(i, strip.Color(leds[i][0], leds[i][1], leds[i][2]));
     strip.show();
    }
    delay(del);
  }
}

// Fill the dots one after the other with a color
void colorWipe() {
  for(uint16_t i=0; i< NUM_LEDS; i++) {
    if(mode != COLOR_WIPE) {
      return;
    }
    strip.setPixelColor(i, strip.Color(r, g, b));
    strip.show();
    delay(del);
  }
  mode = 0x00; // Run once only
}

void clearall() {
  for(uint16_t i=0; i < NUM_LEDS; i++) {
    strip.setPixelColor(i, blank);
  }
  for(int i = 0; i < NUM_LEDS; i++){
   for(int j = 0; j < 3; j++){
    ledMatrix[i][j] = 0;
   }
  }
}

// Rainbow animation, better seen on longer strips
void rainbow() {
  uint16_t i, j;
  while(mode == RAINBOW) {
    for(j=0; j < 256; j++) {
      for(i=0; i < NUM_LEDS; i++) {
        if(mode != RAINBOW) {
          return;
        }
        strip.setPixelColor(i, Wheel((i+j) & 255));
      }
      strip.show();
      delay(del);
    }
  }
}

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle() {
  uint16_t i, j;
  while(mode == RAINBOW_CYCLE) {
    for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
      for(i=0; i<  NUM_LEDS; i++) {
        strip.setPixelColor(i, Wheel(((i * 256 /  NUM_LEDS) + j) & 255));
      }
      strip.show();
      delay(del);
      if(mode != RAINBOW_CYCLE) {
        return;
      }
    }
  }
}

//Theatre-style crawling lights.
void theaterChase() {
  while(mode == THEATER_CHASE) {
    for (int q=0; q < 3; q++) {
      for (uint16_t i=0; i <  NUM_LEDS; i=i+3) {
        if(mode != THEATER_CHASE) {
          return;
        }
        strip.setPixelColor(i+q, currColor);    //turn every third pixel on
      }
      strip.show();

      delay(del);

      for (uint16_t i=0; i <  NUM_LEDS; i=i+3) {
        if(mode != THEATER_CHASE) {
          return;
        }
        strip.setPixelColor(i+q, 0);        //turn every third pixel off
      }
    }
  }
}

//Theatre-style crawling lights with rainbow effect
void theaterChaseRainbow() {
  while(mode == THEATER_CHASE_RAINBOW) {
    for (int j=0; j < 256; j++) {     // cycle all 256 colors in the wheel
      for (int q=0; q < 3; q++) {
        for (uint16_t i=0; i <  NUM_LEDS; i=i+3) {
          if(mode != THEATER_CHASE_RAINBOW) {
            return;
          }
          strip.setPixelColor(i+q, Wheel( (i+j) % 255));    //turn every third pixel on
        }
        strip.show();

        delay(del);

        for (uint16_t i=0; i <  NUM_LEDS; i=i+3) {
          if(mode != THEATER_CHASE_RAINBOW) {
            return;
          }
          strip.setPixelColor(i+q, 0);        //turn every third pixel off
        }
      }
    }
  }
}

void glow() {
  byte col = 0;
  float roll = 0;
  float calc = 0;
  while(mode == GLOW) {
    roll++;
    if(roll > TWO_PI * 100) { roll = 0; }
    for (uint16_t i=0; i <  NUM_LEDS; i++) {
      calc = (-cos(roll/100)+1)*255/2;
      col = (byte)calc;
      strip.setPixelColor(i, strip.Color(col, col, col));
      strip.show();
    }
    delay(del);
  }
}

// Fire2012 library test
void flame() {
  static byte heat[NUM_LEDS];
  byte rnd;

  while(mode == FLAME) {
    // Step 1.  Cool down every cell a little
    for( int i = 0; i < NUM_LEDS; i++) {
      rnd = random(0, ((COOLING * 10) / NUM_LEDS) + 2);
      if(heat[i] > rnd) { heat[i] = heat[i] - rnd; }
      else { heat[i] = 0; }
    }

    // Step 2.  Heat from each cell drifts 'up' and diffuses a little
    for( int k= NUM_LEDS - 3; k > 0; k--) {
      heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
    }

    // Step 3.  Randomly ignite new 'sparks' of heat near the bottom
    if( random(0, 255) < SPARKING ) {
      int y = random(7);
      rnd = random(160,255);
      if(heat[y] + rnd < 255) { heat[y] = heat[y] + rnd; }
      else { heat[y] = 255; }
    }

    // Step 4.  Map from heat cells to LED colors
    for( int j = 0; j < NUM_LEDS; j++) {
        strip.setPixelColor(j, heatColor(heat[j]));
        strip.show();
    }
    delay(del);
  }
}

uint32_t heatColor(uint8_t temperature) {

  byte hr;
  byte hg;
  byte hb;

  // Scale 'heat' down from 0-255 to 0-191,
  // which can then be easily divided into three
  // equal 'thirds' of 64 units each.
  uint8_t t192 = map(temperature, 0, 255, 0, 192);

  // calculate a value that ramps up from
  // zero to 255 in each 'third' of the scale.
  uint8_t heatramp = t192 & 0x3F; // 0..63
  heatramp <<= 2; // scale up to 0..252

  // now figure out which third of the spectrum we're in:
  if( t192 & 0x80) {
    // we're in the hottest third
    hr = 255; // full red
    hg = 255; // full green
    hb = heatramp; // ramp up blue

  } else if( t192 & 0x40 ) {
    // we're in the middle third
    hr = 255; // full red
    hg = heatramp; // ramp up green
    hb = 0; // no blue

  } else {
    // we're in the coolest third
    hr = heatramp; // ramp up red
    hg = 0; // no green
    hb = 0; // no blue
  }

  return strip.Color(hr, hg, hb);
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  }
  if(WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}

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


slightly less current to avoid damages & injuries

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


Deep Sleep

Deep Sleep

#include <ESPert.h>

ESPert_LED led;
ESPert espert;

const int sleepTimeS = 10;

void setup() {
  int status = digitalRead(16);
  espert.init();
  espert.oled.init();
  espert.oled.clear();
  espert.oled.println( "Status: "+String(status) );

  led.init( 12 );
}

void loop() {

  espert.println( "ON" );
  led.on();
  delay( 1000 );
  Serial.println( "OFF" );
  led.off();
  delay( 1000 );

  espert.println( "ON" );
  led.on();
  delay( 1000 );
  Serial.println( "OFF" );
  led.off();
  delay( 1000 );

  ESP.deepSleep(sleepTimeS * 1000000);
}

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


Ajout du sketch Arduino

Ajout du sketch Arduino

// Ce sketch arduino permet d'allumer un ordinateur via le Wake on Ring
// en appliquant une tension sur le pin 9 du port série
// Au MIPS-lab, il faut envoyer en UDP à l'arduino "lamex" où x est le numéro de la
// lame du Cray à activer.

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

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0x4F, 0x39 }; // Défini l'adresse MAC
IPAddress ip(192, 168, 42, 250); // Défini l'adresse IP

int localPort = 9694; // Défini le port

int pin_LAME1 = 5;
int pin_LAME2 = 6;
int pin_LAME3 = 2;
int pin_LAME4 = 3;

int lame = 0;
char packetBuffer[32];	// Où sont stockés les données reçues.x
char ReplyBuffer[] = " OK "; // Réponse de l'arduino
int demande = 0;

EthernetUDP Udp;

void setup() {
	Ethernet.begin(mac,ip); // Initialise le shield ethernet
	Udp.begin(localPort); // Initialise la communication UDP
	Serial.begin(9600);
	pinMode(pin_LAME1, OUTPUT);
	pinMode(pin_LAME2, OUTPUT);
	pinMode(pin_LAME3, OUTPUT);
	pinMode(pin_LAME4, OUTPUT);
	pin_LAME1 = LOW;
	pin_LAME2 = LOW;
	pin_LAME3 = LOW;
	pin_LAME4 = LOW;
}

void loop() {
	int packetSize = Udp.parsePacket();
	if(packetSize) { // Si il y a un paquet
		Udp.read(packetBuffer,32); // le lire
		lame = packetBuffer[4]-'0'; // et convertir le 5e caractére en chiffre (char -> int)
		switch (lame) {
			case 1:
				pin_LAME1 = HIGH;
				Serial.println("Active la lame 1");
				delay(1000);
				pin_LAME1 = LOW;
				break;
			case 2:
				pin_LAME2 = HIGH;
				Serial.println("Active la lame 2");
				delay(1000);
				pin_LAME2 = LOW;
				break;
			case 3:
				pin_LAME3 = HIGH;
				Serial.println("Active la lame 3");
				delay(1000);
				pin_LAME3 = LOW;
				break;
			case 4:
				pin_LAME4 = HIGH;
				Serial.println("Active la lame 4");
				delay(1000);
				pin_LAME4 = LOW;
				break;
		}
		Udp.beginPacket(Udp.remoteIP(), 9694);
		Udp.write(ReplyBuffer);
		Udp.endPacket();
	}
	delay(10);
}

error: pathspec 'wake-on-ring.ino' did not match any file(s) known to git


Successfully contacted acm-web

Successfully contacted acm-web

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


Edited multiserial sketch to be in a proper folder and also use the newer GEVCU4 values.

/*
 Transmit serial data back and forth between two ports
 in order to flash new firmware to ichip with the ichip config tool.

 Note: Steps 1-5 have to be completed within 30 seconds (30000ms)

 Steps:
 1) reset arduino (e.g. power cycle)
 2) start ichip software
 3) menu "serial ports", select com port of ardiuno, set baud rate to 9600
 4) click on "ichip uploader via serial"
 5) select EBI flash 16 Megabit (if window doesn't appear, start over, act faster)
 6) Click FW Update, select .imf file and wait until finished, close ichip program
 7) power cycle arduino/gevcu and wait 20-30sec
 8) menu "serial ports", set baud rate to 115200
 9) go to configuration page

 check-out http://www.youtube.com/watch?v=vS60htz6h1g at 00:35:00

 */

bool flag = true;
void setup() {
	SerialUSB.begin(9600); // use SerialUSB only as the programming port doesn't work
	Serial2.begin(9600); // use Serial3 for GEVCU2, use Serial2 for GEVCU3+4
//	pinMode(43, INPUT);
}

void loop() {
	while (Serial2.available()) {
		SerialUSB.write(Serial2.read());
	}
	while (SerialUSB.available()) {
		Serial2.write(SerialUSB.read());
	}

	/*if (flag && millis() > 30000) {
		SerialUSB.begin(115200);
		Serial2.begin(115200);
		flag = false;
	}*/
}

    /*"FD"
    "BDRA"
    "WLCH=1
    "WLSI=!GEVCU"
    "DIP=192.168.3.10"
    "DPSZ=10"
    "RPG=secret"
    "WPWD=secret"
    "AWS=1"
    "DOWN" */

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


attiny85 wdt sleep

attiny85 wdt sleep

// Using low poer for attiny85
// https://github.com/johnnie502/Low-Power
#include <LowPower.h>
#include <avr/interrupt.h>
#include <avr/sleep.h>

void setup() {
  pinMode(3, OUTPUT);
  for (int k = 0; k < 10; k = k + 1) {
    if (k % 2 == 0) {
      digitalWrite(3, HIGH);
    }
    else {
      digitalWrite(3, LOW);
    }
    delay(250);
  }
}

void loop() {
  sleep16seconds();
  digitalWrite(3, HIGH);
  delay(1000);
  digitalWrite(3, LOW);
}

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

error: pathspec '_24-attiny85-wdt-sleep/_24-attiny85-wdt-sleep.ino' did not match any file(s) known to git


Programming Test 1 initial upload

Programming Test 1 initial upload

#include <Servo.h>

#define MAX_SIGNAL 2000
#define MIN_SIGNAL 700
#define MOTOR_PIN 9

Servo motor;

void setup() {
  Serial.begin(9600);
  Serial.println("Program begin...");
  Serial.println("This program will calibrate the ESC.");

  motor.attach(MOTOR_PIN);

  Serial.println("Now writing maximum output.");
  Serial.println("Turn on power source, then wait 2 seconds and press any key.");
  motor.writeMicroseconds(MAX_SIGNAL);

  // Wait for input
  while (!Serial.available());
  Serial.read();

  // Send min output
  Serial.println("Sending minimum output");
  motor.writeMicroseconds(MIN_SIGNAL);

}

void loop() {

}

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


Update masterCode.ino

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


added goomba

added goomba

#include <FastLED.h>

#define LED_PIN     5
#define COLOR_ORDER GRB
#define CHIPSET     WS2811
#define BRIGHTNESS  200

const uint8_t kMatrixWidth = 20;
const uint8_t kMatrixHeight = 10;
const bool    kMatrixSerpentineLayout = false;

uint16_t XY( uint8_t x, uint8_t y)
{
  uint16_t i;

  if( kMatrixSerpentineLayout == false) {
    i = (y * kMatrixWidth) + x;
  }

  if( kMatrixSerpentineLayout == true) {
    if( y & 0x01) {
      // Odd rows run backwards
      uint8_t reverseX = (kMatrixWidth - 1) - x;
      i = (y * kMatrixWidth) + reverseX;
    } else {
      // Even rows run forwards
      i = (y * kMatrixWidth) + x;
    }
  }

  return i;
}

#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
CRGB leds_plus_safety_pixel[ NUM_LEDS + 1];
CRGB* const leds( leds_plus_safety_pixel + 1);

uint16_t XYsafe( uint8_t x, uint8_t y)
{
  if( x >= kMatrixWidth) return -1;
  if( y >= kMatrixHeight) return -1;
  return XY(x,y);
}

// Demo that USES "XY" follows code below

void loop()
{
//  FastLED.show();
//  FastLED.setBrightness(BRIGHTNESS);
}

void set_led_rgb(int x, int y, int r, int g, int b)
{
  leds[ XY(x, y) ] = CRGB( r, g, b );
}

void ShowGoomba()
{
  // Shows a Goomba, see https://raw.githubusercontent.com/cbries/rgbwall/master/Photos,%20Images,%20Videos/Goomba01.jpg
  set_led_rgb(0, 0, 13, 9, 7);  set_led_rgb(1, 0, 13, 5, 0);  set_led_rgb(2, 0, 8, 3, 0); set_led_rgb(3, 0, 5, 2, 1); set_led_rgb(4, 0, 5, 4, 4); set_led_rgb(5, 0, 7, 3, 0); set_led_rgb(6, 0, 10, 4, 0);  set_led_rgb(7, 0, 13, 5, 0);  set_led_rgb(8, 0, 13, 5, 0);  set_led_rgb(9, 0, 13, 5, 0);  set_led_rgb(10, 0, 13, 5, 0); set_led_rgb(11, 0, 13, 5, 0); set_led_rgb(12, 0, 11, 4, 0); set_led_rgb(13, 0, 8, 3, 0);  set_led_rgb(14, 0, 5, 4, 4);  set_led_rgb(15, 0, 5, 3, 1);  set_led_rgb(16, 0, 7, 2, 0);  set_led_rgb(17, 0, 13, 5, 0); set_led_rgb(18, 0, 13, 8, 5); set_led_rgb(19, 0, 14, 11, 10);
  set_led_rgb(0, 1, 13, 5, 0);  set_led_rgb(1, 1, 13, 5, 0);  set_led_rgb(2, 1, 13, 5, 0);  set_led_rgb(3, 1, 13, 6, 2);  set_led_rgb(4, 1, 13, 12, 10);  set_led_rgb(5, 1, 2, 2, 2); set_led_rgb(6, 1, 5, 2, 0); set_led_rgb(7, 1, 13, 5, 0);  set_led_rgb(8, 1, 13, 5, 0);  set_led_rgb(9, 1, 13, 5, 0);  set_led_rgb(10, 1, 13, 5, 0); set_led_rgb(11, 1, 13, 5, 0); set_led_rgb(12, 1, 7, 3, 0);  set_led_rgb(13, 1, 0, 0, 0);  set_led_rgb(14, 1, 13, 12, 9);  set_led_rgb(15, 1, 13, 8, 4); set_led_rgb(16, 1, 13, 5, 0); set_led_rgb(17, 1, 13, 5, 0); set_led_rgb(18, 1, 13, 5, 0); set_led_rgb(19, 1, 13, 6, 1);
  set_led_rgb(0, 2, 13, 5, 0);  set_led_rgb(1, 2, 13, 5, 0);  set_led_rgb(2, 2, 13, 5, 0);  set_led_rgb(3, 2, 13, 6, 2);  set_led_rgb(4, 2, 13, 12, 10);  set_led_rgb(5, 2, 2, 2, 2); set_led_rgb(6, 2, 0, 0, 0); set_led_rgb(7, 2, 0, 0, 0); set_led_rgb(8, 2, 0, 0, 0); set_led_rgb(9, 2, 0, 0, 0); set_led_rgb(10, 2, 0, 0, 0);  set_led_rgb(11, 2, 0, 0, 0);  set_led_rgb(12, 2, 0, 0, 0);  set_led_rgb(13, 2, 0, 0, 0);  set_led_rgb(14, 2, 13, 12, 9);  set_led_rgb(15, 2, 13, 8, 4); set_led_rgb(16, 2, 13, 5, 0); set_led_rgb(17, 2, 13, 5, 0); set_led_rgb(18, 2, 13, 5, 0); set_led_rgb(19, 2, 13, 6, 2);
  set_led_rgb(0, 3, 13, 5, 0);  set_led_rgb(1, 3, 13, 5, 0);  set_led_rgb(2, 3, 13, 5, 0);  set_led_rgb(3, 3, 13, 6, 2);  set_led_rgb(4, 3, 13, 12, 10);  set_led_rgb(5, 3, 2, 2, 2); set_led_rgb(6, 3, 2, 1, 1); set_led_rgb(7, 3, 5, 4, 4); set_led_rgb(8, 3, 7, 3, 0); set_led_rgb(9, 3, 8, 3, 0); set_led_rgb(10, 3, 8, 3, 0);  set_led_rgb(11, 3, 5, 4, 4);  set_led_rgb(12, 3, 3, 2, 2);  set_led_rgb(13, 3, 0, 0, 0);  set_led_rgb(14, 3, 13, 12, 9);  set_led_rgb(15, 3, 13, 8, 4); set_led_rgb(16, 3, 13, 5, 0); set_led_rgb(17, 3, 13, 5, 0); set_led_rgb(18, 3, 13, 5, 0); set_led_rgb(19, 3, 13, 5, 0);
  set_led_rgb(0, 4, 13, 5, 0);  set_led_rgb(1, 4, 13, 5, 0);  set_led_rgb(2, 4, 13, 5, 0);  set_led_rgb(3, 4, 13, 6, 2);  set_led_rgb(4, 4, 13, 12, 10);  set_led_rgb(5, 4, 2, 2, 2); set_led_rgb(6, 4, 5, 4, 4); set_led_rgb(7, 4, 13, 12, 10);  set_led_rgb(8, 4, 13, 5, 0);  set_led_rgb(9, 4, 13, 5, 0);  set_led_rgb(10, 4, 13, 5, 0); set_led_rgb(11, 4, 13, 12, 10); set_led_rgb(12, 4, 8, 7, 6);  set_led_rgb(13, 4, 0, 0, 0);  set_led_rgb(14, 4, 13, 12, 9);  set_led_rgb(15, 4, 13, 8, 4); set_led_rgb(16, 4, 13, 5, 0); set_led_rgb(17, 4, 13, 5, 0); set_led_rgb(18, 4, 13, 5, 0); set_led_rgb(19, 4, 13, 5, 0);
  set_led_rgb(0, 5, 13, 5, 0);  set_led_rgb(1, 5, 13, 5, 0);  set_led_rgb(2, 5, 13, 5, 0);  set_led_rgb(3, 5, 13, 6, 2);  set_led_rgb(4, 5, 13, 12, 10);  set_led_rgb(5, 5, 13, 12, 10);  set_led_rgb(6, 5, 13, 12, 10);  set_led_rgb(7, 5, 13, 11, 10);  set_led_rgb(8, 5, 13, 5, 0);  set_led_rgb(9, 5, 13, 5, 0);  set_led_rgb(10, 5, 13, 5, 0); set_led_rgb(11, 5, 13, 12, 10); set_led_rgb(12, 5, 13, 12, 10); set_led_rgb(13, 5, 13, 12, 10); set_led_rgb(14, 5, 13, 12, 9);  set_led_rgb(15, 5, 13, 8, 4); set_led_rgb(16, 5, 13, 5, 0); set_led_rgb(17, 5, 13, 5, 0); set_led_rgb(18, 5, 13, 5, 0); set_led_rgb(19, 5, 13, 5, 0);
  set_led_rgb(0, 6, 13, 5, 0);  set_led_rgb(1, 6, 13, 5, 0);  set_led_rgb(2, 6, 13, 5, 0);  set_led_rgb(3, 6, 13, 5, 1);  set_led_rgb(4, 6, 13, 8, 4);  set_led_rgb(5, 6, 13, 8, 4);  set_led_rgb(6, 6, 13, 8, 4);  set_led_rgb(7, 6, 13, 8, 4);  set_led_rgb(8, 6, 13, 5, 0);  set_led_rgb(9, 6, 13, 5, 0);  set_led_rgb(10, 6, 13, 5, 0); set_led_rgb(11, 6, 13, 8, 4); set_led_rgb(12, 6, 13, 8, 4); set_led_rgb(13, 6, 13, 8, 4); set_led_rgb(14, 6, 13, 8, 4); set_led_rgb(15, 6, 13, 6, 2); set_led_rgb(16, 6, 13, 5, 0); set_led_rgb(17, 6, 13, 5, 0); set_led_rgb(18, 6, 13, 5, 0); set_led_rgb(19, 6, 13, 5, 0);
  set_led_rgb(0, 7, 13, 5, 0);  set_led_rgb(1, 7, 13, 5, 0);  set_led_rgb(2, 7, 13, 5, 0);  set_led_rgb(3, 7, 13, 5, 0);  set_led_rgb(4, 7, 13, 5, 0);  set_led_rgb(5, 7, 13, 5, 0);  set_led_rgb(6, 7, 13, 5, 0);  set_led_rgb(7, 7, 13, 5, 0);  set_led_rgb(8, 7, 13, 5, 0);  set_led_rgb(9, 7, 13, 5, 0);  set_led_rgb(10, 7, 13, 5, 0); set_led_rgb(11, 7, 13, 5, 0); set_led_rgb(12, 7, 13, 5, 0); set_led_rgb(13, 7, 13, 5, 0); set_led_rgb(14, 7, 13, 5, 0); set_led_rgb(15, 7, 13, 5, 0); set_led_rgb(16, 7, 13, 5, 0); set_led_rgb(17, 7, 13, 5, 0); set_led_rgb(18, 7, 13, 5, 0); set_led_rgb(19, 7, 13, 5, 0);
  set_led_rgb(0, 8, 13, 5, 0);  set_led_rgb(1, 8, 13, 5, 0);  set_led_rgb(2, 8, 13, 5, 0);  set_led_rgb(3, 8, 13, 5, 0);  set_led_rgb(4, 8, 13, 5, 0);  set_led_rgb(5, 8, 13, 9, 6);  set_led_rgb(6, 8, 13, 12, 10);  set_led_rgb(7, 8, 13, 12, 10);  set_led_rgb(8, 8, 13, 12, 10);  set_led_rgb(9, 8, 13, 12, 10);  set_led_rgb(10, 8, 13, 12, 10); set_led_rgb(11, 8, 13, 12, 10); set_led_rgb(12, 8, 13, 12, 10); set_led_rgb(13, 8, 13, 10, 8);  set_led_rgb(14, 8, 13, 5, 0); set_led_rgb(15, 8, 13, 5, 0); set_led_rgb(16, 8, 13, 5, 0); set_led_rgb(17, 8, 13, 5, 0); set_led_rgb(18, 8, 13, 5, 0); set_led_rgb(19, 8, 13, 6, 2);
  set_led_rgb(0, 9, 14, 11, 8); set_led_rgb(1, 9, 14, 11, 9); set_led_rgb(2, 9, 14, 11, 9); set_led_rgb(3, 9, 13, 10, 7); set_led_rgb(4, 9, 13, 9, 6);  set_led_rgb(5, 9, 13, 11, 8); set_led_rgb(6, 9, 13, 12, 10);  set_led_rgb(7, 9, 13, 12, 10);  set_led_rgb(8, 9, 13, 12, 10);  set_led_rgb(9, 9, 13, 12, 10);  set_led_rgb(10, 9, 13, 12, 10); set_led_rgb(11, 9, 13, 12, 10); set_led_rgb(12, 9, 13, 12, 10); set_led_rgb(13, 9, 13, 11, 9);  set_led_rgb(14, 9, 13, 9, 6); set_led_rgb(15, 9, 14, 10, 7);  set_led_rgb(16, 9, 14, 11, 9);  set_led_rgb(17, 9, 14, 11, 9);  set_led_rgb(18, 9, 14, 11, 9);  set_led_rgb(19, 9, 14, 11, 9);
}

void setup() {
  // LEDColorCorrection { TypicalSMD5050 =0xFFB0F0, TypicalLEDStrip =0xFFB0F0, Typical8mmPixel =0xFFE08C, TypicalPixelString =0xFFE08C, UncorrectedColor =0xFFFFFF }
  FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(UncorrectedColor);
  FastLED.setBrightness( BRIGHTNESS );

  ShowGoomba();
  FastLED.show();
  FastLED.setBrightness(BRIGHTNESS);
}

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


Potentiometer drive with Arduino

Potentiometer drive with Arduino

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/orhaneee/iot-robotarm.git/'


finish TODO; do tuning

finish TODO; do tuning

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


different brake for rotation & goAhead

different brake for rotation & goAhead


catch sneaky CRC errors

catch sneaky CRC errors

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/wsnook/farm.git/'


more changes

more changes

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/markwatneyy/ttt_arduino.git/'


New sketch DT_BlinkLightArray

New sketch DT_BlinkLightArray

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/DavidTangye/sketchbook.git/'


Sender file for one way communication between two arduinos

#include <SPI.h>
#include "RF24.h"

RF24 myRadio (7, 8);
byte addresses[][6] = {"0"};

struct package
{
  int id=1;
  float temperature = 18.3;
  char  text[100] = "Text to be transmitted";
};

typedef struct package Package;
Package data;

void setup()
{
  Serial.begin(115200);
  delay(1000);
  myRadio.begin();
  myRadio.setChannel(115);
  myRadio.setPALevel(RF24_PA_MAX);
  myRadio.setDataRate( RF24_250KBPS ) ;
  myRadio.openWritingPipe( addresses[0]);
  delay(1000);
}

void loop()
{
  myRadio.write(&data, sizeof(data));

  Serial.print("\nPackage:");
  Serial.print(data.id);
  Serial.print("\n");
  Serial.println(data.temperature);
  Serial.println(data.text);
  data.id = data.id + 1;
  data.temperature = data.temperature+0.1;
  delay(1000);

}

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


sending sms with location

sending sms with location

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/werar/iothome.git/'


Add simple sketch to test Ultrasonic sensor

/*
  Test Ultrasonic sensor readings

  Created 2 7 2014
  Modified 2 7 2014
*/

// Ultrasonic sensor settings
const byte ULTRASONIC_PIN = A6;

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

void loop()
{
  Serial.println(analogRead(ULTRASONIC_PIN));
  delay(1000);
}

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


AES dcumentation

AES dcumentation

Signed-off-by: Edi Permadi <163b49ac0c44ca5b49677bf42f3f8680b3bd9867@gmail.com>

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/edipermadi/teensy-hsm.git/'


Cosmetic

Cosmetic

Signed-off-by: Edi Permadi <163b49ac0c44ca5b49677bf42f3f8680b3bd9867@gmail.com>


successfully tested

successfully tested

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


Added Version 2 using Arduino Mega and LCD display

/*
 Weather Shield Example
 By: Nathan Seidle
 SparkFun Electronics
 Date: November 16th, 2013
 License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).

 Much of this is based on Mike Grusin's USB Weather Board code: https://www.sparkfun.com/products/10586

 This code reads all the various sensors (wind speed, direction, rain gauge, humidty, pressure, light, batt_lvl)
 and reports it over the serial comm port. This can be easily routed to an datalogger (such as OpenLog) or
 a wireless transmitter (such as Electric Imp).

 Measurements are reported once a second but windspeed and rain gauge are tied to interrupts that are
 calcualted at each report.

 This example code assumes the GP-635T GPS module is attached.

 */

#include <Wire.h> //I2C needed for sensors
#include "MPL3115A2.h" //Pressure sensor
#include "HTU21D.h" //Humidity sensor
#include <SoftwareSerial.h> //Needed for GPS
#include <TinyGPS++.h> //GPS parsing
#include <LiquidCrystal_I2C.h>//16x2 LCD library
//It requires using fm's LiquidCrystal library replacement:
//https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home

//This is for the 16x2 LCD
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

//this is for RTC
int clockAddress = 0x68;  // This is the I2C address
int command = 0;  // This is the command char, in ascii form, sent from the serial port
long previousMillis = 0;  // will store last time Temp was updated
byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;

byte decToBcd(byte val)
{
  return ( (val/10*16) + (val%10) );
}

// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
  return ( (val/16*10) + (val%16) );
}

// Gets the date and time from the ds1307 and prints result
char* getDateDs1307(int flag) {
  //if flag == 0 : date output
  //if flag == 1 : time output
  // Reset the register pointer
  Wire.beginTransmission(clockAddress);
  Wire.write(byte(0x00));
  Wire.endTransmission();

  Wire.requestFrom(clockAddress, 7);

  // A few of these need masks because certain bits are control bits
  second     = bcdToDec(Wire.read() & 0x7f);
  minute     = bcdToDec(Wire.read());

  // Need to change this if 12 hour am/pm
  hour       = bcdToDec(Wire.read() & 0x3f);
  dayOfWeek  = bcdToDec(Wire.read());
  dayOfMonth = bcdToDec(Wire.read());
  month      = bcdToDec(Wire.read());
  year       = bcdToDec(Wire.read());

  char sza[32];
  if (flag==0)
    sprintf(sza, "%02d-%02d-%02d",year,month,dayOfMonth);
  if (flag==1)
    sprintf(sza, "%02d:%02d:%02d",hour,minute,second);
  return(sza);
}
//end of RTC

TinyGPSPlus gps;

static const int RXPin = 5, TXPin = 4; //GPS is attached to pin 4(TX from GPS) and pin 5(RX into GPS)
SoftwareSerial ss(RXPin, TXPin);

MPL3115A2 myPressure; //Create an instance of the pressure sensor
HTU21D myHumidity; //Create an instance of the humidity sensor

//Hardware pin definitions
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// digital I/O pins
const byte WSPEED = 3;
const byte RAIN = 2;
const byte STAT1 = 7;
const byte STAT2 = 8;
const byte GPS_PWRCTL = 6; //Pulling this pin low puts GPS to sleep but maintains RTC and RAM

// analog I/O pins
const byte REFERENCE_3V3 = A3;
const byte LIGHT = A1;
const byte BATT = A2;
const byte WDIR = A0;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

//Global Variables
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
long lastSecond; //The millis counter to see when a second rolls by
byte seconds; //When it hits 60, increase the current minute
byte seconds_2m; //Keeps track of the "wind speed/dir avg" over last 2 minutes array of data
byte minutes; //Keeps track of where we are in various arrays of data
byte minutes_10m; //Keeps track of where we are in wind gust/dir over last 10 minutes array of data

long lastWindCheck = 0;
volatile long lastWindIRQ = 0;
volatile byte windClicks = 0;

//We need to keep track of the following variables:
//Wind speed/dir each update (no storage)
//Wind gust/dir over the day (no storage)
//Wind speed/dir, avg over 2 minutes (store 1 per second)
//Wind gust/dir over last 10 minutes (store 1 per minute)
//Rain over the past hour (store 1 per minute)
//Total rain over date (store one per day)

byte windspdavg[120]; //120 bytes to keep track of 2 minute average
int winddiravg[120]; //120 ints to keep track of 2 minute average
float windgust_10m[10]; //10 floats to keep track of 10 minute max
int windgustdirection_10m[10]; //10 ints to keep track of 10 minute max
volatile float rainHour[60]; //60 floating numbers to keep track of 60 minutes of rain

//These are all the weather values that wunderground expects:
int winddir = 0; // [0-360 instantaneous wind direction]
float windspeedms = 0; // [mph instantaneous wind speed]
float windgustms = 0; // [mph current wind gust, using software specific time period]
int windgustdir = 0; // [0-360 using software specific time period]
float windspdms_avg2m = 0; // [mph 2 minute average wind speed mph]
int winddir_avg2m = 0; // [0-360 2 minute average wind direction]
float windgustms_10m = 0; // [mph past 10 minutes wind gust mph ]
int windgustdir_10m = 0; // [0-360 past 10 minutes wind gust direction]
float humidity = 0; // [%]
float tempf = 0; // [temperature F]
float rainin = 0; // [rain inches over the past hour)] -- the accumulated rainfall in the past 60 min
volatile float dailyrainin = 0; // [rain inches so far today in local time]
//float baromin = 30.03;// [barom in] - It's hard to calculate baromin locally, do this in the agent
float pressure = 0;
//float dewptf; // [dewpoint F] - It's hard to calculate dewpoint locally, do this in the agent

float batt_lvl = 11.8; //[analog value from 0 to 1023]
float light_lvl = 455; //[analog value from 0 to 1023]
//Rain time stamp
int Rainindi=0;
//Variables used for GPS
//float flat, flon; // 39.015024 -102.283608686
//unsigned long age;
//int year;
//byte month, day, hour, minute, second, hundredths;

// volatiles are subject to modification by IRQs
volatile unsigned long raintime, rainlast, raininterval, rain, Rainindinter, Rainindtime, Rainindlast;

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

//Interrupt routines (these are called by the hardware interrupts, not by the main code)
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void rainIRQ()
// Count rain gauge bucket tips as they occur
// Activated by the magnet and reed switch in the rain gauge, attached to input D2
{
  raintime = millis(); // grab current time
  raininterval = raintime - rainlast; // calculate interval between this and last event

    if (raininterval > 10) // ignore switch-bounce glitches less than 10mS after initial edge
  {
    dailyrainin += 0.011*25.4; //Each dump is 0.011" of water
    rainHour[minutes] += 0.011*25.4; //Increase this minute's amount of rain

    rainlast = raintime; // set up for next event
  }

  //Rain or not (1 or 0)
  if(rainin >0)
  {
    Rainindi=1;
    Rainindtime = millis();
  }
  if(rainin ==0)
  {
   Rainindi=0;
   Rainindlast = millis();
   Rainindlast = Rainindtime;
  }
  Rainindinter = Rainindlast - Rainindtime;

}

void wspeedIRQ()
// Activated by the magnet in the anemometer (2 ticks per rotation), attached to input D3
{
  if (millis() - lastWindIRQ > 10) // Ignore switch-bounce glitches less than 10ms (142MPH max reading) after the reed switch closes
  {
    lastWindIRQ = millis(); //Grab the current time
    windClicks++; //There is 1.492MPH for each click per second.
  }

}

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

  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  lcd.backlight();

  ss.begin(9600); //Begin listening to GPS over software serial at 9600. This should be the default baud of the module.
  Serial.print(F("lon,lat,altitude,sats,date,GMTtime,RTCdate,RTCtime,winddir"));
  Serial.print(F(",windspeedms,windgustms,windgustdir,windspdms_avg2m,winddir_avg2m,windgustms_10m,windgustdir_10m"));
  Serial.print(F(",humidity,tempc,rainhourmm,raindailymm,rainindicate,rainduration,pressure,batt_lvl,light_lvl"));

  pinMode(STAT1, OUTPUT); //Status LED Blue
  pinMode(STAT2, OUTPUT); //Status LED Green

  pinMode(GPS_PWRCTL, OUTPUT);
  digitalWrite(GPS_PWRCTL, HIGH); //Pulling this pin low puts GPS to sleep but maintains RTC and RAM

  pinMode(WSPEED, INPUT_PULLUP); // input from wind meters windspeed sensor
  pinMode(RAIN, INPUT_PULLUP); // input from wind meters rain gauge sensor

  pinMode(REFERENCE_3V3, INPUT);
  pinMode(LIGHT, INPUT);

  //Configure the pressure sensor
  myPressure.begin(); // Get sensor online
  myPressure.setModeBarometer(); // Measure pressure in Pascals from 20 to 110 kPa
  myPressure.setOversampleRate(7); // Set Oversample to the recommended 128
  myPressure.enableEventFlags(); // Enable all three pressure and temp event flags

  //Configure the humidity sensor
  myHumidity.begin();

  seconds = 0;
  lastSecond = millis();

  // attach external interrupt pins to IRQ functions
  attachInterrupt(0, rainIRQ, FALLING);
  attachInterrupt(1, wspeedIRQ, FALLING);

  // turn on interrupts
  interrupts();

  //Serial.println("Weather Shield online!");

}

void loop()
{
  //Keep track of which minute it is
  if(millis() - lastSecond >= 1000)
  {
    digitalWrite(STAT1, HIGH); //Blink stat LED

    lastSecond += 1000;

    //Take a speed and direction reading every second for 2 minute average
    if(++seconds_2m > 119) seconds_2m = 0;

    //Calc the wind speed and direction every second for 120 second to get 2 minute average
    float currentSpeed = get_wind_speed();
    //float currentSpeed = random(5); //For testing
    int currentDirection = get_wind_direction();
    windspdavg[seconds_2m] = (int)currentSpeed;
    winddiravg[seconds_2m] = currentDirection;
    //if(seconds_2m % 10 == 0) displayArrays(); //For testing

    //Check to see if this is a gust for the minute
    if(currentSpeed > windgust_10m[minutes_10m])
    {
      windgust_10m[minutes_10m] = currentSpeed;
      windgustdirection_10m[minutes_10m] = currentDirection;
    }

    //Check to see if this is a gust for the day
    if(currentSpeed > windgustms)
    {
      windgustms = currentSpeed;
      windgustdir = currentDirection;
    }

    if(++seconds > 59)
    {
      seconds = 0;

      if(++minutes > 59) minutes = 0;
      if(++minutes_10m > 9) minutes_10m = 0;

      rainHour[minutes] = 0; //Zero out this minute's rainfall amount
      windgust_10m[minutes_10m] = 0; //Zero out this minute's gust
    }

    //Report all readings every second
    printWeather();

    digitalWrite(STAT1, LOW); //Turn off stat LED
  }

  smartdelay(800); //Wait 1 second, and gather GPS data
}

//While we delay for a given amount of time, gather GPS data
static void smartdelay(unsigned long ms)
{
  unsigned long start = millis();
  do
  {
    while (ss.available())
      gps.encode(ss.read());
  } while (millis() - start < ms);
}

//Calculates each of the variables that wunderground is expecting
void calcWeather()
{
  //Calc winddir
  winddir = get_wind_direction();

  //Calc windspeed
  windspeedms = get_wind_speed();

  //Calc windgustms
  //Calc windgustdir
  //Report the largest windgust today
  windgustms = 0;
  windgustdir = 0;

  //Calc windspdms_avg2m
  float temp = 0;
  for(int i = 0 ; i < 120 ; i++)
    temp += windspdavg[i];
  temp /= 120.0;
  windspdms_avg2m = temp;

  //Calc winddir_avg2m
  temp = 0; //Can't use winddir_avg2m because it's an int
  for(int i = 0 ; i < 120 ; i++)
    temp += winddiravg[i];
  temp /= 120;
  winddir_avg2m = temp;

  //Calc windgustms_10m
  //Calc windgustdir_10m
  //Find the largest windgust in the last 10 minutes
  windgustms_10m = 0;
  windgustdir_10m = 0;
  //Step through the 10 minutes
  for(int i = 0; i < 10 ; i++)
  {
    if(windgust_10m[i] > windgustms_10m)
    {
      windgustms_10m = windgust_10m[i];
      windgustdir_10m = windgustdirection_10m[i];
    }
  }

  //Calc humidity
  humidity = myHumidity.readHumidity();
  //float temp_h = myHumidity.readTemperature();
  //Serial.print(" TempH:");
  //Serial.print(temp_h, 2);

  //Calc tempf from pressure sensor
  tempf = myPressure.readTemp();
  //Serial.print(" TempP:");
  //Serial.print(tempf, 2);

  //Total rainfall for the day is calculated within the interrupt
  //Calculate amount of rainfall for the last 60 minutes
  rainin = 0;
  for(int i = 0 ; i < 60 ; i++)
    rainin += rainHour[i];

  //Calc pressure
  pressure = myPressure.readPressure();

  //Calc dewptf

  //Calc light level
  light_lvl = get_light_level();

  //Calc battery level
  batt_lvl = get_battery_level();

}

//Returns the voltage of the light sensor based on the 3.3V rail
//This allows us to ignore what VCC might be (an Arduino plugged into USB has VCC of 4.5 to 5.2V)
float get_light_level()
{
  float operatingVoltage = analogRead(REFERENCE_3V3);

  float lightSensor = analogRead(LIGHT);

  operatingVoltage = 3.3 / operatingVoltage; //The reference voltage is 3.3V

  lightSensor = operatingVoltage * lightSensor;

  return(lightSensor);
}

//Returns the voltage of the raw pin based on the 3.3V rail
//This allows us to ignore what VCC might be (an Arduino plugged into USB has VCC of 4.5 to 5.2V)
//Battery level is connected to the RAW pin on Arduino and is fed through two 5% resistors:
//3.9K on the high side (R1), and 1K on the low side (R2)
float get_battery_level()
{
  float operatingVoltage = analogRead(REFERENCE_3V3);

  float rawVoltage = analogRead(BATT);

  operatingVoltage = 3.30 / operatingVoltage; //The reference voltage is 3.3V

  rawVoltage = operatingVoltage * rawVoltage; //Convert the 0 to 1023 int to actual voltage on BATT pin

  rawVoltage *= 4.90; //(3.9k+1k)/1k - multiple BATT voltage by the voltage divider to get actual system voltage

  return(rawVoltage);
}

//Returns the instataneous wind speed
float get_wind_speed()
{
  float deltaTime = millis() - lastWindCheck; //750ms

  deltaTime /= 1000.0; //Convert to seconds

  float windSpeed = (float)windClicks / deltaTime; //3 / 0.750s = 4

  windClicks = 0; //Reset and start watching for new wind
  lastWindCheck = millis();

  //windSpeed *= 1.492; //4 * 1.492 = 5.968MPH

  /* Serial.println();
   Serial.print("Windspeed:");
   Serial.println(windSpeed);*/

  return(windSpeed);
}

//Read the wind direction sensor, return heading in degrees
int get_wind_direction()
{
  unsigned int adc;

  adc = analogRead(WDIR); // get the current reading from the sensor

  // The following table is ADC readings for the wind direction sensor output, sorted from low to high.
  // Each threshold is the midpoint between adjacent headings. The output is degrees for that ADC reading.
  // Note that these are not in compass degree order! See Weather Meters datasheet for more information.

  if (adc < 380) return (113);
  if (adc < 393) return (68);
  if (adc < 414) return (90);
  if (adc < 456) return (158);
  if (adc < 508) return (135);
  if (adc < 551) return (203);
  if (adc < 615) return (180);
  if (adc < 680) return (23);
  if (adc < 746) return (45);
  if (adc < 801) return (248);
  if (adc < 833) return (225);
  if (adc < 878) return (338);
  if (adc < 913) return (0);
  if (adc < 940) return (293);
  if (adc < 967) return (315);
  if (adc < 990) return (270);
  return (-1); // error, disconnected?
}

//Prints the various variables directly to the port
//I don't like the way this function is written but Arduino doesn't support floats under sprintf
void printWeather()
{
  calcWeather(); //Go calc all the various sensors

  Serial.println();
  //Serial.print("$,lon=");
  Serial.print(gps.location.lng(), 6);
  Serial.print(",");
  Serial.print(gps.location.lat(), 6);
  Serial.print(",");
  Serial.print(gps.altitude.meters());
  Serial.print(",");
  Serial.print(gps.satellites.value());

  char sz[32];
  Serial.print(",date=");
  sprintf(sz, "%02d-%02d-%02d", gps.date.year(), gps.date.month(), gps.date.day());
  Serial.print(sz);

  Serial.print(",time=");
  sprintf(sz, "%02d:%02d:%02d", gps.time.hour(), gps.time.minute(), gps.time.second());
  Serial.print(sz);

  //Serial.print(",RTCdate=20");
  Serial.print(",");
  sprintf(sz, "%s", getDateDs1307(0));
  Serial.print(sz);
  //Serial.print(",RTCtime=");
  Serial.print(",");
  sprintf(sz, "%s", getDateDs1307(1));
  Serial.print(sz);

  Serial.print(",");
  Serial.print(winddir);
  Serial.print(",");
  Serial.print(windspeedms, 1);
  Serial.print(",");
  Serial.print(windgustms, 1);
  Serial.print(",");
  Serial.print(windgustdir);
  Serial.print(",");
  Serial.print(windspdms_avg2m, 1);
  Serial.print(",");
  Serial.print(winddir_avg2m);
  Serial.print(",");
  Serial.print(windgustms_10m, 1);
  Serial.print(",");
  Serial.print(windgustdir_10m);
  Serial.print(",");
  Serial.print(humidity, 1);
  Serial.print(",");
  Serial.print(tempf, 1);
  Serial.print(",");
  Serial.print(rainin, 2);
  Serial.print(",");
  Serial.print(dailyrainin, 2);
  Serial.print(",");
  Serial.print(Rainindi,1);
  Serial.print(",");
  Serial.print(Rainindinter);
  Serial.print(",");
  Serial.print(pressure, 2);
  Serial.print(",");
  Serial.print(batt_lvl, 2);
  Serial.print(",");
  Serial.print(light_lvl, 2);
  Serial.print(",");

  //--------------------------
  //PRINT TO LCD
  //--------------------------

  lcd.clear();
  lcd.print(F("Lon:"));
  lcd.print(gps.location.lng(), 6);
  lcd.setCursor(0, 2);
  lcd.print(F("Lat:"));
  lcd.print(gps.location.lat(), 6);
  delay(5000);

  lcd.clear();
  sprintf(sz, "%02d-%02d-%02d", gps.date.year(), gps.date.month(), gps.date.day());
  lcd.print(sz);
  lcd.setCursor(0, 2);
  sprintf(sz, "%02d:%02d:%02d", gps.time.hour(), gps.time.minute(), gps.time.second());
  lcd.print(sz);
  lcd.print(F(" GMT"));
  delay(5000);

  lcd.clear();
  lcd.print(F("WD: "));
  lcd.print(get_wind_direction());
  lcd.print(F(" N=0 CW"));
  lcd.setCursor(0, 2);
  lcd.print(F("WS:"));
  lcd.print(get_wind_speed(), 1);
  lcd.print(F(" m/s"));
  delay(5000);

  lcd.clear();
  lcd.print(F("H:"));
  lcd.print(myHumidity.readHumidity(),2);
  lcd.print(F(" %"));
  lcd.setCursor(0, 2);
  lcd.print(F("T:"));
  lcd.print(myPressure.readTemp(),2);
  lcd.print(F(" C"));
  delay(5000);

  //Not enough dynamic memory in UNO
  lcd.clear();
  lcd.print("R:");
  lcd.print(dailyrainin);
  lcd.print("(mm/d)");
  lcd.setCursor(0, 2);
  lcd.print(F("P:"));
  lcd.print(myPressure.readPressure()/100.0,2);
  lcd.print(F(" hPa"));
  delay(5000);

  //Not enough dynamic memory in UNO
  lcd.clear();
  lcd.print(F("Battery Level"));
  lcd.print(get_battery_level());
  lcd.clear();
  lcd.print(F("Sunlight"));
  lcd.setCursor(0, 2);
  lcd.print(get_light_level());
  delay(2000);

}

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


initial commit

initial commit

/**
 * SARA U270
 * @author Kevin Tjiam <kevin@tjiam.com>
 */

#include <stdint.h>
#include <string.h>

#define TRACE

/* Server addresses and shit */
#define APN_TELSTRA                 "telstra.internet"
#define BACKEND_SERVER_ADDRESS      "jsonplaceholder.typicode.com"
#define BACKEND_SERVER_PORT         "80"

/* App return values */
#define RESPONSE_OK                 0
#define RESPONSE_ERROR              1
#define RESPONSE_TIMEOUT            2

/* AT parser FSM */
#define AT_PARSER_TIMEOUT           5000
#define AT_PARSER_OK                0
#define AT_PARSER_ERROR             1
#define AT_PARSER_BUSY              2
#define AT_PARSER_READY             5
static volatile uint32_t g_modem_parser_state = AT_PARSER_READY;
static volatile uint32_t g_modem_has_network = false;
static volatile uint32_t g_modem_has_internet = false;

/* Prototypes */
uint32_t send_modem_command(const char *command);

void set_modem_state(uint32_t state) {
    g_modem_parser_state = state;
}

bool is_modem_state(uint32_t state) {
    return g_modem_parser_state == state;
}

void network_ready() {
    if (g_modem_has_network && g_modem_has_internet) {
        // gets network info
        //send_modem_command("AT+COPS?");

        // gprs
        send_modem_command("AT+CGATT=1");                       /* GSM & GPRS registration */
        delay(1000);

        send_modem_command("AT+UPSD=0,1,\"" APN_TELSTRA "\"");
        //send_modem_command("AT+UPSD=0,7,\"0.0.0.0\"");          /* set dynamic IP */
        //send_modem_command("AT+UPSDA=0,1");                     /* save profile to NVM */
        send_modem_command("AT+UPSDA=0,3");                     /* activate connection */
        send_modem_command("AT+UPSND=0,8");                     /* check status of connection */
        send_modem_command("AT+UPSND=0,0");                     /* check assigned IP */

        // test HTTP GET
        send_modem_command("AT+UHTTP=0");
        send_modem_command("AT+UHTTP=0,1,\"" BACKEND_SERVER_ADDRESS "\"");
        send_modem_command("AT+UHTTP=0,5," BACKEND_SERVER_PORT);
        send_modem_command("AT+UHTTPC=0,1,\"/posts/1\",\"buffer_get\"");    /* must wait for +UUHTTPCR: 0,1,1 (HTTP GET success URC) */
        send_modem_command("AT+URDFILE=\"buffer_get\"");
    }
}

void handle_modem_response(char *response, uint16_t response_length) {
#ifdef TRACE
    if (strncmp(response, "[Res]", 5)) {
        SerialUSB.print("[Res]: ");
        for (int i=0; i<response_length; i++) {
            SerialUSB.print((char)response[i]);
        }
        SerialUSB.print("\r\n");
    }
#endif

    // Final response
    if (!strncmp(response, "OK", 2)) {
        set_modem_state(AT_PARSER_READY);
    } else if (!strncmp(response, "ERROR", 5) ||
               !strncmp(response, "+CME ERROR", 10) ||
               !strncmp(response, "+CMS ERROR", 10) ||
               !strncmp(response, "ABORTED", 7)) {
        set_modem_state(AT_PARSER_READY);
    }

    // URCs
    if (!strncmp(response, "+CREG: 1", 8)) {
        /* Connected to home network */
        g_modem_has_network = true;
        network_ready();
    } else if (!strncmp(response, "+UREG: 3", 8) ||
               !strncmp(response, "+UREG: 6", 8) ||
               !strncmp(response, "+UREG: 9", 8)) {
        /**
         * UREG URCs for Telstra
         * +UREG: 3 => WCDMA/UMTS
         * +UREG: 6 => HSDPA
         * +UREG: 9 => GPRS/EDGE
         */
        if (!g_modem_has_internet) {
            g_modem_has_internet = true;
            network_ready();
        }
    }
}

void flush_modem_responses() {
    while (Serial.available()) {
        uint8_t read_buffer[256];
        uint8_t read_buffer_length;

        // clear buffer
        memset(read_buffer, '\0', 256);
        read_buffer_length = Serial.readBytesUntil('\n', read_buffer, 255);

        handle_modem_response((char *)read_buffer, read_buffer_length);
    }
}

uint32_t send_modem_command(const char *command) {
    uint32_t err_code;

    delay(100);
    /* Write command to UART */
    for (int i=0; i<strlen(command); i++) {
        Serial.print(command[i]);
    }
    Serial.print("\r\n");

    /* Block while parsing response from modem */
    set_modem_state(AT_PARSER_BUSY);
    uint32_t begin_systick = millis();
    do {
        delay(20);
        flush_modem_responses();
    } while (is_modem_state(AT_PARSER_BUSY) && (begin_systick - millis() < AT_PARSER_TIMEOUT));

    /* Set return values */
    if (is_modem_state(AT_PARSER_BUSY)) {
        err_code = RESPONSE_TIMEOUT;
    } else {
        err_code = RESPONSE_OK;
    }

    /* Make sure AT parser state is reset */
    set_modem_state(AT_PARSER_READY);

    return err_code;
}

uint32_t configure_modem() {
    uint32_t err_code;

    while (!Serial);
    Serial.begin(115200);
    Serial.setTimeout(5000);
    flush_modem_responses();

    // wakeup
    do {
        delay(1000);
        err_code = send_modem_command("AT");
    } while (err_code != RESPONSE_OK);

    // reset factory settings
    send_modem_command("AT&F");

    // echo off
    send_modem_command("ATE1");

    // Check PIN ready
    send_modem_command("AT+CPIN?");

    // Disable DTE flow control
    send_modem_command("AT&K0");

    // Verbose errors
    send_modem_command("AT+CMEE=2");

    // Set modem baud rate
    send_modem_command("AT+IPR=115200");

    // Network registration
    //send_modem_command("AT+URAT?");     /* +URAT: 1,2 is UMTS dual-mode */
    //send_modem_command("AT+UBANDSEL?"); /* returns available bands */

    // Enable URCs.
    send_modem_command("AT+UREG=1");
    send_modem_command("AT+CREG=1");
}

void serialEvent() {
    flush_modem_responses();
}

void setup() {
    while (!SerialUSB);
    SerialUSB.begin(115200);
    configure_modem();
}

void loop() {
    //
}


we just read the following motors for homing …

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


Basic melody sketch, added commentary to understand what each part is doing, and changed the tone to a more appropriate warning tone. No external communications ability yet.

/* Play Melody
 * -----------
 *
 * Program to play melodies stored in an array, it requires to know
 * about timing issues and about how to play tones.
 *
 * The calculation of the tones is made following the mathematical
 * operation:
 *
 *       timeHigh = 1/(2 * toneFrequency) = period / 2
 *
 * where the different tones are described as in the table:
 *
 * note         frequency       period  PW (timeHigh)
 * c            261 Hz          3830    1915
 * d            294 Hz          3400    1700
 * e            329 Hz          3038    1519
 * f            349 Hz          2864    1432
 * g            392 Hz          2550    1275
 * a            440 Hz          2272    1136
 * b            493 Hz          2028    1014
 * C            523 Hz          1912    956
 *
 * (cleft) 2005 D. Cuartielles for K3
 */

int ledPin = 13;
int speakerOut = 9;
byte names[] = {'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C'};
int tones[] = {1915, 1700, 1519, 1432, 1275, 1136, 1014, 956};
byte melody[] = "9b6d9b6d9b6d9b6d";
// count length: 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0
//                                10                  20                  30
int count = 0; //Iterates through the notes in the playlist
int count2 = 0; //The counter that iterates through the names, looking for a match with the requested note
int count3 = 0; //Controls how long a "beat" is, via its for loop
int MAX_COUNT = 8; //How many notes are in the melody
int statePin = LOW;

void setup() {
 pinMode(ledPin, OUTPUT);
 //Speaker is already set up by default as output
}

void loop() {
  analogWrite(speakerOut, 0); //Ensure speaker starts off
  for (count = 0; count < MAX_COUNT; count++) { //Iterates through the notes requested
    statePin = !statePin;
    digitalWrite(ledPin, statePin);
    for (count3 = 0; count3 <= (melody[count*2] - 48) * 30; count3++) { //controls how long a note plays
      for (count2=0;count2<8;count2++) { //Iterate through tones
        if (names[count2] == melody[count*2 + 1]) { //if you find a tone that matches the tone requested
          analogWrite(speakerOut,255); //pulse speaker accordingly (does not control volume well)
          delayMicroseconds(tones[count2]);
          analogWrite(speakerOut, 0);
          delayMicroseconds(tones[count2]); //there is a timing issue here where higher notes are played slightly shorter
        }
        if (melody[count*2 + 1] == 'p') {
          // make a pause of a certain size
          analogWrite(speakerOut, 0);
          delayMicroseconds(500);
        }
      }
    }
  }
}

//Code from http://www.arduino.cc/en/Tutorial/PlayMelody


make example line up with book

make example line up with book

error: pathspec 'examples-ltc/7.' did not match any file(s) known to git
error: pathspec 'LoveToCodeVol1/3_SetLevel/SetLevel.ino' did not match any file(s) known to git


Initial ex32 using XSpinner

Initial ex32 using XSpinner

//
// GUIslice Library Examples
// - Calvin Hass
// - https://www.impulseadventure.com/elec/guislice-gui.html
// - https://github.com/ImpulseAdventure/GUIslice
// - Example 32 (Arduino):
//   - Multiple page handling
//   - Background image
//   - XSpinner compound elements
//
//   - NOTE: The XSpinner compound element requires GSLC_FEATURE_COMPOUND enabled
//   - NOTE: This is the simple version of the example without
//     optimizing for memory consumption. Therefore, it may not
//     run on Arduino devices with limited memory. A "minimal"
//     version is located in the "arduino_min" folder which includes
//     FLASH memory optimization for reduced memory devices.
//
// ARDUINO NOTES:
// - GUIslice_config.h must be edited to match the pinout connections
//   between the Arduino CPU and the display controller (see ADAGFX_PIN_*).
// - To support a larger number of GUI elements, it is recommended to
//   use a CPU that provides more than 2KB of SRAM (eg. ATmega2560).
//
#include "GUIslice.h"
#include "GUIslice_drv.h"

// Ensure optional compound element feature is enabled in the configuration
#if !(GSLC_FEATURE_COMPOUND)
  #error "Config: GSLC_FEATURE_COMPOUND required for this example but not enabled. Please update GUIslice_config."
#endif

// Include any extended elements
#include "elem/XGauge.h"
#include "elem/XSpinner.h"

// Defines for resources
#define IMG_BKGND       "back1_24.bmp"

// Enumerations for pages, elements, fonts, images
enum {E_PG_MAIN,E_PG_EXTRA};
enum {E_ELEM_BTN_QUIT,E_ELEM_BTN_EXTRA,E_ELEM_BTN_BACK,
      E_ELEM_TXT_COUNT,E_ELEM_PROGRESS,
      E_ELEM_COMP1,E_ELEM_COMP2,E_ELEM_COMP3};
enum {E_FONT_BTN,E_FONT_TXT,E_FONT_TITLE};

bool      m_bQuit = false;

// Free-running counter for display
unsigned  m_nCount = 0;

// Instantiate the GUI
#define MAX_PAGE                2
#define MAX_FONT                3

// Define the maximum number of elements per page
#define MAX_ELEM_PG_MAIN        9                 // # Elems total on Main page
#define MAX_ELEM_PG_EXTRA       7                 // # Elems total on Extra page
#define MAX_ELEM_PG_MAIN_RAM    MAX_ELEM_PG_MAIN  // # Elems in RAM
#define MAX_ELEM_PG_EXTRA_RAM   MAX_ELEM_PG_EXTRA // # Elems in RAM

gslc_tsGui                  m_gui;
gslc_tsDriver               m_drv;
gslc_tsFont                 m_asFont[MAX_FONT];
gslc_tsPage                 m_asPage[MAX_PAGE];
gslc_tsElem                 m_asMainElem[MAX_ELEM_PG_MAIN_RAM];
gslc_tsElemRef              m_asMainElemRef[MAX_ELEM_PG_MAIN];
gslc_tsElem                 m_asExtraElem[MAX_ELEM_PG_EXTRA_RAM];
gslc_tsElemRef              m_asExtraElemRef[MAX_ELEM_PG_EXTRA];

gslc_tsXGauge               m_sXGauge;
gslc_tsXSpinner              m_sXSpinner[3];

#define MAX_STR             8

  // Save some element pointers for quick access
  gslc_tsElemRef*  m_pElemCnt = NULL;
  gslc_tsElemRef*  m_pElemProgress = NULL;

// Define debug message function
static int16_t DebugOut(char ch) { Serial.write(ch); return 0; }

// Button callbacks
// - Show example of common callback function
bool CbBtnCommon(void* pvGui,void *pvElemRef,gslc_teTouch eTouch,int16_t nX,int16_t nY)
{
  gslc_tsElemRef* pElemRef = (gslc_tsElemRef*)(pvElemRef);
  gslc_tsElem* pElem = pElemRef->pElem;
  int16_t nElemId = pElem->nId;
  if (eTouch == GSLC_TOUCH_UP_IN) {
    if (nElemId == E_ELEM_BTN_QUIT) {
      m_bQuit = true;
    } else if (nElemId == E_ELEM_BTN_EXTRA) {
      gslc_SetPageCur(&m_gui,E_PG_EXTRA);
    } else if (nElemId == E_ELEM_BTN_BACK) {
      gslc_SetPageCur(&m_gui,E_PG_MAIN);
    }
  }
  return true;
}

// Create the default elements on each page
bool InitOverlays()
{
  gslc_tsElemRef*  pElemRef = NULL;

  gslc_PageAdd(&m_gui,E_PG_MAIN,m_asMainElem,MAX_ELEM_PG_MAIN_RAM,m_asMainElemRef,MAX_ELEM_PG_MAIN);
  gslc_PageAdd(&m_gui,E_PG_EXTRA,m_asExtraElem,MAX_ELEM_PG_EXTRA_RAM,m_asExtraElemRef,MAX_ELEM_PG_EXTRA);

  // -----------------------------------
  // Background
  // - Background image from SD card disabled, uncomment to enable
  // - Ensure that GSLC_SD_EN is set to 1 in GUIslice_config.h
  //static const char m_strImgBkgnd[] = IMG_BKGND;
  //gslc_SetBkgndImage(&m_gui,gslc_GetImageFromSD(m_strImgBkgnd,GSLC_IMGREF_FMT_BMP24));

  // -----------------------------------
  // PAGE: MAIN

  // Create background box
  pElemRef = gslc_ElemCreateBox(&m_gui,GSLC_ID_AUTO,E_PG_MAIN,(gslc_tsRect){20,50,280,150});
  gslc_ElemSetCol(&m_gui,pElemRef,GSLC_COL_WHITE,GSLC_COL_BLACK,GSLC_COL_BLACK);

  // Create title
  pElemRef = gslc_ElemCreateTxt(&m_gui,GSLC_ID_AUTO,E_PG_MAIN,(gslc_tsRect){10,10,310,40},
    (char*)"GUIslice Demo",0,E_FONT_TITLE);
  gslc_ElemSetTxtAlign(&m_gui,pElemRef,GSLC_ALIGN_MID_MID);
  gslc_ElemSetFillEn(&m_gui,pElemRef,false);
  gslc_ElemSetTxtCol(&m_gui,pElemRef,GSLC_COL_WHITE);

  // Create Quit button with text label
  pElemRef = gslc_ElemCreateBtnTxt(&m_gui,E_ELEM_BTN_QUIT,E_PG_MAIN,
    (gslc_tsRect){100,140,50,20},(char*)"Quit",0,E_FONT_BTN,&CbBtnCommon);

  // Create Extra button with text label
  pElemRef = gslc_ElemCreateBtnTxt(&m_gui,E_ELEM_BTN_EXTRA,E_PG_MAIN,
    (gslc_tsRect){170,140,50,20},(char*)"Extra",0,E_FONT_BTN,&CbBtnCommon);

  // Create counter
  pElemRef = gslc_ElemCreateTxt(&m_gui,GSLC_ID_AUTO,E_PG_MAIN,(gslc_tsRect){40,60,50,10},
    (char*)"Count:",0,E_FONT_TXT);
  static char mstr1[8] = "";
  pElemRef = gslc_ElemCreateTxt(&m_gui,E_ELEM_TXT_COUNT,E_PG_MAIN,(gslc_tsRect){100,60,50,10},
    mstr1,sizeof(mstr1),E_FONT_TXT);
  gslc_ElemSetTxtCol(&m_gui,pElemRef,GSLC_COL_YELLOW);
  m_pElemCnt = pElemRef; // Save for quick access

  // Create progress bar
  pElemRef = gslc_ElemCreateTxt(&m_gui,GSLC_ID_AUTO,E_PG_MAIN,(gslc_tsRect){40,80,50,10},
    (char*)"Progress:",0,E_FONT_TXT);
  pElemRef = gslc_ElemXGaugeCreate(&m_gui,E_ELEM_PROGRESS,E_PG_MAIN,&m_sXGauge,(gslc_tsRect){100,80,50,10},
    0,100,0,GSLC_COL_GREEN,false);
  m_pElemProgress = pElemRef; // Save for quick access

  // Add compound element
  pElemRef = gslc_ElemXSpinnerCreate(&m_gui,E_ELEM_COMP1,E_PG_MAIN,&m_sXSpinner[0],
    (gslc_tsRect){160,60,120,50},E_FONT_BTN);

  // -----------------------------------
  // PAGE: EXTRA

  // Create background box
  pElemRef = gslc_ElemCreateBox(&m_gui,GSLC_ID_AUTO,E_PG_EXTRA,(gslc_tsRect){40,40,240,160});
  gslc_ElemSetCol(&m_gui,pElemRef,GSLC_COL_WHITE,GSLC_COL_BLACK,GSLC_COL_BLACK);

  // Create Back button with text label
  pElemRef = gslc_ElemCreateBtnTxt(&m_gui,E_ELEM_BTN_BACK,E_PG_EXTRA,
    (gslc_tsRect){50,170,50,20},(char*)"Back",0,E_FONT_BTN,&CbBtnCommon);

  // Create a few labels
  int16_t    nPosY = 50;
  int16_t    nSpaceY = 20;
  pElemRef = gslc_ElemCreateTxt(&m_gui,GSLC_ID_AUTO,E_PG_EXTRA,(gslc_tsRect){60,nPosY,50,10},
    (char*)"Data 1",0,E_FONT_TXT); nPosY += nSpaceY;
  pElemRef = gslc_ElemCreateTxt(&m_gui,GSLC_ID_AUTO,E_PG_EXTRA,(gslc_tsRect){60,nPosY,50,10},
    (char*)"Data 2",0,E_FONT_TXT); nPosY += nSpaceY;
  pElemRef = gslc_ElemCreateTxt(&m_gui,GSLC_ID_AUTO,E_PG_EXTRA,(gslc_tsRect){60,nPosY,50,10},
    (char*)"Data 3",0,E_FONT_TXT); nPosY += nSpaceY;

  // Add compound element
  pElemRef = gslc_ElemXSpinnerCreate(&m_gui,E_ELEM_COMP2,E_PG_EXTRA,&m_sXSpinner[1],
    (gslc_tsRect){130,60,120,50},E_FONT_BTN);

  pElemRef = gslc_ElemXSpinnerCreate(&m_gui,E_ELEM_COMP3,E_PG_EXTRA,&m_sXSpinner[2],
    (gslc_tsRect){130,120,120,50},E_FONT_BTN);

  return true;
}

void setup()
{
  // Initialize debug output
  Serial.begin(9600);
  gslc_InitDebug(&DebugOut);
  //delay(1000);  // NOTE: Some devices require a delay after Serial.begin() before serial port can be used

  // Initialize
  if (!gslc_Init(&m_gui,&m_drv,m_asPage,MAX_PAGE,m_asFont,MAX_FONT)) { return; }

  // Load Fonts
  if (!gslc_FontAdd(&m_gui,E_FONT_BTN,GSLC_FONTREF_PTR,NULL,1)) { return; }
  if (!gslc_FontAdd(&m_gui,E_FONT_TXT,GSLC_FONTREF_PTR,NULL,1)) { return; }
  if (!gslc_FontAdd(&m_gui,E_FONT_TITLE,GSLC_FONTREF_PTR,NULL,1)) { return; }

  // Create page elements
  InitOverlays();

  // Start up display on main page
  gslc_SetPageCur(&m_gui,E_PG_MAIN);

  m_bQuit = false;
}

void loop()
{
  char              acTxt[MAX_STR];

  // Save some element references for easy access
  gslc_tsElemRef*  pElemCnt        = gslc_PageFindElemById(&m_gui,E_PG_MAIN,E_ELEM_TXT_COUNT);
  gslc_tsElemRef*  pElemProgress   = gslc_PageFindElemById(&m_gui,E_PG_MAIN,E_ELEM_PROGRESS);

  m_nCount++;

  // Perform drawing updates
  // - Note: we can make the updates conditional on the active
  //   page by checking gslc_GetPageCur() first.

  snprintf(acTxt,MAX_STR,"%u",m_nCount);
  gslc_ElemSetTxtStr(&m_gui,pElemCnt,acTxt);

  gslc_ElemXGaugeUpdate(&m_gui,pElemProgress,((m_nCount/2)%100));

  // Periodically call GUIslice update function
  gslc_Update(&m_gui);

  // Slow down updates
  delay(100);

  // In a real program, we would detect the button press and take an action.
  // For this Arduino demo, we will pretend to exit by emulating it with an
  // infinite loop. Note that interrupts are not disabled so that any debug
  // messages via Serial have an opportunity to be transmitted.
  if (m_bQuit) {
    gslc_Quit(&m_gui);
    while (1) { }
  }
}

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


Fixed int-problem in arduino-code

Fixed int-problem in arduino-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/tihlde/ircbot.git/'


Added Version 1 (Arduino Uno, no comms) used initially by LRWHF

/*
 Weather Shield Example
 By: Nathan Seidle
 SparkFun Electronics
 Date: November 16th, 2013
 License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).

 Much of this is based on Mike Grusin's USB Weather Board code: https://www.sparkfun.com/products/10586

 This code reads all the various sensors (wind speed, direction, rain gauge, humidty, pressure, light, batt_lvl)
 and reports it over the serial comm port. This can be easily routed to an datalogger (such as OpenLog) or
 a wireless transmitter (such as Electric Imp).

 Measurements are reported once a second but windspeed and rain gauge are tied to interrupts that are
 calcualted at each report.

 This example code assumes the GP-635T GPS module is attached.

 */

#include <Wire.h> //I2C needed for sensors
#include "MPL3115A2.h" //Pressure sensor
#include "HTU21D.h" //Humidity sensor
#include <SoftwareSerial.h> //Needed for GPS
#include <TinyGPS++.h> //GPS parsing

//this is for RTC
int clockAddress = 0x68;  // This is the I2C address
int command = 0;  // This is the command char, in ascii form, sent from the serial port
long previousMillis = 0;  // will store last time Temp was updated
byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;

byte decToBcd(byte val)
{
  return ( (val/10*16) + (val%10) );
}

// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
  return ( (val/16*10) + (val%16) );
}

// Gets the date and time from the ds1307 and prints result
char* getDateDs1307(int flag) {
  //if flag == 0 : date output
  //if flag == 1 : time output
  // Reset the register pointer
  Wire.beginTransmission(clockAddress);
  Wire.write(byte(0x00));
  Wire.endTransmission();

  Wire.requestFrom(clockAddress, 7);

  // A few of these need masks because certain bits are control bits
  second     = bcdToDec(Wire.read() & 0x7f);
  minute     = bcdToDec(Wire.read());

  // Need to change this if 12 hour am/pm
  hour       = bcdToDec(Wire.read() & 0x3f);
  dayOfWeek  = bcdToDec(Wire.read());
  dayOfMonth = bcdToDec(Wire.read());
  month      = bcdToDec(Wire.read());
  year       = bcdToDec(Wire.read());

  char sza[32];
  if (flag==0)
    sprintf(sza, "%02d-%02d-%02d",year,month,dayOfMonth);
  if (flag==1)
    sprintf(sza, "%02d:%02d:%02d",hour,minute,second);
  return(sza);
}
//end of RTC

TinyGPSPlus gps;

static const int RXPin = 5, TXPin = 4; //GPS is attached to pin 4(TX from GPS) and pin 5(RX into GPS)
SoftwareSerial ss(RXPin, TXPin);

MPL3115A2 myPressure; //Create an instance of the pressure sensor
HTU21D myHumidity; //Create an instance of the humidity sensor

//Hardware pin definitions
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// digital I/O pins
const byte WSPEED = 3;
const byte RAIN = 2;
const byte STAT1 = 7;
const byte STAT2 = 8;
const byte GPS_PWRCTL = 6; //Pulling this pin low puts GPS to sleep but maintains RTC and RAM

// analog I/O pins
const byte REFERENCE_3V3 = A3;
const byte LIGHT = A1;
const byte BATT = A2;
const byte WDIR = A0;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

//Global Variables
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
long lastSecond; //The millis counter to see when a second rolls by
byte seconds; //When it hits 60, increase the current minute
byte seconds_2m; //Keeps track of the "wind speed/dir avg" over last 2 minutes array of data
byte minutes; //Keeps track of where we are in various arrays of data
byte minutes_10m; //Keeps track of where we are in wind gust/dir over last 10 minutes array of data

long lastWindCheck = 0;
volatile long lastWindIRQ = 0;
volatile byte windClicks = 0;

//We need to keep track of the following variables:
//Wind speed/dir each update (no storage)
//Wind gust/dir over the day (no storage)
//Wind speed/dir, avg over 2 minutes (store 1 per second)
//Wind gust/dir over last 10 minutes (store 1 per minute)
//Rain over the past hour (store 1 per minute)
//Total rain over date (store one per day)

byte windspdavg[120]; //120 bytes to keep track of 2 minute average
int winddiravg[120]; //120 ints to keep track of 2 minute average
float windgust_10m[10]; //10 floats to keep track of 10 minute max
int windgustdirection_10m[10]; //10 ints to keep track of 10 minute max
volatile float rainHour[60]; //60 floating numbers to keep track of 60 minutes of rain

//These are all the weather values that wunderground expects:
int winddir = 0; // [0-360 instantaneous wind direction]
float windspeedms = 0; // [mph instantaneous wind speed]
float windgustms = 0; // [mph current wind gust, using software specific time period]
int windgustdir = 0; // [0-360 using software specific time period]
float windspdms_avg2m = 0; // [mph 2 minute average wind speed mph]
int winddir_avg2m = 0; // [0-360 2 minute average wind direction]
float windgustms_10m = 0; // [mph past 10 minutes wind gust mph ]
int windgustdir_10m = 0; // [0-360 past 10 minutes wind gust direction]
float humidity = 0; // [%]
float tempf = 0; // [temperature F]
float rainin = 0; // [rain inches over the past hour)] -- the accumulated rainfall in the past 60 min
volatile float dailyrainin = 0; // [rain inches so far today in local time]
//float baromin = 30.03;// [barom in] - It's hard to calculate baromin locally, do this in the agent
float pressure = 0;
//float dewptf; // [dewpoint F] - It's hard to calculate dewpoint locally, do this in the agent

float batt_lvl = 11.8; //[analog value from 0 to 1023]
float light_lvl = 455; //[analog value from 0 to 1023]
//Rain time stamp
int Rainindi=0;
//Variables used for GPS
//float flat, flon; // 39.015024 -102.283608686
//unsigned long age;
//int year;
//byte month, day, hour, minute, second, hundredths;

// volatiles are subject to modification by IRQs
volatile unsigned long raintime, rainlast, raininterval, rain, Rainindinter, Rainindtime, Rainindlast;

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

//Interrupt routines (these are called by the hardware interrupts, not by the main code)
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void rainIRQ()
// Count rain gauge bucket tips as they occur
// Activated by the magnet and reed switch in the rain gauge, attached to input D2
{
  raintime = millis(); // grab current time
  raininterval = raintime - rainlast; // calculate interval between this and last event

    if (raininterval > 10) // ignore switch-bounce glitches less than 10mS after initial edge
  {
    dailyrainin += 0.011*25.4; //Each dump is 0.011" of water
    rainHour[minutes] += 0.011*25.4; //Increase this minute's amount of rain

    rainlast = raintime; // set up for next event
  }

  //Rain or not (1 or 0)
  if(rainin >0)
  {
    Rainindi=1;
    Rainindtime = millis();
  }
  if(rainin ==0)
  {
   Rainindi=0;
   Rainindlast = millis();
   Rainindlast = Rainindtime;
  }
  Rainindinter = Rainindlast - Rainindtime;

}

void wspeedIRQ()
// Activated by the magnet in the anemometer (2 ticks per rotation), attached to input D3
{
  if (millis() - lastWindIRQ > 10) // Ignore switch-bounce glitches less than 10ms (142MPH max reading) after the reed switch closes
  {
    lastWindIRQ = millis(); //Grab the current time
    windClicks++; //There is 1.492MPH for each click per second.
  }

}

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

  ss.begin(9600); //Begin listening to GPS over software serial at 9600. This should be the default baud of the module.

  pinMode(STAT1, OUTPUT); //Status LED Blue
  pinMode(STAT2, OUTPUT); //Status LED Green

  pinMode(GPS_PWRCTL, OUTPUT);
  digitalWrite(GPS_PWRCTL, HIGH); //Pulling this pin low puts GPS to sleep but maintains RTC and RAM

  pinMode(WSPEED, INPUT_PULLUP); // input from wind meters windspeed sensor
  pinMode(RAIN, INPUT_PULLUP); // input from wind meters rain gauge sensor

  pinMode(REFERENCE_3V3, INPUT);
  pinMode(LIGHT, INPUT);

  //Configure the pressure sensor
  myPressure.begin(); // Get sensor online
  myPressure.setModeBarometer(); // Measure pressure in Pascals from 20 to 110 kPa
  myPressure.setOversampleRate(7); // Set Oversample to the recommended 128
  myPressure.enableEventFlags(); // Enable all three pressure and temp event flags

  //Configure the humidity sensor
  myHumidity.begin();

  seconds = 0;
  lastSecond = millis();

  // attach external interrupt pins to IRQ functions
  attachInterrupt(0, rainIRQ, FALLING);
  attachInterrupt(1, wspeedIRQ, FALLING);

  // turn on interrupts
  interrupts();

  //Serial.println("Weather Shield online!");

}

void loop()
{
  //Keep track of which minute it is
  if(millis() - lastSecond >= 1000)
  {
    digitalWrite(STAT1, HIGH); //Blink stat LED

    lastSecond += 1000;

    //Take a speed and direction reading every second for 2 minute average
    if(++seconds_2m > 119) seconds_2m = 0;

    //Calc the wind speed and direction every second for 120 second to get 2 minute average
    float currentSpeed = get_wind_speed();
    //float currentSpeed = random(5); //For testing
    int currentDirection = get_wind_direction();
    windspdavg[seconds_2m] = (int)currentSpeed;
    winddiravg[seconds_2m] = currentDirection;
    //if(seconds_2m % 10 == 0) displayArrays(); //For testing

    //Check to see if this is a gust for the minute
    if(currentSpeed > windgust_10m[minutes_10m])
    {
      windgust_10m[minutes_10m] = currentSpeed;
      windgustdirection_10m[minutes_10m] = currentDirection;
    }

    //Check to see if this is a gust for the day
    if(currentSpeed > windgustms)
    {
      windgustms = currentSpeed;
      windgustdir = currentDirection;
    }

    if(++seconds > 59)
    {
      seconds = 0;

      if(++minutes > 59) minutes = 0;
      if(++minutes_10m > 9) minutes_10m = 0;

      rainHour[minutes] = 0; //Zero out this minute's rainfall amount
      windgust_10m[minutes_10m] = 0; //Zero out this minute's gust
    }

    //Report all readings every second
    printWeather();

    digitalWrite(STAT1, LOW); //Turn off stat LED
  }

  smartdelay(800); //Wait 1 second, and gather GPS data
}

//While we delay for a given amount of time, gather GPS data
static void smartdelay(unsigned long ms)
{
  unsigned long start = millis();
  do
  {
    while (ss.available())
      gps.encode(ss.read());
  } while (millis() - start < ms);
}

//Calculates each of the variables that wunderground is expecting
void calcWeather()
{
  //Calc winddir
  winddir = get_wind_direction();

  //Calc windspeed
  windspeedms = get_wind_speed();

  //Calc windgustms
  //Calc windgustdir
  //Report the largest windgust today
  windgustms = 0;
  windgustdir = 0;

  //Calc windspdms_avg2m
  float temp = 0;
  for(int i = 0 ; i < 120 ; i++)
    temp += windspdavg[i];
  temp /= 120.0;
  windspdms_avg2m = temp;

  //Calc winddir_avg2m
  temp = 0; //Can't use winddir_avg2m because it's an int
  for(int i = 0 ; i < 120 ; i++)
    temp += winddiravg[i];
  temp /= 120;
  winddir_avg2m = temp;

  //Calc windgustms_10m
  //Calc windgustdir_10m
  //Find the largest windgust in the last 10 minutes
  windgustms_10m = 0;
  windgustdir_10m = 0;
  //Step through the 10 minutes
  for(int i = 0; i < 10 ; i++)
  {
    if(windgust_10m[i] > windgustms_10m)
    {
      windgustms_10m = windgust_10m[i];
      windgustdir_10m = windgustdirection_10m[i];
    }
  }

  //Calc humidity
  humidity = myHumidity.readHumidity();
  //float temp_h = myHumidity.readTemperature();
  //Serial.print(" TempH:");
  //Serial.print(temp_h, 2);

  //Calc tempf from pressure sensor
  tempf = myPressure.readTemp();
  //Serial.print(" TempP:");
  //Serial.print(tempf, 2);

  //Total rainfall for the day is calculated within the interrupt
  //Calculate amount of rainfall for the last 60 minutes
  rainin = 0;
  for(int i = 0 ; i < 60 ; i++)
    rainin += rainHour[i];

  //Calc pressure
  pressure = myPressure.readPressure();

  //Calc dewptf

  //Calc light level
  light_lvl = get_light_level();

  //Calc battery level
  batt_lvl = get_battery_level();

}

//Returns the voltage of the light sensor based on the 3.3V rail
//This allows us to ignore what VCC might be (an Arduino plugged into USB has VCC of 4.5 to 5.2V)
float get_light_level()
{
  float operatingVoltage = analogRead(REFERENCE_3V3);

  float lightSensor = analogRead(LIGHT);

  operatingVoltage = 3.3 / operatingVoltage; //The reference voltage is 3.3V

  lightSensor = operatingVoltage * lightSensor;

  return(lightSensor);
}

//Returns the voltage of the raw pin based on the 3.3V rail
//This allows us to ignore what VCC might be (an Arduino plugged into USB has VCC of 4.5 to 5.2V)
//Battery level is connected to the RAW pin on Arduino and is fed through two 5% resistors:
//3.9K on the high side (R1), and 1K on the low side (R2)
float get_battery_level()
{
  float operatingVoltage = analogRead(REFERENCE_3V3);

  float rawVoltage = analogRead(BATT);

  operatingVoltage = 3.30 / operatingVoltage; //The reference voltage is 3.3V

  rawVoltage = operatingVoltage * rawVoltage; //Convert the 0 to 1023 int to actual voltage on BATT pin

  rawVoltage *= 4.90; //(3.9k+1k)/1k - multiple BATT voltage by the voltage divider to get actual system voltage

  return(rawVoltage);
}

//Returns the instataneous wind speed
float get_wind_speed()
{
  float deltaTime = millis() - lastWindCheck; //750ms

  deltaTime /= 1000.0; //Convert to seconds

  float windSpeed = (float)windClicks / deltaTime; //3 / 0.750s = 4

  windClicks = 0; //Reset and start watching for new wind
  lastWindCheck = millis();

  //windSpeed *= 1.492; //4 * 1.492 = 5.968MPH

  /* Serial.println();
   Serial.print("Windspeed:");
   Serial.println(windSpeed);*/

  return(windSpeed);
}

//Read the wind direction sensor, return heading in degrees
int get_wind_direction()
{
  unsigned int adc;

  adc = analogRead(WDIR); // get the current reading from the sensor

  // The following table is ADC readings for the wind direction sensor output, sorted from low to high.
  // Each threshold is the midpoint between adjacent headings. The output is degrees for that ADC reading.
  // Note that these are not in compass degree order! See Weather Meters datasheet for more information.

  if (adc < 380) return (113);
  if (adc < 393) return (68);
  if (adc < 414) return (90);
  if (adc < 456) return (158);
  if (adc < 508) return (135);
  if (adc < 551) return (203);
  if (adc < 615) return (180);
  if (adc < 680) return (23);
  if (adc < 746) return (45);
  if (adc < 801) return (248);
  if (adc < 833) return (225);
  if (adc < 878) return (338);
  if (adc < 913) return (0);
  if (adc < 940) return (293);
  if (adc < 967) return (315);
  if (adc < 990) return (270);
  return (-1); // error, disconnected?
}

//Prints the various variables directly to the port
//I don't like the way this function is written but Arduino doesn't support floats under sprintf
void printWeather()
{
  calcWeather(); //Go calc all the various sensors

  Serial.println();
  Serial.print("$,lon=");
  Serial.print(gps.location.lng(), 6);
  Serial.print(",lat=");
  Serial.print(gps.location.lat(), 6);
  Serial.print(",altitude=");
  Serial.print(gps.altitude.meters());
  Serial.print(",sats=");
  Serial.print(gps.satellites.value());

  char sz[32];
  Serial.print(",date=");
  sprintf(sz, "%02d-%02d-%02d", gps.date.year(), gps.date.month(), gps.date.day());
  Serial.print(sz);

  Serial.print(",time=");
  sprintf(sz, "%02d:%02d:%02d", gps.time.hour(), gps.time.minute(), gps.time.second());
  Serial.print(sz);

  Serial.print(",RTCdate=20");
  sprintf(sz, "%s", getDateDs1307(0));
  Serial.print(sz);
  Serial.print(",RTCtime=");
  sprintf(sz, "%s", getDateDs1307(1));
  Serial.print(sz);

  Serial.print(",winddir=");
  Serial.print(winddir);
  Serial.print(",windspeedms=");
  Serial.print(windspeedms, 1);
  Serial.print(",windgustms=");
  Serial.print(windgustms, 1);
  Serial.print(",windgustdir=");
  Serial.print(windgustdir);
  Serial.print(",windspdms_avg2m=");
  Serial.print(windspdms_avg2m, 1);
  Serial.print(",winddir_avg2m=");
  Serial.print(winddir_avg2m);
  Serial.print(",windgustms_10m=");
  Serial.print(windgustms_10m, 1);
  Serial.print(",windgustdir_10m=");
  Serial.print(windgustdir_10m);
  Serial.print(",humidity=");
  Serial.print(humidity, 1);
  Serial.print(",tempc=");
  Serial.print(tempf, 1);
  Serial.print(",rainhourmm=");
  Serial.print(rainin, 2);
  Serial.print(",raindailymm=");
  Serial.print(dailyrainin, 2);
  Serial.print(",rainindicate=");
  Serial.print(Rainindi,1);
  Serial.print(",raindura=");
  Serial.print(Rainindinter);
  Serial.print(",pressure=");
  Serial.print(pressure, 2);
  Serial.print(",batt_lvl=");
  Serial.print(batt_lvl, 2);
  Serial.print(",light_lvl=");
  Serial.print(light_lvl, 2);

  Serial.print(",");
  Serial.println("#");

}

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


Added a quick bit of test code to help characterise sensing circuit.

#define REGISTRATION A0
#define D7           A1

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

void loop()
{
  delay(250);

  unsigned int reg = analogRead(A0);
  unsigned int d7  = analogRead(D7);

  Serial.print(reg);
  Serial.print(",");
  Serial.println(d7);
}

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


prueba

prueba

Agrego sketch de implementacion preliminar de luces de giro

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


code to read hall sensor and print to serial from arduino

}/*
Arduino Hall Effect Sensor Project
by Arvind Sanjeev
Please check out  http://diyhacking.com for the tutorial of this project.
DIY Hacking
*/

 volatile byte revs;
 unsigned int rpm;
 unsigned long timeold;
 void setup()
 {
   Serial.begin(9600);
   attachInterrupt(0, magnet_detect, RISING);//Initialize the intterrupt pin (Arduino digital pin 2)
   revs = 0;
   rpm = 0;
   timeold = 0;
 }
 void loop()//Measure RPM
 {
   if (revs >= 5) {
     rpm = revs/((millis() - timeold)/1000/60)
     timeold = millis();
     revs = 0;
     Serial.println(rpm,DEC);
   }
 }
 void magnet_detect()//This function is called whenever a magnet/interrupt is detected by the arduino
 {
   revs++;
   Serial.println("detect");+
 }

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


Adding arduino code for photo sensor

Adding arduino code for photo sensor

//Initialize p
int photoResistor = 0;
//Input of photoResistor from sensor
int photoOutput;

void setup(void) {
  // Set baud rate to 9600
  Serial.begin(9600);
}

void loop(void) {
  //Read from analog input A0 on board
  photoOutput = analogRead(photoResistor);

  //Display reading
  Serial.println("Sensor Reading = ");
  Serial.println(photoOutput);

  //Set dealy to 1 second
  delay(100);
}

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


Create interrupt.ino

Create interrupt.ino

/*
 A Timer Interrupt Example
 */
#include "Energia.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/timer.h"
#include "driverlib/sysctl.h"

void SamplerInterrupt(void)
{
  // clear the timer interrupt
  ROM_TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);

  count++;
}

void setup()
{
  // init serial port
  Serial.begin(9600);

  // initialise the sampler interrupt
  ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
  ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
  TimerIntRegister(TIMER0_BASE, TIMER_A, SamplerInterrupt);
  ROM_TimerEnable(TIMER0_BASE, TIMER_A);
  ROM_IntEnable(INT_TIMER0A);
  ROM_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
}

void loop()
{
  // start the timer then loop forever
  ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, 2498); // 2498 =~ 48000Hz
  while (1)
  {
    Serial.println(count);
    count = 0;
    delay(1000);
  }
}

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


EUREKA! Crazy breakthrough! Performant algoritm NFC

char array devided in pieces each step until they are the same!

error: pathspec 'SmartKitchen-Emdebbed' did not match any file(s) known to git
error: pathspec 'System/Software/Arduino/Devide_Algo_id/Devide_Algo_id.ino' did not match any file(s) known to git


Create Firmware.ino

Create Firmware.ino

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

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


code to help characterize RE-TRIGGER vs NO-RE-TRIGGER

- tracks output of PIR with LED
- displays elapsed time of previous state upon state transitions

//-*- C -*-

/*
  pir-sensor-led

  Tracks output of PIR with LED.

  Also displays, in the console, milliseconds spent in a previous
  state when state transitions occur. Useful for observing the
  differences between RE-TRIGGER and NO-RE-TRIGGER.

  Inspired by http://playground.arduino.cc/Code/PIRsense
 */

// amount of time we give the sensor to calibrate (10-60 secs
// according to the datasheet)
int calibrationTime = 60;

int pirPin = 3;    //the digital pin connected to the PIR sensor's output
int ledPin = 13;

int lastPir;
unsigned long lastTime;

void setup() {
  Serial.begin(9600);
  pinMode(pirPin, INPUT);
  pinMode(ledPin, OUTPUT);
  digitalWrite(pirPin, LOW);

  //give the sensor some time to calibrate
  Serial.print("calibrating sensor ");
  for (int i = 0; i < calibrationTime; i++) {
    Serial.print(digitalRead(pirPin));
    delay(500);
  }
  Serial.println(" done");
  Serial.println("SENSOR ACTIVE");

  lastPir = digitalRead(pirPin);
  lastTime = millis();
}

void loop() {
  int pirValue = digitalRead(pirPin);
  unsigned long nowTime = millis();

  // only check for transitions
  if (pirValue != lastPir) {
    unsigned long elapsed = nowTime - lastTime;

    Serial.print(elapsed);
    Serial.print("\t");
    Serial.println(lastPir);

    digitalWrite(ledPin, pirValue);

    lastPir = pirValue;
    lastTime = nowTime;
  }
}

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


Added sketch for NanoCanvas8

Added sketch for NanoCanvas8

/*
    MIT License

    Copyright (c) 2018, Alexey Dynda

    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.
*/
/**
 *   Nano/Atmega328 PINS: connect LCD to D5 (D/C), D4 (CS), D3 (RES), D11(DIN), D13(CLK)
 *   Attiny SPI PINS:     connect LCD to D4 (D/C), GND (CS), D3 (RES), D1(DIN), D2(CLK)
 *   ESP8266: connect LCD to D1(D/C), D2(CS), RX(RES), D7(DIN), D5(CLK)
 */

#include "ssd1306.h"
#include "ssd1331_api.h"
#include "nano_canvas.h"

/* Do not include SPI.h for Attiny controllers */
#ifdef SSD1306_SPI_SUPPORTED
    #include <SPI.h>
#endif

uint8_t buffer[32*32];

NanoCanvas8 canvas(32,32,buffer);
int x = 72;
int textx = 10;

void setup()
{
    ssd1306_setFixedFont(ssd1306xled_font6x8);
    ssd1331_96x64_spi_init(3, 4, 5);
    ssd1306_fillScreen( 0x00 );
    ssd1331_setMode(0);
    canvas.setTextMode(TEXT_MODE_TRANSPARENT);
}

void drawAll()
{
    canvas.clear();
    canvas.drawRect(15,12,x,55,RGB_COLOR8(255,255,0));
    canvas.fillRect(16,13,x-1,54,RGB_COLOR8(0,255,255));
    canvas.putPixel(5,5,RGB_COLOR8(255,255,255));
    canvas.putPixel(10,10,RGB_COLOR8(255,0,0));
    canvas.putPixel(20,15,RGB_COLOR8(0,255,0));
    canvas.putPixel(30,20,RGB_COLOR8(0,0,255));
    canvas.setColor(RGB_COLOR8(255,0,0));
    canvas.printFixed(textx, 30, "This is example of text output", STYLE_NORMAL);
}

void refreshDisplay()
{
    canvas.setOffset(0,0); drawAll(); canvas.blt();
    canvas.setOffset(32,0); drawAll(); canvas.blt();
    canvas.setOffset(64,0); drawAll(); canvas.blt();
    canvas.setOffset(0,32); drawAll(); canvas.blt();
    canvas.setOffset(32,32); drawAll(); canvas.blt();
    canvas.setOffset(64,32); drawAll(); canvas.blt();
}

void loop()
{
    refreshDisplay();
    delay(20);
    textx++; if (textx ==96) textx = -192;
}

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


CAN Message Authentication with SpritzCipher

#include <SpritzCipher.h>
#include "can_constants.h"
#include "mcp_can.h"
#include <SPI.h>

MCP_CAN CAN0(9); // Set CS pin to 9 (only for Seeed Studio CAN Bus)

uint8_t MESSAGE[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
const uint16_t MESSAGE_LEN = sizeof(MESSAGE);
uint8_t CORRECT_KEY[3] = {0x00, 0x01, 0x02};
const uint16_t KEY_LEN = sizeof(CORRECT_KEY);
uint8_t BAD_KEY[3] = {0x0f, 0x0e, 0x0d};
const uint8_t HASH_LEN = 20;

uint8_t CORRECT_HASH[HASH_LEN];

void setup() {
  // put your setup code here, to run once:
  // Create the correct hash
  spritz_mac(&CORRECT_HASH[0], HASH_LEN, &MESSAGE[0], MESSAGE_LEN, &CORRECT_KEY[0], KEY_LEN);
  Serial.begin(9600);
  while(!Serial);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.print("Sending Correct Message...");
  VerifyMessage(&MESSAGE[0], MESSAGE_LEN, &CORRECT_KEY[0], KEY_LEN);
  Serial.print("\n\nSending Incorrect Message...");
  VerifyMessage(&MESSAGE[0], MESSAGE_LEN, &BAD_KEY[0], KEY_LEN);

  delay(10000);
}

//-----------------------------------------------------------------------------------------------

bool CompareHash(uint8_t *hash)
{
  for(int i = 0; i < HASH_LEN; i++)
  {
    if (hash[i] != CORRECT_HASH[i])
      return false;
  }
  return true;
}

bool VerifyMessage(uint8_t *msg, uint16_t msgLen, uint8_t* key, uint16_t keyLen)
{
  // Create hash based off given arguments
  uint8_t *hash = new uint8_t[HASH_LEN];
  spritz_mac(&hash[0], HASH_LEN, &msg[0], msgLen, &key[0], keyLen);

  if (CompareHash(&hash[0]))
  {
    Serial.println("SUCCESS!");
    return true;
  }
  else
  {
    Serial.println("FAILED");
    return false;
  }
}

void PrintMessage(int id, int dlc, byte* data)
{
  Serial.print(id, HEX);
  Serial.print("#0");
  Serial.print(dlc, HEX);
  for(int i = 0; i < dlc; i++)
  {
    if (data[i] < 0x10)
      Serial.print("0");
    Serial.print(data[i], HEX);
  }
  Serial.print("\n");
}

void FillAuthMessages(uint8_t *hash, unsigned char *msg1, unsigned char *msg2, unsigned char *msg3)
{
  for (int i = 0; i < HASH_LEN; i++)
  {
    if (i < 8)
      msg1[i] = hash[i];
    else if (i < 16)
      msg2[i] = hash[i];
    else
      msg3[i] = hash[i];
    i++;
  }
}

void SendAuthMessages(int id, int dlc, uint8_t *auth_hash)
{
  unsigned char auth_msg1[8];
  unsigned char auth_msg2[8];
  unsigned char auth_msg3[4];
  // Divide the hash up among 3 messages (2 and a half really; the last 32-bits will be for timestamp
  FillAuthMessages(auth_hash, &auth_msg1[0], &auth_msg2[0], &auth_msg3[0]);
  CAN0.sendMsgBuf(id, CAN_EXTID, 8, auth_msg1);
  CAN0.sendMsgBuf(id, CAN_EXTID, 8, auth_msg2);
  CAN0.sendMsgBuf(id, CAN_EXTID, 4, auth_msg3);
}

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


Created ReadIMU example for async data
(NOTE: Still in progress)

Signed-off-by: Cruz Monrreal II <663375bc5b4c6ed13a95cc63b2dd9f1e16363f4e@gmail.com>

/************************************************
 Written by Cruz Monrreal II
 Created on 08-19-2012

 Updates can be found here:
  https://github.com/cmonr/Arduino-Bluetooth-Library
************************************************/

#include <Sphero.h>

Sphero sphero;

void setup() {
  Serial.begin(115200);
  delay(2000);
  sphero.setStabilization(0);
  sphero.setStreamingData(400, 1, 0x00040000);
  delay(2000);
}

void loop() {
  Serial.println("\n");

  sphero.readAsyncPacket();
}

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


Updated filter example discription

Updated filter example discription

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/TFTLibraries/TFT.git/'