demo for 2 up matrices

demo for 2 up matrices

/***************************************************
  This is a library for our I2C LED Backpacks

  Designed specifically to work with the Adafruit 16x8 LED Matrix backpacks
  ----> http://www.adafruit.com/products/2035
  ----> http://www.adafruit.com/products/2036
  ----> http://www.adafruit.com/products/2037
  ----> http://www.adafruit.com/products/2038
  ----> http://www.adafruit.com/products/2039
  ----> http://www.adafruit.com/products/2040
  ----> http://www.adafruit.com/products/2041
  ----> http://www.adafruit.com/products/2042
  ----> http://www.adafruit.com/products/2043
  ----> http://www.adafruit.com/products/2044
  ----> http://www.adafruit.com/products/2052

  These displays use I2C to communicate, 2 pins are required to
  interface. There are multiple selectable I2C addresses. For backpacks
  with 2 Address Select pins: 0x70, 0x71, 0x72 or 0x73. For backpacks
  with 3 Address Select pins: 0x70 thru 0x77

  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

Adafruit_8x16matrix matrix = Adafruit_8x16matrix();

void setup() {
  Serial.begin(9600);
  Serial.println("16x8 LED Matrix Test");

  matrix.begin(0x70);  // pass in the address
}

static const uint8_t PROGMEM
  smile_bmp[] =
  { B00111100,
    B01000010,
    B10100101,
    B10000001,
    B10100101,
    B10011001,
    B01000010,
    B00111100 },
  neutral_bmp[] =
  { B00111100,
    B01000010,
    B10100101,
    B10000001,
    B10111101,
    B10000001,
    B01000010,
    B00111100 },
  frown_bmp[] =
  { B00111100,
    B01000010,
    B10100101,
    B10000001,
    B10011001,
    B10100101,
    B01000010,
    B00111100 };

void loop() {

  matrix.clear();
  matrix.drawBitmap(0, 0, smile_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);

  matrix.clear();
  matrix.drawBitmap(0, 8, neutral_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);

  matrix.clear();
  matrix.drawBitmap(0, 0, frown_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);

  matrix.clear();      // clear display
  matrix.drawPixel(0, 0, LED_ON);
  matrix.writeDisplay();  // write the changes we just made to the display
  delay(500);

  matrix.clear();
  matrix.drawLine(0,0, 7,15, LED_ON);
  matrix.writeDisplay();  // write the changes we just made to the display
  delay(500);

  matrix.clear();
  matrix.drawRect(0,0, 8,16, LED_ON);
  matrix.fillRect(2,2, 4,12, LED_ON);
  matrix.writeDisplay();  // write the changes we just made to the display
  delay(500);

  matrix.clear();
  matrix.drawCircle(3,8, 3, LED_ON);
  matrix.writeDisplay();  // write the changes we just made to the display
  delay(500);

  matrix.setTextSize(2);
  matrix.setTextWrap(false);  // we dont want text to wrap so it scrolls nicely
  matrix.setTextColor(LED_ON);
  for (int8_t x=0; x>=-64; x--) {
    matrix.clear();
    matrix.setCursor(x,0);
    matrix.print("Hello");
    matrix.writeDisplay();
    delay(100);
  }

  matrix.setTextSize(1);
  matrix.setTextWrap(false);  // we dont want text to wrap so it scrolls nicely
  matrix.setTextColor(LED_ON);
  matrix.setRotation(1);
  for (int8_t x=7; x>=-36; x--) {
    matrix.clear();
    matrix.setCursor(x,0);
    matrix.print("World");
    matrix.writeDisplay();
    delay(100);
  }
  matrix.setRotation(0);
}

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


Test various time manipulations

Test various time manipulations

/**
 * Test various time manipulations using the RTClib and blink
 * the LED on Jeenode port 2 accordingly.
 *
 * 2015-08-16 Bill
 */

#include <JeeLib.h>
#include <Wire.h> // needed to avoid a linker error :(
#include <RTClib.h>

// boilerplate for low-power waiting
ISR(WDT_vect) { Sleepy::watchdogEvent(); }

// RTC based on the DS1307 chip connected via the Ports library
class RTC_Plug : public DeviceI2C {
    // shorthand
    static uint8_t bcd2bin (uint8_t val) { return RTC_DS1307::bcd2bin(val); }
    static uint8_t bin2bcd (uint8_t val) { return RTC_DS1307::bin2bcd(val); }
public:
    RTC_Plug (const PortI2C& port) : DeviceI2C (port, 0x68) {}

    void begin() {}

    void adjust(const DateTime& dt) {
        send();
        write(0);
        write(bin2bcd(dt.second()));
        write(bin2bcd(dt.minute()));
        write(bin2bcd(dt.hour()));
        write(bin2bcd(0));
        write(bin2bcd(dt.day()));
        write(bin2bcd(dt.month()));
        write(bin2bcd(dt.year() - 2000));
        write(0);
        stop();
    }

    DateTime now() {
      	send();
      	write(0);
        stop();

        receive();
        uint8_t ss = bcd2bin(read(0));
        uint8_t mm = bcd2bin(read(0));
        uint8_t hh = bcd2bin(read(0));
        read(0);
        uint8_t d = bcd2bin(read(0));
        uint8_t m = bcd2bin(read(0));
        uint16_t y = bcd2bin(read(1)) + 2000;

        return DateTime (y, m, d, hh, mm, ss);
    }
};

PortI2C i2cBus (1);
RTC_Plug RTC (i2cBus);
/* Port led_port (2); */

unsigned char start_hh = 14;
unsigned char start_mm = 49;
unsigned char stop_hh = 14;
unsigned char stop_mm = 50;
long start_min = 0;
long stop_min = 0;

long new_time = 0;

long toMin(const unsigned char hh, const unsigned char mm) {
  return (hh * 60) + mm;
}

void showDate(const char* txt, const DateTime& dt) {
    Serial.print(txt);
    Serial.print(' ');
    Serial.print(dt.year(), DEC);
    Serial.print('/');
    Serial.print(dt.month(), DEC);
    Serial.print('/');
    Serial.print(dt.day(), DEC);
    Serial.print(' ');
    Serial.print(dt.hour(), DEC);
    Serial.print(':');
    Serial.print(dt.minute(), DEC);
    Serial.print(':');
    Serial.print(dt.second(), DEC);
    Serial.println();
}

void setup () {
    Serial.begin(57600);
    Serial.println("\n[test times]");
    Serial.flush();

    /* led_port.mode(OUTPUT); */

    // turn the radio off completely
    rf12_initialize(17, RF12_868MHZ);
    rf12_sleep(RF12_SLEEP);
    // wait another 2s for the power supply to settle
    Sleepy::loseSomeTime(2000);

    /* Serial.print("start min "); */
    /* Serial.print(start_min); */
    /* Serial.print("stop min "); */
    /* Serial.print(stop_min); */
    /* Serial.println(); */
    /* Serial.flush(); */

    // Convert start hh:mm to a start minutes
    start_min = toMin(start_hh, start_mm);
    stop_min = toMin(stop_hh, stop_mm);

    int led_state = 0;

    // start both tasks 1.5 seconds from now
    /* scheduler.timer(TASK1, 15); */
    /* scheduler.timer(TASK2, 15); */
}

void loop () {
    // Get time
    DateTime now = RTC.now();
    showDate("dt", now);
    /* Serial.print("secs "); */
    /* Serial.println(now.get()); */
    /* Serial.println(); */

    int sec_til_ten_min = 0;
    sec_til_ten_min = 600L - (now.get() % 600L);

    /* Serial.print("secs until 10 min: "); */
    /* Serial.println(sec_til_ten_min); */

    /* long cur_min = now.hour() * 60 + now.minute(); */
    long cur_min = toMin(now.hour(), now.minute());
    Serial.print("cur min");
    Serial.println(cur_min);

    if ((cur_min >= start_min) && (cur_min < stop_min))  {
      Serial.println("Operational");
    } else {
      Serial.println("Sleep");
    }

    Serial.flush();

    // Wait 3 secs and continue
    Sleepy::loseSomeTime(3000);
    /* delay(3000); */

          // Check if should be operational
          // Set flag used
          // Check reschedule amount aganst RTC
}

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


Signed-off-by: alitai <assaf.litai@gmail.com>

//*********************************************************************
// Profile Graphs: Draw and fill the graph area
//
//  COLOR LIST:
//  ILI9341_BLACK     ILI9341_OLIVE       ILI9341_RED
//  ILI9341_NAVY      ILI9341_LIGHTGREY     ILI9341_MAGENTA
//  ILI9341_DARKGREEN   ILI9341_DARKGREY      ILI9341_YELLOW
//  ILI9341_DARKCYAN    ILI9341_BLUE        ILI9341_WHITE
//  ILI9341_MAROON      ILI9341_GREEN       ILI9341_ORANGE
//  ILI9341_PURPLE      ILI9341_CYAN        ILI9341_GREENYELLOW
//  ILI9341_PINK
//*********************************************************************
void selectandDrawProfilebyMode()
{
	if (g_cleanCycle || g_flushCycle)
	{
		graphDrawEmptyGraph(); // For cleaning cycle - Clear existing graph and draw an empty one
		return;
	}
	switch (g_pullMode)
	{
		case AUTO_PRESSURE_PROFILE_PULL:
		case AUTO_FLOW_PROFILE_PULL:
		case AUTO_PWM_PROFILE_PULL:
		case AUTO_UNION_PROFILE_PULL:
			graphDrawCurrentProfiles();
			break;

		case MANUAL_PULL:
			graphDrawEmptyGraph(); // Clear existing graph and draw an empty one
			graphDrawFLB(); //Draw line where FLB activates
			clearProfiles();
			break;

		case SLAYER_LIKE_PULL:
			graphDrawSlayerProfile();
			break;
	}
}

void graphDrawSlayerProfile()
{
	float perPixel = 1.35; //135 pixels represent 100% signal (or 1.35 pixels / 1 percent)

	graphDrawEmptyGraph();

	// Draw Flow Limited flow line (this isn't a measured number - just shows a diagram that the flow is "low")
	tft.fillRect(0, 177, 33, 80, ILI9341_BLACK);
	printSomething(" PI", 10, 256 - (slayerPIFlowRate * perPixel) , ILI9341_DARKGREY, NULL , false);
	tft.drawFastHLine(34, 260 - (slayerPIFlowRate * perPixel), slayerPIPeriod << 1 , ILI9341_DARKGREY);

	// Draw the Slayer Main PWM speed (the pressure decay is physical)
	printSomething(NULL, 100 + slayerPIPeriod , 250 - (slayerMainPWM * perPixel) , PWM_BGColor, NULL , false);
	tft.print(slayerMainPWM);
	tft.print("%");
	printSomething("PWM", 10, 256 - (slayerMainPWM * perPixel), ILI9341_DARKGREY, NULL , false);
	tft.drawFastHLine(34 + (slayerPIPeriod << 1), 260 - (slayerMainPWM * perPixel) , 200 - (slayerPIPeriod << 1) , ILI9341_DARKGREY);

	// Draw the Slayer PI Period vertical line
	printSomething(NULL, 41 + (slayerPIPeriod << 1), (257 - (slayerPIFlowRate + (((slayerMainPWM - slayerPIFlowRate) >> 1) * perPixel))) , timer_Color , NULL , false);
	tft.print(slayerPIPeriod);
	tft.print("s");
	tft.drawLine(34 + (slayerPIPeriod << 1), 260 - (slayerMainPWM * perPixel) , 34 + (slayerPIPeriod << 1) ,260 - (slayerPIFlowRate * perPixel)  , ILI9341_DARKGREY);

}

void graphDrawCurrentProfiles()
{
	float perPixel = 1.35; //135 pixels represent 100% signal (or 1.35 pixels / 1 percent)

	graphDrawEmptyGraph();
	graphDrawFLB();
	int pulseSum = 0;
	for (byte i = 0; i < 200; i++)
	{
		pulseSum += g_flowProfile[i]; // g_flowProfile stores pulses - we need to accumulate them...
		graphUpdate(g_PWMProfile[i], i, g_pressureProfile[i], pulseSum, true, false);

		// Stored profile - calculate expected pull end - print pull time and draw a vertical dashed line
		if ((i > 10) && (g_flowProfile[i]== 0)  && (g_PWMProfile[i] == 0) && (g_pressureProfile[i] == 0))
		{
			//Print pull time on graph
			printSomething(NULL, 42 + i, 210 , timer_Color, NULL , false);
			tft.print(i / 2);
			tft.print("s");
			for (int j = 0; j < 46; j++)
			tft.drawFastVLine(34+ i, 261 - j * 3,2,ILI9341_DARKGREY);
			return;
		}
	}
}

void graphUpdate(byte pumpSpeedByte, int profileIndex, int averagePressure, unsigned long flowPulseCount, boolean isBackground, boolean preInfusion)
{
	float perPixel = 1.35; //135 pixels represent 100% signal (or 1.35 pixels / 1 percent)

	char* colorPWM = PWM_Color;
	char* colorPressure = pressure_Color;
	char* colorFlow = flow_Color;

	if (isBackground) // draws profile in background (muted) colors
	{
		colorPWM = PWM_BGColor;
		colorPressure = pressure_BGColor;
		colorFlow = flow_BGColor;
	}

    // Draw 3 current graph pixels
	int graph_x = 34+profileIndex;
    tft.drawPixel(graph_x,graph_y ((float)pumpSpeedByte * perPixel * 100 / 255) , colorPWM);
	tft.drawPixel(graph_x,graph_y(averagePressure * 1.2 * perPixel),colorPressure);
	if (preInfusion)
		tft.drawPixel(graph_x,graph_y((float)flowPulseCount * mlPerFlowMeterPulsePreInfusion * perPixel),colorFlow);
	else
		tft.drawPixel(graph_x,graph_y((float)flowPulseCount * mlPerFlowMeterPulse * perPixel),colorFlow);
  // Assaf - added to draw flow rate
	if (!isBackground && preInfusion)
			tft.drawPixel(graph_x, graph_y((float)mlPerFlowMeterPulsePreInfusion * 60.0 * 1000.0 * 0.66666 / (float)g_averageF.mean()), flowRate_Color);  //150ml/min FR...
	if (!isBackground && !preInfusion)
			tft.drawPixel(graph_x, graph_y((float)mlPerFlowMeterPulse * 60.0 * 1000.0 * 0.66666 / (float)g_averageF.mean()), flowRate_Color);  //150ml/min FR...
}

unsigned graph_y(float y)
{
	return constrain(260-(unsigned)(y),120,260);
}

void graphDrawFLB()
{
	float perPixel = 1.35; //135 pixels represent 100% signal (or 1.35 pixels / 1 percent)
	// draw Flow Limiter Bypass threshold dashed line
	tft.fillRect(0, 177, 33, 80, ILI9341_BLACK);
	printSomething("FLB", 10, 256-(FLBThreshold * perPixel), ILI9341_DARKGREY, NULL , false);
	for (int i = 0; i < 70; i++)
		tft.drawFastHLine(31 + i * 3, 260 - (FLBThreshold * perPixel) , 2 , ILI9341_DARKGREY);
}

void graphDrawEmptyGraph()
{
	tft.fillRect(34, 120, 206, 141, ILI9341_BLACK); //redrawing only the graphing area so as to eliminate axis flicker......

	// Write the axis labels
	printSomething("60ml", 0, 115, flow_Color, NULL , false); //-23
	printSomething("100%", 0, 127, PWM_Color, NULL , false);
	printSomething("10bar", 0, 139, pressure_Color , NULL , false);
	printSomething("0", 23, 258, ILI9341_LIGHTGREY, NULL , false);
	printSomething("Time", 115, 270, ILI9341_LIGHTGREY, NULL , false);
	printSomething("100s", 215, 268, ILI9341_LIGHTGREY, NULL , false);
	printSomething("0s", 32, 268, ILI9341_LIGHTGREY, NULL , false);

	// draw the axis
	tft.drawFastHLine(31,262,209,ILI9341_LIGHTGREY);
	tft.fillTriangle(240,262,237,260,237,264,ILI9341_LIGHTGREY);
	tft.drawFastVLine(33,115,147,ILI9341_LIGHTGREY); //134-115 = 19
	tft.fillTriangle(33,115,31,118,35,118,ILI9341_LIGHTGREY);

	//draw axis markers
	tft.drawFastVLine(232,259,6,ILI9341_ORANGE);
	tft.drawFastHLine(30,124 ,6,ILI9341_MAGENTA);
	tft.drawFastHLine(30,125,6,ILI9341_GREEN);
	tft.drawFastHLine(30,126,6,ILI9341_CYAN);
}


Simple Spritz Arduino HMAC example

Simple Spritz Arduino HMAC example

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

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

uint8_t CORRECT_HASH[HASH_LEN];

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

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

  delay(10000);
}

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

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

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

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

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

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


This commit adds TX to the pace clock that sends hello.

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/maleagha/PaceClock.git/'


Optimise data types

Optimise data types

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


Create GPS_localization.ino

Create GPS_localization.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/localization/GPS_localization.ino' did not match any file(s) known to git


make it compile

make it compile

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


Control motor PAP con el driver BD63873EFV

/*******************************************************************************
 *
 *    Control de motor paso a paso con el driver BD63873EFV
 *
 *******************************************************************************
 * FileName:        LM4F_E012.ino
 * Processor:       EX-LM4F120XL
 * Complier:        Energia 1.6.10E18
 * Author:          Pedro Sánchez (MrChunckuee)
 * Blog:            http://mrchunckuee.blogspot.com/
 * Email:           mrchunckuee.psr@gmail.com
 * Description:     Este ejemplo es un testo para control de un motor paso a paso
 *                  con el driver BD63873EFV, ambos rescatados de una vieja impresora
 *******************************************************************************
 * Rev.         Date            Comment
 *   v0.0.0     25/03/2019      Creación del firmware
 ******************************************************************************/

#define pinButton1        PUSH1
#define pinLedRedStatus   RED_LED
#define pinLedGreenStatus GREEN_LED
#define pinLedBlueStatus  BLUE_LED
#define pinClkDriver      PA_2
#define pinCwCcwDriver    PA_3
#define pinMode1Driver    PA_4
#define pinMode2Driver    PB_6
#define pinEnableDriver   PB_7
#define pinPSDriver       PF_0

// Variables will change:
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated
long interval = 10;           // interval at which to blink (milliseconds)

void setup() {
  pinMode(pinButton1, INPUT_PULLUP);
  pinMode(pinLedRedStatus, OUTPUT);
  pinMode(pinLedGreenStatus, OUTPUT);
  pinMode(pinLedBlueStatus, OUTPUT);
  pinMode(pinClkDriver, OUTPUT);
  pinMode(pinCwCcwDriver, OUTPUT);
  pinMode(pinMode1Driver, OUTPUT);
  pinMode(pinMode2Driver, OUTPUT);
  pinMode(pinEnableDriver, OUTPUT);
  pinMode(pinPSDriver, OUTPUT);

  //Init default driver
  digitalWrite(pinCwCcwDriver, LOW); //Clockwise
  digitalWrite(pinMode1Driver, LOW); //Full step
  digitalWrite(pinMode2Driver, LOW); //Full step
  digitalWrite(pinEnableDriver, HIGH); //Active
  digitalWrite(pinPSDriver, HIGH); //Active
}

void loop() {
    unsigned long currentMillis = millis();
    if(currentMillis - previousMillis > interval) {
      // save the last time you blinked the LED
      previousMillis = currentMillis;
      // if the LED is off turn it on and vice-versa:
      if (ledState == LOW)
        ledState = HIGH;
      else
        ledState = LOW;
      // set the LED with the ledState of the variable:
      digitalWrite(pinLedGreenStatus, ledState);
      digitalWrite(pinClkDriver, ledState);
      }
}

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


some progress

some progress

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/Au1st3in/fall2015-e121-arduino-code.git/'


final version of the thing, finally

final version of the thing, finally

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


adding Hello World example and preparing for Arduino IDE

/*
  06/01/2016
  Author: Makerbro
  Platforms: ESP8266
  Language: C++
  File: HelloWorld.ino
  ------------------------------------------------------------------------
  Description:
  Demo for OLED display -- writing a string.
  ------------------------------------------------------------------------
  Please consider buying products from ACROBOTIC to help fund future
  Open-Source projects like this! We'll always put our best effort in every
  project, and release all our design files and code for you to use.
  https://acrobotic.com/
  ------------------------------------------------------------------------
  License:
  Released under the MIT license. Please check LICENSE.txt for more
  information.  All text above must be included in any redistribution.
*/
#include <Wire.h>
#include <ACROBOTIC_SSD1306.h>

void setup()
{
  Wire.begin();
  oled.init();                      // Initialze SSD1306 OLED display
  oled.clearDisplay();              // Clear screen
  oled.setTextXY(0,1);              // Set cursor position
  oled.putString("   ACROBOTIC   ");
  oled.setTextXY(0,2);              // Set cursor position
  oled.putString("  industries   ");
}

void loop()
{
}

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


arduino sequencer simple

arduino sequencer simple

#define ARRAYSIZE(x) (sizeof(x)/sizeof(*x))

const int ledStep1 = 2;
const int ledStep2 = 3;
const int ledStep3 = 4;
const int ledStep4 = 5;

const int ledStep5 = 6;
const int ledStep6 = 7;
const int ledStep7 = 8;
const int ledStep8 = 9;

const int gate = 13;

const int button1 = 11;
const int button2 = 12;
const int pot1 = A5;

int stepArray[] = {ledStep1, ledStep2, ledStep3, ledStep4, ledStep5, ledStep6, ledStep7, ledStep8};
int randArray[8];
//int stepArray[5] = {ledStep1, ledStep2, ledStep3, ledStep4};

int beat = 120;
int curvalue = -1;

int stepCounter = 0;

int mode = 0;

void setup() {
  // put your setup code here, to run once:
  pinMode(ledStep1, OUTPUT);
  pinMode(ledStep2, OUTPUT);
  pinMode(ledStep3, OUTPUT);
  pinMode(ledStep4, OUTPUT);
  pinMode(ledStep5, OUTPUT);
  pinMode(ledStep6, OUTPUT);
  pinMode(ledStep7, OUTPUT);
  pinMode(ledStep8, OUTPUT);
  pinMode(gate, OUTPUT);
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);
  pinMode(pot1, INPUT);

  Serial.begin(9600);
}

void turnAllOff() {
  for ( int i= 0; i <= 7; i++ ) {
    digitalWrite(stepArray[i], LOW);
  }
  digitalWrite(gate, LOW);
}

void regularPlay() {
  Serial.println("regularPlay");
  turnAllOff();
  digitalWrite(stepArray[stepCounter], HIGH);
  digitalWrite(gate, HIGH);

  stepCounter++;
  if ( stepCounter >= 8 ) {
    stepCounter = 0;
  }
}

void reversePlay() {
  Serial.println("reversePlay");
  turnAllOff();
  digitalWrite(stepArray[stepCounter], HIGH);
  digitalWrite(gate, HIGH);

  stepCounter--;
  if ( stepCounter <= -1 ) {
    stepCounter = 7;
  }
}

void doublePlay() {
  Serial.println("doublePlay");
  turnAllOff();

  digitalWrite(stepArray[stepCounter], HIGH);
  digitalWrite(stepArray[stepCounter+4], HIGH);
  digitalWrite(gate, HIGH);

  stepCounter++;
  if ( stepCounter >= 4 ) {
    stepCounter = 0;
  }
}

void randomPlay() {
  Serial.println("randomPlay");
  turnAllOff();
  if ( stepCounter == 0 ) {
     for( int i = 0 ; i < 8 ; ++i ){
      randArray[ i ] = stepArray[ i ];
    }
  }
  for( int i = 0 ; i < 8 ; ++i ){
    Serial.println(randArray[i]);
  }
  Serial.println("--------");
  Serial.println(ARRAYSIZE(randArray) );
  int arr_access = randArray[random(0, 8)];
  digitalWrite( arr_access, HIGH);
  digitalWrite(gate, HIGH);
  //remove_element(arr_access
  stepCounter++;
  if ( stepCounter >= 8 ) {
    stepCounter = 0;
  }
}

int modeSelect() {
  boolean b1 = digitalRead(button1);
  boolean b2 = digitalRead(button2);
  int md = 0;
  Serial.println(b1);
  Serial.println(b2);
  if ( true ) {
    md = 0;
  }
  else if ( b1 == 0 && b2 == 0 ) {
    //Serial.println("regularPlay");
    md = 0;
  } else if ( b1 == 1 && b2 == 0 ) {
    //Serial.println("reversePlay");
    md = 1;
  } else if ( b1 == 0 && b2 == 1 ) {
    //Serial.println("doublePlay");
    md = 2;
  } else if ( b1 == 1 && b2 == 1 ) {
    md = 3;
  }

  return md;

}

void loop() {
  //beat = 30 + 220*(analogRead(pot1)/256);
  mode = modeSelect();
//  mode = 0;
  //Serial.println(stepCounter);
  //Serial.println(mode);
  //Serial.println(analogRead(pot1));
//  Serial.print("\n");
   //Serial.println(beat);
  if ( mode == 0) {
    //Serial.println("Regular play");
    regularPlay();
  } else if ( mode == 1 ) {
    //Serial.println("Alternate play");
    reversePlay();
  } else if ( mode == 2 ) {
    doublePlay();
  } else if ( mode == 3 ) {
    randomPlay();
  }
//  Serial.println(digitalRead(button1));
//  Serial.println(digitalRead(button2));
//  Serial.println(mode);
  //Serial.println(stepArray[stepCounter]);
  delay(beat);
}

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


hmm there was a lot of text in the return codes

let's reduce the code size by giving back numbers only. Sad but
neccessary


Adding App Serial Controller

Adding App Serial Controller

/* Hamshield
 * Example: SerialController
 * This application is used in conjunction with a computer to provide full serial control of HamShield.
*/

#include <HamShield.h>

#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2

HamShield radio;

uint8_t freq_buffer[32];
uint8_t pl_tx_buffer[32];
uint8_t pl_rx_buffer[32];

void setup() {
  // NOTE: if not using PWM out, it should be held low to avoid tx noise
  pinMode(PWM_PIN, OUTPUT);
  digitalWrite(PWM_PIN, LOW);

  // prep the switch
  pinMode(SWITCH_PIN, INPUT_PULLUP);

  // set up the reset control pin
  pinMode(RESET_PIN, OUTPUT);
  digitalWrite(RESET_PIN, HIGH);

  Serial.begin(9600);
  Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield");
  Serial.print("Radio status: ");
  int result = radio.testConnection();
  Serial.println(result,DEC);
  Serial.println("Setting radio to its defaults..");
  radio.initialize();
  radio.setRfPower(0);
  radio.frequency(146520);
}

void loop() {
  if(Serial.available()) {
    uint8_t buf = Serial.read();
    Serial.write(buf);
    switch (buf) {
      case 'X':                               // absorb reset command because we are already reset
        break;
      case 'F':                               // frequency configuration command
        tune_freq();  break;
      case 'P':                               // TX PL Tone configuration command
        pl_tone_tx();  break;
      case 'R':                               // RX PL Tone configuration command
        pl_tone_rx(); break;
      case 'T':                               // turn on transmitter command
        tx_on();  break;
      case 'O':                               // turn off transmitter command
        tx_off();  break;
      case 'A':                               // configure amplifier
        amplifier();  break;
      case 'D':                               // configure predeemph
        predeemph();  break;
      default:
        break;
    }
  }
}

void tx_on() {
  radio.setModeTransmit();
  Serial.println("Transmitting");
}

void tx_off() {
  radio.setModeReceive();
  Serial.println("Transmit off");
}

void pl_tone_tx() {
  Serial.println("TX PL tone");
  memset(pl_tx_buffer,0,32);
  uint8_t ptr = 0;
  while(1) {
    if(Serial.available()) {
    uint8_t buf = Serial.read();
    Serial.write(buf);
    if(buf == 'X') { return; }
    if(buf == '!') { pl_tx_buffer[ptr] = 0; program_pl_tx(); return; }
    if(ptr == 31) { return; }
    pl_tx_buffer[ptr] = buf; ptr++;
    }
  }
}

void program_pl_tx() {
  Serial.print("programming TX PL to ");
  for(int x = 0; x < 32; x++) {
  Serial.write(pl_tx_buffer[x]);
  }
  long pl_tx = atof(pl_tx_buffer);
  Serial.print(" Which is FLOAT of ");
  Serial.println(pl_tx,DEC);
  radio.setCtcssEncoder(pl_tx);
}

void pl_tone_rx() {
  Serial.println("RX PL tone");
  memset(pl_rx_buffer,0,32);
  uint8_t ptr = 0;
  while(1) {
    if(Serial.available()) {
    uint8_t buf = Serial.read();
    Serial.write(buf);
    if(buf == 'X') { return; }
    if(buf == '!') { pl_rx_buffer[ptr] = 0; program_pl_rx(); return; }
    if(ptr == 31) { return; }
    pl_rx_buffer[ptr] = buf; ptr++;
    }
  }
}

void program_pl_rx() {
  Serial.print("programming RX PL to ");
  for(int x = 0; x < 32; x++) {
  Serial.write(pl_rx_buffer[x]);
  }
  long pl_rx = atof(pl_rx_buffer);
  Serial.print(" Which is FLOAT of ");
  Serial.println(pl_rx,DEC);
  radio.setCtcssDecoder(pl_rx);
}

void tune_freq() {
  Serial.println("program frequency mode");
  memset(freq_buffer,0,32);
  uint8_t ptr = 0;
  while(1) {
    if(Serial.available()) {
       uint8_t buf = Serial.read();
       Serial.write(buf);
       if(buf == 'X') { return; }
       if(buf == '!') { freq_buffer[ptr] = 0; program_frequency(); return; }
       if(buf != '.') { freq_buffer[ptr] = buf; ptr++; }
       if(ptr == 31) { return; }
    }
  }
}

void program_frequency() {
  Serial.print("programming frequency to ");
  for(int x = 0; x < 32; x++) {
  Serial.write(freq_buffer[x]);
  }
  long freq = atol(freq_buffer);
  Serial.print(" Which is LONG of ");
  Serial.println(freq,DEC);
  radio.frequency(freq);
}

void amplifier() {
   while(1) {
    if(Serial.available()) {
       uint8_t buf = Serial.read();
       Serial.write(buf);
       if(buf == 'X') { return; }
       if(buf != '!') { radio.setRfPower(buf); return; }
       if(buf == '!') { return; }
    }
  }

  }

void predeemph() { }

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


Create Servo-2.ino

Create Servo-2.ino

error: pathspec 'Final' did not match any file(s) known to git
error: pathspec 'Project' did not match any file(s) known to git
error: pathspec 'Backup/Servo-2.ino' did not match any file(s) known to git


Revert "Revert "Initial Commit of File""

This reverts commit 2dce009f079e7dab6ab2a90b22da024efd7a7f04.

error: pathspec 'electrical/Pause' did not match any file(s) known to git
error: pathspec 'Switch/pause_switch.ino' did not match any file(s) known to git


fix comments

fix comments

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


fix i2c power control

fix i2c power control


example that accurately controls the throttle and steering via serial

#include <Smartcar.h>
#include <Wire.h>
#include <Servo.h>

Car car;

void setup() {
  Serial.begin(9600);
  Serial.setTimeout(200);
  car.begin()
}

void loop() {
  handleInput();
}

void handleInput() { //handle serial input if there is any
  if (Serial.available()) {
    String input = Serial.readStringUntil('\n');
    if (input.startsWith("m")) {
      int throttle = input.substring(1).toInt();
      car.setSpeed(throttle);
    }else if (input.startsWith("t")){
      int deg = input.substring(1).toInt();
      car.setAngle(deg);
    }
  }
}

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


clean up

clean up

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


Create yun_mqtt_rs485_i2c_LCD.ino

Create yun_mqtt_rs485_i2c_LCD.ino

#include <SimpleModbusMaster.h>
#include <SPI.h>
#include <Process.h>
#include <YunClient.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <PubSubClient.h>
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR    0x20
#define  LED_OFF  0
#define  LED_ON  1

char* clientId = "fromOVL";

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

#define baud 153600
#define timeout 200
#define polling 100
#define retry_count 10
unsigned long time;

#define MQTT_SERVER "190.97.168.236"

char message_buff[100];

int val1 = 0;
int val2 = 0;
int val3 = 0;
int val4 = 0;
long values []= {0,0,0,0};

//void callback(char* topic, byte* payload, unsigned int length);

#define TxEnablePin 2

// The total amount of available memory on the master to store data
#define TOTAL_NO_OF_REGISTERS 32

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

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

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

void callback(char* topic, byte* payload, unsigned int length);
YunClient yun;
PubSubClient client(MQTT_SERVER, 1883, callback, yun);

void setup() {

  Serial.begin(9600);

//

  // Initialize each packet
  modbus_construct(&packets[PACKET1], 1, READ_HOLDING_REGISTERS, 0, 0, 0);
  modbus_construct(&packets[PACKET2], 1, PRESET_MULTIPLE_REGISTERS, 0, 16, 0);
 // modbus_construct(&packets[PACKET3], 1, PRESET_MULTIPLE_REGISTERS, 200, 4, 0);

  modbus_configure(&Serial1, baud, SERIAL_8N2, timeout, polling, retry_count, TxEnablePin, packets, TOTAL_NO_OF_PACKETS, regs);

  lcd.begin (20,4);
  lcd.setBacklight(LED_ON);

  lcd.setCursor(0,1);

    Bridge.begin();
// client.connect("yun");
//client.publish("test/test","this works better!");
//client.subscribe("rr/temp");
redlibreconn();

}
void callback(char* topic, byte* payload, unsigned int length) {

  int i = 0;
  for(i=0; i<length; i++) {
    message_buff[i] = payload[i];
  }
  message_buff[i] = '\0';

parse();

}

void loop()
{
//client.loop();
redlibreconn();

if (val4 == 1)
{
modbus_update();
regs[0] = val1;
regs[1] = val2;
regs[2] = val3;
regs[3] = val4;

 lcd.setCursor(0,0);
 lcd.print("SA:");
 lcd.setCursor(3,0);
float val11 = val1 / 100.0;
lcd.print(val11, 1);
lcd.setCursor(7,0);
lcd.print("\337");

  lcd.setCursor(9,0);
  float val22 = val2 / 100.0;
  lcd.print(val22, 1);
  lcd.setCursor(13,0);
lcd.print("\337");

  lcd.setCursor(15,0);
  float val33 = val3 / 100.0;
    String cent = "" + (char)223 ;
  lcd.print(val33, 1);
  lcd.setCursor(19,0);
  lcd.print("%");

}
 else if (val4 == 2)
{

    // client.publish("test/temp2","es el 2");
modbus_update();
regs[4] = val1;
regs[5] = val2;
regs[6] = val3;
regs[7] = val4;

  lcd.setCursor(0,1);
 lcd.print("SB:");
 lcd.setCursor(3,1);
float val11 = val1 / 100.0;
lcd.print(val11, 1);
lcd.setCursor(7,1);
lcd.print("\337");

  lcd.setCursor(9,1);
  float val22 = val2 / 100.0;
  lcd.print(val22, 1);
  lcd.setCursor(13,1);
lcd.print("\337");

  lcd.setCursor(15,1);
  float val33 = val3 / 100.0;
    String cent = "" + (char)223 ;
  lcd.print(val33, 1);
  lcd.setCursor(19,1);
  lcd.print("%");

}

 else if (val4 == 3)
{
modbus_update();
regs[8] = val1;
regs[9] = val2;
regs[10] = val3;
regs[11] = val4;

  lcd.setCursor(0,2);
 lcd.print("SC:");
 lcd.setCursor(3,2);
float val11 = val1 / 100.0;
lcd.print(val11, 1);
lcd.setCursor(7,2);
lcd.print("\337");

  lcd.setCursor(9,2);
  float val22 = val2 / 100.0;
  lcd.print(val22, 1);
  lcd.setCursor(13,2);
lcd.print("\337");

  lcd.setCursor(15,2);
  float val33 = val3 / 100.0;
    String cent = "" + (char)223 ;
  lcd.print(val33, 1);
  lcd.setCursor(19,2);
  lcd.print("%");

}

 else if (val4 == 4)
{
modbus_update();
regs[12] = val1;
regs[13] = val2;
regs[14] = val3;
regs[15] = val4;

  lcd.setCursor(0,3);
 lcd.print("SD:");
 lcd.setCursor(3,3);
float val11 = val1 / 100.0;
lcd.print(val11, 1);
lcd.setCursor(7,3);
lcd.print("\337");

  lcd.setCursor(9,3);
  float val22 = val2 / 100.0;
  lcd.print(val22, 1);
  lcd.setCursor(13,3);
lcd.print("\337");

  lcd.setCursor(15,3);
  float val33 = val3 / 100.0;
    String cent = "" + (char)223 ;
  lcd.print(val33, 1);
  lcd.setCursor(19,3);
  lcd.print("%");

}
}

void parse()
{

     char separator[] = ",";

     char *result = NULL;
     int index = 0;

     result = strtok( message_buff, separator );
     while( (result != NULL) && (index < 4) ) {
       Serial.print(  result );
       Serial.println( );
     values[index++] = atol(result);    // become to values

     result = strtok( NULL, separator );
     }

      val1 = values[0];
      val2 = values[1];
      val3 = values[2];
      val4 = values[3];

Serial.print("valor 1: "); Serial.println(val1);
Serial.print("valor 2: "); Serial.println(val2);
Serial.print("valor 3: "); Serial.println(val3);
Serial.print("valor 4: "); Serial.println(val4);

}

void redlibreSubscribe() {
  client.subscribe("rr/temp");
}
void redlibreconn() {
  // add reconnection logics
  if (!client.connected()) {
    // connection to MQTT server
    if (client.connect(clientId)) {
      Serial.println("[PHYSICAL] Successfully connected with MQTT");
      client.publish("test/temp","holaaa");
      redlibreSubscribe(); // topic subscription
    }
  }
  client.loop();
}

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


made some fixes

made some fixes


WiFiManager test

WiFiManager test

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

//needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>         //https://github.com/tzapu/WiFiManager

//for LED status
#include <Ticker.h>
Ticker ticker;

String macToStr(const uint8_t* mac) {
  String result;
  for (int i = 4; i < 6; ++i) {
    result += String(mac[i], 16);
  }
  return result;
}

void tick()
{
  //toggle state
  int state = digitalRead(BUILTIN_LED);  // get the current state of GPIO1 pin
  digitalWrite(BUILTIN_LED, !state);     // set pin to the opposite state
}

void configModeCallback (WiFiManager *myWiFiManager) {
  Serial.println("Entered config mode");
  Serial.println(WiFi.softAPIP());
  //if you used auto generated SSID, print it
  Serial.println(myWiFiManager->getConfigPortalSSID());
  //entered config mode, make led toggle faster
  ticker.attach(0.2, tick);
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  //set led pin as output
  pinMode(BUILTIN_LED, OUTPUT);
  // start ticker with 0.5 because we start in AP mode and try to connect
  ticker.attach(0.6, tick);

  //WiFiManager
  //Local intialization. Once its business is done, there is no need to keep it around
  WiFiManager wifiManager;
  //reset saved settings
  //wifiManager.resetSettings();

  //set custom ip for portal
  //wifiManager.setAPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));

  wifiManager.setDebugOutput(true);
  //fetches ssid and pass from eeprom and tries to connect
  //if it does not connect it starts an access point with the specified name
  //here  "AutoConnectAP"
  //and goes into a blocking loop awaiting configuration

  String APNAME = "AutoConnectAP-";
  uint8_t mac[6];
  WiFi.macAddress(mac);
  APNAME += macToStr(mac);

  wifiManager.setAPCallback(configModeCallback);
/*
  wifiManager.autoConnect(APNAME.c_str(), "password123");
  //or use this for auto generated name ESP + ChipID
  //wifiManager.autoConnect();
*/

  //fetches ssid and pass and tries to connect
  //if it does not connect it starts an access point with the specified name
  //here  "AutoConnectAP"
  //and goes into a blocking loop awaiting configuration
  if(!wifiManager.autoConnect(APNAME.c_str(), "password123")) {
    Serial.println("failed to connect and hit timeout");
    //reset and try again, or maybe put it to deep sleep
    ESP.reset();
    delay(1000);
  }

  //if you get here you have connected to the WiFi
  Serial.println("connected...yeey :)");

  ticker.detach();
  //keep LED on
  digitalWrite(BUILTIN_LED, LOW);

}

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

}

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


Not sure if this added to the github before

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/sassystacks/DASS.git/'


light raking

light raking

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/andydrop/klampfinator.git/'


Create HT16K33.ino

Create HT16K33.ino

/***************************************************
  This is a library for our I2C LED Backpacks

  Designed specifically to work with the Adafruit LED Matrix backpacks
  ----> http://www.adafruit.com/products/872
  ----> http://www.adafruit.com/products/871
  ----> http://www.adafruit.com/products/870

  These displays use I2C to communicate, 2 pins are required to
  interface. There are multiple selectable I2C addresses. For backpacks
  with 2 Address Select pins: 0x70, 0x71, 0x72 or 0x73. For backpacks
  with 3 Address Select pins: 0x70 thru 0x77

  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

Adafruit_LEDBackpack matrix = Adafruit_LEDBackpack();

uint8_t counter = 0;

void setup() {
  Serial.begin(9600);
  Serial.println("HT16K33 test");

  matrix.begin(0x70);  // pass in the address
}

void loop() {
  // paint one LED per row. The HT16K33 internal memory looks like
  // a 8x16 bit matrix (8 rows, 16 columns)
  for (uint8_t i=0; i<8; i++) {
    // draw a diagonal row of pixels
    matrix.displaybuffer[i] = _BV((counter+i) % 16) | _BV((counter+i+8) % 16)  ;
  }
  // write the changes we just made to the display
  matrix.writeDisplay();
  delay(100);

  counter++;
  if (counter >= 16) counter = 0;
}

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


Added December_6_14.ino Arduino Example.

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


First version by Lucas Soubeyrand "l'ino avec l'accéléra, le gyro et l'altimètre est dans Attitude_Altitude (c'est celui qui fonctionne à 57600 bauds mais pas 9600"

#include "I2Cdev.h"
#include "MPU6050_6Axis_MotionApps20.h"

#include "MS561101BA.h"
#include "Wire.h"

#include <MsTimer2.h>
#include <VirtualWire.h>

#define UPDATE_RATE 500
#define BAUDRATE 57600

#define MOVAVG_SIZE 32

MPU6050 mpu(0x69); // <-- use for AD0 high
MS561101BA baro = MS561101BA();

// uncomment "OUTPUT_READABLE_YAWPITCHROLL" if you want to see the yaw/
// pitch/roll angles (in degrees) calculated from the quaternions coming
// from the FIFO. Note this also requires gravity vector calculations.
// Also note that yaw/pitch/roll angles suffer from gimbal lock (for
// more info, see: http://en.wikipedia.org/wiki/Gimbal_lock)
#define OUTPUT_READABLE_YAWPITCHROLL

// uncomment "OUTPUT_READABLE_WORLDACCEL" if you want to see acceleration
// components with gravity removed and adjusted for the world frame of
// reference (yaw is relative to initial orientation, since no magnetometer
// is present in this case). Could be quite handy in some cases.
#define OUTPUT_READABLE_WORLDACCEL

///******* Acc+gyro
#define LED_PIN 13 // (Arduino is 13, Teensy is 11, Teensy++ is 6)
bool blinkState = false;

// MPU control/status vars
bool dmpReady = false;  // set true if DMP init was successful
uint8_t mpuIntStatus;   // holds actual interrupt status byte from MPU
uint8_t devStatus;      // return status after each device operation (0 = success, !0 = error)
uint16_t packetSize;    // expected DMP packet size (default is 42 bytes)
uint16_t fifoCount;     // count of all bytes currently in FIFO
uint8_t fifoBuffer[64]; // FIFO storage buffer

// orientation/motion vars
Quaternion q;           // [w, x, y, z]         quaternion container
VectorInt16 aa;         // [x, y, z]            accel sensor measurements
VectorInt16 aaReal;     // [x, y, z]            gravity-free accel sensor measurements
VectorInt16 aaWorld;    // [x, y, z]            world-frame accel sensor measurements
VectorFloat gravity;    // [x, y, z]            gravity vector
float euler[3];         // [psi, theta, phi]    Euler angle container
float ypr[3];           // [yaw, pitch, roll]   yaw/pitch/roll container and gravity vector

// packet structure for InvenSense teapot demo
uint8_t teapotPacket[14] = { '$', 0x02, 0,0, 0,0, 0,0, 0,0, 0x00, 0x00, '\r', '\n' };

///////********Baro
float movavg_buff[MOVAVG_SIZE];
int movavg_i=0;

const float sea_press = 1013.25;
float press, temp;
///////************

////*** Com

struct Attitude {
  int u;
  int v;
  int w;
  int x;
  int y;
  int z;
  int t;
  int h;
  int p;
};

Attitude attitude;
// ================================================================
// ===               INTERRUPT DETECTION ROUTINE                ===
// ================================================================

volatile bool mpuInterrupt = false;     // indicates whether MPU interrupt pin has gone high
void dmpDataReady() {
    mpuInterrupt = true;
}

// ================================================================
// ===                      INITIAL SETUP                       ===
// ================================================================

void setup() {
    // join I2C bus (I2Cdev library doesn't do this automatically)
        Wire.begin();
        TWBR = 24; // 400kHz I2C clock (200kHz if CPU is 8MHz)

    // initialize serial communication
    // (115200 chosen because it is required for Teapot Demo output, but it's
    // really up to you depending on your project)
    Serial.begin(BAUDRATE);
    while (!Serial); // wait for Leonardo enumeration, others continue immediately

    // NOTE: 8MHz or slower host processors, like the Teensy @ 3.3v or Ardunio
    // Pro Mini running at 3.3v, cannot handle this baud rate reliably due to
    // the baud timing being too misaligned with processor ticks. You must use
    // 38400 or slower in these cases, or use some kind of external separate
    // crystal solution for the UART timer.

    Serial.println(F("Initializing Barometer..."));
    // Suppose that the CSB pin is connected to GND.
    // You'll have to check this on your breakout schematics
    baro.init(MS561101BA_ADDR_CSB_LOW);
    delay(100);

    // populate movavg_buff before starting loop
    for(int i=0; i<MOVAVG_SIZE; i++) {
    movavg_buff[i] = baro.getPressure(MS561101BA_OSR_4096);
    }

    // initialize device
    Serial.println(F("Initializing Gyro+Acc..."));
    mpu.initialize();

    // verify connection
    Serial.println(F("Testing device connections..."));
    Serial.println(mpu.testConnection() ? F("MPU6050 connection successful") : F("MPU6050 connection failed"));

    while (Serial.available() && Serial.read()); // empty buffer

    // load and configure the DMP
    Serial.println(F("Initializing DMP..."));
    devStatus = mpu.dmpInitialize();

    // supply your own gyro offsets here, scaled for min sensitivity
    mpu.setXGyroOffset(220);
    mpu.setYGyroOffset(76);
    mpu.setZGyroOffset(-85);
    mpu.setZAccelOffset(1788); // 1688 factory default for my test chip

    // make sure it worked (returns 0 if so)
    if (devStatus == 0) {
        // turn on the DMP, now that it's ready
        Serial.println(F("Enabling DMP..."));
        mpu.setDMPEnabled(true);

        // enable Arduino interrupt detection
        Serial.println(F("Enabling interrupt detection (Arduino external interrupt 0)..."));
        attachInterrupt(0, dmpDataReady, RISING);
        mpuIntStatus = mpu.getIntStatus();

        // set our DMP Ready flag so the main loop() function knows it's okay to use it
        Serial.println(F("DMP ready! Waiting for first interrupt..."));
        dmpReady = true;

        // get expected DMP packet size for later comparison
        packetSize = mpu.dmpGetFIFOPacketSize();
    } else {
        // ERROR!
        // 1 = initial memory load failed
        // 2 = DMP configuration updates failed
        // (if it's going to break, usually the code will be 1)
        Serial.print(F("DMP Initialization failed (code "));
        Serial.print(devStatus);
        Serial.println(F(")"));
    }

    // configure LED for output
    pinMode(LED_PIN, OUTPUT);

}

// ================================================================
// ===                    MAIN PROGRAM LOOP                     ===
// ================================================================
long last_time =0;

void loop() {
    // if programming failed, don't try to do anything
    if (!dmpReady) return;

    // wait for MPU interrupt or extra packet(s) available
    while (!mpuInterrupt && fifoCount < packetSize) {

        // other program behavior stuff here
        float temperature = baro.getTemperature(MS561101BA_OSR_4096);
        if(temperature) { temp = temperature;   }
        attitude.t = temp*100;
        //Serial.print(" temp: "); Serial.print(temp);

        press = baro.getPressure(MS561101BA_OSR_4096);
        if(press!=NULL) {      pushAvg(press);      }
        press = getAvg(movavg_buff, MOVAVG_SIZE);
        attitude.p = press;
        //Serial.print(" degC pres: "); Serial.print(press);//

        float altitude = getAltitude(press, temp);
        attitude.h = altitude;
        //Serial.print(" mbar altitude: "); Serial.print(altitude); Serial.println(" m");

        if (millis() > last_time +UPDATE_RATE)
         { sendData();
           last_time = millis();
         }

       // enf of other programm behavior
    }

    // reset interrupt flag and get INT_STATUS byte
    mpuInterrupt = false;
    mpuIntStatus = mpu.getIntStatus();

    // get current FIFO count
    fifoCount = mpu.getFIFOCount();

    // check for overflow (this should never happen unless our code is too inefficient)
    if ((mpuIntStatus & 0x10) || fifoCount == 1024) {
        // reset so we can continue cleanly
        mpu.resetFIFO();
        Serial.println(F("FIFO overflow!"));

    // otherwise, check for DMP data ready interrupt (this should happen frequently)
    } else if (mpuIntStatus & 0x02) {
        // wait for correct available data length, should be a VERY short wait
        while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount();

        // read a packet from FIFO
        mpu.getFIFOBytes(fifoBuffer, packetSize);

        // track FIFO count here in case there is > 1 packet available
        // (this lets us immediately read more without waiting for an interrupt)
        fifoCount -= packetSize;

            // display Euler angles in degrees
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetGravity(&gravity, &q);
            mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
            attitude.u = ypr[0] * 180/M_PI*100;
            attitude.v = ypr[1] * 180/M_PI*100;
            attitude.w= ypr[2] * 180/M_PI*100;
            /*Serial.print("ypr\t");  Serial.print(ypr[0] * 180/M_PI);
            Serial.print("\t");  Serial.print(ypr[1] * 180/M_PI);
            Serial.print("\t"); Serial.println(ypr[2] * 180/M_PI);*/

            // display initial world-frame acceleration, adjusted to remove gravity
            // and rotated based on known orientation from quaternion
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetAccel(&aa, fifoBuffer);
            mpu.dmpGetGravity(&gravity, &q);
            mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
            mpu.dmpGetLinearAccelInWorld(&aaWorld, &aaReal, &q);
            attitude.x = aaWorld.x;
            attitude.y = aaWorld.y;
            attitude.z = aaWorld.z;
            /*Serial.print("aworld\t");  Serial.print(aaWorld.x);
            Serial.print("\t");  Serial.print(aaWorld.y);
            Serial.print("\t");  Serial.println(aaWorld.z);*/

        // blink LED to indicate activity
        blinkState = !blinkState;
        digitalWrite(LED_PIN, blinkState);
    }
}

float getAltitude(float press, float temp) {
  //return (1.0f - pow(press/101325.0f, 0.190295f)) * 4433000.0f;
  return ((pow((sea_press / press), 1/5.257) - 1.0) * (temp + 273.15)) / 0.0065;
}

void pushAvg(float val) {
  movavg_buff[movavg_i] = val;
  movavg_i = (movavg_i + 1) % MOVAVG_SIZE;
}

float getAvg(float * buff, int size) {
  float sum = 0.0;
  for(int i=0; i<size; i++) {
    sum += buff[i];
  }
  return sum / size;

}

void sendData()
{
  //Sending data to gbase
        char SensorMsg1[7];
        //itoa(attitude.u,SensorMsg1,10);
        sprintf(SensorMsg1,"%c%d",'u',attitude.u);
        Serial.println(SensorMsg1);
        sprintf(SensorMsg1,"%c%d",'v',attitude.v);
        Serial.println(SensorMsg1);
        sprintf(SensorMsg1,"%c%d",'w',attitude.w);
        Serial.println(SensorMsg1);
        sprintf(SensorMsg1,"%c%d",'x',attitude.x);
        Serial.println(SensorMsg1);
        sprintf(SensorMsg1,"%c%d",'y',attitude.y);
        Serial.println(SensorMsg1);
        sprintf(SensorMsg1,"%c%d",'z',attitude.z);
        Serial.println(SensorMsg1);
        sprintf(SensorMsg1,"%c%d",'h',attitude.h);
        Serial.println(SensorMsg1);
        sprintf(SensorMsg1,"%c%d",'p',attitude.p);
        Serial.println(SensorMsg1);
        sprintf(SensorMsg1,"%c%d",'t',attitude.t);
        Serial.println(SensorMsg1);
        Serial.println();
}

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


uploaded ensemble seven firmware

uploaded ensemble seven firmware

/* PHOBOS - EnsembleSeven firmware v.0.2 (27.05.2017)
 *
 * using:
 * Arduino v1.8.0
 * MIDI_Library v.4.3.1 by fortyseveneffects
 * Servo Library v.1.1.2
 * EEPROM Library v.2.0.0
 *
 * plays:
 * A - 2 motors rubbing strings
 * B - 4 solenoids plucking strings
 * C - 4 solenoids plucking strings
 * D - 2 servos plucking strings
 */

#include <EEPROM.h>
#include <Servo.h>
#include <MIDI.h>
#define MIDICH 7

// MOTORS PINS
#define A1 9
#define A2 10
// SOLENOIDS_1 PINS
#define B1 5
#define B2 6
#define B3 7
#define B4 8
// SOLENOIDS_2 PINS
#define C1 44
#define C2 2
#define C3 3
#define C4 4
// SERVOS' PINS
#define D1 45
#define D2 46

/* Addresses on Arduino EEPROM for servo control parameters*/
#define S1MININC 0 // servo1 min increment (cc=120)
#define S1MAXINC 1 // servo1 max increment (cc=121)

#define S2MININC 2 // servo2 min increment (cc=122)
#define S2MAXINC 3 // servo2 max increment (cc=123)

#define S1MINANG 4 // servo1 min angle (cc=124)
#define S1MAXANG 5 // servo1 max angle (cc=125)

#define S2MINANG 6 // servo2 min angle (cc=126)
#define S2MAXANG 7 // servo2 max angle (cc=127)

// servos
Servo servo1, servo2;
bool servoState[2]; // servo state to control servos out of MIDI loop
float servoPos[2]; // servo current position
float servoInc[2]; //servo increment value which relates to movement speed
float servoMinInc[2]; // servo min increment values
float servoMaxInc[2]; // servo min increment values
float servoMinAng[2]; // servo min angle
float servoMaxAng[2]; // servo max angle

// make note to pin array
byte note2pin[38];
byte vel, pitch, val, cc;

MIDI_CREATE_DEFAULT_INSTANCE();

void setup() {
  MIDI.begin(MIDICH); // Launch MIDI and listen to channel 1
  MIDI.turnThruOn();

  // set output pins
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);

  pinMode(B1, OUTPUT);
  pinMode(B2, OUTPUT);
  pinMode(B3, OUTPUT);
  pinMode(B4, OUTPUT);

  pinMode(C1, OUTPUT);
  pinMode(C2, OUTPUT);
  pinMode(C3, OUTPUT);
  pinMode(C4, OUTPUT);

  servo1.attach(D1);
  servo2.attach(D2);

  // set servos to initial position
  servoPos[0] = midi2angle(EEPROM.read(S1MINANG));
  servo1.write(servoPos[0]);

  servoPos[1] = midi2angle(EEPROM.read(S2MINANG));
  servo2.write(servoPos[1]);

  // set servos' min&max increment values
  // NOTE: min/max inc values are between 0 and 127 (after mapped correspond to 0.1 to 10 degrees per millisecond)
  servoMinInc[0] = EEPROM.read(S1MININC);
  servoMaxInc[0] = EEPROM.read(S1MAXINC);

  servoMinInc[1] = EEPROM.read(S2MININC);
  servoMaxInc[1] = EEPROM.read(S2MAXINC);

  // set servos0 min&max angle
  // NOTE: min/max angle values are already converted to angles
  servoMinAng[0] = midi2angle( EEPROM.read(S1MINANG) );
  servoMaxAng[0] = midi2angle( EEPROM.read(S1MAXANG) );

  servoMinAng[1] = midi2angle( EEPROM.read(S2MINANG) );
  servoMaxAng[1] = midi2angle( EEPROM.read(S2MAXANG) );

  // set note2pin array
  note2pin[1] = A1;
  note2pin[3] = A2;

  note2pin[0] = B1;
  note2pin[2] = B2;
  note2pin[12] = B3;
  note2pin[13] = B4;

  note2pin[25] = C1;
  note2pin[26] = C1;
  note2pin[27] = C1;
  note2pin[36] = C1;

  note2pin[14] = D1;
  note2pin[24] = D2;
  //note2pin[37] —> there was no servo for this!!!
}

void loop() {
  if(MIDI.read()){
      switch(MIDI.getType()){
        case midi::NoteOn:
          pitch = MIDI.getData1();
          vel = MIDI.getData2();
          switch(pitch){
            // set servos' values only (activation is done in runServos function)
            case 14:
              servoInc[0] = velocity2inc( servoMinInc[0], servoMaxInc[0], vel);
              servoState[0] = true;
            break;
            case 24:
              servoInc[1] = velocity2inc( servoMinInc[1], servoMaxInc[1], vel);
              servoState[1] = true;
            break;
            // activate motors and solenoids
            default:
              analogWrite(note2pin[pitch], vel << 1);
            break;
          }

        case midi::NoteOff:
          pitch = MIDI.getData1();
          switch(pitch){
            // deactivate servos
            case 14:
              servoState[0] = false;
            break;
            case 24:
              servoState[1] = false;
            break;
            // deactivate motors and solenoids
            default:
              analogWrite(note2pin[pitch], LOW);
            break;
          }
          break;

        // CONTROL CHANGE (SET SERVO PARAMETERS)
        case midi::ControlChange:
          cc = MIDI.getData1();
          val = MIDI.getData2();
          // starting on cc=120
          EEPROM.write(cc-120, val); // store...
          updateServoParams(cc, val);//...and update
      }
  }

  runServos(); // activate servos
  delay(1); // (used only to set servo increments in a millisecond basis)
}

/***************** FUNTCIONS *****************/
byte voltage2byte(float v){
  return v*255/5.f;
}

float midi2angle(byte m){
  return 180/127.f*m;
}

float velocity2inc(byte _min, byte _max, byte v){ // translate velocity values into position increments usign a min/max inc.
  return map(v, 0, 127, _min, _max);
}

void runServos(){
  // servo1 attack
  if( servoState[0]==true && servoPos[0] < servoMaxAng[0] ){
    servo1.write(servoPos[0]);
    servoPos[0] += servoInc[0];
  }
  // servo1 release
  else if (servoState[0] == false){
    servoPos[0] = servoMinAng[0];
    servo1.write( servoPos[0] );
  }

  // servo2 attack
  if( servoState[1]==true && servoPos[1] < servoMaxAng[1] ){
    servo2.write(servoPos[1]);
    servoPos[1] += servoInc[1];
  }
  // servo2 release
  else if (servoState[1] == false){
    servoPos[1] = servoMinAng[1];
    servo2.write( servoPos[1] );
  }
}

void updateServoParams(byte addr, byte v){
  switch(addr){
    case 120:
      servoMinInc[0] = v;
      break;
    case 121:
      servoMaxInc[0] = v;
      break;
    case 122:
      servoMinInc[1] = v;
      break;
    case 123:
      servoMaxInc[1] = v;
      break;
    case 124:
      servoMinAng[0] = midi2angle(v);
      break;
    case 125:
      servoMaxAng[0] = midi2angle(v);
      break;
    case 126:
      servoMinAng[1] = midi2angle(v);
      break;
    case 127:
      servoMaxAng[1] = midi2angle(v);
      break;

    default:
    break;
  }
}

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


Fixed backlight setting

Fixed backlight setting

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


This code runs the motor tester within the lunchbox

#include <Servo.h>

// Define variables
int sensorPin = A0;    // select the input pin for the potentiometer
int sensorValue = 0;  // variable to store the value coming from the sensor
int sensorValueAdjusted = 0;
int sensorValueDrive = 0;
int forward = 6;
int forwardnum = 0;
int backward = 7;
int backwardnum = 0;
Servo myservo;

// Setup
void setup() {//If you are reading this, then something is wrong then it is TOTALLY NOT LOGAN NO'S FAULT

  pinMode(forward, INPUT_PULLUP);
  pinMode(backward, INPUT_PULLUP);
  pinMode(sensorPin, INPUT);
  Serial.begin(9600);
  myservo.attach(3);
}

//Main loop
void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);

  // adjusting value to 0 - 89
  sensorValueAdjusted = sensorValue / 11.4943820225;

  // get direction switch value
  forwardnum = digitalRead(forward);
  backwardnum = digitalRead(backward);

  // drive logic
  if(forwardnum == 0)
  {
     sensorValueDrive = 180 - sensorValueAdjusted;//91-180 (forward values) clockwise
     myservo.write(sensorValueDrive);
  }
  else if(backwardnum == 0)
  {
     sensorValueDrive = sensorValueAdjusted;//0-89 (backward values) c.clockwise
     myservo.write(sensorValueDrive);
  }
  else
     myservo.write(90);

  // print information
  Serial.print(forwardnum);
  Serial.print("\t");
  Serial.print(backwardnum);
  Serial.print("\t");
  Serial.print(sensorValue);
  Serial.print("\t");
  Serial.print(sensorValueAdjusted);
  Serial.print("\t");
  Serial.println(sensorValueDrive);

}

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


Stupid Files inside Folder for Arduino

Stupid Files inside Folder for Arduino

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


Added TestCode file

Added TestCode file

#include <Servo.h>

#include <Ultrasonic.h>

#include "FreqCount.h"

#define LEFT_SERVO_PIN  4
#define RIGHT_SERVO_PIN 5
#define IR_PIN_LEFT 6
#define IR_PIN_RIGHT 20
#define EXTINGUISHER_PIN 7
#define FLAME_LED 9
#define MIC_LED 11
#define BABY_LED 17
#define CAMERA 15
#define CAMERA_LED 16
#define GYRO_INPUT_PIN 18

//Ultrasonic Trigger and Echo pins (30-39)
#define F_L_ECHO  30  //Front-left Ultrasonic
#define F_L_TRIG  31
#define F_R_ECHO  32  //Front-right Ultrasonic
#define F_R_TRIG  33
#define R_ECHO  34  //Right Ultrasonic
#define R_TRIG  35
#define B_ECHO  36  //Back Ultrasonic
#define B_TRIG  37
#define L_ECHO  38  //Left Ultrasonic
#define L_TRIG  39

// Bounds for start sound frequency:
#define LOW_START 3306
#define HIGH_START 4294

Servo leftServo;
Servo rightServo;
Servo extinguisher;

Ultrasonic frontLeftUltrasonic(F_L_ECHO, F_L_TRIG, true);
Ultrasonic frontRightUltrasonic(F_R_ECHO, F_R_TRIG, true);
Ultrasonic leftUltrasonic(L_ECHO, L_TRIG, true);
Ultrasonic rightUltrasonic(R_ECHO, R_TRIG, true);
Ultrasonic backUltrasonic(B_ECHO, B_TRIG, true);

//Gyroscope controls
float gyroStartAngle;
float gyroTargetAngle = 0;

bool checkingMicrophone = true;
bool hearingStartSound = false;
bool robotOn = false;
unsigned long freqCount;
double closeToWall = 2;   //defines how close the robot should be (inches) to the wall to register as being "too close"

void rollForward() {
  leftServo.write(180);
  rightServo.write(0);
}

void rollBackward() {
  leftServo.write(0);
  rightServo.write(180);
}

void moveSlightLeft() {
  leftServo.write(135);
  rightServo.write(20); //Half power plus additional 25
  delay(100);
}

void moveSlightRight() {
  leftServo.write(160); //Half power plus additional 25
  rightServo.write(45);
  delay(100);
}

void stopRobot() {
  leftServo.write(90);
  rightServo.write(90);
}

boolean detectFire(){
  if(digitalRead(IR_PIN_RIGHT || IR_PIN_RIGHT)){
    return true;
  } else {
    return false;
  }
}

void startExtinguisher(){
  extinguisher.write(180);
}

void stopExtinguisher(){
  extinguisher.write(90);
}

//Gyro functions
//Resets the gyro so that the current positioning is angle "0"
void resetGyro(){
  gyroStartAngle = digitalRead(GYRO_PIN);
  gyroTargetAngle = 0;
}

//Returns the current angle of the robot relative to its starting angle
float getGyroAngle(){
  return digitalRead(GYRO_PIN)-gyroStartAngle;
}

//adjusts the target angle based on how much we want to turn and turns the robot until that target is reached
//use turn(0) to simply get the gyro back on track if it's off target
void turn(int angle){
  gyroTargetAngle += angle;
  if(gyroTargetAngle > 360){
    gyroTargetAngle = 360 - gyroTargetAngle;
  }
  if(gyroTargetAngle < 0){
    gyroTargetAngle = 360 + gyroTargetAngle
  }
  if(gyroTargetAngle < getGyroAngle()){
    leftServo.write(180);
    rightServo.write(180);
    while(gyroTargetAngle < getGyroAngle()){
      delay(50);
    }
    stopRobot();
  }else if(gyroTargetAngle > getGyroAngle()){
    leftServo.write(0);
    rightServo.write(0);
    while(gyroTargetAngle > getGyroAngle()){
      delay(50);
    }
    stopRobot();
  }
}

int detectBaby(){return 0;}
int usingCamera(){return 0;}

void extinguishFire(){
  while (detectFire()) {
     if (detectFire()){
      digitalWrite(FLAME_LED, HIGH);
     } else {
     digitalWrite(FLAME_LED, LOW);
     }

    if (frontLeftUltrasonic.getDistance() > 3) {
      rollForward();
    } else {
      stopRobot();
      delay(500);

      startExtinguisher();
      delay(500);

      if (!detectFire()) {
        stopExtinguisher();
      }
    }
    delay(100);
  }
}

void checkMicrophone() {
  // Measure sound:
  if (FreqCount.available()) {
    freqCount = FreqCount.read();
  } else {
    freqCount = 0;
  }

  // If the sound frequency is within start sound bounds, turn on robot:
  if (freqCount > LOW_START && freqCount < HIGH_START) {
    robotOn = true; // Set the robot to on
    hearingStartSound = true;
  } else {
    hearingStartSound = false;
    if (robotOn) {
      checkingMicrophone = false;
      FreqCount.end();
    }
  }
}

float calcAvg(float x,float y){
  float avg=(x+y)/2;
  return avg;
}

void startUp(){
  //ping ultrasonics twice and average the values to get (hopefully) accurate values
  float right=calcAvg(rightUltrasonic.getDistance(),rightUltrasonic.getDistance());
  float left=calcAvg(leftUltrasonic.getDistance(),leftUltrasonic.getDistance());
  float front=calcAvg(frontLeftUltrasonic.getDistance(),frontRightUltrasonic.getDistance());
  float back=calcAvg(backUltrasonic.getDistance(),backUltrasonic.getDistance());

  if(right < closeToWall && back < closeToWall && left < closeToWall) {  //robot is facing downward WITH DOG
    turn(0);
  } else if(right < closeToWall && front < closeToWall && back < closeToWall){  //robot is facing backward WITH DOG
    turn(90);
  } else if(front < closeToWall && left < closeToWall && right < closeToWall){ //robot is facing upward WITH DOG
    turn(180);
  } else if(front < closeToWall && left < closeToWall && back < closeToWall){   //robot is facing the correct direction WITH DOG
    turn(-90);
  } else if(right < closeToWall && back < closeToWall) { //downward, no dog
    turn(90);
  } else if(right < closeToWall && front < closeToWall) { //backward, no dog
    turn(180);
  } else if(front < closeToWall && left < closeToWall) { //upward, no dog
    turn(-90);
  } else {  //forward, no dog
    turn(0);
  }

  while(rightUltrasonic.getDistance() > closeToWall){   //roll forward until the first room is encountered, then kick out of function
    rollForward();
  }
}

void setup() {
  // put your setup code here, to run once:
  leftServo.attach(LEFT_SERVO_PIN);
  rightServo.attach(RIGHT_SERVO_PIN);
  extinguisher.attach(EXTINGUISHER_PIN);
  stopRobot();
  extinguisher.write(90);

  pinMode(IR_PIN_LEFT, INPUT);
  pinMode(IR_PIN_RIGHT, INPUT);

  attachInterrupt(digitalPinToInterrupt(IR_PIN_LEFT), extinguishFire, RISING);
  attachInterrupt(digitalPinToInterrupt(IR_PIN_RIGHT), extinguishFire, RISING);

  pinMode(FLAME_LED, OUTPUT);

  pinMode(MIC_LED, OUTPUT);

  pinMode(BABY_LED, OUTPUT);

  pinMode(CAMERA_LED, OUTPUT);

  pinMode(GYRO, INPUT);

  FreqCount.begin(1000); // Begin measuring sound
}

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

}

error: pathspec '2018-Firefighter-TestCode/2018-Firefighter-TestCode.ino' did not match any file(s) known to git


Add demo which uses the Wire library

Add demo which uses the Wire library

// This example demonstrates how to use the HIH61xx class with the Wire library. The HIH61xx state machine
// enables others tasks to run whilst the HIH61xx is powering up etc.

#include <Wire.h>
#include <HIH61xx.h>
#include <AsyncDelay.h>

// The "hih" object must be created with a reference to the "Wire" object which represents the I2C bus it is using.
// Note that the class for the Wire object is called "TwoWire", and must be included in the templated class name.
HIH61xx<TwoWire> hih(Wire);

AsyncDelay samplingInterval;

void setup(void)
{
#if F_CPU >= 12000000UL
    Serial.begin(115200);
#else
	Serial.begin(9600);
#endif

	Wire.begin();

	hih.initialise();
	samplingInterval.start(3000, AsyncDelay::MILLIS);
}

bool printed = true;
void loop(void)
{
	if (samplingInterval.isExpired() && !hih.isSampling()) {
		hih.start();
		printed = false;
		samplingInterval.repeat();
		Serial.println("Sampling started (using Wire library)");
	}

	hih.process();

	if (hih.isFinished() && !printed) {
		printed = true;
		// Print saved values
		Serial.print("RH: ");
		Serial.print(hih.getRelHumidity() / 100.0);
		Serial.println(" %");
		Serial.print("Ambient: ");
		Serial.print(hih.getAmbientTemp() / 100.0);
		Serial.println(" deg C");
		Serial.print("Status: ");
		Serial.println(hih.getStatus());
	}

}

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


Fixed type cast bug.

Fixed type cast bug.

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


Fixed buffer overflow error

Fixed buffer overflow error

There was a buffer overflow happening with the pitchAdjust, rollAdjust, and yawAdjust pins.  Corrected by lowering the ramp factor to +/-111 from +/-INT8_MAX.

/// Justin Lee <justin at kitten dot pink>
//
// Arduino driver for the KSPboard game
// controller.  See LICENSE and README
// for more information.

#include <Wire.h>

/// pin configurations and constants
//

#define ENABLE true
#define DISABLE false
#define NEUTRAL 2

// serial
#define SERIAL_SPEED 115200

// state pins
#define PIN_LED 13 // status
#define PIN_ENABLE A1 // this should be high to run

// helm pins
#define PIN_PITCH_U 12
#define PIN_PITCH_D 11
#define PIN_PITCH_S 5 // axis stick flag
#define PIN_ROLL_R 9
#define PIN_ROLL_L 10
#define PIN_ROLL_S 4 // axis stick flag
#define PIN_YAW_R 7
#define PIN_YAW_L 8
#define PIN_YAW_S 3 // axis stick flag

#define PIN_THROTTLE A0 // analog read

// rotary pins
#define PIN_ROT_CLK 2
#define PIN_ROT_DATA A2
#define PIN_ROT_SW // no pin yet

// ops pins
#define PIN_OP_LAUNCH 0
#define PIN_OP_STAGE 0
#define PIN_OP_ACG3 0
#define PIN_OP_ACG5 0

// delays
#define DELAY_LOOP 100
#define DELAY_START 30
#define DELAY_OP 100

// misc
#define OPS (sizeof(opPin) / sizeof(uint8_t))

// helm
#define RAMP_ADJUST 3
#define RAMP_MAX 111
#define RAMP_MIN -RAMP_MAX
#define DIR_MAX 1023
#define DIR_MIN -1023

#define PITCH_STICK digitalRead(PIN_PITCH_S)
#define ROLL_STICK digitalRead(PIN_ROLL_S)
#define YAW_STICK digitalRead(PIN_YAW_S)

#define PITCH_PINS PIN_PITCH_U, PIN_PITCH_D
#define ROLL_PINS PIN_ROLL_R, PIN_ROLL_L
#define YAW_PINS PIN_YAW_R, PIN_YAW_L

// helm control variables
int16_t pitch, yaw, roll, throttle;
int8_t pitchAdjust = 0, yawAdjust = 0, rollAdjust = 0; // for ramping the direction input

// op control variables
// state == 0 to DELAY_OP-1 -> off / debounce, state == DELAY_OP -> on
uint8_t opState[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
// operation pins set to zero are skipped
uint8_t opPin[] =
{
  0,             // null
  0,             // action group 1
  0,             // '' 2
  PIN_OP_ACG3,   // '' 3
  0,             // '' 4
  PIN_OP_ACG5,   // '' 5
  0,             // '' 6
  0,             // '' 7
  0,             // '' 8
  0,             // '' 9
  0,             // '' 10
  PIN_OP_LAUNCH, //
  PIN_OP_STAGE   //
};

// this controls whether the python script closes or not, 1 == run
boolean state = 1;

// specialized control functions

//// helper functions
//

int8_t getAdjustment(uint8_t pinH, uint8_t pinL, int8_t adj) // get control input
{
  switch (digitalRead(pinH) ? HIGH : (digitalRead(pinL) ? LOW : NEUTRAL))
  {
    case HIGH:
      if ((adj += RAMP_ADJUST) > RAMP_MAX)
        adj = RAMP_MAX;
      break;

    case LOW:
      if ((adj -= RAMP_ADJUST) < RAMP_MIN)
        adj = RAMP_MIN;
      break;

    case NEUTRAL:
    default:
      adj = 0;
  }

  return (adj);
}

int16_t getDirection(int16_t current, int8_t adj, boolean stick)
{
  // reset current if no stick flag or if adj and current are opposite signs
  if (!(adj || stick) || (current > 0 && adj < 0) || (current < 0 && adj > 0))
  {
    current = 0;
  }
  else
  {
    current += adj;

    if (current > DIR_MAX)
      current = DIR_MAX;
    else
      if (current < DIR_MIN)
        current = DIR_MIN;
  }

  return (current);
}

uint16_t getThrottle(uint8_t pin) // get throttle input
{
  return (analogRead(pin));
}

//// setup fucntions
//

void setupSerial()
{
  Wire.begin(); // start up I/O expanders

  Serial.begin(SERIAL_SPEED);
  Serial.println();
  Serial.flush();

  Serial.print(1); // enable code, super secure
  Serial.print(1);
  Serial.print(1);
}

void setupState()
{
  pinMode(PIN_LED, OUTPUT); // debug led

  pinMode(PIN_ENABLE, INPUT_PULLUP);
}

void setupHelm()
{
  pinMode(PIN_PITCH_U, INPUT_PULLUP);
  pinMode(PIN_PITCH_D, INPUT_PULLUP);
  pinMode(PIN_PITCH_S, INPUT_PULLUP);
  pinMode(PIN_ROLL_L, INPUT_PULLUP);
  pinMode(PIN_ROLL_R, INPUT_PULLUP);
  pinMode(PIN_ROLL_S, INPUT_PULLUP);
  pinMode(PIN_YAW_L, INPUT_PULLUP);
  pinMode(PIN_YAW_R, INPUT_PULLUP);
  pinMode(PIN_YAW_S, INPUT_PULLUP);
}

void setupOps()
{ // disabled while building the joystick control
  /*pinMode(PIN_OP_LAUNCH, INPUT_PULLUP);
    pinMode(PIN_OP_STAGE, INPUT_PULLUP);
    pinMode(PIN_OP_ACG3, INPUT_PULLUP);
    pinMode(PIN_OP_ACG5, INPUT_PULLUP);*/
}

//// update fucntions
//

void updateState()
{
  // tells the python client when to close
  state = digitalRead(PIN_ENABLE);
  digitalWrite(PIN_LED, state);
  Serial.println(state);
}

void updateHelm()
{
  pitchAdjust = getAdjustment(PITCH_PINS, pitchAdjust);
  pitch = getDirection(pitch, pitchAdjust, PITCH_STICK);
  Serial.println(pitch);

  rollAdjust = getAdjustment(ROLL_PINS, rollAdjust);
  roll = getDirection(roll, rollAdjust, ROLL_STICK);
  Serial.println(roll);

  yawAdjust = getAdjustment(YAW_PINS, yawAdjust);
  yaw = getDirection(yaw, yawAdjust, YAW_STICK);
  Serial.println(yaw);

  throttle = getThrottle(PIN_THROTTLE);
  Serial.println(throttle);
}

void updateOps()
{
  uint8_t ops = 0;
  uint8_t index = 0;

  for (index = 0; index < OPS; index++)
  {
    if (!opPin[index]) // if the pin is zero, skip
      continue;

    if (opState[index] > 0) // check for debounce on current pin
    {
      opState[index]--; // decrement debounce counter for current state
    }
    else // if not we can check to see if it's triggered
    {
      opState[index] = digitalRead(opPin[index]) ? DELAY_OP : 0;
      ops++;
    }
  }

  if (ops > 0) // if we have at least one operation to send
  {
    Serial.println(ENABLE);

    for (index = 0; index < OPS; index++)
    {
      if (opState[index] == DELAY_OP)
        Serial.println(index); // print it
    }
  }

  Serial.println(DISABLE);
}

//// built-in arduino functions
//

void setup()
{
  setupSerial();

  setupState();
  setupHelm();
  setupOps();

  delay(DELAY_START);
}

void loop()
{
  updateState();

  if (state)
  {
    updateHelm();
    //updateOps();
  }

  delay(DELAY_LOOP);

  Serial.println();
  Serial.flush();
}

/// Justin Lee <justin at kitten dot pink>
//
// Arduino driver for the KSPboard game
// controller.  See LICENSE and README
// for more information.

#include <Wire.h>

/// pin configurations and constants
//

#define ENABLE true
#define DISABLE false
#define NEUTRAL 2

// serial
#define SERIAL_SPEED 115200

// state pins
#define PIN_LED 13 // status
#define PIN_ENABLE A1 // this should be high to run

// helm pins
#define PIN_PITCH_U 12
#define PIN_PITCH_D 11
#define PIN_PITCH_S 5 // axis stick flag
#define PIN_ROLL_R 9
#define PIN_ROLL_L 10
#define PIN_ROLL_S 4 // axis stick flag
#define PIN_YAW_R 7
#define PIN_YAW_L 8
#define PIN_YAW_S 3 // axis stick flag

#define PIN_THROTTLE A0 // analog read

// rotary pins
#define PIN_ROT_CLK 2
#define PIN_ROT_DATA A2
#define PIN_ROT_SW // no pin yet

// ops pins
#define PIN_OP_LAUNCH 0
#define PIN_OP_STAGE 0
#define PIN_OP_ACG3 0
#define PIN_OP_ACG5 0

// delays
#define DELAY_LOOP 500
#define DELAY_START 30
#define DELAY_OP 100

// misc
#define OPS (sizeof(opPin) / sizeof(uint8_t))

// helm
#define RAMP_ADJUST 7
#define RAMP_MAX 175
#define RAMP_MIN -175
#define DIR_MAX 1023
#define DIR_MIN -1023

#define PITCH_STICK digitalRead(PIN_PITCH_S)
#define ROLL_STICK digitalRead(PIN_ROLL_S)
#define YAW_STICK digitalRead(PIN_YAW_S)

#define PITCH_PINS PIN_PITCH_U, PIN_PITCH_D
#define ROLL_PINS PIN_ROLL_R, PIN_ROLL_L
#define YAW_PINS PIN_YAW_R, PIN_YAW_L

// helm control variables
int16_t pitch, yaw, roll, throttle;
int8_t pitchAdjust = 0, yawAdjust = 0, rollAdjust = 0; // for ramping the direction input

// op control variables
// state == 0 to DELAY_OP-1 -> off / debounce, state == DELAY_OP -> on
uint8_t opState[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
// operation pins set to zero are skipped
uint8_t opPin[] =
{
  0,             // null
  0,             // action group 1
  0,             // '' 2
  PIN_OP_ACG3,   // '' 3
  0,             // '' 4
  PIN_OP_ACG5,   // '' 5
  0,             // '' 6
  0,             // '' 7
  0,             // '' 8
  0,             // '' 9
  0,             // '' 10
  PIN_OP_LAUNCH, //
  PIN_OP_STAGE   //
};

// this controls whether the python script closes or not, 1 == run
boolean state = 1;

// specialized control functions

//// helper functions
//

int8_t getAdjustment(uint8_t pinH, uint8_t pinL, int8_t adj) // get control input
{
  switch (digitalRead(pinH) ? HIGH : (digitalRead(pinL) ? LOW : NEUTRAL))
  {
    case HIGH:
      if ((adj += RAMP_ADJUST) >= RAMP_MAX)
        adj = RAMP_MAX;
      break;

    case LOW:
      if ((adj -= RAMP_ADJUST) <= RAMP_MIN)
        adj = RAMP_MIN;
      break;

    case NEUTRAL:
    default:
      adj = 0;
  }

  return (adj);
}

int16_t getDirection(int16_t current, int8_t adj, boolean stick)
{
  // reset current if no stick flag or if adj and current are opposite signs
  if (!(adj || stick) || (current > 0 && adj < 0) || (current < 0 && adj > 0))
    current = 0;

  current += adj;

  if (current > DIR_MAX)
    current = DIR_MAX;

  if (current < DIR_MIN)
    current = DIR_MIN;

  return (current);
}

uint16_t getThrottle(uint8_t pin) // get throttle input
{
  return (analogRead(pin));
}

//// setup fucntions
//

void setupSerial()
{
  Wire.begin(); // start up I/O expanders

  Serial.begin(SERIAL_SPEED);
  Serial.println();
  Serial.flush();

  Serial.print(1); // enable code, super secure
  Serial.print(1);
  Serial.print(1);
}

void setupState()
{
  pinMode(PIN_LED, OUTPUT); // debug led

  pinMode(PIN_ENABLE, INPUT_PULLUP);
}

void setupHelm()
{
  pinMode(PIN_PITCH_U, INPUT_PULLUP);
  pinMode(PIN_PITCH_D, INPUT_PULLUP);
  pinMode(PIN_PITCH_S, INPUT_PULLUP);
  pinMode(PIN_ROLL_L, INPUT_PULLUP);
  pinMode(PIN_ROLL_R, INPUT_PULLUP);
  pinMode(PIN_ROLL_S, INPUT_PULLUP);
  pinMode(PIN_YAW_L, INPUT_PULLUP);
  pinMode(PIN_YAW_R, INPUT_PULLUP);
  pinMode(PIN_YAW_S, INPUT_PULLUP);
}

void setupOps()
{ // disabled while building the joystick control
  /*pinMode(PIN_OP_LAUNCH, INPUT_PULLUP);
  pinMode(PIN_OP_STAGE, INPUT_PULLUP);
  pinMode(PIN_OP_ACG3, INPUT_PULLUP);
  pinMode(PIN_OP_ACG5, INPUT_PULLUP);*/
}

//// update fucntions
//

void updateState()
{
  // tells the python client when to close
  state = digitalRead(PIN_ENABLE);
  digitalWrite(PIN_LED, state);
  Serial.println(state);
}

void updateHelm()
{
  pitchAdjust = getAdjustment(PITCH_PINS, pitchAdjust);
  pitch = getDirection(pitch, pitchAdjust, PITCH_STICK);
  Serial.println(pitch);

  rollAdjust = getAdjustment(ROLL_PINS, rollAdjust);
  roll = getDirection(roll, rollAdjust, ROLL_STICK);
  Serial.println(roll);

  yawAdjust = getAdjustment(YAW_PINS, yawAdjust);
  yaw = getDirection(yaw, yawAdjust, YAW_STICK);
  Serial.println(yaw);

  throttle = getThrottle(PIN_THROTTLE);
  Serial.println(throttle);
}

void updateOps()
{
  uint8_t ops = 0;
  uint8_t index = 0;

  for (index = 0; index < OPS; index++)
  {
    if (!opPin[index]) // if the pin is zero, skip
      continue;

    if (opState[index] > 0) // check for debounce on current pin
    {
      opState[index]--; // decrement debounce counter for current state
    }
    else // if not we can check to see if it's triggered
    {
      opState[index] = digitalRead(opPin[index]) ? DELAY_OP : 0;
      ops++;
    }
  }

  if (ops > 0) // if we have at least one operation to send
  {
    Serial.println(ENABLE);

    for (index = 0; index < OPS; index++)
    {
      if (opState[index] == DELAY_OP)
        Serial.println(index); // print it
    }
  }

  Serial.println(DISABLE);
}

//// built-in arduino functions
//

void setup()
{
  setupSerial();

  setupState();
  setupHelm();
  setupOps();

  delay(DELAY_START);
}

void loop()
{
  updateState();

  if (state)
  {
    updateHelm();
    //updateOps();
  }

  delay(DELAY_LOOP);

  Serial.flush();
}


Adding a simple LCD/RTC (DS3231) clock and temperature display example sketch.

/**
 * @file CosaLCDclock.ino
 * @version 1.0
 *
 * @section License
 * Copyright (C) 2013, Mikael Patel
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * @section Description
 * Cosa LCD demo with RTC.
 *
 * This file is part of the Arduino Che Cosa project.
 */

#include "Cosa/Watchdog.hh"
#include "Cosa/IOStream.hh"
#include "Cosa/LCD/Driver/HD44780.hh"
#include "Cosa/TWI/Driver/DS3231.hh"

// Remove comment to set real-time clock (update below)
// #define RTC_SET_TIME
DS3231 rtc;

// Select the access port for the LCD
// HD44780::Port port;
// HD44780::MJKDZ port;
HD44780::DFRobot port;
HD44780 lcd(&port);
IOStream console(&lcd);

void setup()
{
  Watchdog::begin();
  lcd.begin();
  console << PSTR("CosaLCDclock: started");

#ifdef RTC_SET_TIME
  time_t now;
  now.seconds = 0x00;
  now.minutes = 0x50;
  now.hours = 0x20;
  now.day = 0x01;
  now.date = 0x21;
  now.month = 0x07;
  now.year = 0x13;
  rtc.set_time(now);
#endif

  SLEEP(2);
}

void loop()
{
  // Read clock and temperature
  time_t now;
  rtc.get_time(now);
  int16_t temp = rtc.get_temperature();

  // Update the LCD with the reading
  console << clear;

  // First line with date and temperature
  console << PSTR("20") << bcd << now.year << '-'
	  << bcd << now.month << '-'
	  << bcd << now.date;
  console << PSTR("  ");
  console << (temp >> 2) << PSTR(" C");

  // Second line with time
  console << bcd << now.hours << ':'
	  << bcd << now.minutes << ':'
	  << bcd << now.seconds;
  SLEEP(1);
}

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


added voteino_client program

added voteino_client program

/**
 * Arduino voting system client
 *
 * Pins:
 * Hardware SPI:
 * MISO -> 12
 * MOSI -> 11
 * SCK -> 13
 *
 * Configurable:
 * CE -> 8
 * CSN -> 7
 *
 * Note: To see best case latency comment out all Serial.println
 */

#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>

void setup() {
  Serial.begin( 9600 );
  /* Get the instance of the Mirf object */
  Mirf.spi = &MirfHardwareSpi;

  /* Setup the SPI pins CE and CSN */
  Mirf.cePin = 8;
  Mirf.csnPin = 7;

  /* Set the payload length, 1 data packet size (5 bytes)
   * IMPORTANT!: payload on client and server must be the same
   */
  Mirf.payload = sizeof( byte ) * 5;

  /* Set transmission channel
   * IMPORTANT!: make sure channel is legal in your area
   */
  Mirf.channel = 1;

  /* Initialize SPI communication to tranceiver */
  Mirf.init();
  /* Set our device address */
  Mirf.setRADDR( (byte *) "voting_client" );
  /* Set server address */
  Mirf.setTADDR( (byte *) "voting_server" );
  /* Configure and power up tranceiver */
  Mirf.config();

  /* Initialize button */
  pinMode( 2, INPUT );
  digitalWrite( 2, HIGH );
  Serial.println( "Beginning ... " );
}

void loop() {
  /* Timeout for receiving */
  long time = millis();
  /* Transmission data packet */
  byte data[Mirf.payload] = ['s', 'i', 'l', 'b', 'o'];

  /* Wait for button to be pressed, TODO: implement interrupt */
  while ( digitalRead( 2 ) == HIGH );

  /* Send the data packet */
  Mirf.send(data);

  /* While data is still transmitted */
  while ( Mirf.isSending() );
  Serial.println( "Finished sending" );
  delay( 10 );

  /* While we are receiving the data packet */
  while ( !Mirf.dataReady() ) {
    /* Get the byte from the tranceiver */
    Mirf.getData( data );
    /* TODO: do something useful */
    Serial.println( (char) data );

    /* Timeout when data packet was not received within 1 second */
    if ( ( millis() - time ) > 1000 ) {
        Serial.println("Timeout on response from server!");
        return;
    }
  }

  /* When transmission was successful */
  delay(1000);
}

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


Initial commit

Initial commit

/**
 HC-SR04 Ultrasonic Range Finder attached to the servo.
 Two motors attached to the motor shield.
 */

#include <NewPing.h> // From https://code.google.com/p/arduino-new-ping/
#include <Servo.h>

// Motor attached to channel A:
const byte motorA_direction = 12;
const byte motorA_pwm = 3;
const byte motorA_brake = 9;
const byte motorA_sensor = A0;
// Motor attached to channel B:
const byte motorB_direction = 13;
const byte motorB_pwm = 11;
const byte motorB_brake = 8;
const byte motorB_sensor = A1;

// Sonar configuration
const byte sonar_trigger = 7;  // Arduino pin tied to trigger pin on the ultrasonic sensor.
const byte sonar_echo = 4;  // Arduino pin tied to echo pin on the ultrasonic sensor.
const int sonar_distance = 80; // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
const byte sonar_delay = 50; // Number of milliseconds to wait before next ping
unsigned long sonar_last = 0; // When the last ping happened.
NewPing sonar(sonar_trigger, sonar_echo, sonar_distance); // NewPing setup of pins and maximum distance.

// Servo configuration
const byte servo_pin = 6;
byte servo_sweep_direction = 0; // The current direction the servo is sweeping; 0 or 1
const byte servo_delay = 25; // Number of milliseconds to wait before next move
unsigned long servo_last = 0; // When the last move happened.
Servo servo;  // create servo object to control a servo

unsigned long millis_now;

void setup() {
  Serial.begin(9600); // Open serial monitor at 9600 baud to see ping results.

  servo.attach(servo_pin);  // attaches the sonar servo to the servo object

    // Setup Channel A
  pinMode(motorA_direction, OUTPUT); // Initiates motor pin for channel A
  pinMode(motorA_brake, OUTPUT); // Initiates break pin for channel A

  // Setup Channel B
  pinMode(motorB_direction, OUTPUT); // Initiates motor pin for channel B
  pinMode(motorB_brake, OUTPUT);  // Initiates break pin for channel B

  // Ensure the brakes are off
  digitalWrite(motorA_brake, LOW);   // Disengage the Brake for Channel A
  digitalWrite(motorB_brake, LOW);   // Disengage the Brake for Channel B

  // Turn in place
  digitalWrite(motorA_direction, HIGH); // Channel A forward
  digitalWrite(motorB_direction, LOW); // Channel B backward

  analogWrite(motorA_pwm, 255); // Channel A at max speed
  analogWrite(motorB_pwm, 255); // Channel B at max speed
}

void loop() {
  millis_now = millis();

  // Check to see if it's time for another ping.
  if (millis_now - sonar_last > sonar_delay) {
    // Remeber when this ping was done, so we know when to do the next one.
    sonar_last = millis_now;

    unsigned int cm = sonar.ping_cm(); // Send a ping, get ping time in microseconds (uS).
    Serial.print("Ping: ");
    Serial.print(cm);
    Serial.println("cm");
  }

  // Check to see if it's time for another soanr servo move.
  if (millis_now - servo_last > servo_delay) {
    // Remember when this move was done, so we know when to do the next one.
    servo_last = millis_now;

    // Sweep
    // Get the last angle the servo was set to.
    int servo_pos = servo.read();
    if (servo_sweep_direction == 0) {
      servo_pos++; // Add 1 degree to the servo's position.
    } else {
      servo_pos--; // Remove 1 degree to the servo's position.
    }

    // At the end of the sweep, change directions for the next move.
    if (servo_pos == 170) {
      servo_sweep_direction = 1;
    } else if (servo_pos == 10) {
      servo_sweep_direction = 0;
    }
    servo.write(servo_pos);
  }

}

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


added code for serial controlled, 30 second, 8 segment LED countdown display

/* Serial controlled countdown timer for bit.ly/big-7-seg displays

  Accepted input
    H - display accepted inputs
    S - start
    R - reset the time (call before Start)
    X - stop the current coutdown
    Z - zero the timer

*/

#define NOE 9 //pwm
#define LE 8 //latch
#define CLK 10 //clock
#define SDO 11 //serial data
#define LED 13 //indicator led on arduino

#define BAUD 9600
#define TIMER 300 // 30.0 seconds
#define TIMER_RESOLUTION 10 // 10 ms = 0.01 sec
#define HOLD_TIME 1000 // ms
#define DIGITS 3
#define DECIMAL_PLACES 1

byte segments[] =
  {
    0b11111100, //0
    0b01100000, //1
    0b11011010, //2
    0b11110010, //3
    0b01100110, //4
    0b10110110, //5
    0b10111110, //6
    0b11100000, //7
    0b11111110, //8
    0b11100110, //9
    0b00000001, //dot
  };

boolean run_flag = false;
unsigned long counter = 0UL;

void setup() {
  Serial.begin(BAUD);
  pinMode(LED,OUTPUT);
  pinMode(LE,OUTPUT);
  analogWrite(NOE,LOW);
  pinMode(CLK,OUTPUT);
  pinMode(SDO,OUTPUT);

  digitalWrite(LE,false);

  Serial.println(F("Coutdown Timer"));
  Serial.println(F("=============="));

  displayTime(0);
}

void loop() {
  // if there's any serial available, read it:
  while (Serial.available() > 0) {
    char character = Serial.read();

    if (character == 'h' || character == 'H') {
      Serial.println(F("Accepted input"));
      Serial.println(F("  H - display this message"));
      Serial.println(F("  S - start"));
      Serial.println(F("  R - reset the time (call before Start)"));
      Serial.println(F("  X - stop the current coutdown"));
      Serial.println(F("  Z - zero the timer"));
    }

    if (character == 'S' || character == 's') {
      displayTime(TIMER);
      run_flag = true;
      counter = millis();
    }

    if (character == 'r' || character == 'R') {
      run_flag = false;
      displayTime(TIMER);
    }

    if (character == 'x' || character == 'X') {
      run_flag = false;
    }

    if (character == 'z' || character == '|') {
      run_flag = false;
      displayTime(0);
    }
  }

  if (run_flag == true) {
    if (millis() - counter < TIMER * 100) {
      int time_to_display = TIMER - ((millis() - counter)/100);
      displayTime(time_to_display);
      //Serial.println(time_to_display);
    } else {
      displayTime(0);
      run_flag = false;
    }
  }
}

void displayTime(int number) {
  digitalWrite(LE,LOW);
  // calculate each digit for sending
  for (byte i=0; i<DIGITS; i++) {
    byte output = number % 10;
    if (i == DECIMAL_PLACES) {
      // add decimal place if specified digit
      shiftOut(SDO, CLK, LSBFIRST, segments[output] | segments[10]);
    } else {
      shiftOut(SDO, CLK, LSBFIRST, segments[output]);
    }
    number = number / 10;
  }
  digitalWrite(LE,HIGH);
}

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


EBPMK2-Game.ino

EBPMK2-Game.ino

Added ino file.

///
/// @mainpage	LCD_Joystick
///
/// @details	Joystick controlled cursor
/// @n
/// @n @a		Developed with [embedXcode+](http://embedXcode.weebly.com)
///
/// @author		Rei Vilo
/// @author		http://embeddedcomputing.weebly.com
/// @date		11/12/2013 10:19
/// @version	101
///
/// @copyright	(c) Rei Vilo, 2013
/// @copyright	CC = BY SA NC
///
/// @see		ReadMe.txt for references
///

///
/// @file		LCD_Joystick.ino
/// @brief		Main sketch
///
/// @details	Joystick controlled cursor
/// @n @a		Developed with [embedXcode+](http://embedXcode.weebly.com)
///
/// @author		Rei Vilo
/// @author		http://embeddedcomputing.weebly.com
/// @date		11/12/2013 10:19
/// @version	101
///
/// @copyright	(c) Rei Vilo, 2013
/// @copyright	CC = BY SA NC
///
/// @see		ReadMe.txt for references
/// @n
///

// Core library for code-sense
#if defined(ENERGIA) // LaunchPad MSP430, Stellaris and Tiva, Experimeter Board FR5739 specific
#include "Energia.h"
#else // error
#error Platform not defined
#endif

// Prototypes

// Include application, user and local libraries
#include <SPI.h>

#include <LCD_screen.h>
#include <LCD_screen_font.h>
#include <LCD_utilities.h>
#include <Screen_HX8353E.h>
#include <Terminal12e.h>
#include <Terminal6e.h>
#include <Terminal8e.h>
Screen_HX8353E myScreen;

// Define variables and constants
#define joystickX 2
#define joystickY 26
uint16_t x, y, x00, y00;
uint16_t colour;
uint32_t z;

// Add setup code
void setup()
{
    // By default MSP432 has analogRead() set to 10 bits.
    // This Sketch assumes 12 bits. Uncomment to line below to set analogRead()
    // to 12 bit resolution for MSP432.
    //analogReadResolution(12);

    myScreen.begin();
    x00 = 0;
    y00 = 0;

}

// Add loop code
void loop()
{
    x = map(analogRead(joystickX), 0, 4096, 0, 128);
    y = map(analogRead(joystickY), 0, 4096, 128, 0);
    if (x < 1)      x = 1;
    if (x > 126)    x = 126;
    if (y < 1)      y = 1;
    if (y > 126)    y = 126;

    if ((x00 != x) || (y00 != y)) {
        z = (uint32_t)((x-64)*(x-64)+(y-64)*(y-64)) >> 8;
        if (z > 4)      colour = redColour;
        else if (z > 1) colour = yellowColour;
        else            colour = greenColour;

        myScreen.dRectangle(x00-1, y00-1, 3, 3, blackColour);
        myScreen.dRectangle(x-1, y-1, 3, 3, colour);
        x00 = x;
        y00 = y;
    }

    myScreen.gText(0, myScreen.screenSizeY()-myScreen.fontSizeY(),
                   "x=" + i32toa((int16_t)x-64, 10, 1, 6) +" y=" + i32toa(64-(int16_t)y, 10, 1, 6),
                   colour);
}

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