Arduino

Arduino

  i2c lcd example

error: pathspec 'example/I2C/LCD/i2c-lcd/i2c-lcd.ino' did not match any file(s) known to git

--- example/I2C/LCD/i2c-lcd/i2c-lcd.ino
+++ example/I2C/LCD/i2c-lcd/i2c-lcd.ino
@@ -0,0 +1,54 @@
+#include <I2CIO.h>
+#include <LCD.h>
+#include <LiquidCrystal_I2C.h>
+
+/* YourDuino.com Example Software Sketch
+ 16 character 2 line I2C Display
+ ANOTHER NEW TYPE Marked "LCM1602 IIC  A0 A1 A2"
+ A0-A1-A2 are grounded so I2C Address is 0x20
+ terry@yourduino.com */
+/*-----( Import needed libraries )-----*/
+#include <Wire.h>
+#include <LCD.h>
+#include <LiquidCrystal_I2C.h>  // F Malpartida's NewLiquidCrystal library
+//Download: https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
+// Move original LiquidCrystal library elsewhere, copy this in it's place
+
+/*-----( Declare Constants )-----*/
+#define I2C_ADDR    0x27  // Define I2C Address for the PCF8574T
+//---(Following are the PCF8574 pin assignments to LCD connections )----
+// This are different than earlier/different I2C LCD displays
+#define BACKLIGHT_PIN  3
+#define En_pin  2
+#define Rw_pin  1
+#define Rs_pin  0
+#define D4_pin  4
+#define D5_pin  5
+#define D6_pin  6
+#define D7_pin  7
+
+#define  LED_OFF  1
+#define  LED_ON  0
+
+/*-----( Declare objects )-----*/
+LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
+
+void setup()   /*----( SETUP: RUNS ONCE )----*/
+{
+  lcd.begin (16,2);  // initialize the lcd
+// Switch on the backlight
+  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
+  lcd.setBacklight(LED_ON);
+  lcd.backlight();  //Backlight ON if under program control
+  lcd.setCursor(0,0); //Start at character 0 on line 0
+  lcd.print("Hello, world!");
+}// END Setup
+
+static int count=0;
+void loop()
+{
+  lcd.setCursor(0,1);
+  lcd.print("Realtek: ");
+  lcd.print(count++) ;
+  delay(1000);
+} // END Loop


sample.ino

sample.ino

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

--- examples/sample.ino
+++ examples/sample.ino
@@ -0,0 +1 @@
+// Intentionally blank..


Se crea código de lcd 2x16

Se crea código de lcd 2x16

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

--- lcd_2x16/lcd_2x16.ino
+++ lcd_2x16/lcd_2x16.ino
@@ -0,0 +1,114 @@
+//Incluimos la libreria del LCD
+#include <LiquidCrystal.h>
+
+ /** Iniciamos las conexiones del LCD
+ * LCD RS al pin digital 12
+ * LCD Enable al pin digital 11
+ * LCD D4 al pin digital pin 5
+ * LCD D5 al pin digital pin 4
+ * LCD D6 al pin digital pin 3
+ * LCD D7 al pin digital pin 2
+ * LCD R/W al pin GND
+ * LCD VSS al pin GND
+ * LCD VCC al pin 5V*/
+
+//pines del lcd     rs, en, D4, D5, D6, D7
+//                   |   |  |   |   |   |
+//pines del arduino 12, 11, 5   4   3   2
+LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
+
+
+void setup() {
+
+  //Seteamos en el lcd el número de filas y columnas
+  lcd.begin(16, 2);
+
+  //Imprimimos un mensaje
+  lcd.print("Hola...");
+  delay(2000);
+}
+
+void loop() {
+  //Limpiamos el lcd
+  lcd.clear();
+  lcd.print("Vamos a hacer");
+  lcd.setCursor(0,1);
+  lcd.print("unas pruebas");
+  delay(2000);
+  lcd.clear();
+
+  lcd.print("del uso del lcd en");
+  lcd.setCursor(0,1);
+  lcd.print("donde vemos las funciones");
+  delay(2000);
+  lcd.clear();
+
+  lcd.print("y su uso");
+  delay(3000);
+  lcd.clear();
+
+  //Pruebas de display
+  lcd.print("1. Display");
+  lcd.noDisplay();
+  delay(1000);
+  lcd.display();
+  delay(1000);
+  lcd.clear();
+  delay(200);
+
+  //Pruebas de blink
+  lcd.print("2. Blink");
+  lcd.setCursor(0,1);
+  lcd.blink();
+  delay(3000);
+  lcd.noBlink();
+  delay(3000);
+  lcd.clear();
+  delay(200);
+
+  //Prueba del cursor
+  lcd.print("3. Cursor");
+  lcd.setCursor(0,1);
+  lcd.cursor();
+  delay(3000);
+  lcd.noCursor();
+  delay(3000);
+  lcd.clear();
+  delay(200);
+
+  //Impresion de caracteres
+  lcd.print("3. Caracter");
+  lcd.setCursor(0,1);
+
+  byte armsDown[8] = {
+    0b00100,
+    0b01010,
+    0b00100,
+    0b00100,
+    0b01110,
+    0b10101,
+    0b00100,
+    0b01010
+  };
+
+  byte armsUp[8] = {
+    0b00100,
+    0b01010,
+    0b00100,
+    0b10101,
+    0b01110,
+    0b00100,
+    0b00100,
+    0b01010
+  };
+
+  //Asignacion e impresion de caracteres
+  lcd.createChar(1, armsDown);
+  lcd.createChar(2, armsUp);
+  lcd.setCursor(0, 1);
+  lcd.write(1);
+  delay(2000);
+  lcd.setCursor(0, 1);
+  lcd.write(2);
+  delay(2000);
+}


new code to get fast gyro data from imu

new code to get fast gyro data from imu

error: pathspec 'arduino/src/T-80AFLAME/imu_gyro_int/imu_gyro_int.ino' did not match any file(s) known to git

--- arduino/src/T-80AFLAME/imu_gyro_int/imu_gyro_int.ino
+++ arduino/src/T-80AFLAME/imu_gyro_int/imu_gyro_int.ino
@@ -0,0 +1,121 @@
+/*
+        Microstrain IMU library for Arduino
+        ===================================
+    This routine interacts with microstrain IMU and send/get IMU data.
+    Following function are implemented (the one's used for UAV):
+
+    a) only gyro values
+*/
+
+// Define value of pi
+#define PI 3.141592653589793
+
+// 20 ms wait for serial signal
+#define MAX_MILLIS_TO_WAIT 20
+
+// Global variables
+unsigned long starttime;
+float gyro[] = {0.0, 0.0, 0.0};
+
+// Function to convert angles in radians to degree
+float rad2deg(float angle) {
+    return (180/PI) * angle;
+}
+
+
+void send_gyro_cmd() {
+  byte cmd[] = {0x75,0x65,0x0C,0x07,0x07,0x01,0x00,0x01,0x05,0x00,0x00,0xFB,0xE7};
+
+  // Send serial command
+  Serial.write(cmd, sizeof(cmd));
+}
+
+// Get 3D gyro values from the IMU
+byte get_gyro(float* gyro) {
+    byte reply[30];
+
+    // Variables to receive x,y and z gyro values
+    union {
+     float val;
+     unsigned char b[4];
+    } x_gyro, y_gyro, z_gyro;
+
+    // Wait till all 30 bytes are recieved or 100 ms has gone bye
+    while ((Serial.available() < 30)) {
+    }
+
+    // If less than 30 bytes are available on serial register, return \x01 error
+    // code else send \x00 success code and populate euler angles
+    if (Serial.available() < 30) {
+       return byte(1);
+    }
+    else {
+       for (int n = 0; n < 30; n++) {
+           reply[n] = Serial.read();
+       }
+
+       // X gyro
+       x_gyro.b[0] = reply[19];
+       x_gyro.b[1] = reply[18];
+       x_gyro.b[2] = reply[17];
+       x_gyro.b[3] = reply[16];
+       gyro[0] = x_gyro.val;
+
+       // Y gyro
+       y_gyro.b[0] = reply[23];
+       y_gyro.b[1] = reply[22];
+       y_gyro.b[2] = reply[21];
+       y_gyro.b[3] = reply[20];
+       gyro[1] = y_gyro.val;
+
+       // Z gyro
+       z_gyro.b[0] = reply[27];
+       z_gyro.b[1] = reply[26];
+       z_gyro.b[2] = reply[25];
+       z_gyro.b[3] = reply[24];
+       gyro[2] = z_gyro.val;
+
+       return reply[7];
+    }
+}
+
+
+
+// Entry point for arduino code
+void setup() {
+    // Start Serial transmission from/to IMU
+    Serial.begin(115200);
+
+    // Delay of 10 ms
+    delay(10);
+}
+
+
+// Loop through following code
+void loop() {
+    cli();
+
+    while(1) {
+      send_gyro_cmd();
+
+      if (UCSR0A & _BV(RXC0)) { // check uart  (register name changes per port)
+         break;  // looks like there is data.  Break out of loop to handle it
+      }
+    }
+
+    sei();
+
+    if (get_gyro(gyro) == '\x00') {
+       Serial.println("IMU: Gyro values successful!");
+       Serial.println("X, Y abd Z Gyro values:");
+       Serial.println(rad2deg(gyro[0]));
+       Serial.println(rad2deg(gyro[1]));
+       Serial.println(rad2deg(gyro[2]));
+    }
+    else {
+       Serial.println("IMU: Gyro values unsuccessful!");
+    }
+
+    // Delay os 5 ms (200 Hz) i.e. get IMU data at 200Hz rate
+    delay(10);
+}


Create test_zigzag.ino

Create test_zigzag.ino

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


Added firmata plus Parallax Ping support.

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

--- support/BotFirmata/BotFirmata.ino
+++ support/BotFirmata/BotFirmata.ino
@@ -0,0 +1,657 @@
+/*
+ * Firmata is a generic protocol for communicating with microcontrollers
+ * from software on a host computer. It is intended to work with
+ * any host computer software package.
+ *
+ * To download a host software package, please clink on the following link
+ * to open the download page in your default browser.
+ *
+ * http://firmata.org/wiki/Download
+ */
+
+/*
+  Copyright (C) 2006-2008 Hans-Christoph Steiner.  All rights reserved.
+  Copyright (C) 2010-2011 Paul Stoffregen.  All rights reserved.
+  Copyright (C) 2009 Shigeru Kobayashi.  All rights reserved.
+  Copyright (C) 2009-2011 Jeff Hoefs.  All rights reserved.
+
+  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.
+
+  See file LICENSE.txt for further informations on licensing terms.
+
+  formatted using the GNU C formatting and indenting
+*/
+
+/*
+ * TODO: use Program Control to load stored profiles from EEPROM
+ */
+
+#include <Servo.h>
+#include <Wire.h>
+#include <Firmata.h>
+
+// move the following defines to Firmata.h?
+#define I2C_WRITE B00000000
+#define I2C_READ B00001000
+#define I2C_READ_CONTINUOUSLY B00010000
+#define I2C_STOP_READING B00011000
+#define I2C_READ_WRITE_MODE_MASK B00011000
+#define I2C_10BIT_ADDRESS_MODE_MASK B00100000
+
+#define MAX_QUERIES 8
+#define MINIMUM_SAMPLING_INTERVAL 10
+
+#define REGISTER_NOT_SPECIFIED -1
+
+/*==============================================================================
+ * GLOBAL VARIABLES
+ *============================================================================*/
+
+/* analog inputs */
+int analogInputsToReport = 0; // bitwise array to store pin reporting
+
+/* digital input ports */
+byte reportPINs[TOTAL_PORTS];       // 1 = report this port, 0 = silence
+byte previousPINs[TOTAL_PORTS];     // previous 8 bits sent
+
+/* pins configuration */
+byte pinConfig[TOTAL_PINS];         // configuration of every pin
+byte portConfigInputs[TOTAL_PORTS]; // each bit: 1 = pin in INPUT, 0 = anything else
+int pinState[TOTAL_PINS];           // any value that has been written
+
+/* timer variables */
+unsigned long currentMillis;        // store the current value from millis()
+unsigned long previousMillis;       // for comparison with currentMillis
+int samplingInterval = 19;          // how often to run the main loop (in ms)
+
+/* i2c data */
+struct i2c_device_info {
+  byte addr;
+  byte reg;
+  byte bytes;
+};
+
+/* for i2c read continuous more */
+i2c_device_info query[MAX_QUERIES];
+
+byte i2cRxData[32];
+boolean isI2CEnabled = false;
+signed char queryIndex = -1;
+unsigned int i2cReadDelayTime = 0;  // default delay time between i2c read request and Wire.requestFrom()
+
+Servo servos[MAX_SERVOS];
+/*==============================================================================
+ * FUNCTIONS
+ *============================================================================*/
+
+void readAndReportData(byte address, int theRegister, byte numBytes) {
+  // allow I2C requests that don't require a register read
+  // for example, some devices using an interrupt pin to signify new data available
+  // do not always require the register read so upon interrupt you call Wire.requestFrom()
+  if (theRegister != REGISTER_NOT_SPECIFIED) {
+    Wire.beginTransmission(address);
+    #if ARDUINO >= 100
+    Wire.write((byte)theRegister);
+    #else
+    Wire.send((byte)theRegister);
+    #endif
+    Wire.endTransmission();
+    // do not set a value of 0
+    if (i2cReadDelayTime > 0) {
+      // delay is necessary for some devices such as WiiNunchuck
+      delayMicroseconds(i2cReadDelayTime);
+    }
+  } else {
+    theRegister = 0;  // fill the register with a dummy value
+  }
+
+  Wire.requestFrom(address, numBytes);  // all bytes are returned in requestFrom
+
+  // check to be sure correct number of bytes were returned by slave
+  if(numBytes == Wire.available()) {
+    i2cRxData[0] = address;
+    i2cRxData[1] = theRegister;
+    for (int i = 0; i < numBytes; i++) {
+      #if ARDUINO >= 100
+      i2cRxData[2 + i] = Wire.read();
+      #else
+      i2cRxData[2 + i] = Wire.receive();
+      #endif
+    }
+  }
+  else {
+    if(numBytes > Wire.available()) {
+      Firmata.sendString("I2C Read Error: Too many bytes received");
+    } else {
+      Firmata.sendString("I2C Read Error: Too few bytes received");
+    }
+  }
+
+  // send slave address, register and received bytes
+  Firmata.sendSysex(SYSEX_I2C_REPLY, numBytes + 2, i2cRxData);
+}
+
+void outputPort(byte portNumber, byte portValue, byte forceSend)
+{
+  // pins not configured as INPUT are cleared to zeros
+  portValue = portValue & portConfigInputs[portNumber];
+  // only send if the value is different than previously sent
+  if(forceSend || previousPINs[portNumber] != portValue) {
+    Firmata.sendDigitalPort(portNumber, portValue);
+    previousPINs[portNumber] = portValue;
+  }
+}
+
+void outputPingPort(byte portNumber)
+{
+  long duration, cm, distance;
+
+  pinMode(portNumber, OUTPUT);
+  digitalWrite(portNumber, LOW);
+  delayMicroseconds(2);
+  digitalWrite(portNumber, HIGH);
+  delayMicroseconds(5);
+  digitalWrite(portNumber, LOW);
+  pinMode(portNumber, INPUT);
+  duration = pulseIn(portNumber, HIGH);
+  distance = duration / 29 / 2;
+  Firmata.sendDigitalPort(portNumber, distance);
+}
+
+/* -----------------------------------------------------------------------------
+ * check all the active digital inputs for change of state, then add any events
+ * to the Serial output queue using Serial.print() */
+void checkDigitalInputs(void)
+{
+  /* Using non-looping code allows constants to be given to readPort().
+   * The compiler will apply substantial optimizations if the inputs
+   * to readPort() are compile-time constants. */
+  if (TOTAL_PORTS > 0 && reportPINs[0]) outputPort(0, readPort(0, portConfigInputs[0]), false);
+  if (TOTAL_PORTS > 1 && reportPINs[1]) outputPort(1, readPort(1, portConfigInputs[1]), false);
+  if (TOTAL_PORTS > 2 && reportPINs[2]) outputPort(2, readPort(2, portConfigInputs[2]), false);
+  if (TOTAL_PORTS > 3 && reportPINs[3]) outputPort(3, readPort(3, portConfigInputs[3]), false);
+  if (TOTAL_PORTS > 4 && reportPINs[4]) outputPort(4, readPort(4, portConfigInputs[4]), false);
+  if (TOTAL_PORTS > 5 && reportPINs[5]) outputPort(5, readPort(5, portConfigInputs[5]), false);
+  if (TOTAL_PORTS > 6 && reportPINs[6]) outputPort(6, readPort(6, portConfigInputs[6]), false);
+  //if (TOTAL_PORTS > 7 && reportPINs[7]) outputPort(7, readPort(7, portConfigInputs[7]), false);
+  outputPingPort(7);
+  if (TOTAL_PORTS > 8 && reportPINs[8]) outputPort(8, readPort(8, portConfigInputs[8]), false);
+  if (TOTAL_PORTS > 9 && reportPINs[9]) outputPort(9, readPort(9, portConfigInputs[9]), false);
+  if (TOTAL_PORTS > 10 && reportPINs[10]) outputPort(10, readPort(10, portConfigInputs[10]), false);
+  if (TOTAL_PORTS > 11 && reportPINs[11]) outputPort(11, readPort(11, portConfigInputs[11]), false);
+  if (TOTAL_PORTS > 12 && reportPINs[12]) outputPort(12, readPort(12, portConfigInputs[12]), false);
+  if (TOTAL_PORTS > 13 && reportPINs[13]) outputPort(13, readPort(13, portConfigInputs[13]), false);
+  if (TOTAL_PORTS > 14 && reportPINs[14]) outputPort(14, readPort(14, portConfigInputs[14]), false);
+  if (TOTAL_PORTS > 15 && reportPINs[15]) outputPort(15, readPort(15, portConfigInputs[15]), false);
+}
+
+// -----------------------------------------------------------------------------
+/* sets the pin mode to the correct state and sets the relevant bits in the
+ * two bit-arrays that track Digital I/O and PWM status
+ */
+void setPinModeCallback(byte pin, int mode)
+{
+  if (pinConfig[pin] == I2C && isI2CEnabled && mode != I2C) {
+    // disable i2c so pins can be used for other functions
+    // the following if statements should reconfigure the pins properly
+    disableI2CPins();
+  }
+  if (IS_PIN_SERVO(pin) && mode != SERVO && servos[PIN_TO_SERVO(pin)].attached()) {
+    servos[PIN_TO_SERVO(pin)].detach();
+  }
+  if (IS_PIN_ANALOG(pin)) {
+    reportAnalogCallback(PIN_TO_ANALOG(pin), mode == ANALOG ? 1 : 0); // turn on/off reporting
+  }
+  if (IS_PIN_DIGITAL(pin)) {
+    if (mode == INPUT) {
+      portConfigInputs[pin/8] |= (1 << (pin & 7));
+    } else {
+      portConfigInputs[pin/8] &= ~(1 << (pin & 7));
+    }
+  }
+  pinState[pin] = 0;
+  switch(mode) {
+  case ANALOG:
+    if (IS_PIN_ANALOG(pin)) {
+      if (IS_PIN_DIGITAL(pin)) {
+        pinMode(PIN_TO_DIGITAL(pin), INPUT); // disable output driver
+        digitalWrite(PIN_TO_DIGITAL(pin), LOW); // disable internal pull-ups
+      }
+      pinConfig[pin] = ANALOG;
+    }
+    break;
+  case INPUT:
+    if (IS_PIN_DIGITAL(pin)) {
+      pinMode(PIN_TO_DIGITAL(pin), INPUT); // disable output driver
+      digitalWrite(PIN_TO_DIGITAL(pin), LOW); // disable internal pull-ups
+      pinConfig[pin] = INPUT;
+    }
+    break;
+  case OUTPUT:
+    if (IS_PIN_DIGITAL(pin)) {
+      digitalWrite(PIN_TO_DIGITAL(pin), LOW); // disable PWM
+      pinMode(PIN_TO_DIGITAL(pin), OUTPUT);
+      pinConfig[pin] = OUTPUT;
+    }
+    break;
+  case PWM:
+    if (IS_PIN_PWM(pin)) {
+      pinMode(PIN_TO_PWM(pin), OUTPUT);
+      analogWrite(PIN_TO_PWM(pin), 0);
+      pinConfig[pin] = PWM;
+    }
+    break;
+  case SERVO:
+    if (IS_PIN_SERVO(pin)) {
+      pinConfig[pin] = SERVO;
+      if (!servos[PIN_TO_SERVO(pin)].attached()) {
+          servos[PIN_TO_SERVO(pin)].attach(PIN_TO_DIGITAL(pin));
+      }
+    }
+    break;
+  case I2C:
+    if (IS_PIN_I2C(pin)) {
+      // mark the pin as i2c
+      // the user must call I2C_CONFIG to enable I2C for a device
+      pinConfig[pin] = I2C;
+    }
+    break;
+  default:
+    Firmata.sendString("Unknown pin mode"); // TODO: put error msgs in EEPROM
+  }
+  // TODO: save status to EEPROM here, if changed
+}
+
+void analogWriteCallback(byte pin, int value)
+{
+  if (pin < TOTAL_PINS) {
+    switch(pinConfig[pin]) {
+    case SERVO:
+      if (IS_PIN_SERVO(pin))
+        servos[PIN_TO_SERVO(pin)].write(value);
+        pinState[pin] = value;
+      break;
+    case PWM:
+      if (IS_PIN_PWM(pin))
+        analogWrite(PIN_TO_PWM(pin), value);
+        pinState[pin] = value;
+      break;
+    }
+  }
+}
+
+void digitalWriteCallback(byte port, int value)
+{
+  byte pin, lastPin, mask=1, pinWriteMask=0;
+
+  if (port < TOTAL_PORTS) {
+    // create a mask of the pins on this port that are writable.
+    lastPin = port*8+8;
+    if (lastPin > TOTAL_PINS) lastPin = TOTAL_PINS;
+    for (pin=port*8; pin < lastPin; pin++) {
+      // do not disturb non-digital pins (eg, Rx & Tx)
+      if (IS_PIN_DIGITAL(pin)) {
+        // only write to OUTPUT and INPUT (enables pullup)
+        // do not touch pins in PWM, ANALOG, SERVO or other modes
+        if (pinConfig[pin] == OUTPUT || pinConfig[pin] == INPUT) {
+          pinWriteMask |= mask;
+          pinState[pin] = ((byte)value & mask) ? 1 : 0;
+        }
+      }
+      mask = mask << 1;
+    }
+    writePort(port, (byte)value, pinWriteMask);
+  }
+}
+
+
+// -----------------------------------------------------------------------------
+/* sets bits in a bit array (int) to toggle the reporting of the analogIns
+ */
+//void FirmataClass::setAnalogPinReporting(byte pin, byte state) {
+//}
+void reportAnalogCallback(byte analogPin, int value)
+{
+  if (analogPin < TOTAL_ANALOG_PINS) {
+    if(value == 0) {
+      analogInputsToReport = analogInputsToReport &~ (1 << analogPin);
+    } else {
+      analogInputsToReport = analogInputsToReport | (1 << analogPin);
+    }
+  }
+  // TODO: save status to EEPROM here, if changed
+}
+
+void reportDigitalCallback(byte port, int value)
+{
+  if (port < TOTAL_PORTS) {
+    reportPINs[port] = (byte)value;
+  }
+  // do not disable analog reporting on these 8 pins, to allow some
+  // pins used for digital, others analog.  Instead, allow both types
+  // of reporting to be enabled, but check if the pin is configured
+  // as analog when sampling the analog inputs.  Likewise, while
+  // scanning digital pins, portConfigInputs will mask off values from any
+  // pins configured as analog
+}
+
+/*==============================================================================
+ * SYSEX-BASED commands
+ *============================================================================*/
+
+void sysexCallback(byte command, byte argc, byte *argv)
+{
+  byte mode;
+  byte slaveAddress;
+  byte slaveRegister;
+  byte data;
+  unsigned int delayTime;
+
+  switch(command) {
+  case I2C_REQUEST:
+    mode = argv[1] & I2C_READ_WRITE_MODE_MASK;
+    if (argv[1] & I2C_10BIT_ADDRESS_MODE_MASK) {
+      Firmata.sendString("10-bit addressing mode is not yet supported");
+      return;
+    }
+    else {
+      slaveAddress = argv[0];
+    }
+
+    switch(mode) {
+    case I2C_WRITE:
+      Wire.beginTransmission(slaveAddress);
+      for (byte i = 2; i < argc; i += 2) {
+        data = argv[i] + (argv[i + 1] << 7);
+        #if ARDUINO >= 100
+        Wire.write(data);
+        #else
+        Wire.send(data);
+        #endif
+      }
+      Wire.endTransmission();
+      delayMicroseconds(70);
+      break;
+    case I2C_READ:
+      if (argc == 6) {
+        // a slave register is specified
+        slaveRegister = argv[2] + (argv[3] << 7);
+        data = argv[4] + (argv[5] << 7);  // bytes to read
+        readAndReportData(slaveAddress, (int)slaveRegister, data);
+      }
+      else {
+        // a slave register is NOT specified
+        data = argv[2] + (argv[3] << 7);  // bytes to read
+        readAndReportData(slaveAddress, (int)REGISTER_NOT_SPECIFIED, data);
+      }
+      break;
+    case I2C_READ_CONTINUOUSLY:
+      if ((queryIndex + 1) >= MAX_QUERIES) {
+        // too many queries, just ignore
+        Firmata.sendString("too many queries");
+        break;
+      }
+      queryIndex++;
+      query[queryIndex].addr = slaveAddress;
+      query[queryIndex].reg = argv[2] + (argv[3] << 7);
+      query[queryIndex].bytes = argv[4] + (argv[5] << 7);
+      break;
+    case I2C_STOP_READING:
+	  byte queryIndexToSkip;
+      // if read continuous mode is enabled for only 1 i2c device, disable
+      // read continuous reporting for that device
+      if (queryIndex <= 0) {
+        queryIndex = -1;
+      } else {
+        // if read continuous mode is enabled for multiple devices,
+        // determine which device to stop reading and remove it's data from
+        // the array, shifiting other array data to fill the space
+        for (byte i = 0; i < queryIndex + 1; i++) {
+          if (query[i].addr = slaveAddress) {
+            queryIndexToSkip = i;
+            break;
+          }
+        }
+
+        for (byte i = queryIndexToSkip; i<queryIndex + 1; i++) {
+          if (i < MAX_QUERIES) {
+            query[i].addr = query[i+1].addr;
+            query[i].reg = query[i+1].addr;
+            query[i].bytes = query[i+1].bytes;
+          }
+        }
+        queryIndex--;
+      }
+      break;
+    default:
+      break;
+    }
+    break;
+  case I2C_CONFIG:
+    delayTime = (argv[0] + (argv[1] << 7));
+
+    if(delayTime > 0) {
+      i2cReadDelayTime = delayTime;
+    }
+
+    if (!isI2CEnabled) {
+      enableI2CPins();
+    }
+
+    break;
+  case SERVO_CONFIG:
+    if(argc > 4) {
+      // these vars are here for clarity, they'll optimized away by the compiler
+      byte pin = argv[0];
+      int minPulse = argv[1] + (argv[2] << 7);
+      int maxPulse = argv[3] + (argv[4] << 7);
+
+      if (IS_PIN_SERVO(pin)) {
+        if (servos[PIN_TO_SERVO(pin)].attached())
+          servos[PIN_TO_SERVO(pin)].detach();
+        servos[PIN_TO_SERVO(pin)].attach(PIN_TO_DIGITAL(pin), minPulse, maxPulse);
+        setPinModeCallback(pin, SERVO);
+      }
+    }
+    break;
+  case SAMPLING_INTERVAL:
+    if (argc > 1) {
+      samplingInterval = argv[0] + (argv[1] << 7);
+      if (samplingInterval < MINIMUM_SAMPLING_INTERVAL) {
+        samplingInterval = MINIMUM_SAMPLING_INTERVAL;
+      }
+    } else {
+      //Firmata.sendString("Not enough data");
+    }
+    break;
+  case EXTENDED_ANALOG:
+    if (argc > 1) {
+      int val = argv[1];
+      if (argc > 2) val |= (argv[2] << 7);
+      if (argc > 3) val |= (argv[3] << 14);
+      analogWriteCallback(argv[0], val);
+    }
+    break;
+  case CAPABILITY_QUERY:
+    Firmata.write(START_SYSEX);
+    Firmata.write(CAPABILITY_RESPONSE);
+    for (byte pin=0; pin < TOTAL_PINS; pin++) {
+      if (IS_PIN_DIGITAL(pin)) {
+        Firmata.write((byte)INPUT);
+        Firmata.write(1);
+        Firmata.write((byte)OUTPUT);
+        Firmata.write(1);
+      }
+      if (IS_PIN_ANALOG(pin)) {
+        Firmata.write(ANALOG);
+        Firmata.write(10);
+      }
+      if (IS_PIN_PWM(pin)) {
+        Firmata.write(PWM);
+        Firmata.write(8);
+      }
+      if (IS_PIN_SERVO(pin)) {
+        Firmata.write(SERVO);
+        Firmata.write(14);
+      }
+      if (IS_PIN_I2C(pin)) {
+        Firmata.write(I2C);
+        Firmata.write(1);  // to do: determine appropriate value
+      }
+      Firmata.write(127);
+    }
+    Firmata.write(END_SYSEX);
+    break;
+  case PIN_STATE_QUERY:
+    if (argc > 0) {
+      byte pin=argv[0];
+      Firmata.write(START_SYSEX);
+      Firmata.write(PIN_STATE_RESPONSE);
+      Firmata.write(pin);
+      if (pin < TOTAL_PINS) {
+        Firmata.write((byte)pinConfig[pin]);
+	Firmata.write((byte)pinState[pin] & 0x7F);
+	if (pinState[pin] & 0xFF80) Firmata.write((byte)(pinState[pin] >> 7) & 0x7F);
+	if (pinState[pin] & 0xC000) Firmata.write((byte)(pinState[pin] >> 14) & 0x7F);
+      }
+      Firmata.write(END_SYSEX);
+    }
+    break;
+  case ANALOG_MAPPING_QUERY:
+    Firmata.write(START_SYSEX);
+    Firmata.write(ANALOG_MAPPING_RESPONSE);
+    for (byte pin=0; pin < TOTAL_PINS; pin++) {
+      Firmata.write(IS_PIN_ANALOG(pin) ? PIN_TO_ANALOG(pin) : 127);
+    }
+    Firmata.write(END_SYSEX);
+    break;
+  }
+}
+
+void enableI2CPins()
+{
+  byte i;
+  // is there a faster way to do this? would probaby require importing
+  // Arduino.h to get SCL and SDA pins
+  for (i=0; i < TOTAL_PINS; i++) {
+    if(IS_PIN_I2C(i)) {
+      // mark pins as i2c so they are ignore in non i2c data requests
+      setPinModeCallback(i, I2C);
+    }
+  }
+
+  isI2CEnabled = true;
+
+  // is there enough time before the first I2C request to call this here?
+  Wire.begin();
+}
+
+/* disable the i2c pins so they can be used for other functions */
+void disableI2CPins() {
+    isI2CEnabled = false;
+    // disable read continuous mode for all devices
+    queryIndex = -1;
+    // uncomment the following if or when the end() method is added to Wire library
+    // Wire.end();
+}
+
+/*==============================================================================
+ * SETUP()
+ *============================================================================*/
+
+void systemResetCallback()
+{
+  // initialize a defalt state
+  // TODO: option to load config from EEPROM instead of default
+  if (isI2CEnabled) {
+  	disableI2CPins();
+  }
+  for (byte i=0; i < TOTAL_PORTS; i++) {
+    reportPINs[i] = false;      // by default, reporting off
+    portConfigInputs[i] = 0;	// until activated
+    previousPINs[i] = 0;
+  }
+  // pins with analog capability default to analog input
+  // otherwise, pins default to digital output
+  for (byte i=0; i < TOTAL_PINS; i++) {
+    if (IS_PIN_ANALOG(i)) {
+      // turns off pullup, configures everything
+      setPinModeCallback(i, ANALOG);
+    } else {
+      // sets the output to 0, configures portConfigInputs
+      setPinModeCallback(i, OUTPUT);
+    }
+  }
+  // by default, do not report any analog inputs
+  analogInputsToReport = 0;
+
+  /* send digital inputs to set the initial state on the host computer,
+   * since once in the loop(), this firmware will only send on change */
+  /*
+  TODO: this can never execute, since no pins default to digital input
+        but it will be needed when/if we support EEPROM stored config
+  for (byte i=0; i < TOTAL_PORTS; i++) {
+    outputPort(i, readPort(i, portConfigInputs[i]), true);
+  }
+  */
+}
+
+void setup()
+{
+  Firmata.setFirmwareVersion(FIRMATA_MAJOR_VERSION, FIRMATA_MINOR_VERSION);
+
+  Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
+  Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback);
+  Firmata.attach(REPORT_ANALOG, reportAnalogCallback);
+  Firmata.attach(REPORT_DIGITAL, reportDigitalCallback);
+  Firmata.attach(SET_PIN_MODE, setPinModeCallback);
+  Firmata.attach(START_SYSEX, sysexCallback);
+  Firmata.attach(SYSTEM_RESET, systemResetCallback);
+
+  Firmata.begin(57600);
+  systemResetCallback();  // reset to default config
+}
+
+/*==============================================================================
+ * LOOP()
+ *============================================================================*/
+void loop()
+{
+  byte pin, analogPin;
+
+  /* DIGITALREAD - as fast as possible, check for changes and output them to the
+   * FTDI buffer using Serial.print()  */
+  checkDigitalInputs();
+
+  /* SERIALREAD - processing incoming messagse as soon as possible, while still
+   * checking digital inputs.  */
+  while(Firmata.available())
+    Firmata.processInput();
+
+  /* SEND FTDI WRITE BUFFER - make sure that the FTDI buffer doesn't go over
+   * 60 bytes. use a timer to sending an event character every 4 ms to
+   * trigger the buffer to dump. */
+
+  currentMillis = millis();
+  if (currentMillis - previousMillis > samplingInterval) {
+    previousMillis += samplingInterval;
+    /* ANALOGREAD - do all analogReads() at the configured sampling interval */
+    for(pin=0; pin<TOTAL_PINS; pin++) {
+      if (IS_PIN_ANALOG(pin) && pinConfig[pin] == ANALOG) {
+        analogPin = PIN_TO_ANALOG(pin);
+        if (analogInputsToReport & (1 << analogPin)) {
+          Firmata.sendAnalog(analogPin, analogRead(analogPin));
+        }
+      }
+    }
+    // report i2c data for all device with read continuous mode enabled
+    if (queryIndex > -1) {
+      for (byte i = 0; i < queryIndex + 1; i++) {
+        readAndReportData(query[i].addr, query[i].reg, query[i].bytes);
+      }
+    }
+  }
+}


Add initial hello world

Add initial hello world

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

--- arduino-workshop.ino
+++ arduino-workshop.ino
@@ -0,0 +1,27 @@
+#include <TFT.h>  // Arduino LCD library
+#include <SPI.h>
+
+// pin definition for LCD
+#define cs   10
+#define dc   9
+#define rst  8
+
+TFT TFTscreen = TFT(cs, dc, rst);
+
+
+void setup() {
+  // put your setup code here, to run once:
+  // initialize the display
+  TFTscreen.begin();
+  // clear the screen with a black background
+  TFTscreen.background(0, 0, 0);
+  // set the font color to white
+  TFTscreen.stroke(255, 255, 255);
+  // print test text
+  TFTscreen.text("Hello world", 0, 20);
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+
+}


made some formatting changes

made some formatting changes

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


update calc_hour()

update calc_hour()

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/janiversen/SolarPower.git/'


tested LCD

tested LCD


this project was moved as separated projec: soilsensor

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


Add ROMdumper utility (Arduino Mega based).

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

--- utilities/ROMdumper/ROMdumper.ino
+++ utilities/ROMdumper/ROMdumper.ino
@@ -0,0 +1,167 @@
+/**
+ * ROM dump utility.  Use an Arduino Mega to dump game cartridges
+ * directly to an SD card.
+ **/
+#include <SD.h>
+#include <SPI.h>
+#include <TM1637Display.h>
+
+#define _CE                  2
+#define BUT_UP               5
+#define BUT_DN               6
+#define BUT_OK               7
+#define DISP_CLK            13
+#define DISP_DIO            12
+
+#define NOKEY                0
+#define UPKEY                1
+#define DNKEY                2
+#define OKKEY                3
+#define BYTES_PER_FLUSH    512
+#define TWOK             0x800
+#define FOURK           0x1000
+#define SIXK            0x1600  // = 5.5K, because of PVI mirror
+
+TM1637Display disp(DISP_CLK, DISP_DIO);
+File file;
+uint8_t lastkey = NOKEY;
+uint8_t gameType = 2;
+unsigned romSize = 0;
+uint8_t fileNumber = 0;
+unsigned long bytesWritten = 0;
+uint8_t dispInitData[] = {0, 0, 0, 0};
+char fileName[] = { 0, 0, 0, 0, 0, 0, 0 };
+
+void setup() {
+  // setting PORTF to output (low byte of address bus)
+  DDRF = 0xff;
+  // setting PORTK to output (high byte of address bus)
+  DDRK = 0xff;
+
+  //set PORTL as input for the data bus
+  DDRL = 0x00;
+
+  pinMode(_CE,OUTPUT);
+  pinMode(BUT_UP, INPUT_PULLUP);
+  pinMode(BUT_DN, INPUT_PULLUP);
+  pinMode(BUT_OK, INPUT_PULLUP);
+
+  // Init display
+  disp.setSegments(dispInitData);
+  disp.setBrightness(0x0f);
+
+  // Loop, if SD card not available
+  if (!SD.begin()) {
+    disp.showNumberDec(9999, false, 4, 4);
+    for (;;);
+  }
+}
+
+void loop() {
+  setRomSize();
+  setFileName();
+  dumpRom();
+}
+
+byte getKey() {
+  if (!digitalRead(BUT_UP))
+    return UPKEY;
+  else if (!digitalRead(BUT_DN))
+    return DNKEY;
+  else if (!digitalRead(BUT_OK))
+    return OKKEY;
+  else
+    return NOKEY;
+}
+
+void setRomSize() {
+  byte key = getKey();
+  do {
+    if (key == UPKEY && lastkey != UPKEY && gameType != 6) {
+      gameType += 2;
+    } else if (key == DNKEY && lastkey != DNKEY && gameType != 2) {
+      gameType -= 2;
+    }
+    disp.showNumberDec(gameType, false, 2, 2);
+    lastkey = key;
+    key = getKey();
+  } while (key != OKKEY);
+
+  if (gameType == 2)
+    romSize = TWOK;
+  else if (gameType == 4)
+    romSize = FOURK;
+  else if (gameType == 6)
+    romSize = SIXK;
+}
+
+void setFileName() {
+  delay(1000);   // Wait for user stop pressing OK
+  ++fileNumber;  // Eases dumping of multiple games
+  disp.showNumberDec(fileNumber, true, 2, 2);
+  byte key = getKey();
+  do {
+    if (key == UPKEY && lastkey != UPKEY) {
+      if (fileNumber < 99)
+        ++fileNumber;
+      else {
+        fileNumber = 1;
+      }
+    }
+    else if (key == DNKEY && lastkey != DNKEY) {
+      if (fileNumber > 1)
+        --fileNumber;
+      else
+        fileNumber = 99;
+    }
+    disp.showNumberDec(fileNumber, true, 2, 2);
+    lastkey = key;
+    key = getKey();
+  } while (key != OKKEY);
+
+  // Construct ROM file name
+  if (fileNumber < 10) {
+    fileName[0] = '0';
+    itoa(fileNumber, fileName+1, 10);
+  } else {
+    itoa(fileNumber, fileName, 10);
+  }
+  strcpy(fileName+2, ".BIN");  // Append filename extension
+}
+
+void dumpRom() {
+  if (openFile()) {
+    digitalWrite(_CE,HIGH);
+
+    for (unsigned i = 0; i < romSize; ++i) {
+      // Assert address:
+      PORTF = (byte)(i & 0xff);
+      PORTK = (byte)(i >> 8);
+      delay(1);          // Ensure that data is ready.
+      byte data = PINL;  // Read data
+      writeToFile(data);
+    }
+    writeToFile(0x0a);
+    file.close();
+  }
+  delay(1000);
+}
+
+bool openFile() {
+  // Remove file, if it already exists (i.e. overwrite it)
+  if (SD.exists(fileName))
+    if (!SD.remove(fileName))
+      return false;
+  file = SD.open(fileName, FILE_WRITE);
+  if (file)
+    return true;
+  else
+    return false;
+}
+
+void writeToFile(uint8_t dataByte) {
+  file.write(dataByte);
+  bytesWritten++;
+  if (bytesWritten == BYTES_PER_FLUSH)
+    file.flush();
+}


initial add of IRsendDemoMagi.ino

initial add of IRsendDemoMagi.ino

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

--- examples/IRsendDemoMagi/IRsendDemoMagi.ino
+++ examples/IRsendDemoMagi/IRsendDemoMagi.ino
@@ -0,0 +1,27 @@
+/*
+ * IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
+ * An IR LED must be connected to Arduino PWM pin 3.
+ * Version 0.1 July, 2009
+ * Copyright 2009 Ken Shirriff
+ * http://arcfn.com
+ */
+
+#include <IRremote.h>
+
+IRsend irsend;
+
+void setup()
+{
+  Serial.begin(115200);
+}
+
+void loop() {
+  if (Serial.read() != -1) {
+      delay(500);
+      irsend.sendMagiQuest(0x19D1DD01, 0xB6);
+      delay(3000);
+      irsend.sendMagiQuest(0x18C04B01, 0xEEEE);
+      delay(3000);
+      irsend.sendMagiQuest(0x4FAB881, 0xB6);
+  }
+}


Adds helper functions for dealing with midi

--- midi.ino
+++ midi.ino
@@ -0,0 +1,60 @@
+/**
+ * Helper functions and constants to deal with MIDI signals by Nicolas Hurtubise
+ */
+
+#include <math.h>
+
+#define 	MIDI_PITCHBEND_MIN   -8192
+#define 	MIDI_PITCHBEND_MAX   8191
+
+// Minimum and maximum MIDI frequencies (in Hz)
+#define     MIN_MIDI_FREQ        8
+#define     MAX_MIDI_FREQ        12543
+
+/**
+ * Returns a round midi note
+ * Use midi_pitch_round() to get the pitch correction of a precise frequency
+ *
+ * @param frequency The frequency (in Hz) to parse
+ */
+int midi_note_round(long frequency) {
+    return 69 + 12*log(frequency/440.0)/log(2);
+}
+
+/**
+ * Returns a midi pitch
+ * Use midi_note_round() to get the midi base note to adjust
+ *
+ * @param frequency The frequency (in Hz) to parse
+ */
+int midi_pitch_round(long frequency) {
+    return map(floor((71 + 12 * log((frequency/440.0))/log(2) - floor(69 + 12 * log((frequency/440.0))/log(2))) * 32),
+                0, 127, MIDI_PITCHBEND_MIN, MIDI_PITCHBEND_MAX);
+}
+
+/**
+ * Autotunes a note on a given scale
+ *
+ * @param note the midi note
+ * @param start the first note of the scale (default : C)
+ */
+int scale_round(int note, int start = 0) {
+
+    int closest_note = -1;
+    int octave = 0;
+
+    int notes[] = {0, 2, 3, 5, 7, 8, 10};
+    int number_of_notes = 6;
+
+    note -= start;
+    octave = note/12;
+    note %= 12;
+
+    for(int i=0; i < number_of_notes && closest_note == -1; i++) {
+        if (i == number_of_notes - 1 || note <= notes[i] + (notes[i+1] - notes[i])/2.0) {
+            closest_note = notes[i];
+        }
+    }
+
+    return closest_note + 12 * octave + start;
+}


messing around w/ Teensy Audio objects

messing around w/ Teensy Audio objects

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

--- Test.ino
+++ Test.ino
@@ -0,0 +1,35 @@
+#include <Audio.h>
+#include <Wire.h>
+#include <SPI.h>
+#include <SD.h>
+#include <SerialFlash.h>
+
+const int myInput = AUDIO_INPUT_LINEIN;
+const int myInput = AUDIO_INPUT_MIC_1;
+
+
+// GUItool: begin automatically generated code
+AudioInputAnalog         adc1;           //xy=174,211
+AudioInputAnalog         adc2;           //xy=176,263
+AudioAnalyzeFFT1024      fft1024_1;      //xy=371,211
+AudioAnalyzeFFT1024      fft1024_2;      //xy=373,264
+AudioAnalyzeFFT1024	 new_fft;	 //xy=no idea
+AudioAnalyzeFFT1024	 fft_sum;	 // ditto
+AudioConnection          patchCord1(adc1, fft1024_1);
+AudioConnection          patchCord2(adc2, fft1024_2);
+// GUItool: end automatically generated code
+AudioOutputI2S		 audioOutput;
+
+void setup() {
+
+	AudioMemory(12); // check this out later.
+
+
+	// messy band-pass... Most likely this is all wrong.
+	for( int i = 0; i < 511; i++ ) {
+		double freq = fft_sum.read(i);
+		if( freq > 200 && freq < 520 ) {
+			new_fft.output[i] = freq; } else {
+			new_fft.output[i] = 0;
+		}
+


Added 12 segment example

Added 12 segment example

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

--- examples/12Segment.ino
+++ examples/12Segment.ino
@@ -0,0 +1,50 @@
+// This #include statement was automatically added by the Spark IDE.
+#include "Spark_Adafruit_LEDBackpack.h"
+#include "Adafruit_GFX/Adafruit_GFX.h"
+#include "application.h"
+
+/***************************************************
+  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 "a.h"
+//#include "Adafruit_GFX.h"
+
+Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4();
+
+String message = "THIS IS A LONG MESSAGE";
+int displayposition = 0;
+
+void setup() {
+  alpha4.begin(0x70);
+  alpha4.setBrightness(2);
+}
+
+
+void loop() {
+
+    //This is test code for method 2 - updates the display by one increment every time called
+    displayposition = alpha4.ledPrint(message, 4, 1, 2, displayposition, true, false);
+    delay(500);
+    //displayposition = alpha4.ledPrint(message, 4, 1, 1, 500, true, false);
+    //delay(5000);
+    //displayposition = alpha4.ledPrint(" WE ARE DONEFOR NOW", 4, 2, 1, 500, true, false);
+    //delay(5000);
+}


Colovaria script added

Colovaria script added

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

--- colovaria_crossfade.ino
+++ colovaria_crossfade.ino
@@ -0,0 +1,172 @@
+/*
+* A slightly modified version of arduino crossfade code by
+* Clay Shirky.
+*
+* Modifed to allow for random fades and pin trigger.
+*/
+
+// Output
+int redPin = PB0;   // Red LED,   connected to digital pin 9
+int grnPin = PB1;  // Green LED, connected to digital pin 10
+int bluPin = PB2;  // Blue LED,  connected to digital pin 11
+int trigPin = PB4;
+
+// Color arrays
+int black[3]  = { 100, 100, 100 };
+int white[3]  = { 0, 0, 0 };
+int red[3]    = { 0, 100, 100 };
+int fuscia[3]  = { 0, 100, 0 };
+int green[3]  = { 100, 0, 100 };
+int blue[3]   = { 100, 100, 0 };
+int aqua[3]   = { 100, 0, 0 };
+int yellow[3] = { 60, 5, 100 };
+int orange[3] = { 0, 0, 100 };
+int dimWhite[3] = { 40, 40, 40 };
+// etc.
+
+// Set initial color
+int redVal = black[0];
+int grnVal = black[1];
+int bluVal = black[2];
+
+int wait = 1;      // 10ms internal crossFade delay; increase for slower fades
+int hold = 0;       // Optional hold when a color is complete, before the next crossFade
+int DEBUG = 1;      // DEBUG counter; if set to 1, will write values back via serial
+int loopCount = 60; // How often should DEBUG report?
+int repeat = 0;     // How many times should we loop before stopping? (0 for no stop)
+int j = 0;          // Loop counter for repeat
+int val = 0;
+
+// Initialize color variables
+int prevR = redVal;
+int prevG = grnVal;
+int prevB = bluVal;
+
+//color Array
+int* colors[9]   = {white,red,fuscia,blue,aqua,green,yellow,orange};
+
+// Set up the LED outputs
+void setup()
+{
+  pinMode(redPin, OUTPUT);   // sets the pins as output
+  pinMode(grnPin, OUTPUT);
+  pinMode(bluPin, OUTPUT);
+  pinMode(trigPin, INPUT);
+  crossFade(green);
+}
+
+// Main program: list the order of crossfades
+void loop()
+{
+  //crossFade(red);
+  //crossFade(blue);
+  //crossFade(yellow);
+  val = digitalRead(trigPin);
+  if (val==HIGH) {
+       //do noting.. just go 'roind and round this
+       //    inner loop until button pressed again
+     //int randColor[3] = {colors[0][random (0, 9)]};
+     //crossFade(randColor);
+      int randColor[3] = {random (0, 100),random (0, 100),random (0, 100)};
+      crossFade(randColor);
+      delay(1000);
+  }// end of main loop
+
+}
+
+/* BELOW THIS LINE IS THE MATH -- YOU SHOULDN'T NEED TO CHANGE THIS FOR THE BASICS
+*
+* The program works like this:
+* Imagine a crossfade that moves the red LED from 0-10,
+*   the green from 0-5, and the blue from 10 to 7, in
+*   ten steps.
+*   We'd want to count the 10 steps and increase or
+*   decrease color values in evenly stepped increments.
+*   Imagine a + indicates raising a value by 1, and a -
+*   equals lowering it. Our 10 step fade would look like:
+*
+*   1 2 3 4 5 6 7 8 9 10
+* R + + + + + + + + + +
+* G   +   +   +   +   +
+* B     -     -     -
+*
+* The red rises from 0 to 10 in ten steps, the green from
+* 0-5 in 5 steps, and the blue falls from 10 to 7 in three steps.
+*
+* In the real program, the color percentages are converted to
+* 0-255 values, and there are 1020 steps (255*4).
+*
+* To figure out how big a step there should be between one up- or
+* down-tick of one of the LED values, we call calculateStep(),
+* which calculates the absolute gap between the start and end values,
+* and then divides that gap by 1020 to determine the size of the step
+* between adjustments in the value.
+*/
+
+int calculateStep(int prevValue, int endValue) {
+  int step = endValue - prevValue; // What's the overall gap?
+  if (step) {                      // If its non-zero,
+    step = 1020/step;              //   divide by 1020
+  }
+  return step;
+}
+
+/* The next function is calculateVal. When the loop value, i,
+*  reaches the step size appropriate for one of the
+*  colors, it increases or decreases the value of that color by 1.
+*  (R, G, and B are each calculated separately.)
+*/
+
+int calculateVal(int step, int val, int i) {
+
+  if ((step) && i % step == 0) { // If step is non-zero and its time to change a value,
+    if (step > 0) {              //   increment the value if step is positive...
+      val += 1;
+    }
+    else if (step < 0) {         //   ...or decrement it if step is negative
+      val -= 1;
+    }
+  }
+  // Defensive driving: make sure val stays in the range 0-255
+  if (val > 255) {
+    val = 255;
+  }
+  else if (val < 0) {
+    val = 0;
+  }
+  return val;
+}
+
+/* crossFade() converts the percentage colors to a
+*  0-255 range, then loops 1020 times, checking to see if
+*  the value needs to be updated each time, then writing
+*  the color values to the correct pins.
+*/
+
+void crossFade(int color[3]) {
+  // Convert to 0-255
+  int R = (color[0] * 255) / 100;
+  int G = (color[1] * 255) / 100;
+  int B = (color[2] * 255) / 100;
+
+  int stepR = calculateStep(prevR, R);
+  int stepG = calculateStep(prevG, G);
+  int stepB = calculateStep(prevB, B);
+
+  for (int i = 0; i <= 1020; i++) {
+    redVal = calculateVal(stepR, redVal, i);
+    grnVal = calculateVal(stepG, grnVal, i);
+    bluVal = calculateVal(stepB, bluVal, i);
+
+    analogWrite(redPin, redVal);   // Write current values to LED pins
+    analogWrite(grnPin, grnVal);
+    analogWrite(bluPin, bluVal);
+
+    delay(wait); // Pause for 'wait' milliseconds before resuming the loop
+  }
+  // Update current values for next loop
+  prevR = redVal;
+  prevG = grnVal;
+  prevB = bluVal;
+  delay(hold); // Pause for optional 'wait' milliseconds before resuming the loop
+}


updated status codes

updated status codes

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


Script works. Need someone to put it on all laptops. Need to test scoreboard fix on changed files to merge this branch.

error: pathspec 'Sounds' did not match any file(s) known to git
error: pathspec 'and' did not match any file(s) known to git
error: pathspec 'Senses/scoreboard/scoreboard.ino' did not match any file(s) known to git


Create build.ino

Create build.ino

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


continued work on the arduino code

continued work on the arduino code

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


Create Example1.ino

Create Example1.ino

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

--- sketches/Example1.ino
+++ sketches/Example1.ino
@@ -0,0 +1,33 @@
+/*
+   Based on the DigitalReadSerial example provided by Arduino.
+   This is a slight modification. If the button state is changed from LOW to HIGH
+   then the text 'BUTTON PRESSED' is emitted over Serial connection.
+ */
+
+// digital pin 2 has a pushbutton attached to it. Give it a name:
+int pushButton = 2;
+int previousState = LOW;
+int currentState = LOW;
+// the setup routine runs once when you press reset:
+void setup() {
+  // initialize serial communication at 9600 bits per second:
+  Serial.begin(9600);
+  // make the pushbutton's pin an input:
+  pinMode(pushButton, INPUT);
+}
+
+// the loop routine runs over and over again forever:
+void loop() {
+  // read the input pin:
+  currentState = digitalRead(pushButton);
+  if (currentState != previousState){
+    if (currentState == HIGH)
+        Serial.println("BUTTON PRESSED");
+    previousState = currentState;
+  }
+  // print out the state of the button:
+
+  delay(20);        // delay in between reads for stability
+}
+
+


pushing basic events for charge level and voltage to particle cloud

error: pathspec 'photon-device/src/iot-garden.ino' did not match any file(s) known to git

--- photon-device/src/iot-garden.ino
+++ photon-device/src/iot-garden.ino
@@ -0,0 +1,29 @@
+// This #include statement was automatically added by the Particle IDE.
+#include "SparkFunMAX17043/SparkFunMAX17043.h"
+
+int led2 = D7;
+
+double lipoVoltage = 0.0;
+double lipoSoc = 0.0;
+
+void setup() {
+    lipo.begin();
+    lipo.quickStart();
+
+    pinMode(led2, OUTPUT);
+}
+
+void loop() {
+    // turning the LED on and off every 5 seconds.
+    // Not necessary but helpful when sat next to the device
+    digitalWrite(led2, HIGH);
+    lipoVoltage = lipo.getVoltage();
+    lipoSoc = lipo.getSOC();
+
+    Particle.publish("lipo-voltage", String(lipoVoltage), 60, PRIVATE);
+    Particle.publish("lipo-soc", String(lipoSoc), 60, PRIVATE);
+
+    delay(5000);
+    digitalWrite(led2, LOW);
+    delay(5000);
+}


initial add

initial add

error: pathspec 'hardware/lm4f/variants/launchpad_129/tests/TestDelays/TestDelays.ino' did not match any file(s) known to git

--- hardware/lm4f/variants/launchpad_129/tests/TestDelays/TestDelays.ino
+++ hardware/lm4f/variants/launchpad_129/tests/TestDelays/TestDelays.ino
@@ -0,0 +1,27 @@
+/* TestDelays
+  This test is not the best approach because test and mechanism are
+  based on same timer.
+*/
+
+unsigned long start,end;
+
+void setup() {
+  Serial.begin(9600);
+  Serial.println("\nTestDelays setup");
+
+  start = millis();
+  delay(888);
+  end   = millis();
+  Serial.print("millis = ");
+  Serial.println((end - start),DEC);
+
+  start = micros();
+  delayMicroseconds(444);
+  end   = micros();
+  Serial.print("micros = ");
+  Serial.println((end - start),DEC);
+
+}
+
+void loop() {
+}


Recieved serial data is intepret and sendt to a LCD display The String $LCD,Line 1,Line 2  Shows the folowing on the display: Line 1 Line 2

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

--- arduino_src/SerialShowLCD/SerialShowLCD.ino
+++ arduino_src/SerialShowLCD/SerialShowLCD.ino
@@ -0,0 +1,103 @@
+
+#include <LiquidCrystal.h>
+
+#define MAX_RECV_LINE_LENGTH 200
+#define MAX_COMMANDS 10
+
+String strIncompleteLine = ""; // a string to hold incoming data
+String strInputLine = ""; // a string to the recieved line
+boolean bStrComplete = false; // whether the string is complete
+
+String strCommands[MAX_COMMANDS];
+
+// Connections:
+// rs (LCD )to Arduino pin 11
+// rw (LCD) to Arduino pin 10
+// enable (LCD ) to Arduino pin 9
+// LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
+LiquidCrystal lcd(11, 10, 9, 5, 4, 3, 2);
+
+void setup()
+{
+
+  // initialize serial:
+  Serial.begin(9600);
+  // reserve MAX_RECV_LENGTH bytes for the inputString:
+  strIncompleteLine.reserve(MAX_RECV_LINE_LENGTH);
+  strInputLine.reserve(MAX_RECV_LINE_LENGTH);
+
+  lcd.begin(16,2);              // Use 16,2 for a 16x2 LCD Module
+  lcd.clear();                  // Clear screen
+  lcd.setCursor(0,0);           // Set cursor to column 0, row 0 (the first row)
+  lcd.print("Wating For");      // Display text at line 0
+  lcd.setCursor(0,1);           // set cursor to column 0, row 1
+  lcd.print("Serial Data");     // Display text at line 1
+}
+
+// strCommands - input string that contains a CVS string ($LED,1,0,1,0,2)
+// strTab - has the splited input (strTab[0]="$LED",strTab[1]="1",strTab[2]="0")
+// maxItems - the maximum commands to parse
+// Return the number of read items
+int SplitCommands(String strCommands, String strTab[],int maxItems)
+{
+  //Start position looking for ','
+  int fisrtCommaPosition=0;
+  int lastCommaPosition=0;
+  int iItems=0;
+  do
+    { //Get the position of the next item
+        lastCommaPosition = strCommands.indexOf(',',fisrtCommaPosition);
+        if(lastCommaPosition != -1)
+        { strTab[iItems]= strCommands.substring(fisrtCommaPosition,lastCommaPosition);
+            fisrtCommaPosition=lastCommaPosition+1;
+        }
+        else
+            //Prints the last element
+            strTab[iItems]= strCommands.substring(fisrtCommaPosition,strInputLine.length());
+
+       iItems++;
+
+     } while((lastCommaPosition >=0) & (iItems<maxItems));
+
+  return iItems;
+}
+
+void loop()
+{
+    int i=0;
+  // print the string when a newline arrives:
+  if (bStrComplete)
+  { bStrComplete=false;
+    // Splits the incoming string into strCommands[0] .. [MAX_COMMANDS]
+    int nCommands=SplitCommands(strInputLine,strCommands,MAX_COMMANDS); // Parses the CVS string
+    if(strCommands[0]=="$LCD")
+    {
+      lcd.setCursor(0,0);           // Set cursor to column 0, row 0 (the first row)
+      lcd.print(strCommands[1]);    // Display text at line 0
+      lcd.setCursor(0,1);           // set cursor to column 0, row 1
+      lcd.print(strCommands[2]);    // Display text at line 1
+    }
+  }
+}
+
+/*
+SerialEvent occurs whenever a new data comes in the
+hardware serial RX. This routine is run between each
+time loop() runs, so using delay inside loop can delay
+response. Multiple bytes of data may be available.
+*/
+void serialEvent() {
+  while (Serial.available()) {
+    // get the new byte:
+    char inChar = (char)Serial.read();
+    // add it to the inputString:
+    strIncompleteLine += inChar;
+    // if the incoming character is a newline, set a flag
+    // so the main loop can do something about it:
+    if (inChar == '\n') {
+      strInputLine=strIncompleteLine;
+      bStrComplete = true;
+      strIncompleteLine="";
+    }
+  }
+}


sketch folder created

sketch folder created

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

--- sketch/HelloWorld/HelloWorld.ino
+++ sketch/HelloWorld/HelloWorld.ino
@@ -0,0 +1,151 @@
+/*
+  LiquidCrystal Library - Hello World
+
+ Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
+ library works with all LCD displays that are compatible with the
+ Hitachi HD44780 driver. There are many of them out there, and you
+ can usually tell them by the 16-pin interface.
+
+ This sketch prints "Hello World!" to the LCD
+ and shows the time.
+
+  The circuit:
+ * LCD RS pin to digital pin 12
+ * LCD Enable pin to digital pin 11
+ * LCD D4 pin to digital pin 5
+ * LCD D5 pin to digital pin 4
+ * LCD D6 pin to digital pin 3
+ * LCD D7 pin to digital pin 2
+ * LCD R/W pin to ground
+ * LCD VSS pin to ground
+ * LCD VCC pin to 5V
+ * 10K resistor:
+ * ends to +5V and ground
+ * wiper to LCD VO pin (pin 3)
+
+ Library originally added 18 Apr 2008
+ by David A. Mellis
+ library modified 5 Jul 2009
+ by Limor Fried (http://www.ladyada.net)
+ example added 9 Jul 2009
+ by Tom Igoe
+ modified 22 Nov 2010
+ by Tom Igoe
+
+ This example code is in the public domain.
+
+ http://www.arduino.cc/en/Tutorial/LiquidCrystal
+ */
+
+// include the library code:
+#include <LiquidCrystal.h>
+
+#define UPDATE_TIME 1500 //1.5 seg for screen updating
+
+long lastScreenUpdate;
+
+volatile byte REV;       //  VOLATILE DATA TYPE TO STORE REVOLUTIONS
+
+unsigned long int rpm, maxRPM;  //  DEFINE RPM AND MAXIMUM RPM
+
+unsigned long time;         //  DEFINE TIME TAKEN TO COVER ONE REVOLUTION
+
+int ledPin = 13;           //   STATUS LED
+
+int led = 0,RPMlen , prevRPM;  //  INTEGERS TO STORE LED VALUE AND CURRENT RPM AND PREVIOUS RPM
+
+int flag = 0;             //  A VARIABLE TO DETERMINE WHETHER THE LCD NEEDS TO BE CLEARED OR NOT
+
+long prevtime = 0;       //  STORE IDLE TIME TO TOGGLE MENU
+
+// initialize the library with the numbers of the interface pins
+LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
+
+void setup() {
+
+     attachInterrupt(0, RPMCount, FALLING);     //  ADD A HIGH PRIORITY ACTION ( AN INTERRUPT)  WHEN THE SENSOR GOES FROM LOW TO HIGH
+
+     REV = 0;      //  START ALL THE VARIABLES FROM 0
+
+     rpm = 0;
+
+     time = 0;
+
+     pinMode(ledPin, OUTPUT);
+
+     pinMode(3, OUTPUT);
+
+
+     digitalWrite(3, HIGH);             //  VCC PIN FOR SENSOR
+
+  // set up the LCD's number of columns and rows:
+  lcd.begin(20, 4);
+  // Print a message to the LCD.
+  lcd.print("DViejo's Tachometer");
+  lcd.setCursor(0, 1);
+  lcd.print("RPM ");
+  lcd.setCursor(10,1);
+  lcd.print("MAX ");
+  lcd.setCursor(0,2);
+  lcd.print("Debug REV: ");
+
+  lastScreenUpdate = -UPDATE_TIME;
+}
+
+void loop() {
+
+   delay(500);
+   detachInterrupt(0);
+   rpm = 30*1000/(millis() - time)*REV;       //  CALCULATE  RPM USING REVOLUTIONS AND ELAPSED TIME
+
+   if(rpm > maxRPM)
+     maxRPM = rpm;                             //  GET THE MAX RPM THROUGHOUT THE RUN
+
+   time = millis();
+
+   REV = 0;
+
+   printStatus();
+  attachInterrupt(0, RPMCount, FALLING);
+
+}
+
+void printStatus()
+{
+  int cont, len, aux;
+  lcd.setCursor(4, 1);
+  aux=rpm;
+  len = 4;
+  while(aux>10)
+  {
+    len--;
+    aux /= 10;
+  }
+  for(cont=0;cont<len;cont++) lcd.print(" ");
+
+  lcd.print(rpm);
+  lcd.setCursor(14,1);
+  lcd.print(maxRPM);
+  lcd.setCursor(11,2);
+  lcd.print(REV);
+
+}
+
+ void RPMCount()                                // EVERYTIME WHEN THE SENSOR GOES FROM LOW TO HIGH , THIS FUNCTION WILL BE INVOKED
+ {
+   REV++;                                         // INCREASE REVOLUTIONS
+
+   if (led == LOW)
+   {
+
+     led = HIGH;                                 //  TOGGLE STATUS LED
+   }
+
+   else
+   {
+     led = LOW;
+   }
+   digitalWrite(ledPin, led);
+ }
+
+


Added a RGBW LED test

Added a RGBW LED test

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

--- simple_rgbw_test/simple_rgbw_test.ino
+++ simple_rgbw_test/simple_rgbw_test.ino
@@ -0,0 +1,26 @@
+#include <Adafruit_NeoPixel.h>
+
+#define PIN            6
+#define NUMPIXELS      7
+
+Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRBW + NEO_KHZ800);
+
+int delayval = 500; // delay for half a second
+
+void setup() {
+  pixels.begin(); // This initializes the NeoPixel library.
+}
+
+void loop() {
+  // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
+  for(int i=0;i<NUMPIXELS;i++){
+    pixels.setPixelColor(i, pixels.Color(255,0,0,0));
+    pixels.show();
+  }
+    delay(delayval);
+  for(int i=0;i<NUMPIXELS;i++){
+    pixels.setPixelColor(i, pixels.Color(0,0,0,255));
+    pixels.show();
+  }
+    delay(delayval);
+}


Fixed bug

Fixed bug

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


arduino code

arduino code

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

--- arduino/ConstantSpeedMega.ino
+++ arduino/ConstantSpeedMega.ino
@@ -0,0 +1,120 @@
+// ConstantSpeed.pde
+// -*- mode: C++ -*-
+//
+// Shows how to run AccelStepper in the simplest,
+// fixed speed mode with no accelerations
+/// \author  Mike McCauley (mikem@open.com.au)
+// Copyright (C) 2009 Mike McCauley
+// $Id: ConstantSpeed.pde,v 1.1 2011/01/05 01:51:01 mikem Exp mikem $
+
+#define X_STEP_PIN         54
+#define X_DIR_PIN          55
+#define X_ENABLE_PIN       38
+#define X_MIN_PIN           3
+#define X_MAX_PIN           2
+
+#define Y_STEP_PIN         60
+#define Y_DIR_PIN          61
+#define Y_ENABLE_PIN       56
+#define Y_MIN_PIN          14
+#define Y_MAX_PIN          15
+#include <AccelStepper.h>
+
+//AccelStepper stepper; // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5
+AccelStepper stepper(AccelStepper::FULL2WIRE,X_STEP_PIN, X_DIR_PIN  );
+AccelStepper stepper1(AccelStepper::FULL2WIRE, Y_STEP_PIN , Y_DIR_PIN);
+float stepsize = 50;
+
+void setup()
+{  pinMode(X_ENABLE_PIN,OUTPUT);
+   pinMode(Y_ENABLE_PIN,OUTPUT);
+   digitalWrite(X_ENABLE_PIN,LOW);
+   digitalWrite(Y_ENABLE_PIN,LOW);
+   //stepper.setMinPulseWidth(100);
+//   stepper.setMaxSpeed(100);
+
+   //stepper1.setMaxSpeed(100);
+
+ //   stepper.setAcceleration(200);
+   //  stepper1.setAcceleration(200);
+  //stepper.moveTo(5000);
+//  stepper1.moveTo(5000);
+   stepper.setAcceleration(200);
+   stepper.setMaxSpeed(1000000);
+   stepper.setSpeed(10000);
+
+   stepper1.setAcceleration(200000);
+   stepper1.setMaxSpeed(100000);
+   stepper1.setSpeed(10000);
+
+
+   Serial.begin(9600);
+
+}
+
+void loop()
+{
+    if(Serial.available()){
+        byte r = Serial.read();
+        switch (r) {
+        case '1':
+           digitalWrite(X_ENABLE_PIN,LOW);
+           digitalWrite(Y_ENABLE_PIN,LOW);
+           break;
+        case '0':
+           digitalWrite(X_ENABLE_PIN,HIGH);
+           digitalWrite(Y_ENABLE_PIN,HIGH);
+           break;
+
+        case 'w':
+          stepper.moveTo(stepper.currentPosition()-stepsize);
+          break;
+        case 's':
+          stepper.moveTo(stepper.currentPosition()+stepsize);
+          break;
+        case 'a':
+          stepper1.moveTo(stepper1.currentPosition()-stepsize*2);
+          break;
+        case 'd':
+          stepper1.moveTo(stepper1.currentPosition()+stepsize*2);
+          break;
+        case '2':
+          stepsize = 1;
+          break;
+        case '3':
+          stepsize = 2;
+          break;
+        case '4':
+          stepsize = 5;
+          break;
+        case '5':
+          stepsize = 10;
+          break;
+        case '6':
+          stepsize = 20;
+          break;
+        case '7':
+          stepsize = 50;
+          break;
+        case '8':
+          stepsize = 100;
+          break;
+
+        case '9':
+          stepsize = 200;
+          break;
+         case '?':
+          Serial.println(stepsize);
+          break;
+
+        default:
+          break;
+          // turn all the LEDs off:
+          }
+        }
+
+
+    stepper.run();
+    stepper1.run();
+
+}


Bug fixes as per Issue #167

Bug fixes as per Issue #167

Have updated IRrecvDdump to fix bugs described in Issue: #167

In summary, removed bug where large space values were displayed incorrectly & confusing users. The output now always starts with a mark, instead of a space, which makes it easier to interpret and less confusing for users.

refer to #167 for more detials.

The update has been tested with several protocols (but not all) and verified as working.

--- examples/IRrecvDump/IRrecvDump.ino
+++ examples/IRrecvDump/IRrecvDump.ino
@@ -10,7 +10,12 @@

 #include <IRremote.h>

-int RECV_PIN = 11;
+/*
+*  Default is Arduino pin D11.
+*  You can change this to another available Arduino Pin.
+*  Your IR receiver should be connected to the pin defined here
+*/
+int RECV_PIN = 11;

 IRrecv irrecv(RECV_PIN);

@@ -22,18 +27,17 @@
   irrecv.enableIRIn(); // Start the receiver
 }

-// Dumps out the decode_results structure.
-// Call this after IRrecv::decode()
-// void * to work around compiler issue
-//void dump(void *v) {
-//  decode_results *results = (decode_results *)v
+
 void dump(decode_results *results) {
+  // Dumps out the decode_results structure.
+  // Call this after IRrecv::decode()
   int count = results->rawlen;
   if (results->decode_type == UNKNOWN) {
     Serial.print("Unknown encoding: ");
   }
   else if (results->decode_type == NEC) {
     Serial.print("Decoded NEC: ");
+
   }
   else if (results->decode_type == SONY) {
     Serial.print("Decoded SONY: ");
@@ -46,21 +50,20 @@
   }
   else if (results->decode_type == PANASONIC) {
     Serial.print("Decoded PANASONIC - Address: ");
-    Serial.print(results->address,HEX);
+    Serial.print(results->address, HEX);
     Serial.print(" Value: ");
   }
   else if (results->decode_type == LG) {
-     Serial.print("Decoded LG: ");
+    Serial.print("Decoded LG: ");
   }
   else if (results->decode_type == JVC) {
-     Serial.print("Decoded JVC: ");
-
+    Serial.print("Decoded JVC: ");
   }
   else if (results->decode_type == AIWA_RC_T501) {
     Serial.print("Decoded AIWA RC T501: ");
   }
   else if (results->decode_type == WHYNTER) {
-     Serial.print("Decoded Whynter: ");
+    Serial.print("Decoded Whynter: ");
   }
   Serial.print(results->value, HEX);
   Serial.print(" (");
@@ -70,18 +73,18 @@
   Serial.print(count, DEC);
   Serial.print("): ");

-  for (int i = 0; i < count; i++) {
-    if ((i % 2) == 1) {
+  for (int i = 1; i < count; i++) {
+    if (i & 1) {
       Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
     }
     else {
-      Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
+      Serial.write('-');
+      Serial.print((unsigned long) results->rawbuf[i]*USECPERTICK, DEC);
     }
     Serial.print(" ");
   }
-  Serial.println("");
+  Serial.println();
 }
-

 void loop() {
   if (irrecv.decode(&results)) {


Add examples

Add examples

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

--- examples/Kelvin2rgb/Kelvin2rgb.ino
+++ examples/Kelvin2rgb/Kelvin2rgb.ino
@@ -0,0 +1,43 @@
+#include <Kelvin2RGB.h>
+
+String inString = "";
+
+void setup() {
+  Serial.begin(57600);
+  Serial.println("Enter Temperature and brightness.   eg. 6600K50%");
+}
+
+void loop() {
+  while (Serial.available() > 0) {
+    int inChar = Serial.read();
+    inString += (char)inChar;
+
+    if (inChar == '\n') {
+
+      int brightness = 100;
+      int temperature = 0;
+
+      temperature = inString.substring(0, inString.indexOf('K')).toInt();
+      brightness = constrain(inString.substring(inString.indexOf('K')+1).toInt(), 0, 100);
+
+      Kelvin2RGB kel(temperature, brightness);
+
+      Serial.print("Temp:");
+      Serial.print(kel.Temperature);
+      Serial.print("K  Brightness:");
+      Serial.print(kel.Brightness);
+      Serial.print("%  Red:");
+      Serial.print(kel.Red);
+      Serial.print("  Green:");
+      Serial.print(kel.Green);
+      Serial.print("  Blue:");
+      Serial.print(kel.Blue);
+
+      Serial.println("    HEX:#" + String(kel.Red, HEX) + String(kel.Green, HEX) + String(kel.Blue, HEX));
+
+      inString = "";
+    }
+  }
+}
+
+


Servo Sweep

Servo Sweep

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

--- examples/ServoSweep/ServoSweep.ino
+++ examples/ServoSweep/ServoSweep.ino
@@ -0,0 +1,33 @@
+
+/**
+  Servo Sweep
+*/
+
+// Include the Denbit library.
+#include <Denbit.h>
+// Initialize the denbit.
+Denbit denbit;
+
+#include <Servo.h>
+
+Servo myservo;  // create servo object to control a servo
+// twelve servo objects can be created on most boards
+
+int pos = 0;    // variable to store the servo position
+
+void setup() {
+  myservo.attach(12);  // attaches the servo on pin 9 to the servo object
+}
+
+void loop() {
+  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
+    // in steps of 1 degree
+    myservo.write(pos);              // tell servo to go to position in variable 'pos'
+    delay(15);                       // waits 15ms for the servo to reach the position
+  }
+  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
+    myservo.write(pos);              // tell servo to go to position in variable 'pos'
+    delay(15);                       // waits 15ms for the servo to reach the position
+  }
+}
+


base version of arduino code for driving multiple strings of neo pixels

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

--- MagnusCoreNeoPixel_v1.ino
+++ MagnusCoreNeoPixel_v1.ino
@@ -0,0 +1,166 @@
+#include <Adafruit_NeoPixel.h>
+#include <stdlib.h>
+
+
+// first communication pin for neo pixel string
+#define BASE_PIN 2
+
+enum Direction { NORTH = 0, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, NORTHWEST };
+enum Ownership {  neutral = 0, enlightened, resistance };
+
+struct pixel_string {
+  uint16_t phase;
+  uint32_t timing;
+};
+
+#define NUM_STRINGS 8 // one for each resonator
+
+
+pixel_string strings[NUM_STRINGS];
+
+// Parameter 1 = number of pixels in strip
+// Parameter 2 = Arduino pin number (most are valid)
+// Parameter 3 = pixel type flags, add together as needed:
+//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
+//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
+//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
+//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
+//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
+Adafruit_NeoPixel strip = Adafruit_NeoPixel(120, BASE_PIN, NEO_RGBW + NEO_KHZ800);
+
+
+// Serial I/O
+int8_t command[32];
+int8_t in_index = 0;
+
+void start_serial(void)
+{
+  in_index = 0;
+  Serial.begin(9600);
+}
+
+bool collect_serial(void)
+{
+  while( Serial.available() > 0 )
+  {
+    int8_t ch = Serial.read();
+    if( ch == '\n' )
+    {
+      command[in_index] = 0; // terminate
+      if( in_index > 0 )
+      {
+        in_index = 0;
+        return true;
+      }
+    }
+    else if( ch == 0x0a || ch == 0x13 ) // carriage return or linefeed (ignore
+    {
+    }
+    else
+    {
+      command[in_index] = ch;
+      in_index++;
+      //if( in_index >= 32 ) //sizeof(command) )
+      //  in_index = 0;
+    }
+  }
+  return false;
+}
+
+uint8_t getPercent(uint8_t *buffer)
+{
+  unsigned long inVal = strtoul(buffer,NULL,10);
+  return uint8_t( constrain(inVal, 0, 100) );
+}
+
+
+uint8_t dir;
+uint8_t percent;
+uint8_t owner;    // 0=neutral, 1=enl, 2=res
+
+
+// the setup function runs once when you press reset or power the board
+void setup()
+{
+  start_serial();
+  strip.begin();
+  uint8_t i;
+  for( i = 0; i<NUM_STRINGS; i++)
+  {
+    strip.setPin(i+BASE_PIN);
+    strip.show(); // Initialize all pixels to 'off'
+
+    strings[i].phase = 0;
+    strings[i].timing = 0;
+  }
+
+  dir = NORTH; // begin on the north resonator
+  owner = neutral;
+  percent = 0;
+}
+
+// the loop function runs over and over again forever
+void loop()
+{
+  uint16_t i, val;
+
+  if( collect_serial() )
+  {
+    // we have valid buffer of serial input
+    if( command[0] == 'e' || command[0] == 'E' )
+    {
+      owner = enlightened;
+      percent = getPercent(&command[1]);
+    }
+    else if( command[0] == 'r' || command[0] == 'R' )
+    {
+      owner = resistance;
+      percent = getPercent(&command[1]);
+    }
+    else if( command[0] == 'n' || command[0] == 'N' )
+    {
+      owner = neutral;
+      percent = 100;
+    }
+    //Serial.print((char *)command); Serial.print(" - ");Serial.print(command[0],DEC);Serial.print(": ");
+    //Serial.print("owner "); Serial.print(owner,DEC); Serial.print(", percent "); Serial.println(percent,DEC);
+  }
+
+  if(strings[dir].timing < millis() )
+  {
+    strings[dir].timing += 100; // every 100 milliseconds we will check this direction
+
+    strip.setPin(dir+BASE_PIN);  // pick the string
+
+    uint8_t red, green, blue, white;
+    red = 0x20; green = 0; blue = 0x20; white = 0x20;
+    if( owner == neutral )
+    {
+      red = 0; green = 0; blue = 0; white = 0x40;
+    }
+    else if( owner == resistance )
+    {
+      red = 0; green = 0x1f; blue = 0xff;; white = 0;
+    }
+    else if( owner == enlightened )
+    {
+      red = 0x1f; green = 0xff; blue = 0; white = 0;
+    }
+
+    for(i=0; i < strip.numPixels(); i++)
+    {
+        //strip.setPixelColor(i, green,blue,red); // for RGB order is funny?
+        strip.setPixelColor(i, green, red, blue,white);
+        strip.setBrightness((uint8_t)((uint16_t)(255*percent)/100));
+    }
+    strip.show();
+
+    dir++;
+    if( dir >= NUM_STRINGS )
+      dir = 0;
+  }
+
+
+}
+
+


new version

new version

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

--- MagnusCoreNeoPixel_v2.ino
+++ MagnusCoreNeoPixel_v2.ino
@@ -0,0 +1,166 @@
+#include <Adafruit_NeoPixel.h>
+#include <stdlib.h>
+
+
+// first communication pin for neo pixel string
+#define BASE_PIN 2
+
+enum Direction { NORTH = 0, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, NORTHWEST };
+enum Ownership {  neutral = 0, enlightened, resistance };
+
+struct pixel_string {
+  uint16_t phase;
+  uint32_t timing;
+};
+
+#define NUM_STRINGS 8 // one for each resonator
+
+
+pixel_string strings[NUM_STRINGS];
+
+// Parameter 1 = number of pixels in strip
+// Parameter 2 = Arduino pin number (most are valid)
+// Parameter 3 = pixel type flags, add together as needed:
+//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
+//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
+//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
+//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
+//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
+Adafruit_NeoPixel strip = Adafruit_NeoPixel(120, BASE_PIN, NEO_RGBW + NEO_KHZ800);
+
+
+// Serial I/O
+int8_t command[32];
+int8_t in_index = 0;
+
+void start_serial(void)
+{
+  in_index = 0;
+  Serial.begin(9600);
+}
+
+bool collect_serial(void)
+{
+  while( Serial.available() > 0 )
+  {
+    int8_t ch = Serial.read();
+    if( ch == '\n' )
+    {
+      command[in_index] = 0; // terminate
+      if( in_index > 0 )
+      {
+        in_index = 0;
+        return true;
+      }
+    }
+    else if( ch == 0x0a || ch == 0x13 ) // carriage return or linefeed (ignore
+    {
+    }
+    else
+    {
+      command[in_index] = ch;
+      in_index++;
+      //if( in_index >= 32 ) //sizeof(command) )
+      //  in_index = 0;
+    }
+  }
+  return false;
+}
+
+uint8_t getPercent(uint8_t *buffer)
+{
+  unsigned long inVal = strtoul(buffer,NULL,10);
+  return uint8_t( constrain(inVal, 0, 100) );
+}
+
+
+uint8_t dir;
+uint8_t percent;
+uint8_t owner;    // 0=neutral, 1=enl, 2=res
+
+
+// the setup function runs once when you press reset or power the board
+void setup()
+{
+  start_serial();
+  strip.begin();
+  uint8_t i;
+  for( i = 0; i<NUM_STRINGS; i++)
+  {
+    strip.setPin(i+BASE_PIN);
+    strip.show(); // Initialize all pixels to 'off'
+
+    strings[i].phase = 0;
+    strings[i].timing = 0;
+  }
+
+  dir = NORTH; // begin on the north resonator
+  owner = neutral;
+  percent = 0;
+}
+
+// the loop function runs over and over again forever
+void loop()
+{
+  uint16_t i, val;
+
+  if( collect_serial() )
+  {
+    // we have valid buffer of serial input
+    if( command[0] == 'e' || command[0] == 'E' )
+    {
+      owner = enlightened;
+      percent = getPercent(&command[1]);
+    }
+    else if( command[0] == 'r' || command[0] == 'R' )
+    {
+      owner = resistance;
+      percent = getPercent(&command[1]);
+    }
+    else if( command[0] == 'n' || command[0] == 'N' )
+    {
+      owner = neutral;
+      percent = 100;
+    }
+    //Serial.print((char *)command); Serial.print(" - ");Serial.print(command[0],DEC);Serial.print(": ");
+    //Serial.print("owner "); Serial.print(owner,DEC); Serial.print(", percent "); Serial.println(percent,DEC);
+  }
+
+  if(strings[dir].timing < millis() )
+  {
+    strings[dir].timing += 100; // every 100 milliseconds we will check this direction
+
+    strip.setPin(dir+BASE_PIN);  // pick the string
+
+    uint8_t red, green, blue, white;
+    red = 0x20; green = 0; blue = 0x20; white = 0x20;
+    if( owner == neutral )
+    {
+      red = 0; green = 0; blue = 0; white = 0x40;
+    }
+    else if( owner == resistance )
+    {
+      red = 0; green = 0x1f; blue = 0xff;; white = 0;
+    }
+    else if( owner == enlightened )
+    {
+      red = 0x1f; green = 0xff; blue = 0; white = 0;
+    }
+
+    for(i=0; i < strip.numPixels(); i++)
+    {
+        //strip.setPixelColor(i, green,blue,red); // for RGB order is funny?
+        strip.setPixelColor(i, green, red, blue,white);
+        strip.setBrightness((uint8_t)((uint16_t)(255*percent)/100));
+    }
+    strip.show();
+
+    dir++;
+    if( dir >= NUM_STRINGS )
+      dir = 0;
+  }
+
+
+}
+
+


ported to esp32

ported to esp32

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/jadalqui/ha_arduino.git/'


Create Gyro3.ino

Create Gyro3.ino

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

--- Gyro3.ino
+++ Gyro3.ino
@@ -0,0 +1,57 @@
+// Once you import this library into an app on the web based IDE, modify the code to look something like the following.
+// This code is a heavily modified version of the MPU6050_raw.ino example found elsewhere in this repo.
+// This code has been tested against the MPU-9150 breakout board from Sparkfun.
+
+// This #include statement was automatically added by the Spark IDE.
+#include "MPU6050/MPU6050.h"
+
+int ledPin = D7;
+
+// MPU variables:
+MPU6050 accelgyro;
+int16_t ax, ay, az;
+int16_t gx, gy, gz;
+
+
+bool ledState = false;
+void toggleLed() {
+    ledState = !ledState;
+    digitalWrite(ledPin, ledState);
+}
+
+void setup() {
+    pinMode(ledPin, OUTPUT);
+
+    Wire.begin();
+    Serial.begin(9600);
+
+    // The following line will wait until you connect to the Spark.io using serial and hit enter. This gives
+    // you enough time to start capturing the data when you are ready instead of just spewing data to the UART.
+    //
+    // So, open a serial connection using something like:
+    // screen /dev/tty.usbmodem1411 9600
+    while(!Serial.available()) SPARK_WLAN_Loop();
+
+    Serial.println("Initializing I2C devices...");
+    accelgyro.initialize();
+
+    // Cerify the connection:
+    Serial.println("Testing device connections...");
+    Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
+
+}
+
+void loop() {
+    // read raw accel/gyro measurements from device
+    accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
+    Serial.print("a/g:\t");
+    Serial.print(ax); Serial.print("\t");
+    Serial.print(ay); Serial.print("\t");
+    Serial.print(az); Serial.print("\t");
+    Serial.print(gx); Serial.print("\t");
+    Serial.print(gy); Serial.print("\t");
+    Serial.println(gz);
+
+    toggleLed();
+
+}


Created a generic template for V0p2 apps

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

--- Arduino/hardware/V0p2_template.ino
+++ Arduino/hardware/V0p2_template.ino
@@ -0,0 +1,223 @@
+/*
+The OpenTRV project licenses this file to you
+under the Apache Licence, Version 2.0 (the "Licence");
+you may not use this file except in compliance
+with the Licence. You may obtain a copy of the Licence at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the Licence is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the Licence for the
+specific language governing permissions and limitations
+under the Licence.
+
+Author(s) / Copyright (s): Damon Hart-Davis 2013--2017
+                           Deniz Erbilgin 2015--2017
+*/
+
+/******************************************************************************
+ * NOTES
+ *****************************************************************************/
+/**
+ * @brief   Template for building a V0p2 app.
+ * @TODO    Figure out how detailed this should be, e.g.
+ *          - Do we want a template for setup and loop functions?
+ *          - What generic functions should be included/assumed necessary?
+ *            e.g. pollIO, CLI stuff etc.
+ */
+
+/******************************************************************************
+ * INCLUDES
+ *****************************************************************************/
+
+////// GLOBAL flags that alter system build and behaviour.
+
+// If defined, do extra checks and serial logging.  Will take more code space and power.
+#undef DEBUG
+// Ensure that OpenTRV 'standard' UART speed is set unless explicitly overridden.
+#define BAUD 4800
+
+// *** Global flag for REVx configuration here *** //
+// e.g.
+// #define CONFIG_REV10_SECURE_BHR // REV10: secure stats relay and boiler hub.
+
+// Get defaults for valve applications.
+#include <OTV0p2_valve_ENABLE_defaults.h>
+
+// *** Main board config imported here *** //
+
+// --------------------------------------------
+// Fixups to apply after loading the target config.
+#include <OTV0p2_valve_ENABLE_fixups.h>
+// I/O pin allocation and setup: include ahead of I/O module headers.
+#include <OTV0p2_Board_IO_Config.h>
+
+
+////// MAIN LIBRARIES
+
+#include <Arduino.h>
+#include <OTV0p2Base.h>
+#include <OTRadioLink.h>
+
+
+////// ADDITIONAL LIBRARIES/PERIPHERALS
+
+// #define RFM23B_IRQ_CONTROL  // Enable RFM23B IRQ control code.
+// #include <OTRFM23BLink.h>
+// #include <OTAESGCM.h>
+
+
+////// ADDITIONAL USER HEADERS
+
+
+/******************************************************************************
+ * GENERAL CONSTANTS AND VARIABLES
+ * Core constants and variables required for V0p2 loop.
+ *****************************************************************************/
+
+
+
+/******************************************************************************
+ * PERIPHERALS
+ * Peripheral drivers and config
+ *****************************************************************************/
+
+////// RADIOS
+
+
+////// SENSORS
+
+
+////// ACTUATORS
+
+
+/******************************************************************************
+ * INTERRUPT SERVICE ROUTINES
+ *****************************************************************************/
+
+/**
+ * Example pin change ISR for a generic peripheral "periph" on pin bank "x".
+ */
+// static volatile uint8_t prevStatePx;
+// Interrupt service routine for Px I/O port transition changes.
+// ISR(PCINTx_vect)
+// {
+//     // Basic profiling info
+//     OTV0P2BASE::MemoryChecks::recordPC();
+//
+//     const uint8_t pins = PINx;
+//     const uint8_t changes = pins ^ prevStatePx;
+//     prevStatePBx= pins;
+//
+//     // RFM23B nIRQ falling edge is of interest.
+//     // Handler routine not required/expected to 'clear' this interrupt.
+//     if((changes & periph_INT_MASK) && !(pins & periph_INT_MASK))
+//         { periph._handleInterrupt(); }
+// }
+
+
+/******************************************************************************
+ * LOCAL FUNCTIONS
+ *****************************************************************************/
+
+////// PANIC
+
+// Indicate that the system is broken in an obvious way (distress flashing the main LED).
+// DOES NOT RETURN.
+// Tries to turn off most stuff safely that will benefit from doing so, but nothing too complex.
+// Tries not to use lots of energy so as to keep distress beacon running for a while.
+/**
+ * Example panic routines with one radio.
+ */
+// static void panic()
+// {
+//     // Reset radio and go into low-power mode here
+//     PrimaryRadio.panicShutdown();
+//
+//     // Power down almost everything else...
+//     OTV0P2BASE::minimisePowerWithoutSleep();
+//     pinMode(OTV0P2BASE::LED_HEATCALL_L, OUTPUT);
+//
+//     // Flash LED.
+//     for( ; ; ) {
+//         OTV0P2BASE::LED_HEATCALL_ON();
+//         OTV0P2BASE::nap(WDTO_15MS);
+//         OTV0P2BASE::LED_HEATCALL_OFF();
+//         OTV0P2BASE::nap(WDTO_120MS);
+//     }
+// }
+//
+// // Panic with fixed message.
+// static void panic(const __FlashStringHelper *s)
+// {
+//     OTV0P2BASE::serialPrintlnAndFlush(); // Start new line to highlight error.  // May fail.
+//     OTV0P2BASE::serialPrintAndFlush('!'); // Indicate error with leading '!' // May fail.
+//     OTV0P2BASE::serialPrintlnAndFlush(s); // Print supplied detail text. // May fail.
+//     panic();
+// }
+
+
+////// DIAGNOSTICS
+// e.g. stack check
+
+
+////// CONTROL
+
+/**
+ * Example IO Poll.
+ */
+// // Call this to do an I/O poll if needed; returns true if something useful definitely happened.
+// // This call should typically take << 1ms at 1MHz CPU.
+// // Does not change CPU clock speeds, mess with interrupts (other than possible brief blocking), or sleep.
+// // Should also do nothing that interacts with Serial.
+// // Limits actual poll rate to something like once every 8ms, unless force is true.
+// //   * force if true then force full poll on every call (ie do not internally rate-limit)
+// // Note that radio poll() can be for TX as well as RX activity.
+// // Not thread-safe, eg not to be called from within an ISR.
+// bool pollIO(const bool force = false)
+// {
+//     static volatile uint8_t _pO_lastPoll;
+//     // Poll RX at most about every ~8ms.
+//     const uint8_t sct = OTV0P2BASE::getSubCycleTime();
+//     if(force || (sct != _pO_lastPoll)) {
+//         _pO_lastPoll = sct;
+//         // Poll for inbound frames.
+//         // If RX is not interrupt-driven then
+//         // there will usually be little time to do this
+//         // before getting an RX overrun or dropped frame
+//         PrimaryRadio.poll();
+//     }
+//     return(false);
+// }
+
+
+////// MESSAGING
+// e.g. void bareStatsTX()
+
+
+////// UI
+// e.g. void pollCLI()
+
+
+/******************************************************************************
+ * SETUP
+ *****************************************************************************/
+
+// Setup routine: runs once after reset.
+void setup()
+{
+
+}
+
+
+/******************************************************************************
+ * MAIN LOOP
+ *****************************************************************************/
+
+void loop()
+{
+
+}
+


Add connect project with additional debug statements

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

--- Code/connect_debug_enabled/connect.ino
+++ Code/connect_debug_enabled/connect.ino
@@ -0,0 +1,53 @@
+#include <MicrochipLoRaModem.h>
+#include "keys.h"
+#include <ATT_LoRa_IOT.h>
+
+#define SERIAL_BAUD 57600
+#define FULLDEBUG
+
+MicrochipLoRaModem Modem(&Serial1);
+ATTDevice Device(&Modem);
+boolean connected;
+
+int DigitalSensor = 20;
+
+void setup() {
+  // put your setup code here, to run once:
+  // Serial is the USB connection and Serial1 the connection to the Bee module (Microchip).
+  Serial.begin(SERIAL_BAUD);                   // set baud rate of the default serial debug connection
+  Serial.println("Setup started");
+  Serial1.begin(Modem.getDefaultBaudRate());
+  connected = connect();
+  Serial1.write("radio get rxbw\r\n");
+  delay(10000);
+  Serial.write("get rxbw: ");
+  while(Serial1.available()) Serial.write(Serial1.read());
+  Serial.println("Setup complete");
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  if (!connected)
+    connected = connect();
+
+  bool sensorRead = digitalRead(DigitalSensor);
+
+  if (sensorRead){
+    Serial.println("sensor value = true");
+    Device.Send(sensorRead, BINARY_SENSOR);
+  } else
+    Serial.println("sensor value = false");
+
+
+  delay(5000);
+}
+
+boolean connect(){
+  Serial.println("trying to connect...");
+  boolean conn = Device.Connect(DEV_ADDR,APPSKEY,NWKSKEY,true);
+  if(conn)
+    Serial.println("connection success");
+  else
+    Serial.println("connection failed");
+}
+


ソフトウェアAPモードによる動作確認用サンプル

ソフトウェアAPモードによる動作確認用サンプル

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

--- 2_example/example33d_led/example33d_led.ino
+++ 2_example/example33d_led/example33d_led.ino
@@ -0,0 +1,89 @@
+/*******************************************************************************
+Example 33B(=32+01D): ESP32でLEDを点滅させる
+デモ用：展示会などでPCやスマホから直接ESPモジュールへ接続する場合のサンプル
+                                           Copyright (c) 2016-2017 Wataru KUNINO
+*******************************************************************************/
+#include <WiFi.h>                           // ESP32用WiFiライブラリ
+#define PIN_LED 2                           // GPIO 2(24番ピン)をLEDを接続
+#define SSID "ESP_SoftAP"                   // 無線LANアクセスポイントのSSID
+#define TIMEOUT 20000                       // タイムアウト 20秒
+WiFiServer server(80);                      // Wi-Fiサーバ(ポート80=HTTP)定義
+
+void setup(){                               // 起動時に一度だけ実行する関数
+    pinMode(PIN_LED,OUTPUT);                // LEDを接続したポートを出力に
+    Serial.begin(115200);                   // 動作確認のためのシリアル出力開始
+    Serial.println("ESP32 eg.01D LED HTTP");// 「Example 01D」をシリアル出力表示
+    WiFi.softAP(SSID);                      // ソフトウェアAPの起動
+    WiFi.softAPConfig(
+        IPAddress(192,168,1,2),             /* 固定IPアドレス */
+        IPAddress(192,168,1,1),             /* ゲートウェイアドレス */
+        IPAddress(255,255,255,0)            /* ネットマスク */
+    );
+    server.begin();                         // サーバを起動する
+    Serial.println("\nStarted");            // 起動したことをシリアル出力表示
+    Serial.println(SSID);                   // 本APのSSIDをシリアル出力
+    Serial.println(WiFi.softAPIP());        // 本APのIPアドレスをシリアル出力
+}
+
+void loop(){                                // 繰り返し実行する関数
+    WiFiClient client;                      // Wi-Fiクライアントの定義
+    char c;                                 // 文字変数を定義
+    char s[129];                            // 文字列変数を定義 129バイト128文字
+    int len=0;                              // 文字列の長さカウント用の変数
+    int led=-1;                             // LEDの設定(-1は未設定)
+    int i=0;                                // 待ち受け時間のカウント用の変数
+    int headF=0;                            // HTTPヘッダ用フラグ(0:初期状態)
+
+    client = server.available();            // 接続されたクライアントを生成
+    if(!client) return;                     // 非接続の時にloop()の先頭に戻る
+    Serial.println("Connected");            // 接続されたことをシリアル出力表示
+    while(client.connected()){              // 当該クライアントの接続状態を確認
+        if(client.available()){             // クライアントからのデータを確認
+            i=0;                            // 待ち時間変数をリセット
+            c=client.read();                // データを文字変数cに代入
+            switch(c){                      // 文字cに応じて
+                case '\0':                      // 文字変数cの内容が空のとき
+                case '\r':                      // 文字変数cの内容がCRのとき
+                    break;                      // 何もしない
+                case '\n':                      // 文字変数cの内容がLFのとき
+                    if(strncmp(s,"GET /L",6)==0 && len>6){
+                        led=1;                  // 変数ledに1を代入
+                        if(s[6]=='0')led=0;     // 7番目の文字が0のとき0を代入
+                    }else if( len==0 ) headF=1; // ヘッダの終了
+                    len=0;                      // 文字列長を0に
+                    break;
+                default:                        // その他の場合
+                    s[len]=c;                   // 文字列変数に文字cを追加
+                    len++;                      // 変数lenに1を加算
+                    s[len]='\0';                // 文字列を終端
+                    if(len>=128) len=127;       // 文字列変数の上限
+                    break;
+            }
+        }
+        i++;                                // 変数iの値を1だけ増加させる
+        if(headF) break;                    // HTTPヘッダが終わればwhileを抜ける
+        if(i>TIMEOUT) break; else delay(1); // TIMEOUTに到達したらwhileを抜ける
+    }
+    if(client.connected()){                 // 当該クライアントの接続状態を確認
+        client.println("HTTP/1.1 200 OK");  // HTTP OKを応答
+        if(led>=0)digitalWrite(PIN_LED,led);// LEDの制御
+        IPAddress ip=WiFi.softAPIP();       // 変数ipに本APのIPアドレスを代入
+        sprintf(s,
+            "LED=%01d
LED ON ,http://%d.%d.%d.%d/L1
",
+            digitalRead(PIN_LED),ip[0],ip[1],ip[2],ip[3]);
+        client.print("Content-Length: ");   // HTTPヘッダ情報を出力
+        client.println(15+strlen(s)*2-9+2); // コンテンツ長さを出力(改行2バイト)
+        client.println();                   // HTTPヘッダの終了を出力
+        client.println("");           // HTML開始タグを出力(IE以外で必要)
+        client.println(s);                  // HTTPコンテンツを出力
+        Serial.println(s);                  // シリアルへコンテンツを出力
+        sprintf(s,
+            "LED OFF,http://%d.%d.%d.%d/L0
",
+            ip[0],ip[1],ip[2],ip[3]);
+        client.println(s);                  // HTTPコンテンツを出力
+        Serial.println(s);                  // シリアルへコンテンツを出力
+        client.println("");          // HTML終了タグを出力(IE以外で必要)
+    }
+    client.stop();                          // クライアントの切断
+    Serial.println("Disconnected");         // シリアル出力表示
+}