Meir fjernkontrollert

Meir fjernkontrollert

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/Oegly/NotARobotCoup.git/'


initial BT serial test

initial BT serial test

/* Turn an LED on/off based on a command send via BlueTooth
**
** Credit: The following example was used as a reference
** Rui Santos: http://randomnerdtutorials.wordpress.com
*/

int ledPin = 13;  // use the built in LED on pin 13 of the Uno
int state = 0;
int flag = 0;        // make sure that you return the state only once

void setup() {
    // sets the pins as outputs:
    pinMode(ledPin, OUTPUT);
    digitalWrite(ledPin, LOW);

    Serial4.begin(9600); // Default connection rate for my BT module
}

void loop() {
    //if some data is sent, read it and save it in the state variable
    if(Serial4.available() > 0){
      state = Serial4.read();
      flag=0;
    }
    // if the state is 0 the led will turn off
    if (state == '0') {
        digitalWrite(ledPin, LOW);
        if(flag == 0){
          Serial4.println("LED: off");
          flag = 1;
        }
    }
    // if the state is 1 the led will turn on
    else if (state == '1') {
        digitalWrite(ledPin, HIGH);
        if(flag == 0){
          Serial4.println("LED: on");
          flag = 1;
        }
    }
}

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


Add PwmOut example.

Add PwmOut example.

#include "mbed.h"

AnalogIn ain(A0);
DigitalOut pwm(p3);

void setup() {
}

void loop() {
    pwm.write(ain.read());
}

#ifndef ARDUINO
int main() {
    setup();
    for (;;) {
        loop();
    }
}
#endif

error: pathspec 'examples/mbino-example-pwmout/mbino-example-pwmout.ino' did not match any file(s) known to git


add node ID to code

add node ID to 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/jeremywrnr/wampum.git/'


Added a watchdog timer for a teensy

Added a watchdog timer for a teensy

The watchdog can be used as a backup for ensuring J1939 messages are
present on the bus.

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/SynerconTechnologies/SmartSensorSimulator.git/'


Update Stepper1 for 200 SPM stepper.

Update Stepper1 for 200 SPM stepper.

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


program to measure temperature

program to measure temperature

program to measure temperature and send the data via serially

/*
Temperature Measurement
=========== ===========
rev v.1
#measure the temperature using LM35
#sends the data serially for verification
*/

//tm-temperature measurement

#define tminput A0

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

float tm,tmvoltage;
void loop()
{
  tm=analogRead(tminput);//read the temperature value
  tmvoltage = tm * (5 / 1024);
  Serial.print("The temperature is ");//diplay the temperature
  Serial.println(tmvoltage);
  delay(500);
}

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


first commit

first commit

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/TEAMarg/ID-37-DICE.git/'


added New Arduino project

added New Arduino project

 for newer version led strip driver

/*
  Serial RGB controller

 Reads a serial input string looking for three comma-separated
 integers with a newline at the end. Values should be between
 0 and 255. The sketch uses those values to set the color
 of an RGB LED attached to pins 9 - 11.

 The circuit:
 * Common-anode RGB LED cathodes attached to pins 9 - 11
 * LED anode connected to pin 13

 To turn on any given channel, set the pin LOW.
 To turn off, set the pin HIGH. The higher the analogWrite level,
 the lower the brightness.

 created 29 Nov 2010
 by Tom Igoe

 This example code is in the public domain.
 */
//https://github.com/iKenndac/Arduino-Dioder-Playground
#include <Wire.h>
#include <SoftwareSerial.h>
#include "Suli.h"
#include "LED_Strip_Arduino.h"

#define CLK 2//pins definitions for the driver
#define DIO 3
led_strip Driver(CLK,DIO);
// Protocol details (two header bytes, 12 value bytes, checksum)

const int kProtocolHeaderFirstByte = 0xBA;
const int kProtocolHeaderSecondByte = 0xBE;

const int kProtocolHeaderLength = 2;
const int kProtocolBodyLength = 12;
const int kProtocolChecksumLength = 1;

// Buffers and state

bool appearToHaveValidMessage;
byte receivedMessage[kProtocolBodyLength];

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(57600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

}

void loop() {
  int availableBytes = Serial.available();

  if (!appearToHaveValidMessage) {

    // If we haven't found a header yet, look for one.
    if (availableBytes >= kProtocolHeaderLength) {

      // Read then peek in case we're only one byte away from the header.
      byte firstByte = Serial.read();
      byte secondByte = Serial.peek();

      if (firstByte == kProtocolHeaderFirstByte &&
          secondByte == kProtocolHeaderSecondByte) {

          // We have a valid header. We might have a valid message!
          appearToHaveValidMessage = true;

          // Read the second header byte out of the buffer and refresh the buffer count.
          Serial.read();
          availableBytes = Serial.available();
      }
    }
    else
    {
       Serial.println("FAIL");
    }
  }

  if (availableBytes >= (kProtocolBodyLength + kProtocolChecksumLength) && appearToHaveValidMessage) {

    // Read in the body, calculating the checksum as we go.
    byte calculatedChecksum = 0;

    for (int i = 0; i < kProtocolBodyLength; i++) {
      receivedMessage[i] = Serial.read();
      calculatedChecksum ^= receivedMessage[i];
    }

    byte receivedChecksum = Serial.read();

    if (receivedChecksum == calculatedChecksum) {
      // Hooray! Push the values to the output pins.

      Driver.begin();

      for(int i = 0 ; i < 4 ; i++)
      {
        int index = i*3;
        Driver.setColor(receivedMessage[index], receivedMessage[index+1] , receivedMessage[index+2]);
      }
      Driver.end();

      Serial.println("OK");

    } else {

      Serial.println("FAIL");
    }

    appearToHaveValidMessage = false;
  }

}

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


Added Arduino sketch

Added Arduino sketch

/*
  Harry Potter Interactive Wands

  Made with Little Bits
  Copied and only slightly modified from the Scent-imental Notification System
  http://www.instructables.com/id/Scent-imental-Notification-System/

  This example code is in the public domain.
 */

 int cloudValue = 0;

//Give unique names to the 3 digital output pins of the Arduino
int incendioPin  = 1;
int locomotorPin = 5;
int aguamentiPin = 9;

// The setup routine sets up the Arduino and runs once
void setup() {

  // Initialize the digital pins as output pins.
  pinMode(incendioPin,  OUTPUT);
  pinMode(locomotorPin, OUTPUT);
  pinMode(aguamentiPin, OUTPUT);

  //uncomment the line below for debugging
  //Serial.begin(9600);

}

// The loop routine runs over and over forever
void loop() {

  //Read the analog input from the Cloudbit
  cloudValue = analogRead(A0);

  //Convert the analog value of 0 to 1023 to a number between 0 and 100
  cloudValue = map(cloudValue, 0, 1023, 0, 100);

  //uncomment the line below for debugging
  //Serial.println(cloudValue);

  //Check for values from the Cloudbit

  //If the number is 25, trigger incendio
  if((cloudValue > 10) &&  (cloudValue < 33)){
    digitalWrite(incendioPin,  HIGH);
    digitalWrite(locomotorPin, LOW);
    digitalWrite(aguamentiPin, LOW);
  }

  //If the number is 50, trigger locomotor
  else if((cloudValue >= 33) && (cloudValue < 66)){
    digitalWrite(incendioPin,  LOW);
    digitalWrite(locomotorPin, HIGH);
    digitalWrite(aguamentiPin, LOW);
  }

  //If the number is 75, trigger agumenti
  else if((cloudValue >= 66) && (cloudValue < 100)){
    digitalWrite(incendioPin,  LOW);
    digitalWrite(locomotorPin, LOW);
    digitalWrite(aguamentiPin, HIGH);
  }

  //If the number is 0, trigger nothing
  else if(cloudValue <= 10){
    digitalWrite(incendioPin,  LOW);
    digitalWrite(locomotorPin, LOW);
    digitalWrite(aguamentiPin, LOW);
  }

}

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


Add periodic temps when in heating, 1 second base cycle, input cycle mult.

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/FirstBuild/pizzaduino.git/'


Add Arduino formware

Add Arduino formware

/*
  AnalogReadSerial
  Reads an analog input on pin 0, prints the result to the serial monitor.
  Graphical representation is available using serial plotter (Tools > Serial Plotter menu)
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

  This example code is in the public domain.
*/

struct buf64 {
    char str[64];
    int nextChar;
};
buf64 cmdBuf;

void exeCmds(char str[64]){  //Take a command string (whitespace stripped) and execute it.

    if (str[0] == '1'){
        digitalWrite(8, HIGH);
    }
    else if (str[0] == '0'){
        digitalWrite(8, LOW);
    }
    else if (str[0] == 'M'){
        digitalWrite(7, LOW);
    }
    else if (str[0] == 'N'){
        digitalWrite(7, HIGH);
    }
}

void sendReport(String report){

    Serial.println(report);
}

void serialEvent(){  //Upon receiving new serial data, read it in (ignoring spaces) and execute the command if a newline character is detected

    unsigned char ch;

    while (Serial.available() > 0){

        ch = Serial.read();

        //Serial.print("I just read the character ");
        //Serial.println(ch);

        if (ch != '\n' && ch != ' '){
            //Serial.println("ch wasn't a newline or space");
            cmdBuf.str[cmdBuf.nextChar] = ch;
            cmdBuf.nextChar++;
        }
        else if (ch == '\n'){
            //Serial.print("ch was a newline, so I need to execute this string: ");
            //Serial.println(cmdBuf.str);
            cmdBuf.str[cmdBuf.nextChar] = ch;
            cmdBuf.nextChar = 0;
            exeCmds(cmdBuf.str);
            cmdBuf.str[0] = '\0';
            //Serial.print("I have reset the string to: ");
            //Serial.println(cmdBuf.str);
        }
    }
}

void setup() {
    Serial.begin(9600);
    pinMode(4, OUTPUT);
    digitalWrite(4, HIGH);
    pinMode(7, OUTPUT);
    digitalWrite(7, HIGH);
    pinMode(8, OUTPUT);
}

void loop() {
    ;  //Should prob put something here to save power, so as not to churn away doing nothing
}

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


Add touch pin detection diagnostic sketch

//
// GUIslice Library Examples
// - Calvin Hass
// - https://www.impulseadventure.com/elec/guislice-gui.html
// - https://github.com/ImpulseAdventure/GUIslice
// - TFT Diagnostic (Arduino): Test Touch Pin Detection
//   - This sketch is intended to detect and report the set of pins
//     currently wired to a 4-wire resistive touch display
//   - This sketch is only intended to run in DRV_TOUCH_ADA_SIMPLE mode
//   - The pin detection logic is not supported on ARM or ESP32 devices
//   - Please refer to the touch configuration guide for details:
//     https://github.com/ImpulseAdventure/GUIslice/wiki/Configure-Touch-Support
//
// ACKNOWLEDGEMENT:
// - The pin detection logic was adapted from David Prentice's mcufriend_kbv library:
//   https://github.com/prenticedavid/MCUFRIEND_kbv/blob/master/examples/diagnose_Touchpins/diagnose_Touchpins.ino
//

#include "GUIslice.h"
#include "GUIslice_drv.h"

// Ensure debug messaging is enabled
#if (DEBUG_ERR != 1)
#undef  DEBUG_ERR
#define DEBUG_ERR 1
#endif

#if defined(DRV_TOUCH_NONE)
#error "Touch pin detection requires a touch driver but DRV_TOUCH_NONE was set"
#elif !defined(DRV_TOUCH_ADA_SIMPLE)
#error "Only DRV_TOUCH_ADA_SIMPLE supports pin detection"
#endif

#if defined(__arm__) || defined(ESP32)
#error "Pin detection not supported on ARM or ESP32 platforms"
#endif

#if defined(DRV_DISP_ADAGFX_MCUFRIEND)
  // Import MCUFRIEND to support ID reporting
#include <MCUFRIEND_kbv.h>
extern MCUFRIEND_kbv m_disp;
#endif

#define MAX_STR             30

// Defines for resources
enum { E_FONT_TXT };

// Instantiate the GUI
#define MAX_FONT                1

gslc_tsGui                  m_gui;
gslc_tsDriver               m_drv;
gslc_tsFont                 m_asFont[MAX_FONT];

char m_acTxt[MAX_STR];
gslc_tsRect m_rStatus = (gslc_tsRect) { 40, 60, 50, 10 };
gslc_tsFont* m_pFont = NULL;

#define MAX_FONT                1

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

void DrawBackground()
{
  // Background
  gslc_tsRect rBack = (gslc_tsRect) { 0, 0, 0, 0 };
  rBack.w = m_gui.nDispW;
  rBack.h = m_gui.nDispH;
  gslc_DrawFillRect(&m_gui, rBack, GSLC_COL_BLACK);

  // Status
  gslc_DrvDrawTxt(&m_gui, m_rStatus.x, m_rStatus.y, m_pFont, "Detecing Pins", GSLC_TXT_DEFAULT, GSLC_COL_YELLOW, GSLC_COL_BLACK);
}

bool DetectPins()
{
  int nPinXm = -1;
  int nPinXp = -1;
  int nPinYp = -1;
  int nPinYm = -1;

  int i, j, value, Apins[2], Dpins[2], Values[2], found = 0;

  GSLC_DEBUG_PRINT("Making all control and bus pins INPUT_PULLUP\n", "");
  GSLC_DEBUG_PRINT("Typical 30k Analog pullup with corresponding pin\n", "");
  GSLC_DEBUG_PRINT("would read low when digital is written LOW\n", "");
  GSLC_DEBUG_PRINT("e.g. reads ~25 for 300R X direction\n", "");
  GSLC_DEBUG_PRINT("e.g. reads ~30 for 500R Y direction\n", "");
  GSLC_DEBUG_PRINT("\n", "");
  GSLC_DEBUG_PRINT("Starting detection:\n", "");

  for (i = A0; i < A5; i++) pinMode(i, INPUT_PULLUP);
  for (i = 2; i < 10; i++) pinMode(i, INPUT_PULLUP);
  for (i = A0; i < A4; i++) {
    for (j = 5; j < 10; j++) {
      pinMode(j, OUTPUT);
      digitalWrite(j, LOW);
      value = analogRead(i);   // ignore first reading
      value = analogRead(i);
      if (value < 100) {
        GSLC_DEBUG_PRINT(" Detected: (A%u, D%u) = %u\n", (i - A0), j, value);
        if (found < 2) {
          Apins[found] = i;
          Dpins[found] = j;
          Values[found] = value;
          found++;
        }
      }
      pinMode(j, INPUT_PULLUP);
    }
  }
  if (found == 2) {
    if (Values[0] < Values[1]) {
      nPinXm = Apins[0];
      nPinXp = Dpins[0];
    }
    else {
      nPinYp = Apins[0];
      nPinYm = Dpins[0];
    }
    if (Values[1] < Values[0]) {
      nPinXm = Apins[1];
      nPinXp = Dpins[1];
    }
    else {
      nPinYp = Apins[1];
      nPinYm = Dpins[1];
    }
    GSLC_DEBUG_PRINT("Final detection: YP=A%u XM=A%u YM=%u XP=%u\n", (nPinYp - A0), (nPinXm - A0), nPinYm, nPinXp);

    GSLC_DEBUG_PRINT("-----------------------------------------------\n", "");
    GSLC_DEBUG_PRINT("Recommended config settings:\n", "");
    GSLC_DEBUG_PRINT("- Please copy these values over any existing ADATOUCH_PIN_* settings in your config.\n\n", "");

    GSLC_DEBUG_PRINT("  // Pinout for DRV_TOUCH_SIMPLE 4-wire resistive touchscreen\n", "");
    #if defined(DRV_DISP_ADAGFX_MCUFRIEND)
      // For MCUFRIEND displays, report the ID
      snprintf(m_acTxt, MAX_STR, "(MCUFRIEND ID=0x%04X)", m_disp.readID());
      GSLC_DEBUG_PRINT("  // %s\n", m_acTxt);
    #endif
    GSLC_DEBUG_PRINT("  #define ADATOUCH_PIN_YP   A%d    // \"Y+\": Must be an analog pin\n", (nPinYp - A0));
    GSLC_DEBUG_PRINT("  #define ADATOUCH_PIN_XM   A%d    // \"X-\": Must be an analog pin\n", (nPinXm - A0));
    GSLC_DEBUG_PRINT("  #define ADATOUCH_PIN_YM   %d     // \"Y-\": Can be a digital pin\n", nPinYm);
    GSLC_DEBUG_PRINT("  #define ADATOUCH_PIN_XP   %d     // \"X+\": Can be a digital pin\n", nPinXp);

    GSLC_DEBUG_PRINT("-----------------------------------------------\n", "");
    GSLC_DEBUG_PRINT("Current config settings:\n", "");
    GSLC_DEBUG_PRINT("- YP=A%u XM=A%u YM=%u XP=%u\n",
      (ADATOUCH_PIN_YP - A0), (ADATOUCH_PIN_XM - A0), ADATOUCH_PIN_YM, ADATOUCH_PIN_XP);
    GSLC_DEBUG_PRINT("-----------------------------------------------\n", "");
    GSLC_DEBUG_PRINT("Current config match recommendation?: ", "");
    // Check pins for a match
    if ((nPinXm != ADATOUCH_PIN_XM) || (nPinXp != ADATOUCH_PIN_XP) || \
      (nPinYp != ADATOUCH_PIN_YP) || (nPinYm != ADATOUCH_PIN_YM))
    {
      GSLC_DEBUG_PRINT("MISMATCH - Please update config\n", "");
      return false;
    }
    else {
      GSLC_DEBUG_PRINT("OK - No need to update config\n", "");
      return true;
    }
    GSLC_DEBUG_PRINT("-----------------------------------------------\n", "");

  }
  else {
    return false;
  }

}

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 (with no support for GUI elements)
  if (!gslc_Init(&m_gui, &m_drv, NULL, 0, m_asFont, MAX_FONT)) { return; }

  // Use default font
  if (!gslc_FontAdd(&m_gui, E_FONT_TXT, GSLC_FONTREF_PTR, NULL, 1)) { return; }

  m_pFont = gslc_FontGet(&m_gui, E_FONT_TXT);

  DrawBackground();

  bool m_bDetectPinsOk = DetectPins();
}

void loop()
{

}

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


different debug config

different debug config

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


compiling code!

compiling code!


Cleaned Up Serial Code

Cleaned Up Serial Code

error: pathspec 'Data' did not match any file(s) known to git
error: pathspec 'Logging/Data-Logging-Main/Data-Logging-Main.ino' did not match any file(s) known to git


First commit of project test script.

First commit of project test script.

/**
 *             robot_arm_test_script.ino
 * Purpose:    Quick and dirty scripts to test parts of my project robot.
 *
 * @author:    Tyler Lucas
 * Student ID: 3305203
 * Date:       September 28, 2017
 * Version     0.1
 *
 * References: N/A
 *
 */

#include <Servo.h>  // servo library

#define sonarTrigPin 13
#define sonarEchoPin 12
#define servo0PWMPin 11
#define servo1PWMPin 9
#define servo2PWMPin 8
#define servo3PWMPin 6
#define forceLVccPin 5
#define forceRVccPin 4
#define servo0PosPin A0
#define servo1PosPin A1
#define servo2PosPin A2
#define servo3PosPin A3
#define forceLPin A4
#define forceRPin A5

Servo servo[4];  // servo control objects
int angles[4] = { 90, 65, 90, 60 };   // initial angles

void setup()
{
  servo[0].attach( servo0PWMPin );   // swivel
  servo[1].attach( servo1PWMPin );   // boom
  servo[2].attach( servo2PWMPin );   // pincher
  servo[3].attach( servo3PWMPin );   // main arm
  for ( int n=0; n<4; n++ )
    servo[n].write( angles[n] );

  pinMode(sonarTrigPin, OUTPUT);
  pinMode(sonarEchoPin, INPUT);

  Serial.begin(9600);
}

void loop()
{
  Serial.println();

  Serial.print("Servo #");
  int servo_num = -1;
  while ( servo_num < 0 || servo_num > 3 )
  {
    while ( Serial.available() == 0 ) { }
    servo_num = Serial.parseInt();
    if ( servo_num < 0 || servo_num > 3 )
      Serial.print("\n Umm.. nope. Try again.\nServo #");
  }
  Serial.println( servo_num );

  Serial.print("Angle: ");
  while ( Serial.available() == 0 ) { }
  int angle = Serial.parseInt();
  Serial.println( angle );

  angle = constrain_servo_angle(servo_num, angle);

  Serial.print("Setting servo #");
  Serial.print( servo_num );
  Serial.print(" to ");
  Serial.print( angle );
  Serial.println(" degrees.");

  go_to(servo_num, angle);

  Serial.print("Servo #");
  Serial.print( servo_num );
  Serial.print(" set to ");
  Serial.print( angles[servo_num] );
  Serial.println(" degrees.");
}

int constrain_servo_angle(int servo_number, int input_angle)
{
  switch ( servo_number )
  {
  case 0: return constrain(input_angle, 0, 180);
  case 1:
    if (angles[3] < 60)
      return constrain(input_angle, formulaZ(angles[3]), formulaA(angles[3]));
    else if (angles[3] >= 60 && angles[3] < 70)
      return constrain(input_angle, formulaY(angles[3]), formulaB(angles[3]));
    else if (angles[3] >= 70 && angles[3] < 80)
      return constrain(input_angle, formulaY(angles[3]), formulaC(angles[3]));
    else if (angles[3] >= 80 && angles[3] < 100)
      return constrain(input_angle, formulaX(angles[3]), formulaC(angles[3]));
    else if (angles[3] >= 100 && angles[3] < 110)
      return constrain(input_angle, formulaX(angles[3]), formulaD(angles[3]));
    else if (angles[3] >= 110 && angles[3] < 120)
      return constrain(input_angle, formulaW(angles[3]), formulaE(angles[3]));
    else if (angles[3] >= 120 && angles[3] < 140)
      return constrain(input_angle, formulaV(angles[3]), formulaE(angles[3]));
    else if (angles[3] >= 140)
      return constrain(input_angle, formulaU(angles[3]), formulaE(angles[3]));
    else
      return -1;
  case 2: return constrain(input_angle, 65, 140);
  case 3: return constrain(input_angle, 60, 140);
  default: return -1;
  }
}

int formulaA(int angle) { return 140; }
int formulaB(int angle) { return 140 + (angle - 60) * (135-140)/(70-60); }
int formulaC(int angle) { return 135; }
int formulaD(int angle) { return 135 + (angle - 100) * (130-135)/(110-100); }
int formulaE(int angle) { return 130; }
int formulaZ(int angle) { return 65; }
int formulaY(int angle) { return 65 + (angle - 60) * (54-65)/(80-60); }
int formulaX(int angle) { return 54 + (angle - 80) * (20-54)/(110-80); }
int formulaW(int angle) { return 20 + (angle - 110) * (25-20)/(120-110); }
int formulaV(int angle) { return 25 + (angle - 120) * (18-25)/(140-120); }
int formulaU(int angle) { return 18; }

int constrain_servo_angle_conservatively(int servo_number, int input_angle)
{
  switch ( servo_number )
  {
  case 0: return constrain(input_angle, 15, 165);
  case 1: return constrain(input_angle, 65, 130);
  case 2: return constrain(input_angle, 65, 140);
  case 3: return constrain(input_angle, 60, 140);
  default: return -1;
  }
}

/*
 * Increments towards the intended angle, keeping other angles in valid ranges.
 */
void go_towards(int servo_number, int angle)
{
  angle = constrain_servo_angle(servo_number, angle);

  int diff = angle - angles[servo_number];
  int dir;
  if (diff == 0)
    dir = 0;
  else
    dir = diff / abs(diff);

  angles[servo_number] += dir;
  servo[servo_number].write( angles[servo_number] );

  if ( servo_number == 3)
  {
    angles[(servo_number + 2) % 4] = constrain_servo_angle((servo_number + 2) % 4, angles[(servo_number + 2) % 4]);
    servo[(servo_number + 2) % 4].write( angles[(servo_number + 2) % 4] );
  }

//  if ( angles[servo_number] % 15 == 0 )
//    Serial.print(angles[servo_number]);
}

void go_to(int servo_number, int angle)
{
  int min_delay_time = 10, max_delay_time = 100, delay_time = max_delay_time;

  int previous_angle;
  do {
    previous_angle = angles[servo_number];

    delay(delay_time);

    go_towards(servo_number, angle);

    if ( abs(angle - angles[servo_number]) > 15 && delay_time > min_delay_time )
      delay_time -= min_delay_time;
    else if ( abs(angle - angles[servo_number]) <= 15 && delay_time < max_delay_time)
      delay_time += min_delay_time;
  } while ( previous_angle - angles[servo_number] != 0 );
}

double readSonar()
{
  long duration;

  digitalWrite(sonarTrigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(sonarTrigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(sonarTrigPin, LOW);

  duration = pulseIn(sonarEchoPin, HIGH);
  return 0.146 * duration - 23.843;  // returns in mm
}

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


IR Sensor Arduino code. Publishes range data using ROS interface.

/*
 * rosserial IR Ranger Example
 *
 */

#include <ros.h>
#include <std_msgs/Int32.h>

ros::NodeHandle  nh;

std_msgs::Int32 irReading;

// topic name is range_data
ros::Publisher irSensor( "range_data", &irReading);

int pin = 0;
int val = 0;

void setup()
{
  //Serial.begin(9600);
  nh.initNode();
  nh.advertise(irSensor);
}

void loop()
{
  // publish the range value
  val = analogRead(pin);
  irReading.data = val;
  irSensor.publish(&irReading);
  //Serial.println(val);
  nh.spinOnce();
  delay(5000);
}

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


Added Yun Example (With Static CIK)

Added Yun Example (With Static CIK)

//*****************************************************************************
//
// YunReadWriteString - A simple example showing how to use the Exosite
//                      library on the Arduino Yún with a static CIK.
//
// Copyright (c) 2013 Exosite LLC.  All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:

//  * Redistributions of source code must retain the above copyright notice,
//    this list of conditions and the following disclaimer.
//  * Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
//  * Neither the name of Exosite LLC nor the names of its contributors may
//    be used to endorse or promote products derived from this software
//    without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
//*****************************************************************************

#include <Bridge.h>
#include <YunClient.h>
#include <Exosite.h>
#include <EEPROM.h>

/*==============================================================================
* Configuration Variables
*
* Change these variables to your own settings.
*=============================================================================*/
String cikData = "0000000000000000000000000000000000000000";  // <-- Fill in your CIK here! (https://portals.exosite.com -> Add Device)

// Use these variables to customize what datasources are read and written to.
String readString = "command&uptime";
String writeString = "uptime=";
String returnString;

/*==============================================================================
* End of Configuration Variables
*=============================================================================*/
class YunClient client;
Exosite exosite(cikData, &client);

/*==============================================================================
* setup
*
* Arduino setup function.
*=============================================================================*/
void setup(){
  Bridge.begin();
  Serial.begin(115200);
  Serial.println("Boot");
}

/*==============================================================================
* loop
*
* Arduino loop function.
*=============================================================================*/
void loop(){
  //Write to "uptime" and read from "uptime" and "command" datasources.
  if ( exosite.writeRead(writeString+String(millis()), readString, returnString)){
    Serial.println("OK");
    Serial.println(returnString);
  }else{
    Serial.println("Error");
  }

  delay(5000);
}

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


PushbuttonExample

PushbuttonExample

#include <Pushbutton.h>

/*
 * This example uses the Pushbutton library to demonstrate three different
 * methods for detecting a button press and release. It blinks the yellow
 * user LED each time the Zumo user button is pressed and released. You can
 * still use this demo without a Zumo Shield if you connect a normally-open
 * momentary pushbutton between digital pin 12 and ground on your Arduino.
 */

#define LED_PIN 13

/*
 * Create a Pushbutton object for pin 12 (the Zumo user pushbutton pin)
 * with default settings, which enables the internal pull-up on the pin
 * and interprets a HIGH pin value as the default (unpressed) state of the
 * button. (Optional arguments can be passed to the constructor to specify
 * other button types and connection methods; see the documentation for
 * details.)
 */
Pushbutton button(ZUMO_BUTTON);

void setup()
{
  pinMode(LED_PIN, OUTPUT);
}

void loop()
{
  /*
   * Method 1: Directly read the state of the button with the isPressed()
   * function. You must debounce the button yourself with this method.
   */
  do
  {
    while (!button.isPressed());  // wait for button to be pressed
    delay(10);                    // debounce the button press
  }
  while (!button.isPressed());    // if button isn't still pressed, loop

  do
  {
    while (button.isPressed());   // wait for button to be released
    delay(10);                    // debounce the button release
  }
  while (button.isPressed());     // if button isn't still released, loop

  // blink LED
  digitalWrite(LED_PIN, HIGH);
  delay(200);
  digitalWrite(LED_PIN, LOW);

  /*
   * Method 2: Use the waitForButton() function, which blocks and doesn't
   * return until a button press and release are detected. This function
   * takes care of button debouncing.
   */
  button.waitForButton();

  // blink LED
  digitalWrite(LED_PIN, HIGH);
  delay(200);
  digitalWrite(LED_PIN, LOW);

  /*
   * Method 3: Call the getSingleDebouncedRelease() function repeatedly
   * in a loop, which returns true to report a single button release or false
   * otherwise. This function takes care of button debouncing. If you have
   * multiple buttons, you can call getSingleDebouncedRelease() or
   * getSingleDebouncedPress() in a loop for all of them until one of them
   * returns true.
   */
  while (1)
  {
    if (button.getSingleDebouncedRelease())
    {
      // blink LED
      digitalWrite(LED_PIN, HIGH);
      delay(200);
      digitalWrite(LED_PIN, LOW);

      break;
    }
  }
}

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


you should write to the correct motors …


First commit. Basic rotary control.

First commit. Basic rotary control.

int encoderPin1 = 2;
int encoderPin2 = 3;

int enc1LastValue;
int counter = 0;

char* streams[] = {"primero", "segundo", "tercero",
                    "cuarto", "quinto", "sexto",
                    "septimo", "octavo", "noveno"};

int streamsSize = sizeof(streams)/sizeof(char*);

void setup() {

  Serial.begin (9600);
  Serial.println(streamsSize);

  pinMode(encoderPin1, INPUT);
  digitalWrite(encoderPin1, HIGH);
  enc1LastValue = digitalRead(encoderPin1);

  pinMode(encoderPin2, INPUT);
  digitalWrite(encoderPin2, HIGH);

}

void loop() {

  int enc1Value = digitalRead(encoderPin1);
  int enc2Value = digitalRead(encoderPin2);

  if (enc1Value != enc1LastValue) {
    delay(1);
    if (enc1Value == LOW) {
      (enc2Value == enc1Value) ? counter++ : counter--;
      if (counter<0) {
        counter = 0;
      }
      if (counter>=streamsSize) {
        counter = streamsSize-1;
      }
      Serial.print(counter);
      Serial.print(": ");
      Serial.println(streams[counter]);
    }
    enc1LastValue = enc1Value;
  }
}

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


Added TA project v2

Added TA project v2

#include <SPI.h>
#include <Ethernet.h>
#include <Keypad.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>

const char server_addr[] = "192.168.2.4";
byte mac[] = {
  0x90, 0xA2, 0xDA, 0x0E, 0xF5, 0xF8};
byte ip[] = {
  192,168,1,73};

EthernetServer server(80);
boolean device_status = true;

const byte ROWS = 4;
const byte COLS = 3;
char keys[ROWS][COLS] = {
  {
    '1','2','3'  }
  ,
  {
    '4','5','6'  }
  ,
  {
    '7','8','9'  }
  ,
  {
    '*','0','#'  }
};

byte rowPins[ROWS] = {
  2, 3, 4, 5};
byte colPins[COLS] = {
  6, 7, 8};

Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS );
LiquidCrystal_I2C lcd(0x27,20,4);
Servo myservo;

char pass[16];
int attempt = 0;
int count = 0;
int max_attempt = 3;

const int sensor = A2;
const int push_btn = A3;
const int servo = 9;

void setup(){
  Serial.begin(9600);
  Ethernet.begin(mac, ip);
  server.begin();
  pinMode(sensor, INPUT);
  digitalWrite(sensor, HIGH);
  pinMode(push_btn, INPUT);
  digitalWrite(push_btn, HIGH);
  myservo.write(70);
  Serial.println("ready");
}

void loop(){
  EthernetClient client = server.available();
  if(client){
    while(client.connected()){
      if(client.available()){
        if(client.find("GET /")){
          while(client.findUntil("command_", "\n\r")){
            char type = client.read();
            if(type == 'o') {
              Serial.println("Open Command");
              client.println("HTTP/1.1 200 OK");
              client.println("Content-Type: application/json");
              client.println();
              client.print("{\"response\":\"open\"}");
            }
            else if(type == 's'){
              int val = client.parseInt();
              Serial.println("Status Command");
              if(val == 2){
                device_status = true;
                Serial.println("Activate");
                client.println("HTTP/1.1 200 OK");
                client.println("Content-Type: application/json");
                client.println();
                client.print("{\"response\":\"activate\"}");
              }
              else if(val == 0){
                device_status = false;
                Serial.println("Deactivate");
                client.println("HTTP/1.1 200 OK");
                client.println("Content-Type: application/json");
                client.println();
                client.print("{\"response\":\"deactivate\"}");
              }
              else{
                Serial.println("Unexpected command");
                client.println("HTTP/1.1 200 OK");
                client.println("Content-Type: application/json");
                client.println();
                client.print("{\"response\":\"invalid_status\"}");
              }
            }
            else if(type == 'a') {
              Serial.println("Pinging");
              client.println("HTTP/1.1 200 OK");
              client.println("Content-Type: application/json");
              client.println();
              client.print("{\"response\":\"online\"}");
            }
            else if(type == 'c') {
              Serial.println("Check Status");
              client.println("HTTP/1.1 200 OK");
              client.println("Content-Type: application/json");
              client.println();
              if(device_status){
                client.print("{\"response\":\"active\"}");
              }
              else{
                client.print("{\"response\":\"non-active\"}");
              }
            }
            else {
              Serial.print("Unexpected type ");
              Serial.print(type);
              client.println("HTTP/1.1 200 OK");
              client.println("Content-Type: application/json");
              client.println();
              client.print("{\"response\":\"invalid\"}");
            }
          }
        }
        break;
      }
    }
    delay(10);
    client.stop();
  }
  if(digitalRead(push_btn) == LOW){
    auth_user("keluar");
    open_door();
  }

  if(device_status){
    char key = keypad.getKey();
    if (key != NO_KEY && key != '*'){
      pass[count] = key;
      count++;
    }
    if(key == '*'){
      attempt++;
      auth_user(pass);
      sys_init();
    }
    if(key == '#'){
      sys_init();
    }
  }
}

void sys_init(){
  memset(pass, 0, sizeof pass);
  count = 0;
}

void auth_user(char user_input[]){
  EthernetClient client;
  Serial.println("Sending");
  if (client.connect(server_addr,80))
  {
    client.print("GET /api/dcs/dcs_auth/");
    client.print(user_input);
    Serial.println(user_input);
    client.print(" HTTP/1.1\n");
    client.print("Host: 192.168.2.4\n");
    client.print("Connection: close\n\n");
    Serial.println("Sending success");
  }
  else{
    Serial.println("Sending failed");
  }
}

void open_door(){
  Serial.println("Door open");
  delay(1000);
}

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


Three stack tower

Three stack tower

int dir1PinA = 13;
int speedPinA = 11;
int buze = 4;
double AcX, AcY, AcZ;
double error1;
double e1 = 0;
double e2 = 0;
double e3 = 0;
double error_average;
int current_angle = 0;
int target_angle = 0;
int Kp = 3;

void motorControl(int pwm1, int dir1){
  int p1;
  if (pwm1 >= 255) {p1 = 255;}
  else {p1 = pwm1;}
  if (dir1 == 1){
    digitalWrite(dir1PinA, LOW);
    analogWrite(speedPinA,p1);
    }
  if (dir1 == 2){
    digitalWrite(dir1PinA, HIGH);
    analogWrite(speedPinA, p1);
    }
}

void setup() {

  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(dir1PinA, OUTPUT);
  pinMode(speedPinA, OUTPUT);
  pinMode(buze, OUTPUT);
}

void loop() {
  AcX = (analogRead(A5)-342)/68.0;
  AcZ = (analogRead(A3)-350)/70.0;
  error1 = round(atan2(AcX, AcZ)/3.14*180);
  e1 = e2;
  e2 = e3;
  e3 = error1;
  error_average = (e1 + e2 + e3)/3;
  current_angle = error_average;
  int error = current_angle - target_angle;
  if (error > 0) {
    motorControl(Kp * error, 1);
  } else {
    motorControl(- Kp * error, 2);
  }

  Serial.print("  accel_X_reading is ");Serial.print(AcX);
  Serial.print("  accel_Z_reading is ");Serial.print(AcZ);
  Serial.print("error is");Serial.println(error_average);
  digitalWrite(buze, LOW);
  // put your main code here, to run repeatedly:
  delay(20);

}

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


Shorten lines so it doesn't wrap when copied to my MSWord doc. Replaced min speed hardcode in MotorGo with const int variable.

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


Sketches: Add sparkcore-glow-rgbled

Sketches: Add sparkcore-glow-rgbled

Fix https://github.com/gmacario/learning-arduino/issues/30

/*
 * Glow a RGB LED on a Spark Core
 * Adapted from https://learn.adafruit.com/rgb-led-strips/example-code
 */

int led_r = A4;
int led_g = A5;
int led_b = A6;

int FADESPEED = 5;     // make this higher to slow down

void setup() {
    Serial.begin(9600);
    pinMode(led_r, OUTPUT);
    pinMode(led_g, OUTPUT);
    pinMode(led_b, OUTPUT);
}

void loop() {
  int r, g, b;

  Serial.println("fade from blue to violet");
  for (r = 0; r < 256; r++) {
    analogWrite(led_r, r);
    delay(FADESPEED);
  }
  Serial.println("fade from violet to red");
  for (b = 255; b > 0; b--) {
    analogWrite(led_b, b);
    delay(FADESPEED);
  }
  Serial.println("fade from red to yellow");
  for (g = 0; g < 256; g++) {
    analogWrite(led_g, g);
    delay(FADESPEED);
  }
  Serial.println("fade from yellow to green");
  for (r = 255; r > 0; r--) {
    analogWrite(led_r, r);
    delay(FADESPEED);
  }
  Serial.println("fade from green to teal");
  for (b = 0; b < 256; b++) {
    analogWrite(led_b, b);
    delay(FADESPEED);
  }
  Serial.println("fade from teal to blue");
  for (g = 255; g > 0; g--) {
    analogWrite(led_g, g);
    delay(FADESPEED);
  }
}

error: pathspec 'Sketches/sparkcore-glow-rgbled/sparkcore-glow-rgbled.ino' did not match any file(s) known to git


POSTPIR_OK ULTRASON_OK LED_KO

POSTPIR_OK ULTRASON_OK LED_KO

/*
  Repeating Web client

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

 This example uses DNS, by assigning the Ethernet client with a MAC address,
 IP address, and DNS address.

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

 created 19 Apr 2012
 by Tom Igoe
 modified 21 Jan 2014
 by Federico Vanzati

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

 */

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

String data = "{\"name\":\"TESTPOSTMULTI\"}";

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

// initialize the library instance:
EthernetClient client;

//char server[] = "www.arduino.cc";
IPAddress server(192,168,1,16);

unsigned long lastConnectionTime = 0;             // last time you connected to the server, in milliseconds
const unsigned long postingInterval = 10L * 1000L; // delay between updates, in milliseconds
// the "L" is needed to use long type numbers

void setup() {
  // start serial port:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

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

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

  // if ten seconds have passed since your last connection,
  // then connect again and send data:
  if (millis() - lastConnectionTime > postingInterval) {
    httpRequest();
  }

}

// this method makes a HTTP connection to the server:
void httpRequest() {
  // close any connection before send a new request.
  // This will free the socket on the WiFi shield
  client.stop();

  // if there's a successful connection:
  if (client.connect(server, 8000)) {
    Serial.println("connecting...");
    // send the HTTP GET request:
    client.println("POST /api/addsensor HTTP/1.1");
      client.println("Host: 192.168.1.16");
      client.println("Content-Type: application/x-www-form-urlencoded");
      client.println("Connection: close");
      client.println("User-Agent: Arduino/1.0");
      client.print("Content-Length: ");
      client.println(data.length());
      client.println();
      client.print(data);
      client.println();

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

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


added hardware tester for I2C messages

added hardware tester for I2C messages

error: pathspec 'hardware' did not match any file(s) known to git
error: pathspec 'testers/Oscillator/CheckIncomingI2Cmessages/CheckIncomingI2Cmessages.ino' did not match any file(s) known to git


added beacon encoder sketch

added beacon encoder sketch

#define CONTROL_PIN 6

void transmit_encoded_signal(char encoded_signal){
  //Send start signal (off for 100ms on for 500ms)
  digitalWrite(CONTROL_PIN,LOW);
  delay(100);
  digitalWrite(CONTROL_PIN,HIGH);
  delay(500);
  digitalWrite(CONTROL_PIN,LOW);
  delay(100);
  //Write encoded signal, each bit is written for 100ms

  //Most significant bit
  digitalWrite(CONTROL_PIN,(encoded_signal&B10000000)==B10000000);
  delay(100);
  digitalWrite(CONTROL_PIN,(encoded_signal&B01000000)==B01000000);
  delay(100);
  digitalWrite(CONTROL_PIN,(encoded_signal&B00100000)==B00100000);
  delay(100);
  digitalWrite(CONTROL_PIN,(encoded_signal&B00010000)==B00010000);
  delay(100);
  digitalWrite(CONTROL_PIN,(encoded_signal&B00001000)==B00001000);
  delay(100);
  digitalWrite(CONTROL_PIN,(encoded_signal&B00000100)==B00000100);
  delay(100);
  digitalWrite(CONTROL_PIN,(encoded_signal&B00000010)==B00000010);
  delay(100);
  //Least significant bit
  digitalWrite(CONTROL_PIN,(encoded_signal&B00000001)==B00000001);
  delay(100);

}
void setup(){
  Serial.begin(9600);
  pinMode(CONTROL_PIN,OUTPUT);
}

void loop(){
  transmit_encoded_signal(B11111111);
  delay(2000);
}

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


add RainbowCycle demo

add RainbowCycle demo

#include "Adafruit_NeoPixel.h"

#define pixelCount 5 // number of pixels in the chain; doesn't hurt to have less actual pixels in
Adafruit_NeoPixel strip = Adafruit_NeoPixel(pixelCount, LED_BUILTIN_RGB,
                                            NEO_GRB + NEO_KHZ800);

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

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
    }
    strip.show();
    delay(wait);
  }
}

void setup() {
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
  rainbowCycle(20);
}

// Code based on Adafruit Neopixel examples

error: pathspec 'examples-ltc/4.RainbowTape/RainbowCycle/RainbowCycle.ino' did not match any file(s) known to git


Colorful Light

Colorful Light

there were some noisy color changes when switching from one color to
another color, fixed that by making sure that the ranges are all
continues.

error: pathspec 'Action' did not match any file(s) known to git
error: pathspec 'Modules/RGB' did not match any file(s) known to git
error: pathspec 'LED/RGBLEDATtiny/RGBLEDATtiny.ino' did not match any file(s) known to git


Optimise data types

Optimise data types

fatal: remote error: upload-pack: not our ref c44d8166d2aa0ef8fa289faac54dcb9c4b17bc4f
fatal: the remote end hung up unexpectedly


Latest driver

Latest driver

/***************************************************
           ArcEyes MD03 I2C sandbox
             by David Wilman
   MD03 over I2C code by By James Henderson 2012
****************************************************/

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

 //int LCD pins on I2C bus
 #define I2C_ADDR 0x27
 #define BACKLIGHT_PIN 3
 #define En_pin  2
 #define Rw_pin  1
 #define Rs_pin  0
 #define D4_pin  4
 #define D5_pin  5
 #define D6_pin  6
 #define D7_pin  7
 LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

const int potPin1 = A0;
const int potPin2 = A1;
const int potPin3 = A2;
const int rlyPin1 = 7; // Relay Pin for break
const int rlyPin2 = 8; // Relay Pin for break
const int rlyPin3 = 9; // Relay Pin for break
const int motorPinSpeed1 = 3;
const int motorPinSpeed2 = 10;
const int motorPinSpeed3 = 11;
const int motorPinDir1 = 2;
const int motorPinDir2 = 4;
const int motorPinDir3 = 5;
boolean direct1 = LOW; // Stores what direction the motor should run in
boolean direct2 = LOW; // Stores what direction the motor should run in
boolean direct3 = LOW; // Stores what direction the motor should run in
float speedControl1 = 0; //store the current speed
float speedControl2 = 0; //store the current speed
float speedControl3 = 0; //store the current speed
long previousMillis = 0;  // store the time LCD was last updated
long interval = 50; // time setween lcd updates

//serial
String inputString = "";         // a string to hold incoming data
boolean stringComplete = false;  // whether the string is complete

void setup(){
  Wire.begin(); //start I2C bus
  delay(100); //wait for bus to stabalise
  pinMode(rlyPin1,OUTPUT); // Setup pins
  pinMode(rlyPin2,OUTPUT); // Setup pins
  pinMode(rlyPin3,OUTPUT); // Setup pins
  pinMode(motorPinDir1,OUTPUT); // Setup pins
  pinMode(motorPinDir2,OUTPUT); // Setup pins
  pinMode(motorPinDir3,OUTPUT); // Setup pins
  lcd.begin (16,2); // 2 rows x 16 char
  // Switch on the backlight
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("ArcEyes MD03 I2C");
  lcd.setCursor(0,1);
  lcd.print("SandBox");
  delay(30);
  //lcd.clear();

  //serial

    Serial.begin(9600);
  // reserve 200 bytes for the inputString:
  inputString.reserve(200);
}

void loop(){
  direct1 = manualSpeedControl(motorPinSpeed1, potPin1, rlyPin1, motorPinDir1, direct1, speedControl1);
  direct2 = manualSpeedControl(motorPinSpeed2, potPin2, rlyPin2, motorPinDir2, direct2, speedControl2);
  direct3 = manualSpeedControl(motorPinSpeed3, potPin3, rlyPin3, motorPinDir3, direct3, speedControl3);

    // print the string when a newline arrives:
  if (stringComplete) {
    Serial.println(inputString);
    // clear the string:
    inputString = "";
    stringComplete = false;
  }

}

byte manualSpeedControl(int speedPin, byte potPin, int rlyPin, int dirPin, byte direct, int speedControl){
    int potVal = analogRead(potPin);
    if(potVal < 450){               //Sets reverse speed from Pot1
      digitalWrite(rlyPin, LOW);
      speedControl = map(potVal, 450, 0, 0, 250);
      direct = LOW;
    }
    else if(potVal < 573){          // sets zero speed from Pot1
      digitalWrite(rlyPin, HIGH);
      speedControl = 0;
    }
    else if (potVal >= 574){        // sets forward speed from Pot1
      digitalWrite(rlyPin, LOW);
      speedControl = map(potVal, 574, 1023, 0, 250);
      direct = HIGH;
    }
    analogWrite(speedPin, speedControl);
    digitalWrite(dirPin, direct);

    return direct;
}
/*
byte getData(int address, byte reg){                   // function for getting data from MD03
  Wire.beginTransmission(address);
  Wire.write(reg);
  Wire.endTransmission();

  byte data = 0;
  //for (int i; i<100; i++){
    Wire.requestFrom(address, 1);         // Requests byte from MD03
    while(Wire.available() < 1);          // Waits for byte to become availble
    data = Wire.read();
    //}

  return(data);
}

void sendData(int address, byte reg, byte val){         // Function for sending data to MD03
  Wire.beginTransmission(address);         // Send data to MD03
    Wire.write(reg);
    Wire.write(val);
  Wire.endTransmission();
}
*/
/*
  SerialEvent occurs whenever a new data comes in the
 hardware serial RX.  This routine is run between each
 time loop() runs, so using delay inside loop can delay
 response.  Multiple bytes of data may be available.
 */
void serialEvent() {
  while (Serial.available()) {
    // get the new byte:
    char inChar = (char)Serial.read();
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print(inChar);
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    }
  }
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print(inputString);

}

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


REV14 hardware test

REV14 hardware test

uint8_t ch = 0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(19200);
  Serial.println("start");
}

void loop() {
  // put your main code here, to run repeatedly:
  uint8_t inBuf[64];
  uint8_t outBuf[128];

  for(uint8_t i = 0; i < sizeof(inBuf); i++) {
    inBuf[i] = i + (ch * sizeof(inBuf));
  }

  Serial.print("ReturnVal: ");
  Serial.println(getHex(inBuf, outBuf, sizeof(outBuf)));
  for(uint8_t i = 0; i < sizeof(inBuf); i++) {
    Serial.print(inBuf[i], HEX);
  }
  Serial.println();
  Serial.write(outBuf, sizeof(outBuf));
  Serial.println();
  Serial.println();
  ch++;
  while (ch == 4) {}
  delay(500);
}

bool getHex(const uint8_t *string, uint8_t *output, uint8_t outputLen)
{
  if((string || output) == NULL) return false; // check for null pointer
    uint8_t counter = outputLen;
    // convert to hex
  while(counter) {
    uint8_t highValue = *string >> 4;
    uint8_t lowValue  = *string & 0x0f;
    uint8_t temp;

    temp = highValue;
    if(temp <= 9) temp += '0';
    else temp += ('A' - 10);
    *output++ = temp;

    temp = lowValue;
    if(temp <= 9) temp += '0';
    else temp += ('A'-10);
    *output++ = temp;

    string++;
    counter -= 2;
  }
  return true;
}

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


Connecting of computer mouse on SpikeRecorder with Arduino Due

error: pathspec 'Muscle/Arduino' did not match any file(s) known to git
error: pathspec 'Code/Mouse/MouseAndSpikeRecorder.ino' did not match any file(s) known to git


Add plain hhi code

Add plain hhi code

/* Arduino Code for an EMG SpikerShield to control a TENS device, LED lights, and a gripper */

#include <Servo.h>  //Includes the Gripper Servo Library
Servo ServoGripper; //Declares the Name of the Servo to be ServoGripper -- this is all if you want to control a gripper hand as well

#define NUM_LED 6  //sets the maximum numbers of LEDs
#define MAX_Low 100   //for people with low EMG activity
#define MAX_High 254//for people with high EMG activity
#define Threshold 3 // this sets the light to activate TENS
#define threshold_degrees 10 //Number of steps the Servo will have

int reading[10];
int finalReading;
int StimPin = 3; // TENS Digital 3
int SwitchPin = 4;   // pushbutton connected to digital pin 4 -  this will momentarily turn on TENS
int SwitchThreshold = 7; //pushbutton connected to digital pin 7 - this will switch thresholds
int GripPin = 2; //Digital Out that controls Servo Motor Gripper Hand
int SwitchState = 0;
int SwitchThresholdState = 0;
int MAX = 0;
byte litLeds = 0;
byte multiplier = 1;
byte leds[] = {8, 9, 10, 11, 12, 13};
int aQ1 = 11;
int aQ2 = 13;
int aQ3 = 8;

const int UpdateTime = 200; // (number of milliseconds between updating servo position -- if too low you will burn motor out)
unsigned long OldTime = 0;
int old_degrees = 0;
int new_degrees = 0;

void setup(){
  Serial.begin(9600); //begin serial communications
  ServoGripper.attach(GripPin); //Declare the Servo to be Connected to GripPin
  pinMode(StimPin, OUTPUT); // Set TENS output to StimPin
  pinMode(SwitchPin, INPUT);      // sets the digital pin 4 as the switch input
  pinMode(SwitchThreshold, INPUT);      // sets the digital pin 7 as the threshold changer
  for(int i = 0; i < NUM_LED; i++){ //initialize LEDs as outputs
    pinMode(leds[i], OUTPUT);
  pinMode(aQ1, OUTPUT);

  }
  MAX = MAX_High; //This sets the default to people with high EMG activity.

}

void loop(){

    //note the serial print stuff is sjust debugging tools
    SwitchThresholdState = digitalRead(SwitchThreshold);
    if (SwitchThresholdState == HIGH){ // This will allow the switching between a low threshold and high threshold state on S2
    if (MAX == MAX_High){ MAX = MAX_Low; digitalWrite(aQ3, HIGH);}
    else{
     MAX = MAX_High; digitalWrite(aQ2, HIGH); }
    while (SwitchThresholdState == HIGH) { // This will pause the program while the person is touching the threshold button,
    SwitchThresholdState = digitalRead(SwitchThreshold);
    delay(10); }                         // so it doesn't flip back and forth while button is pushed
    }

    SwitchState = digitalRead(SwitchPin);
    //Serial.println(SwitchState);
    if (SwitchState == HIGH){ // This will activate the TENS if the PushButton is pressed on S1
    digitalWrite(StimPin, HIGH), digitalWrite(aQ1, HIGH);
    //Serial.println('Stim');
     while (SwitchState == HIGH) { // This will pause the program while the person is touching TENS test button
    SwitchState = digitalRead(SwitchPin);
    delay(10); }
    }

  for(int i = 0; i < 10; i++){    //take ten readings in ~0.02 seconds
    reading[i] = analogRead(A0) * multiplier;
    delay(2);
  }
  for(int i = 0; i < 10; i++){   //average the ten readings
    finalReading += reading[i];
  }
  finalReading /= 10;
  for(int j = 0; j < NUM_LED; j++){  //write all LEDs low and stim pin low

    digitalWrite(leds[j], LOW);
    digitalWrite(StimPin, LOW);
  }
  Serial.println(finalReading);
  //Serial.print("\t");
  finalReading = constrain(finalReading, 0, MAX);
  litLeds = map(finalReading, 0, MAX, 0, NUM_LED);
  //Serial.println(litLeds);

  for(int k = 0; k < litLeds; k++){
    digitalWrite(leds[k], HIGH); // This turns on the LEDS
    if (k >= Threshold){
      digitalWrite(StimPin, HIGH); // This turns on the TENS as a function of which LED is lit
    }
  }

  new_degrees = map(finalReading, 0 ,MAX, 165, 0); //Translate the analog reading to degrees for the servo (from 165° to 0°).

if (millis() - OldTime > UpdateTime){
  if(abs(new_degrees-old_degrees) > threshold_degrees){
    ServoGripper.write(new_degrees); //Move the servo according to the degrees calculated
  }
  OldTime = millis();
  old_degrees = new_degrees;
}
   //delay(10);
  //for serial debugging, uncomment the next two lines.
  //Serial.println(finalReading);
  //delay(100);
}

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


Create PotMeterRead.ino

Create PotMeterRead.ino

error: pathspec 'The' did not match any file(s) known to git
error: pathspec 'Things' did not match any file(s) known to git
error: pathspec 'Network/potmeter-workshop/PotMeterRead/PotMeterRead.ino' did not match any file(s) known to git


Added comments, cleaned code.

Added comments, cleaned code.

There was a fair amount of code that was still in place that was no longer needed. Removed that.

The comments were sparse, so I added a fair amount and tried to get them a bit more readable/understandable.

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/erikjlane/tracktimer.git/'


Add new revision of energino sketch, this version shall support both version of energino

/*
 * Energino
 *
 * Energino is a energy consumption meter for DC loads
 *
 * This sketch connects an Arduino equipped with the Energino
 * shield and with an Ethernet shield with a web service
 * implementing the COSM (formely Pachube) REST API. It also
 * implements a serial interface.
 *
 * Circuit:
 *  Analog inputs attached to pins A0 (Current), A1 (Voltage)
 *  Digital output attached to pin D3 (Relay)
 *
 * Supported commands from the serial:
 *  #P<integer>, sets the period between two updates (in ms) [default is 2000]
 *  #S<0/1>, sets the relay configuration, 0 load on, 1 load off [default is 0]
 *  #A<integer>, sets the value in ohms of the R1 resistor [default is 100000]
 *  #B<integer>, sets the value in ohms of the R2 resistor [default is 10000]
 *  #C<integer>, sets the offset in mV of the current sensor [default is 2500]
 *  #D<integer>, sets the sensitivity in mV of the current sensor [default is 185]
 *  #R, resest the configuration to the defaults
 *  #F<feed>, sets the feed id [default is 0]
 *  #K<key>, sets the COSM authentication key [default is -]
 *  #H, sets the remote host ip address [default is 216.52.233.121 (Cosm)]
 *  #O, sets the remote host port [default is 80]
 *
 * No updates are sent over the Ethernet interface if the feed id is set to 0
 *
 * Serial putput:
 *   #Energino,0,<voltage>,<current>,<power>,<relay>,<period>,<samples>,<ip>,<port>,<host>,<port>,<feed>,<key>
 *
 * RESTful interface:
 *  This sketch accepts HTTP requests in the form GET /<cmd>/<param>/[value], where "cmd"
 *  can be either "read" or "write", param is one of the following parameters:
 *   datastreams [read]
 *   switch [read|write]
 *  Examples:
 *   GET http://<ipaddress>/read/datastreams
 *   GET http://<ipaddress>/read/switch
 *   GET http://<ipaddress>/write/switch/0
 *   GET http://<ipaddress>/write/switch/1
 *
 * created 31 October 2012
 * by Roberto Riggio
 *
 * This code is released under the BSD Licence
 *
 */

#include <SPI.h>
#include <Ethernet.h>
#include <EEPROM.h>
#include <avr/eeprom.h>

// comment/uncomment to disable/enable debug
#define DEBUG

#define RELAY_PIN 3
#define STRING_BUFFER_SIZE 300

#ifdef DEBUG
#define DBG if(1)
#else
#define DBG if(0)
#endif

// Feed id
const long FEED = 0;
// Cosm key
const char KEY[] = "-";

// Cosm configuration
IPAddress HOST(216,52,233,121);
const long PORT = 80;

// This configuration is used when DHCP fails
IPAddress IP(172,25,18,219);
IPAddress MASK(255,255,255,0);
IPAddress GW(172,25,18,254);

// Energino parameters
int R1 = 100;
int R2 = 10;
int OFFSET = 2500;
int SENSITIVITY = 850;
int PERIOD = 2000;

// Buffers used for parsing HTTP request lines
char buffer[STRING_BUFFER_SIZE];
char r[10];

// Server configuration parameters, energino will listen for
// incoming requests on this port
const long SERVER_PORT = 8180;

// Accumulators
long VRaw;
long IRaw;

// Control loop paramters
long sleep = 0;
long delta = 0;

// Last computed values
float VFinal = 0.0;
float IFinal = 0.0;

// Not found page
const char CONTENT_404[] = "HTTP/1.1 404 Not Found\n\n";

// Not implemented page
const char CONTENT_501[] = "HTTP/1.1 501 Not Implemented\n\n";

// JSON response header and footer
const char JSON_RESPONSE_BEGIN[] = "HTTP/1.1 200 OK\nContent-Type: application/json\n\n[";
const char JSON_RESPONSE_END[] = "]\n";

// magic string
const char MAGIC[] = "Energino";
const int REVISION = 0;

// Minimum period for Ethernet updates
const long MIN_ETHERNET_PERIOD = 2000;

// Permanent configuration
struct settings_t {
  char magic[17];
  byte mac[6];
  char apikey[49];
  long period;
  int r1;
  int r2;
  int offset;
  int sensitivity;
  long feed;
  IPAddress host;
  long port;
}
settings;

// working vars
EthernetServer server(SERVER_PORT);

void reset() {
  DBG Serial.println("Writing defaults.");
  strcpy (settings.magic,MAGIC);
  settings.period = PERIOD;
  settings.r1 = R1;
  settings.r2 = R2;
  settings.offset = OFFSET;
  settings.sensitivity = SENSITIVITY;
  settings.feed = FEED;
  settings.host = HOST;
  settings.port = PORT;
  strcpy (settings.apikey,KEY);
  randomSeed(analogRead(0));
  settings.mac[0] = 0x90;
  settings.mac[1] = 0xA2;
  settings.mac[2] = 0xDA;
  for (int i = 3; i < 6; i++) {
    settings.mac[i] = random(0, 255);
  }
}

void setup() {
  // Default on
  pinMode(RELAY_PIN,OUTPUT);
  digitalWrite(RELAY_PIN, LOW);
  pinMode(13,OUTPUT);
  digitalWrite(13, LOW);
  // configuring serial
  Serial.begin(115200);
  // Loading setting
  eeprom_read_block((void*)&settings, (void*)0, sizeof(settings));
  if (strcmp(settings.magic, MAGIC) != 0) {
    reset();
    eeprom_write_block((const void*)&settings, (void*)0, sizeof(settings));
  }
  // set sleep counter
  resetSleep(settings.period);
  // Print hw address
  char macstr[18];
  snprintf(macstr, 18, "%02x:%02x:%02x:%02x:%02x:%02x", settings.mac[0], settings.mac[1], settings.mac[2], settings.mac[3], settings.mac[4], settings.mac[5]);
  DBG Serial.print("HWAddr: ");
  DBG Serial.println(macstr);
  // Try to configure the ethernet using DHCP
  DBG Serial.println("Running DHCP...");
  if (Ethernet.begin(settings.mac) == 0) {
    DBG Serial.println("DHCP failed, using static IP.");
    // Use static IP
    Ethernet.begin(settings.mac, IP, MASK, GW);
  }
  // Give the Ethernet shield a second to initialize:
  delay(1000);
  // Start server
  server.begin();
}

void loop() {

  // Make sure that update period is not too high
  if ((settings.feed != 0) && (settings.period < MIN_ETHERNET_PERIOD)) {
    DBG Serial.println("Update period is too high, resetting.");
    resetSleep(MIN_ETHERNET_PERIOD);
  }

  // Start profiling
  long started = millis();

  // Parse incoming commands
  serParseCommand();

  // Listen for incoming requests
  handleRequests();

  // Instant values are too floating,
  // let's smooth them up
  VRaw = 0;
  IRaw = 0;

  int skipCount = 0;

  for(long i = 0; i < sleep; i++) {
    VRaw += analogRead(A1);
    IRaw += analogRead(A0);
  }

  // Conversion
  VFinal = scaleVoltage((float)VRaw/sleep);
  IFinal = scaleCurrent((float)IRaw/sleep);

  // send data to remote host
  sendData();

  // Control loop
  delta = abs(millis() - started);
  sleep -= 5 * (delta - settings.period);
  if (sleep < 5) {
    sleep = 5;
  }

}

void serParseCommand()
{
  char cmd = '\0';
  int i, serAva;
  char inputBytes[60] = {
    '\0'       };
  char * inputBytesPtr = &inputBytes[0];
  if (Serial.available() > 0) {
    delay(5);
    serAva = Serial.available();
    for (i=0; i<serAva; i++) {
      char chr = Serial.read();
      if (i == 0) {
        if (chr != '#') {
          return;
        }
        else {
          continue;
        }
      }
      else if (i == 1) {
        cmd = chr;
      }
      else{
        inputBytes[i-2] = chr;
      }
    }
    inputBytes[i] = '\0';
  }
  if (cmd == 'F') {
    long value = atol(inputBytesPtr);
    if (value >= 0) {
      settings.feed = value;
    }
  }
  else if (cmd == 'P') {
    int value = atoi(inputBytesPtr);
    if (value > 0) {
      resetSleep(value);
    }
  }
  else if (cmd == 'A') {
    int value = atoi(inputBytesPtr);
    if (value >= 0) {
      settings.r1 = value;
    }
  }
  else if (cmd == 'B') {
    int value = atoi(inputBytesPtr);
    if (value >= 0) {
      settings.r2 = value;
    }
  }
  else if (cmd == 'C') {
    int value = atoi(inputBytesPtr);
    if (value >= 0) {
      settings.offset = value;
    }
  }
  else if (cmd == 'D') {
    int value = atoi(inputBytesPtr);
    if (value >= 0) {
      settings.sensitivity = value;
    }
  }
  else if (cmd == 'S') {
    int value = atoi(inputBytesPtr);
    if (value >= 0) {
      digitalWrite(RELAY_PIN, HIGH);
    }
    else {
      digitalWrite(RELAY_PIN, LOW);
    }
  }
  else if (cmd == 'K') {
    strncpy(settings.apikey, inputBytes,49);
    settings.apikey[48] = '\0';
  }
  else if (cmd == 'H') {
    byte host[4];
    char *p = strtok(inputBytes, ".");
    for (int i = 0; i < 4; i++) {
      host[i] = atoi(p);
      p = strtok(NULL, ".");
    }
    IPAddress hostIP = IPAddress(host);
    DBG Serial.print("New host ip address: ");
    DBG Serial.println(hostIP);
    settings.host=IPAddress(host);
  }
  else if (cmd == 'O') {
    long value = atol(inputBytesPtr);
    if (value > 0) {
      DBG Serial.print("New host port: ");
      DBG Serial.println(value);
      settings.port = value;
    }
  }
  else if (cmd == 'R') {
    reset();
  }
  eeprom_write_block((const void*)&settings, (void*)0, sizeof(settings));
}

// This method accepts HTTP requests in the form GET /<cmd>/<param>/[value]
void handleRequests() {
  EthernetClient request = server.available();
  if (request) {
    DBG Serial.println("Got request: ");
    int idx = 0;
    while (request.connected() && request.available()) {
      // Read char by char HTTP request
      char c = request.read();
      DBG Serial.print(c);
      // Store characters to string
      if (idx < STRING_BUFFER_SIZE) {
        buffer[idx] = c;
      }
      idx++;
      // If you've gotten to the end of the line (received a newline
      // character) the http request has ended, so you can send a reply
      if (c == '\n' || idx >= STRING_BUFFER_SIZE) {
        char method [5];
        char url [20];
        sscanf (buffer,"%s /%s/%s/%d",method,url);
        if (strcmp(method, "GET") == 0) {
          char * toks;
          toks = strtok (url,"/");
          if (strcmp(toks, "read") == 0) {
            toks = strtok (NULL, "/");
            if (strcmp(toks, "datastreams") == 0) {
              DBG Serial.println("Sending full datastream");
              sendContent(request,getDatastreams());
              break;
            }
            else if (strcmp(toks, "switch") == 0) {
              DBG Serial.println("Sending switch status");
              sendContent(request, digitalRead(RELAY_PIN));
              break;
            }
          }
          else if (strcmp(toks, "write") == 0) {
            toks = strtok (NULL, "/");
            if (strcmp(toks, "switch") == 0) {
              toks = strtok (NULL, "/");
              if (atoi(toks) > 0) {
                DBG Serial.println("Setting switch status to HIGH");
                digitalWrite(RELAY_PIN, HIGH);
              }
              else {
                DBG Serial.println("Setting switch status to LOW");
                digitalWrite(RELAY_PIN, LOW);
              }
              sendContent(request, digitalRead(RELAY_PIN));
              break;
            }
          }
          // send a not found response header
          request.println(CONTENT_404);
          request.println();
          break;
        }
        request.println(CONTENT_501);
        request.println();
        break;
      }
    }
    // give the web browser time to receive the data
    delay(10);
    // close the connection:
    request.stop();
  }
}

void sendContent(EthernetClient &request, long value) {
  request.println(JSON_RESPONSE_BEGIN);
  request.print(value);
  request.print(JSON_RESPONSE_END);
}

void sendContent(EthernetClient &request, char *value) {
  request.println(JSON_RESPONSE_BEGIN);
  request.print(value);
  request.print(JSON_RESPONSE_END);
}

// this method makes a HTTP connection to the server
void sendData() {
  // poll energino
  char *json = getDatastreams();
  // check if the feed has been initialized
  if (settings.feed == 0) {
    return;
  }
  // try to connect
  DBG Serial.println("Connecting.");
  EthernetClient client;
  if (client.connect(settings.host, settings.port)) {
    DBG Serial.println("connected.");
    DBG Serial.print("PUT /v2/feeds/");
    DBG Serial.println(settings.feed);
    // send the HTTP PUT request.
    client.print("PUT /v2/feeds/");
    client.print(settings.feed);
    client.print(" HTTP/1.1\n");
    client.print("X-PachubeApiKey: ");
    client.println(settings.apikey);
    client.print("User-Agent: ");
    client.println(MAGIC);
    client.print("Content-Length: ");
    client.print(strlen(json));
    client.print("\n");
    client.print("Content-Type: application/json\n");
    client.print("\n");
    // here's the actual content of the PUT request:
    client.print(json);
    delay(1000);
    // if there are incoming bytes available
    // from the server, read them and print them:
    while (client.available()) {
      char c = client.read();
      DBG Serial.print(c);
    }
    DBG Serial.print("\n");
    client.stop();
  }
  else {
    // if you couldn't make a connection:
    DBG Serial.println("Unable to connect.");
  }
}

char * getDatastreams() {
  strcpy (buffer,"{\"version\":\"1.0.0\",");
  strcat (buffer,"\"datastreams\":[");
  strcat (buffer,"{\"id\":\"current\",\"current_value\":");
  strcat (buffer,dtostrf (IFinal, 5, 3, r));
  strcat (buffer,"},");
  strcat (buffer,"{\"id\":\"voltage\",\"current_value\":");
  strcat (buffer,dtostrf (VFinal, 5, 3, r));
  strcat (buffer,"},");
  strcat (buffer,"{\"id\":\"watts\",\"current_value\":");
  strcat (buffer,dtostrf (VFinal * IFinal, 5, 3, r));
  strcat (buffer,"},");
  strcat (buffer,"{\"id\":\"switch\", \"current_value\":");
  strcat (buffer,itoa(digitalRead(RELAY_PIN),r,10));
  strcat (buffer,"}");
  strcat (buffer,"]}");
  // Print data also on the serial
  Serial.print("#");
  Serial.print(MAGIC);
  Serial.print(",");
  Serial.print(REVISION);
  Serial.print(",");
  Serial.print(VFinal,3);
  Serial.print(",");
  Serial.print(IFinal,3);
  Serial.print(",");
  Serial.print(VFinal * IFinal,3);
  Serial.print(",");
  Serial.print(digitalRead(RELAY_PIN));
  Serial.print(",");
  Serial.print(delta);
  Serial.print(",");
  Serial.print(sleep);
  Serial.print(",");
  Serial.print(Ethernet.localIP());
  Serial.print(",");
  Serial.print(SERVER_PORT);
  Serial.print(",");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(settings.host[thisByte], DEC);
    if (thisByte < 3) {
      Serial.print(".");
    }
  }
  Serial.print(",");
  Serial.print(settings.port);
  Serial.print(",");
  Serial.print(settings.feed);
  Serial.print(",");
  Serial.print(settings.apikey);
  Serial.print("\n");
  return buffer;
}

float scaleVoltage(float VRaw) {
  return ( VRaw * 5 * (settings.r1 + settings.r2)) / ( settings.r2 * 1024 );
}

float scaleCurrent(float IRaw) {
  return ( IRaw * 5 / ( 1024 ) - settings.offset) / settings.sensitivity;
}

void resetSleep(long value) {
  sleep = value / 1000 * 5000;
  settings.period = value;
}

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


making a tweak to the servo controller so it works well with the python code and fixing the \n naivety

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/VisIR/RoboCode.git/'


Added diagnostic packets for example Tzbii Tzl3B

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


Create mecanumwheels2.ino

Create mecanumwheels2.ino

const int leftrearPin = 3;    // leftrear motor connected to digital pin 3
const int leftfrontPin = 5;    // leftfront motor connected to digital pin 5
const int rightrearPin = 9;    // rightrear motor connected to digital pin 9
const int rightfrontPin = 10;    // rightfront motor  connected to digital pin 10

int sensorPin0 = A1;    // select the input pin for the  potentiometer
int sensorPin1 = A0;    // select the input pin for the potentiometer
int sensor0Value = 0;  // variable to store the value coming from the sensor
int sensor1Value = 0;  // variable to store the value coming from the sensor

int Stop = 127;

int leftfront = Stop;
int rightfront = Stop;
int leftrear = Stop;
int rightrear = Stop;

const int mandrivePin = 2;     // the number of the pushbutton pin
int mandriveState = 0;         // variable for reading the pushbutton status
int mandrive = 0;

void setup() {

    Serial.begin(115200);

    analogWrite(leftfrontPin,  leftfront);
    analogWrite(rightfrontPin, rightfront);
    analogWrite(leftrearPin,  leftrear);
    analogWrite(rightrearPin, rightrear);

    pinMode(mandrivePin, INPUT);
}

void loop() {
    mandriveState = digitalRead(mandrivePin);

    delay(20);
    if (mandriveState == LOW) {
      if (mandrive == 0) {
        mandrive = 1;
      }
      else if (mandrive == 1) {
        mandrive = 2;
      }
      else if (mandrive == 2) {
        mandrive = 0;
      }
      delay(500);
      }

    if (mandrive == 0) {

      // if there's any serial available, read it:
      while (Serial.available() > 0) {

        // look for the next valid integer in the incoming serial stream:
        int red = Serial.parseInt();
        // do it again:
        int green = Serial.parseInt();
        // do it again:
        int blue = Serial.parseInt();

        // look for the newline. That's the end of your
        // sentence:
        if (Serial.read() == '\n') {
          // constrain the values to 0 - 255 and invert
          // if you're using a common-cathode LED, just use "constrain(color, 0, 255);"
          red = 255 - constrain(red, 0, 255);
          green = 255 - constrain(green, 0, 255);
          blue = 255 - constrain(blue, 0, 255);

          red = map(red, 0, 255, -70, 325);
          green = map(green, 0, 255, -70, 325);
          blue = map(blue, 0, 255, -70, 325);

          leftfront = (green + blue + (255 - red) ) / 3 ;
          rightfront = (green + (255 - blue) + red ) / 3 ;
          leftrear = (green + blue + red) / 3 ;
          rightrear = (green + (255 - blue) + (255 - red) ) / 3 ;

          // fade the red, green, and blue legs of the LED:
          analogWrite(leftrearPin, - leftrear);
          analogWrite(rightrearPin, - rightrear);
          analogWrite(leftfrontPin, - leftfront);
          analogWrite(rightfrontPin, - rightfront);
        }
      }
    }

    else if (mandrive == 1) {
      sensor0Value = analogRead(sensorPin0);
      sensor0Value = map(sensor0Value, 0, 1023, 300, -60);
      sensor1Value = analogRead(sensorPin1);
      sensor1Value = map(sensor1Value, 0, 1023, 250, 0);

      leftfront = (sensor0Value + sensor1Value) / 2 ;
      if (leftfront >= 200) {
        leftfront = 200;
      }
      if (leftfront <= 30) {
        leftfront = 30;
      }
      rightfront = ((sensor0Value + 127) / 2) + (127 - sensor1Value) / 2 ;
      if (rightfront >= 200) {
        rightfront = 200;
      }
      if (rightfront <= 30) {
        rightfront = 30;
      }
      leftrear = (sensor0Value + sensor1Value) / 2 ;
      if (leftrear >= 200) {
        leftrear = 200;
      }
      if (leftrear <= 30) {
        leftrear = 30;
      }
      rightrear = ((sensor0Value + 127) / 2) + (127 - sensor1Value) / 2 ;
      if (rightrear >= 200) {
        rightrear = 200;
      }
      if (rightrear <= 30) {
        rightrear = 30;
      }

      analogWrite(leftrearPin, - leftrear);
      analogWrite(rightrearPin, - rightrear);
      analogWrite(leftfrontPin, - leftfront);
      analogWrite(rightfrontPin, - rightfront);

      }

    else if (mandrive == 2) {
      sensor0Value = analogRead(sensorPin0);
      sensor0Value = map(sensor0Value, 0, 1023, 250, 0);
      sensor1Value = analogRead(sensorPin1);
      sensor1Value = map(sensor1Value, 0, 1023, 250, 0);

      leftfront = (sensor0Value + sensor1Value) / 2 ;
      if (leftfront >= 200) {
        leftfront = 200;
      }
      if (leftfront <= 50) {
        leftfront = 50;
      }
      rightfront = ((sensor0Value + 127) / 2) + (127 - sensor1Value) / 2 ;
      if (rightfront >= 200) {
        rightfront = 200;
      }
      if (rightfront <= 50) {
        rightfront = 50;
      }
      leftrear = ((sensor0Value + 127) / 2) + (127 - sensor1Value) / 2 ;
      if (leftrear >= 200) {
        leftrear = 200;
      }
      if (leftrear <= 50) {
        leftrear = 50;
      }
      rightrear = (sensor0Value + sensor1Value) / 2 ;
      if (rightrear >= 200) {
        rightrear = 200;
      }
      if (rightrear <= 50) {
        rightrear = 50;
      }

      analogWrite(leftrearPin, - leftrear);
      analogWrite(rightrearPin, - rightrear);
      analogWrite(leftfrontPin, - leftfront);
      analogWrite(rightfrontPin, - rightfront);

      }

 //   Serial.println(leftfront);
 //   Serial.println(rightfront);
 //   Serial.println(leftrear);
//    Serial.println(rightrear);
//    delay(100);
  }

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


Create go_west.ino

Create go_west.ino

#include "Robox.h"
#include <Servo.h>

#include "Wire.h"
#include "I2Cdev.h"
#include "HMC5883L.h"

HMC5883L mag;
int16_t mx, my, mz;

//Here we create a Robox called "pika", which has basic moves

//Syntax:
//Robox ur_bot_name(left_wheel_pin, right_wheel_pin);

Robox pika(9,10);

void setup()
{
  //begin I2C Communication
  Wire.begin();

  //initialize magnets
  mag.initialize();

  //attach servo motors
  pika.attach();

  //begin serial interface
  Serial.begin(115200);
}

void loop()
{

  //make the robot point north
  mag.getHeading(&mx, &my, &mz);
  float heading = atan2(my, mx) * 180/M_PI;
  Serial.println(heading);
  delay(100);

/*
  pika.forward();
  delay(2000);

  Serial.println("pika.right();");
  pika.right();
  delay(2000);

  Serial.println("pika.left();");
  pika.left();
  delay(2000);

  Serial.println("pika.backward();");
  pika.backward();
  delay(2000);

  Serial.println("pika.stop();");
  pika.stop();
  delay(2000);
*/
}

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


Update pt_remote controlled car.ino

Update pt_remote controlled car.ino

pt_remote controlled car/pt_remote controlled car.ino

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


Cerveau: Gyroscope ajout calculs pitch roll yaw

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


added value echo for code send in nduin

added value echo for code send in nduin

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


update

update

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/DaveCalaway/ESP8266.git/'


BT command, include ATVER examples

BT command, include ATVER examples

#include <SoftwareSerial.h>
SoftwareSerial BT(10, 11); // RX, TX

void setup(){
  Serial.begin(9600);
  // state = IDLE;
  // digitalWrite(softpotPin, HIGH); //enable pullup resistor
  // randomSeed(analogRead(5));
  // digitalWrite(ledPin, LOW);
  BT.begin(57600);
  // XBeePacketCounter = 0;
  // pressed = false;
  // released = false;
  // last_release_time = 0;
  delay(300);
  Serial.println("system begins");

  BT.println("ATVER,ver1");
  delay(100);
  while(BT.available()){
    // Serial.print("msg receive:");
    Serial.write(BT.read());
    // Serial.println();
  }

  delay(100);

  BT.println("ATRSW,6");
  delay(100);
  while(BT.available()){
    // Serial.print("msg receive:");
    Serial.write(BT.read());
    // Serial.println();
  }

  delay(100);

  // BT.println("ATPAIR,B8F6B1196970");
  // delay(2000);
  // while(BT.available()){
  //   // Serial.print("msg receive:");
  //   Serial.write(BT.read());
  //   // Serial.println();
  // }
}

void loop(){
	if(BT.available()){
		// Serial.print("msg receive:");
		Serial.write(BT.read());
    // Serial.println();
	}
  // BT.write("send to BT\n");
  // Serial.println("send to Serial");
  if(Serial.available()){
    // char msg[100];

    // Serial.readBytesUntil('\n', msg, 100);
    // Serial.print("send via BT");
    // String msg_str = new String(msg);
    // Serial.println(msg_str);
    // BT.print(msg_str);
    // BT.write(msg);

    BT.write(Serial.read());
    BT.println();
  }
  // delay(10);

}

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


Added single-shot paintball firmware

Added single-shot paintball firmware

#include "LEDDisplay.h"
#include "EEPROM.h"

uint8_t ammo = 0;

// Inputs
const uint8_t trigger = PIN_TRIG;
const uint8_t magazine = PIN_MAG;

// Outputs
const uint8_t fpulse = 2;
const uint8_t ok = 3;

// LED pins:
//
// Left digit:
//
// A = 19
// B = 18
// C = 8
// D = 7
// E = 6
// F = 21
// G = 20
// DP = 9
//
// Right digit:
//
// A = 16
// B = 15
// C = 13
// D = 11
// E = 10
// F = 17
// G = 12
// DP = 14

const uint8_t ledPins[16] = {
	19, 18, 8, 7, 6, 21, 20, 9,
	16, 15, 13, 11, 10, 17, 12, 14
};

/*
 *     - 80 -
 *    04    40
 *     - 02 -
 *    08    20
 *     - 10 -
 *            01
 */

#define LED_EMPTY 0x009E
//#define LED_EMPTY 0x9E00
//#define LED_EMPTY 0x9E9E

const uint8_t ee_first = 0;
const uint8_t ee_duty = 1;
const uint8_t ee_start = 2;
const uint8_t ee_down = 3;
const uint8_t ee_speed1 = 4;
const uint8_t ee_speed2 = 5;
const uint8_t ee_pulse = 6;

uint8_t duty = 10;
uint8_t start = 10;
uint8_t down = 10;
uint8_t speed1 = 250;
uint8_t speed2 = 66;
uint8_t pulse = 50;

void setup() {
	Serial.begin(115200);
	LED.setPins(ledPins);
	pinMode(trigger, INPUT_PULLUP);
	pinMode(magazine, INPUT_PULLUP);
	pinMode(fpulse, OUTPUT);
	pinMode(ok, OUTPUT);
	digitalWrite(fpulse, LOW);
	digitalWrite(ok, LOW);
	uint8_t isConfigured = EEPROM.read(ee_first);

	if (isConfigured != 1) {
		EEPROM.write(ee_duty, duty);
		EEPROM.write(ee_first, 1);
		EEPROM.write(ee_start, start);
		EEPROM.write(ee_down, down);
		EEPROM.write(ee_speed1, speed1);
		EEPROM.write(ee_speed2, speed2);
		EEPROM.write(ee_pulse, pulse);
	}

	duty = EEPROM.read(ee_duty);
	start = EEPROM.read(ee_start);
	down = EEPROM.read(ee_down);
	speed1 = EEPROM.read(ee_speed1);
	speed2 = EEPROM.read(ee_speed2);
	pulse = EEPROM.read(ee_pulse);
	ammo = start;
}

enum {
	BOOT,
	IDLE,
	LOADING,
	FIRING,
	HELD,
	EMPTY,
	REMOVED,
};

void displaySettings() {
	char temp[5];
	Serial.print_P((const char *)"\x1b[2J\x1b[1;1H");
	Serial.println_P((const char *)"uPR Settings");
	Serial.println_P((const char *)"============");
	Serial.println_P((const char *)"");
	Serial.print_P((const char *)"[B/b] Brightness: ");
	sprintf(temp, "%u", duty);
	Serial.print(temp);
	Serial.println_P((const char *)"");
	Serial.print_P((const char *)"[L/l] Load speed: ");
	sprintf(temp, "%u", speed1);
	Serial.print(temp);
	Serial.println_P((const char *)"ms");
	Serial.print_P((const char *)"[F/f] Fire speed: ");
	sprintf(temp, "%u", speed2);
	Serial.print(temp);
	Serial.println_P((const char *)"ms");
	Serial.print_P((const char *)"[I/i] Initial ammo: ");
	sprintf(temp, "%u", start);
	Serial.print(temp);
	Serial.println_P((const char *)"");
	Serial.print_P((const char *)"[C/c] Countdown ammo: ");
	sprintf(temp, "%u", down);
	Serial.print(temp);
	Serial.println_P((const char *)"");
	Serial.print_P((const char *)"[P/p] Output pulse: ");
	sprintf(temp, "%u", pulse);
	Serial.print(temp);
	Serial.println_P((const char *)"ms");
	Serial.println_P((const char *)"");
}

uint8_t tweak(uint8_t *val, uint8_t min, uint8_t max, int8_t dir) {
	if ((dir == -1) && (*val <= min)) {
		*val = min;
		return 0;
	}

	if ((dir == 1) && (*val >= max)) {
		*val = max;
		return 0;
	}

	*val += dir;
	return 1;
}

void loop() {
	static uint8_t state = BOOT;
	static uint32_t ts = 0;
	static uint8_t phase = 0;
	static uint32_t saveCounter = 0;
	static uint32_t pulseCounter = 0;
	delay(1);

	if (saveCounter > 0) {
		if (millis() - saveCounter > 5000) {
			EEPROM.write(ee_duty, duty);
			EEPROM.write(ee_start, start);
			EEPROM.write(ee_down, down);
			EEPROM.write(ee_speed1, speed1);
			EEPROM.write(ee_speed2, speed2);
			saveCounter = 0;
			Serial.println_P((const char *)"Saved");
		}
	}

	if (pulseCounter > 0) {
		if (millis() - pulseCounter > pulse) {
			digitalWrite(fpulse, LOW);
			pulseCounter = 0;
		}
	}

	if (Serial.available()) {
		int sr = Serial.read();
		uint8_t changed = 0;

		switch (sr) {
			case 'B':
				changed = tweak(&duty, 0, 10, +1);
				break;

			case 'b':
				changed = tweak(&duty, 0, 10, -1);
				break;

			case 'L':
				changed = tweak(&speed1, 0, 255, +1);
				break;

			case 'l':
				changed = tweak(&speed1, 0, 255, -1);
				break;

			case 'F':
				changed = tweak(&speed2, 0, 255, +1);
				break;

			case 'f':
				changed = tweak(&speed2, 0, 255, -1);
				break;

			case 'I':
				changed = tweak(&start, 0, 99, +1);
				break;

			case 'i':
				changed = tweak(&start, 0, 99, -1);
				break;

			case 'C':
				changed = tweak(&down, 0, 99, +1);
				break;

			case 'c':
				changed = tweak(&down, 0, 99, -1);
				break;

			case 'P':
				changed = tweak(&pulse, 0, 255, +1);
				break;

			case 'p':
				changed = tweak(&pulse, 0, 255, -1);
				break;

			case 'r':
				asm("RESET");

				while (1);

				break;
		}

		if (changed != 0) {
			saveCounter = millis();
		}

		displaySettings();
	}

	if (phase < duty) {
		if (state == REMOVED) {
            LED.displayRaw(LED_EMPTY);
		} else {
            LED.displayValue(ammo);
		}
	} else {
		LED.displayRaw(0);
	}

	phase++;

	if (phase >= 10) {
		phase = 0;
	}

	if (digitalRead(magazine) == HIGH && state == BOOT) {
		state = REMOVED;
		ts = millis();
		digitalWrite(ok, LOW);
		ammo = 0;
	}

	if (digitalRead(magazine) == LOW && state == BOOT) {
		state = LOADING;
		ts = millis();
		digitalWrite(ok, LOW);
		ammo = start;
	}

	// Magazine has just been removed.
	if (digitalRead(magazine) == HIGH && state != REMOVED) {
		state = REMOVED;
		ammo = 0;
		digitalWrite(ok, LOW);
	}

	if (digitalRead(magazine) == LOW && state == REMOVED) {
		state = LOADING;
		ammo = start;
		ts = millis();
		digitalWrite(ok, LOW);
	}

	if (digitalRead(trigger) == LOW && state == IDLE) {
		state = FIRING;
		ts = millis();
	}

	if (digitalRead(trigger) == HIGH && state == FIRING) {
		state = IDLE;
	}

	if (digitalRead(trigger) == HIGH && state == HELD) {
		state = IDLE;
	}

	if (state == LOADING) {
		if (millis() - ts > speed1) {
			ts = millis();

			if (ammo == down) {
				digitalWrite(ok, HIGH);
				state = IDLE;
			} else {
				ammo--;
			}
		}
	}

	if (state == FIRING) {
		digitalWrite(fpulse, HIGH);
		pulseCounter = millis();
		ts = millis();

		if (ammo == 0) {
			digitalWrite(ok, LOW);
			state = EMPTY;
		} else {
            ammo--;
    		state = HELD;
		}
	}
}

error: pathspec 'Firmware/uPR-SingleShot-10-E/uPR-SingleShot-10-E.ino' did not match any file(s) known to git


Add files via upload

Add files via upload

Nearest Neighbor averaging upscale

Thermal Imaging HUD code/Thermal_HUD.ino

error: pathspec 'Thermal' did not match any file(s) known to git
error: pathspec 'Imaging' did not match any file(s) known to git
error: pathspec 'HUD' did not match any file(s) known to git
error: pathspec 'code/Thermal_HUD.ino' did not match any file(s) known to git


Add outside station code.

Add outside station code.

#include <dht11.h>
#include <Bridge.h>
#include <Console.h>
#include <FileIO.h>
#include <HttpClient.h>
#include <Mailbox.h>
#include <Process.h>
#include <YunClient.h>
#include <YunServer.h>

YunServer server;
dht11 dht;

int E1 = 2;
int M1 = 3;
int GROUND_0 = 5;
int GROUND_1 = 4;
int DHT11 = 4;

void setup() {
  // put your setup code here, to run once:
  pinMode(M1, OUTPUT);
  //pinMode(GROUND_0, INPUT);

  Serial.begin(9600);
  Bridge.begin();
  server.noListenOnLocalhost();
  server.begin();
}

void sendFail(YunClient client, int code, String result) {
  client.print(F("{\"code\": "));
  client.print(code);
  client.print(F(", \"result\": \""));
  client.print(result);
  client.println(F("\"}"));
}

void sendIntResult(YunClient client, int code, int result) {
  client.print(F("{\"code\": "));
  client.print(code);
  client.print(F(", \"result\": \""));
  client.print(result);
  client.println(F("\"}"));
}

void waterPollControl(YunClient client, int number) {
  if (client.read() != '/') {
    sendFail(client, 500, "invalid params");
    return;
  }
  int on = client.parseInt();
  if (on == 1 && client.read() != '/') {
    sendFail(client, 500, "invalid params");
    return;
  }
  int power = client.parseInt();
  switch (number) {
    case 0:
      digitalWrite(E1, on);
      analogWrite(M1, power);
      sendIntResult(client, 200, on);
      break;
    case 1:
      break;
    default:
      sendFail(client, 500, "no more water poll");
      break;
  }
}

void groundStatus(YunClient client, int number) {
  switch (number) {
    case 0:
      sendIntResult(client, 200, analogRead(GROUND_0));
      break;

    case 1:
      sendIntResult(client, 200, analogRead(GROUND_1));
      break;

    default:
      sendFail(client, 500, "no more ground status");
      break;
  }
}

void envStatus(YunClient client, int number) {
  int chk = dht.read(DHT11);
  switch (chk){
  case DHTLIB_OK:
    break;

  case DHTLIB_ERROR_CHECKSUM:
    sendFail(client, 500, "DHT11 checksum error.");
    return;

  case DHTLIB_ERROR_TIMEOUT:
    sendFail(client, 500, "DHT11 time out.");
    return;

  default:
    sendFail(client, 500, "DHT11 unknown error.");
    return;
  }

  switch (number) {
    case 0:
      sendIntResult(client, 200, dht.temperature);
      break;

    case 1:
      sendIntResult(client, 200, dht.humidity);
      break;

    default:
      sendFail(client, 500, "no more env status");
      break;
  }
}

void process(YunClient client) {
  String command = client.readStringUntil('/');
  Serial.println(command);
  if (command.startsWith("GET")) {
    String method = client.readStringUntil('/');
    if (method.startsWith("ground")) {
      int number = client.parseInt();
      groundStatus(client, number);
    } else if (method.startsWith("env")) {
      int number = client.parseInt();
      envStatus(client, number);
    } else {
      sendFail(client, 404, "method not be support!");
    }
  } else if (command.startsWith("PUT")) {
    String method = client.readStringUntil('/');
    if (method.startsWith("water")) {
      int number = client.parseInt();
      waterPollControl(client, number);
    } else {
      sendFail(client, 404, "method not be support!");
    }
  } else if (command.startsWith("POST")) {

  } else {
    Serial.print(command);
    Serial.println("not be support!");
    sendFail(client, 404, "method not be support!");
  }
}

void loop() {
  YunClient client = server.accept();

  if (client) {
    process(client);
    client.stop();
  }
  delay(50);
}

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


added motor test firmware

added motor test firmware

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/Denzo77/OTRadioLink.git/'


Ensure minimum spi pulse width.

Ensure minimum spi pulse width.

fatal: remote error: upload-pack: not our ref 50f9e539d8b424842f4dab9d1357b30c6db3e0d8
fatal: the remote end hung up unexpectedly


BASIC OPMODES WORKING

BASIC OPMODES WORKING

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/JulioOrdonezV/pvcloud.git/'


two circles

two circles

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/nathankoch/arduino-videosynth.git/'