Initial commit

Initial commit

////////////////////////////////////////////////////////////////////////////////
// A digital VFO using the DDS-60 card.
//
// The VFO will generate signals in the range 1.000000MHz to 30.000000MHz
// with a step of 1Hz.
//
// The interface will be a single rotary encoder with a built-in pushbutton.
// The frequency display will have a 'selected' digit which can be moved left
// and right by pressing the encoder knob and twisting left or right.
// Turning the encoder knob will increment or decrement the selected digit by 1
// with overflow or underflow propagating to the left.
////////////////////////////////////////////////////////////////////////////////

#include <LiquidCrystal.h>
#include <EEPROM.h>

// display constants - below is for ubiquitous small HD44780 16x2 display
#define NUM_ROWS        2
#define NUM_COLS        16

// define data pins we connect to the LCD
static byte lcd_RS = 7;
static byte lcd_ENABLE = 8;
static byte lcd_D4 = 9;
static byte lcd_D5 = 10;
static byte lcd_D6 = 11;
static byte lcd_D7 = 12;

// define data pins used by the rotary encoder
static int re_pinA = 2;     // encoder A pin
static int re_pinB = 3;     // encoder B pin
static int re_pinPush = 4;  // encoder pushbutton pin

// max and min frequency showable
#define MAX_FREQ        30000000L
#define MIN_FREQ        1000000L

// size of frequency display in chars (30MHz is maximum frequency)
#define MAX_FREQ_CHARS  8

// address in display CGRAM for definable characters
#define SELECT_CHAR     0   // shows 'underlined' decimal digits (dynamic, 0 to 9)
#define SPACE_CHAR      1   // shows an 'underlined' space character

// define the numeric digits and space with selection underline
byte sel0[8] = {0xe,0x11,0x13,0x15,0x19,0x11,0xe,0x1f};
byte sel1[8] = {0x4,0xc,0x4,0x4,0x4,0x4,0xe,0x1f};
byte sel2[8] = {0xe,0x11,0x1,0x2,0x4,0x8,0x1f,0x1f};
byte sel3[8] = {0x1f,0x2,0x4,0x2,0x1,0x11,0xe,0x1f};
byte sel4[8] = {0x2,0x6,0xa,0x12,0x1f,0x2,0x2,0x1f};
byte sel5[8] = {0x1f,0x10,0x1e,0x1,0x1,0x11,0xe,0x1f};
byte sel6[8] = {0x6,0x8,0x10,0x1e,0x11,0x11,0xe,0x1f};
byte sel7[8] = {0x1f,0x1,0x2,0x4,0x8,0x8,0x8,0x1f};
byte sel8[8] = {0xe,0x11,0x11,0xe,0x11,0x11,0xe,0x1f};
byte sel9[8] = {0xe,0x11,0x11,0xf,0x1,0x2,0xc,0x1f};
byte selspace[8] = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1f};

// array of references to the 11 'selected' characters (0 to 9 plus space)
byte *sel_digits[] = {sel0, sel1, sel2, sel3, sel4, sel5, sel6, sel7, sel8, sel9, selspace};
#define SPACE_INDEX   10

// map select_offset to bump values
unsigned long offset2bump[] = {1,           // offset = 0
                               10,          // 1
                               100,         // 2
                               1000,        // 3
                               10000,       // 4
                               100000,      // 5
                               1000000,     // 6
                               10000000,    // 7
                               100000000};  // 8

// values updated by rotary encoder interrupt routines
volatile byte encoderCount = 0;

// define the display connections
LiquidCrystal lcd(lcd_RS, lcd_ENABLE, lcd_D4, lcd_D5, lcd_D6, lcd_D7);

// old values of 're_delta' and 're_position'
int oldEncOffset = 1;
byte oldEncPos = 180;

////////////////////////////////////////////////////////////////////////////////
// The VFO state variables
////////////////////////////////////////////////////////////////////////////////

unsigned long VfoFrequency;   // VFO frequency (Hz)
int VfoSelectDigit;           // selected digit, indexed from zero at right

////////////////////////////////////////////////////////////////////////////////
// Utility routines for the display.
////////////////////////////////////////////////////////////////////////////////

//------------------------------------------------------------------------------
// Function to convert an unsigned long into an array of byte digit values.
//     buf      address of buffer for byte results
//     bufsize  size of the 'buf' buffer
//     value    the unsigned long value to convert
// The function won't overflow the given buffer, it will truncate at the left.
//
// For example, given the value 1234 and a buffer of length 7, will fill the
// buffer with 0001234.  Given 123456789 it will fill with 3456789.
//------------------------------------------------------------------------------
void ltobbuff(char *buf, int bufsize, unsigned long value)
{
  char *ptr = buf + bufsize - 1;

  for (int i = 0; i < bufsize; ++i)
  {
    int rem = value % 10;

    value = value / 10;
    *ptr-- = char(rem);
  }
}

//------------------------------------------------------------------------------
// Print the frequency on the display with selected colum underlined.
//     freq  the frequency to display
//     col   the selection offset of digit to underline
//           (0 is rightmost digit, increasing to the left)
// The row and columns used to show frequency digits are defined elsewhere.
// A final "Hz" is written.
//------------------------------------------------------------------------------
void print_freq(unsigned long freq, int col)
{
  char buf [MAX_FREQ_CHARS];
  int index = MAX_FREQ_CHARS - col - 1;
  bool lead_zero = true;

  ltobbuff(buf, MAX_FREQ_CHARS, freq);

  lcd.createChar(SELECT_CHAR, sel_digits[int(buf[index])]);
  lcd.setCursor(NUM_COLS - MAX_FREQ_CHARS - 2, 0);
  for (int i = 0; i < MAX_FREQ_CHARS; ++i)
  {
    int char_val = buf[i];

    if (char_val != 0)
        lead_zero = false;

    if (lead_zero)
    {
      if (index == i)
        lcd.write(byte(SPACE_CHAR));
      else
        lcd.write(" ");
    }
    else
    {
      if (index == i)
        lcd.write(byte(SELECT_CHAR));
      else
        lcd.write(char_val + '0');
    }
  }

  lcd.write("Hz");
}

////////////////////////////////////////////////////////////////////////////////
// Interrupt driven rotary encoder interface.
////////////////////////////////////////////////////////////////////////////////

// states for the encode machine
static int re_stateUp = 0;
static int re_stateDown = 1;
volatile int re_state = 0;

////////////////////////////
// internal state variables
////////////////////////////

// expecting rising edge on pinA - at detent
volatile byte aFlag = 0;

// expecting rising edge on pinA - at detent
volatile byte bFlag = 0;

// this variable stores our current value of encoder position.
// Change to int or uin16_t instead of byte if you want to record a larger range than 0-255
volatile long re_delta = 0;

// stores latest offset value
volatile int re_position = 0;

//----------------------------------------------------------
// Setup the encoder stuff, pins, etc.
//----------------------------------------------------------
void re_setup(int position)
{
  // set pinA as an input, pulled HIGH to the logic voltage (5V or 3.3V for most cases)
  pinMode(re_pinA, INPUT_PULLUP);

  // set pinB as an input, pulled HIGH to the logic voltage (5V or 3.3V for most cases)
  pinMode(re_pinB, INPUT_PULLUP);

  // set pinPush as an input, pulled HIGH to the logic voltage (5V or 3.3V for most cases)
  pinMode(re_pinPush, INPUT_PULLUP);

  // attach pins to IST on rising edge only
  attachInterrupt(digitalPinToInterrupt(re_pinA), pinA_isr, RISING);
  attachInterrupt(digitalPinToInterrupt(re_pinB), pinB_isr, RISING);
  attachInterrupt(digitalPinToInterrupt(re_pinPush), pinPush_isr, CHANGE);

  // start at given select digit position
  re_position = position;
}

void bump_encoder_posn(long bump)
{
  if (re_state == re_stateUp)
  {
    re_delta += bump * offset2bump[re_position];
  }
  else if (re_state == re_stateDown)
  {
    re_position -= bump;
    if (re_position < 0)
      re_position = 0;
    if (re_position > 7)
      re_position = 7;
  }
}

void pinPush_isr()
{
  // stop interrupts, read Push pin, restore interrupts
  byte reading;

  cli();
    reading = PIND & 0x10;
    if (reading)
      re_state = re_stateUp;
    else
      re_state = re_stateDown;
  sei();
}

void pinA_isr()
{
  // stop interrupts, read A & B pins, restore interrupts
  byte reading;

  cli();
    reading = PIND & 0xC;

    if (reading == B00001100 && aFlag)
    { // check that we have both pins at detent (HIGH) and that we are expecting detent on
      // this pin's rising edge
      bump_encoder_posn(-1);
      bFlag = 0; //reset flags for the next turn
      aFlag = 0; //reset flags for the next turn
    }
    else if (reading == B00000100)
      // show we're expecting pinB to signal the transition to detent from free rotation
      bFlag = 1;
  sei();
}

void pinB_isr()
{
  // stop interrupts, read A & B pins, restore interrupts
  byte reading;

  cli();
  reading = PIND & 0xC;

  if (reading == B00001100 && bFlag)
  { // check that we have both pins at detent (HIGH) and that we are expecting detent on
    // this pin's rising edge
    bump_encoder_posn(+1);
    bFlag = 0; //reset flags for the next turn
    aFlag = 0; //reset flags for the next turn
  }
  else if (reading == B00001000)
    // show we're expecting pinA to signal the transition to detent from free rotation
    aFlag = 1;
  sei();
}

////////////////////////////////////////////////////////////////////////////////
// Code to save/restore in EEPROM.
////////////////////////////////////////////////////////////////////////////////

// address for unsigned long 'frequency'
static int AddressFreq = 0;

// address for int 'selected digit'
static int AddressSelDigit = AddressFreq + sizeof(AddressFreq);

// save VFO state to EEPROM
void save_to_eeprom()
{
  EEPROM.put(AddressFreq, VfoFrequency);
  EEPROM.put(AddressSelDigit, VfoSelectDigit);
}

// restore VFO state from EEPROM
void restore_from_eeprom()
{
  EEPROM.get(AddressFreq, VfoFrequency);
  EEPROM.get(AddressSelDigit, VfoSelectDigit);
}

////////////////////////////////////////////////////////////////////////////////
// Code to handle the DDS-60.
////////////////////////////////////////////////////////////////////////////////

void update_dds60(unsigned long freq)
{

}

//------------------------------------------------------------------------------
// The standard Arduino setup() function.
//------------------------------------------------------------------------------

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

  // initialize the display
  lcd.begin(NUM_COLS, NUM_COLS);      // define display size
  lcd.clear();
  lcd.createChar(SPACE_CHAR, sel_digits[SPACE_INDEX]);

  restore_from_eeprom();

  // set up the rotary encoder
  re_setup(VfoSelectDigit);
}

//------------------------------------------------------------------------------
// Standard Arduino loop() function.
//------------------------------------------------------------------------------
void loop()
{
  static unsigned long old_freq = 0L;
  static int old_position = -1;

  long copy_re_delta;

  // do an atomic copy/reset of the volatile RE state variables
  cli();
    copy_re_delta = re_delta;
    VfoSelectDigit = re_position;
    re_delta = 0L;
  sei();

  // calculate new frequency, limit if required
  VfoFrequency += copy_re_delta;
  if (VfoFrequency > MAX_FREQ)
    VfoFrequency = MAX_FREQ;
  if (VfoFrequency < MIN_FREQ)
    VfoFrequency = MIN_FREQ;

  // display frequency if changed, update DDS-60
  if (old_freq != VfoFrequency || old_position != VfoSelectDigit)
  {
    print_freq(VfoFrequency, VfoSelectDigit);
    old_freq = VfoFrequency;
    old_position = VfoSelectDigit;

    save_to_eeprom();

    update_dds60(VfoFrequency);
  }
}

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


Arduino Code

Arduino Code

//Message
byte input_byte;
//Setup
void setup(){
  //Serial baud rate 9600.
  Serial.begin(9600);
  //1/5
  pinMode(2, OUTPUT);
  //2/5
  pinMode(3, OUTPUT);
  //3/5
  pinMode(4, OUTPUT);
  //4/5
  pinMode(5, OUTPUT);
  //5/5
  pinMode(6, OUTPUT);
}
//Main loop.
void loop(){
  //Buffer size is 1 byte.
  if(Serial.available() == 1){
    //Read from buffer.
    input_byte = Serial.read();
  }
  switch (input_byte){
    case 0:
      Serial.print("THIS IS ARDUINO!");
      break;
    case 1:
      digitalWrite(2, HIGH);
      digitalWrite(3, LOW);
      digitalWrite(4, LOW);
      digitalWrite(5, LOW);
      digitalWrite(6, LOW);
      break;
    case 2:
      digitalWrite(2, HIGH);
      digitalWrite(3, HIGH);
      digitalWrite(4, LOW);
      digitalWrite(5, LOW);
      digitalWrite(6, LOW);
      break;
    case 3:
      digitalWrite(2, HIGH);
      digitalWrite(3, HIGH);
      digitalWrite(4, HIGH);
      digitalWrite(5, LOW);
      digitalWrite(6, LOW);
      break;
    case 4:
      digitalWrite(2, HIGH);
      digitalWrite(3, HIGH);
      digitalWrite(4, HIGH);
      digitalWrite(5, HIGH);
      digitalWrite(6, LOW);
      break;
    case 5:
      digitalWrite(2, HIGH);
      digitalWrite(3, HIGH);
      digitalWrite(4, HIGH);
      digitalWrite(5, HIGH);
      digitalWrite(6, HIGH);
      break;
  }
  //Clear message.
  input_byte = 0;
}

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


Added whiskers test

Added whiskers test

Prints values of all analog inputs

#include <Servo.h>

const int WHISKER_L_PIN  = A2;
const int WHISKER_R_PIN = A3;

const float analogConversionFactor = 5.0 / 1024.0;
float whiskerLVal, whiskerRVal;

void setup() {
  Serial.begin(9600);
  pinMode(A0,INPUT);
  pinMode(A1,INPUT);
  pinMode(WHISKER_L_PIN, INPUT);
  pinMode(WHISKER_L_PIN,INPUT);
  pinMode(A4,INPUT);
  pinMode(A5,INPUT);
}

void loop() {
  whiskerLVal = analogRead(WHISKER_L_PIN) * analogConversionFactor;
  whiskerRVal = analogRead(WHISKER_R_PIN) * analogConversionFactor;
  float a0 = analogRead(A0) * analogConversionFactor;
  float a1 = analogRead(A1) * analogConversionFactor;
  float a4 = analogRead(A4) * analogConversionFactor;
  float a5 = analogRead(A5) * analogConversionFactor;

  Serial.println(
    "A0: " +String(a0) + "\t" +
    "A1: " +String(a1) + "\t" +
    "A2: " +String(whiskerLVal) + "\t" +
    "A3: " +String(whiskerRVal) + "\t" +
    "A4: " +String(a1) + "\t" +
    "A5: " +String(a1)
  );
 /* Serial.println(
    "Left: " +String(whiskerLVal) + "\t" +
    "Right: "+String(whiskerRVal)
  ); */
}

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


Remove a debugging line

Remove a debugging line

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

// Configure your MAC address, IP address, and HTTP port here.
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,0,77);
int port = 80;

Dino dino;
EthernetServer server(port);
EthernetClient client;
char c;
int index = 0;
char request[8];

// Dino.h doesn't handle TXRX. Setup a function to tell it to write to the TCP socket.
void writeResponse(char *response) { client.println(response); }
void (*writeCallback)(char *str) = writeResponse;

void setup() {
  // Explicitly disable the SD card.
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);

  // Start up the network connection and server.
  Ethernet.begin(mac, ip);
  server.begin();

  // Start serial for debugging.
  Serial.begin(115200);
  Serial.print("Dino::TCP started at ");
  Serial.print(Ethernet.localIP());
  Serial.print(" on port ");
  Serial.println(port);

  // Attach the write callback.
  dino.setupWrite(writeCallback);
}

void loop() {
  // Listen for connections.
  client = server.available();

  // Handle a connection.
  if (client) {
    while (client.connected()) {
      while (client.available()) {
        c = client.read();
        if (c == '!') index = 0;                     // Reset request
        else if (c == '.') dino.process(request);    // End request and process
        else request[index++] = c;                   // Append to request
      }
      if (dino.updateReady()) dino.updateListeners();
    }
    client.stop();
  }
}

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

// Configure your MAC address, IP address, and HTTP port here.
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,0,77);
int port = 80;

Dino dino;
EthernetServer server(port);
EthernetClient client;
char c;
int index = 0;
char request[8];

// Dino.h doesn't handle TXRX. Setup a function to tell it to write to the TCP socket.
void writeResponse(char *response) { Serial.println(response); client.println(response); }
void (*writeCallback)(char *str) = writeResponse;

void setup() {
  // Explicitly disable the SD card.
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);

  // Start up the network connection and server.
  Ethernet.begin(mac, ip);
  server.begin();

  // Start serial for debugging.
  Serial.begin(115200);
  Serial.print("Dino::TCP started at ");
  Serial.print(Ethernet.localIP());
  Serial.print(" on port ");
  Serial.println(port);

  // Attach the write callback.
  dino.setupWrite(writeCallback);
}

void loop() {
  // Listen for connections.
  client = server.available();

  // Handle a connection.
  if (client) {
    while (client.connected()) {
      while (client.available()) {
        c = client.read();
        if (c == '!') index = 0;                     // Reset request
        else if (c == '.') dino.process(request);    // End request and process
        else request[index++] = c;                   // Append to request
      }
      if (dino.updateReady()) dino.updateListeners();
    }
    client.stop();
  }
}


Adds batlog.ino

Adds batlog.ino

typedef struct {
  uint8_t logbat;
  uint16_t eeaddr;
} BatLog_t;

BatLog_t BatLog = {0};

void batlog_init() {
  BatLog.eeaddr = 1;

  if (EEPROM[0] != 0x05) {
    EEPROM[0] = 0x05;
    // filled the log with 0xFF so we know later when the log stops.
    for (uint16_t addr = 1; addr < 1024; ++addr) {
      EEPROM[addr] = 0xFF;
    }
    BatLog.logbat = 1;
  } else {
    Serial.begin(9600);

    delay(3000);
    Serial.println("Battery log detected, not overwriting");

    for (uint16_t eeaddr = 1; eeaddr < 1024; ++eeaddr) {
      Serial.print(eeaddr, DEC);
      Serial.print(" ");
      Serial.println(EEPROM[eeaddr], DEC);
      delay(10);

      // no need to print the entire log
      if (EEPROM[eeaddr] == 0xFF) break;
    }
    delay(3000);
  }
}

void batlog_tick(uint8_t changes) {
  if (changes >= 2 && BatLog.logbat) {
    if (BatLog.eeaddr < 1024) {
      uint8_t batvol = Xadow.getBatVol()*10;
      EEPROM[BatLog.eeaddr] = batvol;
      BatLog.eeaddr += 1;
    }
  }
}

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


Add basic functioning sketch

Add basic functioning sketch

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


Added GPS+SD module

Added GPS+SD module

#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>
#include <SPI.h>
#include <SD.h>

File myFile;
uint32_t lastsave(0);
SoftwareSerial mySerial(3, 2);
Adafruit_GPS GPS(&mySerial);
#define GPSECHO  true
boolean usingInterrupt = false;
void useInterrupt(boolean); // Func prototype keeps Arduino 0023 happy

void setup()
{
  Serial.begin(115200);
  //Serial.println("Adafruit GPS library basic test!");
  GPS.begin(9600);
  GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
  GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);   // 1 Hz update rate
  GPS.sendCommand(PGCMD_ANTENNA);
  useInterrupt(true);
  delay(1000);
  mySerial.println(PMTK_Q_RELEASE);
  //Serial.print("Initializing SD card...");
  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }
  //Serial.println("initialization done.");
  myFile = SD.open("test.txt", FILE_WRITE);
  myFile.print("GPS Data-");
  myFile.flush();
}

SIGNAL(TIMER0_COMPA_vect) {
  char c = GPS.read();
#ifdef UDR0
  if (GPSECHO)
    if (c) UDR0 = c;
#endif
}

void useInterrupt(boolean v) {
  if (v) {
    OCR0A = 0xAF;
    TIMSK0 |= _BV(OCIE0A);
    usingInterrupt = true;
  } else {
    TIMSK0 &= ~_BV(OCIE0A);
    usingInterrupt = false;
  }
}

uint32_t timer = millis();
void loop()                     // run over and over again
{
  if(myFile){
    //Serial.print("In Loop");
    if (! usingInterrupt) {
      // read data from the GPS in the 'main loop'
      char c = GPS.read();
      if (GPSECHO)
        if (c) Serial.print(c);
    }
    if (GPS.newNMEAreceived()) {
      if (!GPS.parse(GPS.lastNMEA()))
        return;
    }

    if (timer > millis())  timer = millis();
    if (millis() - timer > 2000) {
      timer = millis(); // reset the timer

      myFile.print("\nTime: ");
      myFile.print(GPS.hour, DEC); myFile.print(':');
      myFile.print(GPS.minute, DEC); myFile.print(':');
      myFile.print(GPS.seconds, DEC); myFile.print('.');
      myFile.println(GPS.milliseconds);
      myFile.print("Date: ");
      myFile.print(GPS.day, DEC); myFile.print('/');
      myFile.print(GPS.month, DEC); myFile.print("/20");
      myFile.println(GPS.year, DEC);

      myFile.print("Fix: "); myFile.print((int)GPS.fix);
      myFile.print(" quality: "); myFile.println((int)GPS.fixquality);
      Serial.print("Year: "); Serial.print(GPS.year, DEC);
      Serial.print(" Fix: "); Serial.println((int)GPS.fix);
      if (GPS.fix) {
        Serial.println("Getting data");
        myFile.print("Location: ");
        myFile.print(GPS.latitude, 4); Serial.print(GPS.lat);
        myFile.print(", ");
        myFile.print(GPS.longitude, 4); Serial.println(GPS.lon);
        myFile.print("Location (in degrees, works with Google Maps): ");
        myFile.print(GPS.latitudeDegrees, 4);
        myFile.print(", ");
        myFile.println(GPS.longitudeDegrees, 4);

        myFile.print("Speed (knots): "); Serial.println(GPS.speed);
        myFile.print("Angle: "); Serial.println(GPS.angle);
        myFile.print("Altitude: "); Serial.println(GPS.altitude);
        myFile.print("Satellites: "); Serial.println((int)GPS.satellites);
      }
      myFile.flush();
    }
  }
  else;
   // Serial.print("File is corrupt");
}

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


def file 19-2-17

def file 19-2-17

#define zampaAS 8
#define zampaAD 6
#define zampaPS 7
#define zampaPD 5

#define piede A0
#define tamburo 2

#define pot A3

int volo = 400; //tempo in ms delle gambe in aria
int attesaAppoggio = 60; //tempo in ms dell'appoggio tra le gambe vicine (as e ap per esempio)
int attesaAllungo = 120; //tempo in ms tra appoggio gambe davanti e gambe dietro

int z[4] = {zampaPS, zampaPD, zampaAS, zampaAD};

int tempo = 400;

void setup() {
  pinMode(zampaAS, OUTPUT);
  pinMode(zampaAD, OUTPUT);
  pinMode(zampaPS, OUTPUT);
  pinMode(zampaPD, OUTPUT);

  pinMode(piede, OUTPUT);
  pinMode(tamburo, OUTPUT);

  digitalWrite(zampaAS, LOW);
  digitalWrite(zampaAD, LOW);
  digitalWrite(zampaPS, LOW);
  digitalWrite(zampaPD, LOW);

  digitalWrite(piede, LOW);
  digitalWrite(tamburo, LOW);

}

void loop() {
  if (analogRead(pot) > 512) {
    veloce();
  }
  else {
    lenta();
  }

}

void lenta() {
  digitalWrite(zampaPS, HIGH);  //0 ms - apro 0
  delay(60);
  digitalWrite(zampaPD, HIGH);  //60 ms  - apro 1
  delay(160);
  digitalWrite(zampaAS, HIGH);  //220 ms - apro 2
  delay(60);
  digitalWrite(zampaAD, HIGH);  //280 ms - apro 3
  delay(200);
  digitalWrite(zampaPS, LOW);   //480 ms - chiudo 0: 740 ms di tempo aperto
  delay(60);
  digitalWrite(zampaPD, LOW);   //480 ms - chiudo 1: 740 ms di tempo aperto
  delay(160);
  digitalWrite(zampaAS, LOW);   //980 ms - chiudo 2: 740 ms di tempo aperto
  delay(60);
  digitalWrite(zampaAD, LOW);   //1060 ms - chiudo 3: 740 ms di tempo aperto
  delay(600);
}

void veloce() {
  digitalWrite(zampaPS, HIGH);  //0 ms - apro 0
  delay(40);
  digitalWrite(zampaPD, HIGH);  //80 ms  - apro 1
  delay(150);
  digitalWrite(zampaAS, HIGH);  //240 ms - apro 2
  delay(40);
  digitalWrite(zampaAD, HIGH);  //320 ms - apro 3
  delay(150);
  digitalWrite(zampaPS, LOW);   //740 ms - chiudo 0: 740 ms di tempo aperto
  delay(40);
  digitalWrite(zampaPD, LOW);   //820 ms - chiudo 1: 740 ms di tempo aperto
  delay(150);
  digitalWrite(zampaAS, LOW);   //980 ms - chiudo 2: 740 ms di tempo aperto
  delay(40);
  digitalWrite(zampaAD, LOW);   //1060 ms - chiudo 3: 740 ms di tempo aperto
  delay(400);
}

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


File arduino/skypointer.ino added. It includes the Arduino code for the SkyPointer.

/*******************************************************************************
Author: David Vazquez Garcia -- davidvazquez.gijon@gmail.com

The library SkyPointer_MotorShield can be downloaded from:
    https://github.com/davidvg/SkyPointer_MotorShield

*******************************************************************************/

#include <SoftwareSerial.h>
#include <SerialCommand.h>
#include <Wire.h>
#include <SkyPointer_MotorShield.h>
#include <TimerOne.h>
#include <EEPROM.h>

// A modulo operator that handles negative numbers
#define MOD(a,b) ((((a)%(b))+(b))%(b))

// Motor parameters
#define STEPS 200
#define USTEPS 16
#define TOTAL_USTEPS (STEPS*USTEPS)

// Correction for mechanical errors
#define Z1  0.00045725
#define Z2 -0.00021926
#define Z3 -0.06099543

// Speed parameters
#define DT 10000 // Timer1 interrupt period
#define RPM 1   // Desired rotation speed in rpm

#define LASER_PIN 13

#define DEBUG 1
// Pin for debug
#ifdef DEBUG
  int blinkLed = 12;
#endif

// Definition of the SerialCommand object, with delimiter ":"
SerialCommand sCmd;
// Definition of the motor shield
SkyPointer_MotorShield MS = SkyPointer_MotorShield();
// Motor 1 on port 1, 200 steps/rev
SkyPointer_MicroStepper *motor1 =MS.getMicroStepper(STEPS, 1);
// Motor 2 on port 2, 200 steps/rev
SkyPointer_MicroStepper *motor2 = MS.getMicroStepper(STEPS, 2);

/****************************************************************************
 * Functions for writing/reading mechanical errors to/from EPRROM
 ***************************************************************************/
void writeErrorToEEPROM (int n, double Z) {
    // Writes to EEPROM the n-th error correction, where n = 1, 2 or 3
    int32_t _z = (int32_t) (Z * 1e8);
    for (int k = 0; k < 4; k++) {
        EEPROM.write(4*(n-1) + k, (int) ((_z >> 8*k) & 0xFF));
    }
}

void writeAllErrorsToEEPROM (double z1, double z2, double z3) {
    double z[3] = {z1, z2, z3};
    for (int k = 0; k < 3; k++) {
        writeErrorToEEPROM (k+1, z[k]);
    }
}

double readErrorFromEEPROM (int n) {
    // Reads the n-th error stored in the EEPROM and converts it to double,
    // where n = 1, 2 or 3
    int32_t res = 0;
    for (int k = 0; k < 4; k++) {
        res |= (int32_t) ((int32_t) (EEPROM.read(4*(n-1)+k)) << 8*k);
    }
    return (double) (res / 1e8);
}
/****************************************************************************/
// Interruption routine
void ISR_rotate() {
  #ifdef DEBUG
    // Turns the LED on when entering the ISR
    // Measures the duration of the interruption routine
    digitalWrite (blinkLed, HIGH);
  #endif

  uint16_t pos, sim_pos, tg;
  uint8_t dir;

/*  // Toggles LED status on each ISR callback
  #ifdef DEBUG
      bool status;
      status = digitalRead(blinkLed);
      if (status == HIGH) {
        digitalWrite(blinkLed, LOW);
      }
      else {
        digitalWrite(blinkLed, HIGH);
      }
  #endif
*/

  sei();  // Enable interrupts --> Serial, I2C (MotorShield)

  // MOTOR 1
  pos = motor1->getPosition();
  // Calculate simmetric point to current position
  sim_pos = (pos + TOTAL_USTEPS/2) % TOTAL_USTEPS;
  tg = motor1->target;

  if (!motor1->isTarget()) {  // Check target has not been reached
    if (pos < TOTAL_USTEPS/2) {
      dir = ((tg > pos) && (tg < sim_pos)) ? FORWARD : BACKWARD;
    } else {
      dir = ((tg > pos) || (tg < sim_pos)) ? FORWARD : BACKWARD;
    }
    motor1->microstep(1, dir);
  }

  // MOTOR 2
  pos = motor2->getPosition();
  // Calculate simmetric point to current position
  sim_pos = (pos + TOTAL_USTEPS/2) % TOTAL_USTEPS;
  tg = motor2->target;

  if (!motor2->isTarget()) {  // Check target has not been reached
    if (pos < TOTAL_USTEPS/2) {
      dir = ((tg > pos) && (tg < sim_pos)) ? FORWARD : BACKWARD;
    } else {
      dir = ((tg > pos) || (tg < sim_pos)) ? FORWARD : BACKWARD;
    }
    motor2->microstep(1, dir);
  }

  // Check if target is reached
  // This needs to be changed to invoke a new function to be created.
  // This function must turn the laser on.
  if ((motor1->isTarget()) && (motor2->isTarget())) {
    Timer1.detachInterrupt();
  }

  #ifdef DEBUG
    digitalWrite (blinkLed, LOW);   // Turn the l¡LED off in ISR exit
  #endif
}

/****************************************************************************
 * Functions for processing the commands received
 ***************************************************************************/

// Update the target positions of both motors
void ProcessGoto() {
  uint16_t tgt1, tgt2;

  tgt1 = MOD(atoi(sCmd.next()), TOTAL_USTEPS);
  tgt2 = MOD(atoi(sCmd.next()), TOTAL_USTEPS);

  motor1 -> setTarget(tgt1);
  motor2 -> setTarget(tgt2);

  Serial.print("OK\r");
  Timer1.attachInterrupt(ISR_rotate);  // Enable TimerOne interrupt
}

// Move both motors to a relative position
void ProcessMove() {
  uint16_t tgt1, tgt2;

  tgt1 = MOD((int16_t)motor1->getPosition() + atoi(sCmd.next()), TOTAL_USTEPS);
  tgt2 = MOD((int16_t)motor2->getPosition() + atoi(sCmd.next()), TOTAL_USTEPS);

  motor1 -> setTarget(tgt1);
  motor2 -> setTarget(tgt2);

  Serial.print("OK\r");
  Timer1.attachInterrupt(ISR_rotate);  // Enable TimerOne interrupt
}

// Stop both motors
void ProcessStop() {
  motor1 -> setTarget(motor1->getPosition());
  motor2 -> setTarget(motor2->getPosition());

  Serial.print("OK\r");
  Timer1.attachInterrupt(ISR_rotate);  // Enable TimerOne interrupt
}

// Get the current position of the motors
void ProcessGetPos() {
  char buf[13];
  uint16_t tgt1, tgt2;

  tgt1 = motor1->getPosition();
  tgt2 = motor2->getPosition();

  sprintf(buf, "P %04d %04d\r", tgt1, tgt2);
  Serial.print(buf);
}

// Enable/disable the laser module
void ProcessLaser() {
  uint8_t enable;

  enable = atoi(sCmd.next()) != 0;
  digitalWrite(LASER_PIN, enable);
  Serial.print("OK\r");
}

// Get ID
void ProcessID() {
  Serial.print("SkyPointer 1.0\r");
}

// Write errors to EEPROM
void ProcessWriteEEPROM () {
  // Reads (12) ints from Serial port and writes them to EEPROM, starting in
  // address 0x00 and incrementing by 1 with each byte
  uint8_t n = 0;         // Init address counter
  char *a = sCmd.next(); // First element
  while (a != NULL) {
    EEPROM.write(n, atoi(a));
    a = sCmd.next(); // Get next element
    n++;             // Increment address counter
  }
  Serial.print("OK\r");
}

// Read errors from EEPROM
void ProcessReadEEPROM () {
  /* Reads 12 bytes from EEPROM, 4 by each error, and sends them via Serial port.

  A string is generated in the form:
    R b_0 b_1 b_2 ... b_10 b_11\r
  where 'b_n' is the n-th byte.
  The size of the buffer is then obtained:
    R   --> 1 byte
    b_x --> 3 bytes + y space
    \r  --> 2 bites
  So we need to store (1 + 12x4 + 2) bytes = 51 bytes
  */
  char buf[51];
  // Init the buffer with the respose code letter
  sprintf (buf, "R");
  // Read EEPROM positions
  for (int k = 0; k < 12; k++) {
    // Append to the buffer
    sprintf(buf + strlen(buf), " %03d", EEPROM.read(k));
  }
  // Append eol
  sprintf (buf + strlen(buf), "\r");
  // Send the buffer via Serial
  Serial.print(buf);
}

// Handles unknown commands
void Unrecognized() {
  Serial.print("NK\r");
}
/****************************************************************************/

void setup() {
  pinMode(LASER_PIN, OUTPUT);
  #ifdef DEBUG
    pinMode (blinkLed, OUTPUT);
    digitalWrite (blinkLed, LOW);   // Turn off the LED
  #endif

  // Start the serial port
  Serial.begin(115200);

  // Add the commands to the SerialComnnand object
  sCmd.addCommand("G", ProcessGoto);    // G pos1 pos2\r
  sCmd.addCommand("M", ProcessMove);    // M steps1 steps2\r
  sCmd.addCommand("S", ProcessStop);    // S\r
  sCmd.addCommand("P", ProcessGetPos);  // P\r
  sCmd.addCommand("L", ProcessLaser);   // L enable\r
  sCmd.addCommand("I", ProcessID);      // I\r
  sCmd.addCommand("W", ProcessWriteEEPROM); // Write mechanical errors to EEPROM
  sCmd.addCommand("R", ProcessReadEEPROM);  // Reads mechanical errors from EEPROM
  sCmd.addDefaultHandler(Unrecognized);	// Unknown commands

  // Configure interrupt speed (microseconds)
  Timer1.initialize(DT);

  // Start motor shield
  MS.begin();
  motor1->setSpeed(RPM);
  motor2->setSpeed(RPM);

  // Reset EEPROM
  //writeAllErrorsToEEPROM((double) 0, (double) 0, (double) 0);
}

void loop() {
  sCmd.readSerial();  // Read commands from serial port
}

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


first working version w. trottling events and UPD

int led = D0;
int motionSensor = D1;
int sensorValue;
unsigned int FIVE_MINUTES_MILLIS = 1000*10;
unsigned long currentTime;
unsigned long lastCloudEvent = 0;
unsigned long lastUDPEvent = 0;
unsigned long lastCheck = 0;

//loxone muss immer gleiche ip haben --> next router mit mac to dhcp server
UDP Udp;
unsigned int localPort = 8777;
unsigned int remotePort = 8765;
IPAddress remoteIP(192, 168, 1, 44);
unsigned char str[6] = {108, 111, 120, 111, 110, 101}; //loxone

void setup() {
    pinMode(led,OUTPUT);
    pinMode(motionSensor,INPUT);
    Particle.variable("motionSensor", &sensorValue, INT);
    currentTime = millis();
    Serial.begin(9600);
    Serial.println("Sending UPD to ip: 192.168.1.44 and port: 8765");
    Serial.print("Local IP is: ");
    Serial.println(WiFi.localIP());
    Udp.begin(localPort);
}

void loop() {
    sensorValue = digitalRead(motionSensor);
    ledToggle(sensorValue);

    if (sensorValue) {
        currentTime = millis();
        cloudEvent();
        udpEvent();
        checkLoxoneServer();
    }
}

int ledToggle(int value) {
    if (value) {
        digitalWrite(led,HIGH);
        return 1;
    }
    else {
        digitalWrite(led,LOW);
        return 0;
    }

}

void udpEvent() {
    if (WiFi.ready()) {
        if (currentTime-lastUDPEvent > FIVE_MINUTES_MILLIS) {
            //repeat UDP paket 3 times with delay
            for (int i=0; i < 3; i++) {
                Serial.println("Writing UDP");
                Udp.beginPacket(remoteIP, remotePort);
                Udp.write(str, 6);
                Udp.endPacket();
                lastUDPEvent = millis();
                delay(200);
            }
        }
    }
}

void cloudEvent(){
    if (currentTime-lastCloudEvent > FIVE_MINUTES_MILLIS) {
        Serial.println("Sending cloud event");
        bool response = Particle.publish("motion-detected");
        if (!response){
            Serial.println("Sending cloud event failed");
        }
        lastCloudEvent = millis();
    }
}

void checkLoxoneServer() {
    if (currentTime-lastCheck > FIVE_MINUTES_MILLIS) {
        if (WiFi.ready()) {
            int response = WiFi.ping(remoteIP, 3);
            if (response == 3){
                Serial.println("Loxone server is here");
            } else {
                Serial.println("Loxone server not reachable!");
            }
            lastCheck = millis();
        } else {
            Serial.print("Wifi is not working...SSID is: ");
            Serial.println(WiFi.SSID());
        }
    }
}

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


added ready status for pyserial durability improvements

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/ekwoodrich/nirha.git/'


Added analog FFT example

Added analog FFT example

Commented and documented example that shows a time-domain and
frequency-domain analysis of an analog input signal.

/*
 * This is a Phoenard display implementation for an Arduino FFT example.
 * The analog intensity in time-domain and the FFT in frequency-domain are graphed on the screen.
 * By default analog channel 0 (A0) is used as input. Attach an amplified microphone signal to this pin to analyze sounds!
 *
 * This sketch requires the FFFT library to be installed. For convenience, we provide a mirror to it here:
 * http://phoenard.com/media/ffft.zip
 *
 * Original Fixed point FFT library is from ELM Chan: http://elm-chan.org/works/akilcd/report_e.html
 * A way to port it to the Arduino library and most demo codes are from AMurchick
 * Forum post: http://arduino.cc/forum/index.php/topic,37751.0.html
 *
 * This example acquires an analog signal from A0 and displays it on the screen
 * Analog signal is captured at 9.6 KHz, 64 spectrum bands each 150Hz which can be changed in adcInit()
 */
#include "Phoenard.h"
#include <ffft.h>

#define IR_ADC_INPUT  0   // ADC channel to capture
#define RANDOM_NOISE  0   // Set to non-zero to add random() noise

/* Time-domain graph settings */
#define TD_GRAPH_X     6
#define TD_GRAPH_Y     22
#define TD_GRAPH_W     306
#define TD_GRAPH_H     90

/* Frequency-domain graph settings */
#define FD_GRAPH_X     5
#define FD_GRAPH_Y     (display.height()-14)
#define FD_GRAPH_SIZE  4
#define FD_GRAPH_CNT   62

/* FFT state variables */
volatile byte fft_position = 0;      /* Running position of the FFT */
int16_t fft_capture[FFT_N];          /* Waveform ADC capturing buffer */
complex_t bfly_buff[FFT_N];          /* FFT buffer */
uint16_t fft_spectrum[FFT_N/2];      /* Spectrum output buffer */
uint16_t fft_spectrumPast[FFT_N/2];  /* Tracks previous spectrum to render differences */

/* Time domain graph variables */
long intensity = 30;          /* Time-domain intensity */
long intensityPast = 30;      /* Time-domain intensity of previous run */
long timePos = TD_GRAPH_X;  /* Time-domain running time position */

void setup() {
  // Initialize the ADC registers to receive input in the interrupt
  adcInit();

  // Draw the frames in which the graphs are shown
  display.drawRoundRect(0,0,display.width(),display.height(),7,RED);
  display.drawRoundRect(2,12,display.width()-4,display.height()/2-17,7,BLUE);
  display.drawRoundRect(2,display.height()/2+5,display.width()-4,display.height()/2-7,7,BLUE);

  // Top title
  display.setTextColor(WHITE);
  display.drawStringMiddle(0,2,display.width(),10,"Signal Analyzer (FFT and RAW)");

  // Graph titles
  display.setTextColor(YELLOW);
  display.drawStringMiddle(0,13,display.width(),10,"Intensity in Time Domain");
  display.drawStringMiddle(0,126,display.width(),10,"Frequency Using FFT");

  // Frequency labeling
  display.setTextColor(CYAN);
  display.drawStringMiddle(0,226,display.width(),10,"2.4kHz");
  display.drawStringMiddle(0,226,40,10,"0kHz");
  display.drawStringMiddle(276,226,40,10,"4.8kHz");
}

void loop() {
  // When interrupt finishes filling the buffer, execute and display FFT
  if (fft_position == FFT_N) {
    fft_input(fft_capture, bfly_buff);
    fft_execute(bfly_buff);
    fft_output(bfly_buff, fft_spectrum);
    displayFFT();

    // Fill the buffer again
    fft_position = 0;
  }
}

/* Draws the FFT spectrum and time-domain analysis to the screen */
void displayFFT() {
  // Add all previously captured ADC values to form an intensity
  // At the same time, update the difference for each frequency bar
  long captureSum = 0;
  int x = FD_GRAPH_X;
  int y = FD_GRAPH_Y;
  int fft_spectrumOld, fft_spectrumNew, fft_spectrumDiff;
  for (byte i = 0; i < FD_GRAPH_CNT; i++) {
    captureSum += fft_capture[i];
    fft_spectrumOld = min(fft_spectrumPast[i], 80);
    fft_spectrumNew = min(fft_spectrum[i], 80);
    fft_spectrumDiff = fft_spectrumOld - fft_spectrumNew;
    fft_spectrumPast[i] = fft_spectrum[i];

    if (fft_spectrumDiff > 0) {
      display.fillRect(x, y - fft_spectrumOld, FD_GRAPH_SIZE, fft_spectrumDiff, BLACK);
    } else if (fft_spectrumDiff < 0) {
      display.fillRect(x, y - fft_spectrumNew, FD_GRAPH_SIZE, fft_spectrumNew, GREEN);
    }
    x += FD_GRAPH_SIZE + 1;
  }

  // Convert the sum of all waveform captures into a graph intensity range
  intensity = map(captureSum,-10000,10000,TD_GRAPH_Y,TD_GRAPH_Y+TD_GRAPH_H);
  intensity = constrain(intensity, TD_GRAPH_Y, TD_GRAPH_Y+TD_GRAPH_H);

  // Draw time-domain graph line
  display.drawLine(timePos,intensityPast,timePos+1,intensity,GREEN);
  intensityPast=intensity;

  // Increment time position, wipe when fully filled up
  if (++timePos >= (TD_GRAPH_X+TD_GRAPH_W)) {
    timePos = TD_GRAPH_X;
    display.fillRect(TD_GRAPH_X, TD_GRAPH_Y, TD_GRAPH_W+2, TD_GRAPH_H, BLACK);
  }
}

/* free running ADC fills capture buffer */
ISR(ADC_vect) {
  int16_t value;
  if (fft_position < FFT_N) {
    /* Input ADC value */
    value = ADC;

    /* Add random noise */
    if (RANDOM_NOISE) {
      value += random(-RANDOM_NOISE, RANDOM_NOISE);
    }

    /* Store sample in fft capture buffer */
    fft_capture[fft_position++] = value;
  }
}

/* Initializes ADC registers to use an interrupt-based free-running mode */
void adcInit(){
  /*  REFS0 : VCC use as a ref, IR_AUDIO : channel selection, ADEN : ADC Enable, ADSC : ADC Start, ADATE : ADC Auto Trigger Enable, ADIE : ADC Interrupt Enable,  ADPS : ADC Prescaler  */
  // free running ADC mode, f = ( 16MHz / prescaler ) / 13 cycles per conversion
  ADMUX = _BV(REFS0) | IR_ADC_INPUT; // | _BV(ADLAR);
  //ADCSRA = _BV(ADSC) | _BV(ADEN) | _BV(ADATE) | _BV(ADIE) | _BV(ADPS2) | _BV(ADPS1); //prescaler 64 : 19231 Hz - 300Hz per 64 divisions
  ADCSRA = _BV(ADSC) | _BV(ADEN) | _BV(ADATE) | _BV(ADIE) | _BV(ADPS2) | _BV(ADPS1) | _BV(ADPS0); // prescaler 128 : 9615 Hz - 150 Hz per 64 divisions, better for most music
  sei();
}

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


add scroll_text examples

add scroll_text examples

#include <Adafruit_GFX.h>				// https://github.com/adafruit/Adafruit-GFX-Library
#include <Humblesoft_GFX.h>			// https://github.com/h-nari/Humblesoft_GFX
#include <Humblesoft_LedMat.h>	// https://github.com/h-nari/Humblesoft_LedMat
#include <ScrollText.h>

ScrollText sc1(&LedMat);
ScrollText sc2(&LedMat);
uint8_t imgBuf[1024*4];

void setup(void)
{
  Serial.begin(115200);
  delay(100);
  Serial.println("\n\nReset:");

  LedMat.begin(LMMT64x32s16);
	LedMat.setLedMode(1);
	LedMat.setImgBuf(imgBuf, sizeof imgBuf);

	int w = LedMat.width();
	int h = LedMat.height();

	sc1.setSpeed(16);
	sc1.setScrollArea(16, 0, w - 16 - 2, h/2);
	sc1.setYPos();

	sc2.setSpeed(32);
	sc2.setScrollArea(0, h/2, w, h/2);
	sc2.setYPos();

	LedMat.clear();
	LedMat.display();
}

const char *colors[] =
	{ "WHITE", "RED", "GREEN", "BLUE",
		"YELLOW", "PURPLE", "CYAN", "MAGENTA", "NAVY",
		"DARKGREEN", "DARKCYAN", "MAROON", "OLIVE", "LIGHTGREY",
		"DARKGRAY", "ORANGE", "GREENYELLOW", "PINK",
	};

void loop(void){
	static int idx1,idx2;
	static const char *prev_color2 = "black";
	if(!sc1.update()){
		LedMat.fillRect(0,0,16,16,"black");
		LedMat.setCursor(2,4);
		LedMat.print(idx1);

		if(idx1 >= sizeof(colors)/sizeof(colors[0]))
			idx1 = 0;
		sc1.setTextColor(colors[idx1]);
		sc1.print(colors[idx1]);
		sc1.scrollOut();
		idx1++;
	}

	if(!sc2.update()){
		if(idx2 >= sizeof(colors)/sizeof(colors[0]))
			idx2 = 0;
		sc2.setTextColor(colors[idx2]);
		sc2.setBgColor(prev_color2);
		sc2.print(' ');
		sc2.print(colors[idx2]);
		sc2.print(' ');
		prev_color2 = colors[idx2];
		idx2++;
	}
}

/*** Local variables: ***/
/*** tab-width:2      ***/
/*** truncate-lines:t ***/
/*** End:             ***/

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


Add example

Add example

#include <Arduino.h>
#include <EspWiFi.h>

// Wired to `RESET` pin on the ESP8266
#define RESET_PIN 6

#define SSID     "Your-SSID"
#define PASSWORD "P4ssw0rd"
#define TCP_PORT 80

EspWiFi wifi(Serial, RESET_PIN);

void setup() {
  pinMode(RESET_PIN, OUTPUT);

  if (wifi.connect(SSID, PASSWORD)) {
    if (! wifi.listen(TCP_PORT)) {
      // TODO: error
    }
  } else {
    // TODO: error
  }
}

void loop() {
  unsigned int mux_id, len;
  String data = wifi.read(mux_id, len);

  // send received data back
  if (data.length() > 0) {
    wifi.write(mux_id, data);
  }
}

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


Drive a 28BYJ-48 stepper motor.

Drive a 28BYJ-48 stepper motor.

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


my first commit

my first commit

#include <EEPROM.h>
#include <SPI.h>
#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
#include <EthernetUdp.h>
#include <util.h>
#include <TimerOne.h>

//
const int pinc = 4;
const int pins[pinc] = {5,6,7,8}; //physical to logical pin
const int eeprom[pinc] = {0,1,2,3}; //pin address in eeprom
volatile int pinhardstate[pinc] = {0,0,0,0};
volatile int pinsoftstate[pinc] = {0,0,0,0};
volatile unsigned long pintime[pinc] = {0,0,0,0};
int pinreport[pinc] = {0,0,0,0};

byte mac[] = {0x02, 0x80, 0xC2, 0x00, 0x00, 0x01};
byte ip[] = {192, 168, 12, 80};
byte netdns[] = {192, 168, 12, 1};
byte gateway[] = {192, 168, 12, 1};
byte mask[] = {255, 255, 255, 0};

EthernetServer server(2323);

//
void timerIsr()
{
//
   int state;
   for (int i = 0; i < pinc; i++)
      {
   //
      state = digitalRead(pins[i]);
      if (state==LOW && pinhardstate[i]==0 && pinsoftstate[i]==0) // button down...
         {
      //
         pinhardstate[i] = 1;
         pinsoftstate[i] = 1;
         pintime[i] = millis();
         }
      else
         if (state==HIGH && pinhardstate[i]==1) // ...button up
            {
         //
            pinhardstate[i] = 0;
            pintime[i] = millis() - pintime[i];
            }
      }
}

// the setup routine runs once when you press reset:
void setup()
{
   // initialize the digital pin as an output.
   //pinMode(led, OUTPUT);

   // initialise to internal 20Mom rezister
   for (int i = 0; i < pinc; i++)
      {
   //
      pinMode(pins[i], INPUT);
      digitalWrite(pins[i], HIGH);
      }

   //
   Timer1.initialize(2000); // 500Hz // set a timer of length 100000 microseconds (or 0.1 sec - or 10Hz => the led will blink 5 times, 5 cycles of on-and-off, per second)
   Timer1.attachInterrupt( timerIsr );

   //Start up the serial port
   //Serial.begin(9600);

   //
   Ethernet.begin(mac, ip, netdns, gateway, mask);
   server.begin();
}

// the loop routine runs over and over again forever:
void loop()
{
//
   //int ledstate = 0;
   for (int i = 0; i < pinc; i++)
      {
   //
      //if (pinsoftstate[i]==1) ledstate = 1;
      //анализ pinsoftstate? без pinreport? где сообщать клиенту?
      if (pinhardstate[i] == 1 && pinsoftstate[i]==1 && pinreport[i]==0)
         {
      //
         if (pinreport[i]==0)
            {
         //
            //Serial.println();
            //Serial.print("pin down["); Serial.print(i, DEC); Serial.print("]");
            server.println();
            server.print("pin down["); server.print(i, DEC); server.print("]");

            pinreport[i] = 1;
            }
         }
      else
         if (pinhardstate[i] == 0 && pinsoftstate[i]==1 && pinreport[i]==1)
            {
         //
            //Serial.println();
            //Serial.print("pintime["); Serial.print(i, DEC); Serial.print("]=");
            //Serial.println(pintime[i], DEC);
            server.println();
            server.print("pintime["); server.print(i, DEC); server.print("]="); server.print(pintime[i], DEC);

            pinsoftstate[i] = 0;
            pinreport[i] = 0;
            //digitalWrite(led, HIGH);   delay(200);    digitalWrite(led, LOW);   delay(200);
            }
      }
}

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


Blinking led from one sensor works

Blinking led from one sensor works

int frontSensorPin = 14;
int ledPin = 13;
int frontSensorValue = 0;

void setup() {
  pinMode(frontSensorPin, INPUT);
  pinMode(ledPin, OUTPUT);

  Serial.begin(9600);
}

void loop() {
  frontSensorValue = analogRead(frontSensorPin);

  if (frontSensorValue > 512)
    digitalWrite(ledPin, HIGH);
  else
    digitalWrite(ledPin, LOW);

  Serial.println(frontSensorValue);
}

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


Create print_HSV_values.ino

Create print_HSV_values.ino

//***************************************************************
//  Print out HSV values to serial monitor example...
//
//  Marc Miller, July 2017
//***************************************************************

#include "FastLED.h"
#define DATA_PIN    11
#define CLOCK_PIN   13
#define LED_TYPE    LPD8806
#define COLOR_ORDER GBR
#define NUM_LEDS    32

#define BRIGHTNESS  50
CRGB leds[NUM_LEDS];
CHSV hsv[NUM_LEDS];

//---------------------------------------------------------------
void setup() {
  Serial.begin(115200);  // Allows serial monitor output (check baud rate)
  delay(1500); // startup delay for recovery
  //FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
  FastLED.addLeds<LED_TYPE,DATA_PIN,CLOCK_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
  FastLED.setBrightness(BRIGHTNESS);
  FastLED.clear();
}

//---------------------------------------------------------------
void loop() {
  EVERY_N_SECONDS( 5 ) {

    for (uint8_t i=0; i < NUM_LEDS; i++) {
      hsv[i].h = random8();
      hsv[i].s = random8(200,256);
      hsv[i].v = random8(64,85);
      leds[i] = CHSV(hsv[i].h, hsv[i].s, hsv[i].v);

      Serial.print("HSV["); Serial.print(i);
      Serial.print("]: "); Serial.print(hsv[i].h);
      Serial.print(" "); Serial.print(hsv[i].s);
      Serial.print(" "); Serial.println(hsv[i].v);
    }

    FastLED.show();

  }//end_EVERY_N

}//end_main_loop

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


add servo controller

add servo controller

Servo myservo;
int pos = 0;

void setup()
{
  myservo.attach(D0);
  Spark.function("servo", updateServo);
}

void loop()
{
  // do nothing
}

//this function automagically gets called upon a matching POST request
int updateServo(String command)
{
  uint8_t pos = command.toInt();
  if(pos <= 180) {
    myservo.write(pos);
    return 200;
  }
  else {
    return -1;
  }
}

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


Create color_temperature_demo.ino

Create color_temperature_demo.ino

//***************************************************************
//  Demo to show all the predefined FastLED color temperatures.
//  Fills the LED strip with white and then cycles through the temperatures.
//
//  Marc Miller, Aug 2017
//***************************************************************

#include "FastLED.h"
#define DATA_PIN    11
#define CLOCK_PIN   13
#define LED_TYPE    LPD8806
#define COLOR_ORDER GRB
#define NUM_LEDS    32
#define BRIGHTNESS  255
CRGB leds[NUM_LEDS];

#define DISPLAYTIME 4  //number of SECONDS to show each color temperature
#define BLACKOUTTIME 100  //number of MILLISECONDS to blackout between tempatures
uint8_t temp;  //current tempature_# being displayed

//---------------------------------------------------------------
void setup() {
  Serial.begin(115200);  // Allows serial monitor output (check baud rate)
  delay( 1500 ); // power-up safety delay
  FastLED.addLeds<LED_TYPE, DATA_PIN, CLOCK_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalSMD5050 );
  FastLED.setBrightness( BRIGHTNESS );
  FastLED.clear();
}

//---------------------------------------------------------------
//All the predefined FastLED color temperatures:
#define TEMPERATURE_0 UncorrectedTemperature
#define TEMPERATURE_1 Candle
#define TEMPERATURE_2 Tungsten40W
#define TEMPERATURE_3 Tungsten100W
#define TEMPERATURE_4 Halogen
#define TEMPERATURE_5 CarbonArc
#define TEMPERATURE_6 HighNoonSun
#define TEMPERATURE_7 DirectSunlight
#define TEMPERATURE_8 OvercastSky
#define TEMPERATURE_9 ClearBlueSky
#define TEMPERATURE_10 WarmFluorescent
#define TEMPERATURE_11 StandardFluorescent
#define TEMPERATURE_12 CoolWhiteFluorescent
#define TEMPERATURE_13 FullSpectrumFluorescent
#define TEMPERATURE_14 GrowLightFluorescent
#define TEMPERATURE_15 BlackLightFluorescent
#define TEMPERATURE_16 MercuryVapor
#define TEMPERATURE_17 SodiumVapor
#define TEMPERATURE_18 MetalHalide
#define TEMPERATURE_19 HighPressureSodium

//---------------------------------------------------------------
void loop() {
  switch (temp) {
    case 0:
      FastLED.setTemperature( TEMPERATURE_0 );  break;
    case 1:
      FastLED.setTemperature( TEMPERATURE_1 );  break;
    case 2:
      FastLED.setTemperature( TEMPERATURE_2 );  break;
    case 3:
      FastLED.setTemperature( TEMPERATURE_3 );  break;
    case 4:
      FastLED.setTemperature( TEMPERATURE_4 );  break;
    case 5:
      FastLED.setTemperature( TEMPERATURE_5 );  break;
    case 6:
      FastLED.setTemperature( TEMPERATURE_6 );  break;
    case 7:
      FastLED.setTemperature( TEMPERATURE_7 );  break;
    case 8:
      FastLED.setTemperature( TEMPERATURE_8 );  break;
    case 9:
      FastLED.setTemperature( TEMPERATURE_9 );  break;
    case 10:
      FastLED.setTemperature( TEMPERATURE_10 );  break;
    case 11:
      FastLED.setTemperature( TEMPERATURE_11 );  break;
    case 12:
      FastLED.setTemperature( TEMPERATURE_12 );  break;
    case 13:
      FastLED.setTemperature( TEMPERATURE_13 );  break;
    case 14:
      FastLED.setTemperature( TEMPERATURE_14 );  break;
    case 15:
      FastLED.setTemperature( TEMPERATURE_15 );  break;
    case 16:
      FastLED.setTemperature( TEMPERATURE_16 );  break;
    case 17:
      FastLED.setTemperature( TEMPERATURE_17 );  break;
    case 18:
      FastLED.setTemperature( TEMPERATURE_18 );  break;
    case 19:
      FastLED.setTemperature( TEMPERATURE_19 );  break;
  }

  fill_solid(leds, NUM_LEDS, CRGB(255,255,255) );  //fill with white
  if (temp==0) { leds[0]=CRGB::Red; leds[1]=CRGB::Green; leds[2]=CRGB::Blue; }

  FastLED.show();  //display pixels

  EVERY_N_SECONDS(DISPLAYTIME) {
    FastLED.clear();
    FastLED.show();
    delay(BLACKOUTTIME);
    temp++;
    if (temp == 20) { temp = 0; }  //reset
    Serial.print("Current temperature: "); Serial.println(temp);  //print temp # to serial monitor
  }

}//end_main_loop

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


Create main.ino

Create main.ino

#include <math.h>
#define LED_CS 6
#define SWITCH_CS D0
#define LEFT_LED D0
#define RIGHT_LED D1
#define THERMISTOR_CS A7
#define PHOTOCELL A6
#define PIEZO A5

Servo rightServo, leftServo;
int temperature = 0, photocell = 0, runs = 0;

int move(String command){
    analogWrite(PIEZO, 120);
    switch(command.toInt()){
        case 0:
            //Deinit
            rightServo.write(90);
            leftServo.write(90);
            break;
        case 1:
            //Up
            rightServo.write(0);
            leftServo.write(180);
            break;
        case 2:
            //Down
            rightServo.write(180);
            leftServo.write(0);
            break;
        case 3:
            //Right
            rightServo.write(180);
            leftServo.write(180);
            break;
        case 4:
            //Left
            rightServo.write(0);
            leftServo.write(0);
            break;
        default:
            return 400;
    }
    return 200;
}

int led_control(String command){
    analogWrite(PIEZO, 120);
    switch(command.toInt()){
        case 0:
            digitalWrite(LEFT_LED, 1);
            digitalWrite(RIGHT_LED, 1);
            break;
        case 1:
            digitalWrite(LEFT_LED, 0);
            digitalWrite(RIGHT_LED, 0);
            break;
        case 11:
            digitalWrite(LEFT_LED, 1);
            digitalWrite(RIGHT_LED, 0);
            break;
        case 12:
            digitalWrite(LEFT_LED, 0);
            digitalWrite(RIGHT_LED, 1);
            break;
        default:
            return 400;
    }
    return 200;
}

void setup() {
  leftServo.attach(A0);
  rightServo.attach(A1);

  Spark.function("MOVE", move);
  Spark.function("LED_CONTROL", led_control);

  Spark.variable("temperature", &temperature, INT);
  Spark.variable("light", &photocell, INT);
  Spark.variable("runs", &runs, INT);

  pinMode(LED_CS, OUTPUT);
  pinMode(THERMISTOR_CS, INPUT);
  pinMode(PHOTOCELL, INPUT);
  pinMode(RIGHT_LED, OUTPUT);
  pinMode(LEFT_LED, OUTPUT);
  pinMode(PIEZO, OUTPUT);

  for(int i = 0; i < 21; i++){
    digitalWrite(RIGHT_LED, (i % 2 == 0));
    digitalWrite(LEFT_LED, (i % 2 == 0));
    delay(200-(i*10));
  }
}

void loop() {
  runs++;
  delay(100);
  temperature = analogRead(THERMISTOR_CS);
  photocell = analogRead(PHOTOCELL);
}

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


modified:   sources/sketchs/moniteur/moniteur.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/emeric254/autoArduino.git/'


Moved the command write out of the individual states

error: pathspec 'software/embedded/Arduino' did not match any file(s) known to git
error: pathspec 'Code/basicDriveCode/basicDriveCode.ino' did not match any file(s) known to git


Create RS485_UnoR3_Slave_only_LED.ino

Create RS485_UnoR3_Slave_only_LED.ino

#include <SimpleModbusSlave.h>

#define  LED 8

//////////////// registers of your slave ///////////////////
enum
{
  ADC_VAL,
  PWM_VAL,
  HOLDING_REGS_SIZE
};

unsigned int holdingRegs[HOLDING_REGS_SIZE]; // function 3 and 16 register array
////////////////////////////////////////////////////////////

void setup()
{
  modbus_configure(&Serial, 9600, SERIAL_8N2, 1, 2, HOLDING_REGS_SIZE, holdingRegs);
  modbus_update_comms(9600, SERIAL_8N2, 1);

  pinMode(LED, OUTPUT);
}

void loop()
{

  modbus_update();
 // holdingRegs[ADC_VAL] = analogRead(A0);

 digitalWrite(LED, HIGH);
 delay(holdingRegs[PWM_VAL]);
 digitalWrite(LED, LOW);
 delay(holdingRegs[PWM_VAL]);

}

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


add code necessary to add to interface program for radio

#include <cc1101.h>

#include <constants.h>

// data transfer values
radio_t radio_data;
interface_t interface_data;
target_t target_data;

int cadence = 0;
int gear = 1;

void setup() {
  // initialize radio
  Radio.Init();
  Radio.SetDataRate(4);
  Radio.SetLogicalChannel(1);
  Radio.RxOn();
}

void loop() {
  // receive potential radio data
  if (Radio.CheckReceiveFlag()) {
    Radio.ReceiveData((byte *)&radio_data);

    if (radio_data.header == INTERFACE_HEADER) {
      interface_data = radio_data.interface;

      cadence = interface_data.cadence;
      gear = interface_data.gear;
    }

    Radio.RxOn();
  }
}

void send_up() {
  target_data.up = 1;
  target_data.down = 0;
  target_data.set = 0;
  radio_data.header = INTERFACE_HEADER;
  radio_data.target = target_data;

  Radio.SendData((byte *)&radio_data, sizeof(radio_data));
  Radio.RxOn();
}

void send_down() {
  target_data.up = 0;
  target_data.down = 1;
  target_data.set = 0;
  radio_data.header = INTERFACE_HEADER;
  radio_data.target = target_data;

  Radio.SendData((byte *)&radio_data, sizeof(radio_data));
  Radio.RxOn();
}

void send_set() {
  target_data.up = 0;
  target_data.down = 0;
  target_data.set = 1;
  radio_data.header = INTERFACE_HEADER;
  radio_data.target = target_data;

  Radio.SendData((byte *)&radio_data, sizeof(radio_data));
  Radio.RxOn();
}

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


Arduino serial communication with Processing and the NY Times API

char val;

int arrayIndex0_pin = 12;
int arrayIndex1_pin = 10;
int arrayIndex2_pin = 8;

void setup(){
 pinMode(arrayIndex0_pin, OUTPUT);
 pinMode(arrayIndex1_pin, OUTPUT);
 pinMode(arrayIndex2_pin, OUTPUT);
 Serial.begin(9600);
}

void loop(){
 if(Serial.available()){
  val= Serial.read();
  //Serial.print(val);
 }
 if (val == 'A'){
   digitalWrite(arrayIndex0_pin, HIGH);
  // Serial.println(val);
 } else {
     digitalWrite(arrayIndex0_pin, LOW);
 }

  if (val == 'B'){
   digitalWrite(arrayIndex1_pin, HIGH);
  //  Serial.println(val);
 } else {
     digitalWrite(arrayIndex1_pin, LOW);
 }

   if (val == 'C'){
   digitalWrite(arrayIndex2_pin, HIGH);
   // Serial.println(val);
 } else {
     digitalWrite(arrayIndex2_pin, LOW);
 }

}

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


Delete Sensor.ino

Delete Sensor.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/matthewpruett/ece2881.git/'


anavi-blinking-led.ino: Blinking LED

anavi-blinking-led.ino: Blinking LED

Super simple Arduino sketch with a blinking LED
(D1) on ANAVI Light Controller.

Signed-off-by: Leon Anavi <be92910ae7bb6f58bb9b7c6f845bc30640119592@anavi.org>

#include <ESP8266WiFi.h>          //https://github.com/esp8266/Arduino

// Configure pins
const int pinAlarm = 16;

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

  //LED
  pinMode(pinAlarm, OUTPUT);

  Serial.println("Blinking LED demo on ANAVI Light Controller");
}

void loop() {
  // Blinking LED
  while(true)
  {
      digitalWrite(pinAlarm, HIGH);
      delay(100);
      digitalWrite(pinAlarm, LOW);
      delay(100);
  }
}

error: pathspec 'anavi-light-controller/anavi-blinking-led/anavi-blinking-led.ino' did not match any file(s) known to git