Drone Beat Software Sample

Drone Beat Software Sample

example of using the S1 with low pass resonant filter control.
Potmeter attached to adc input.

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

--- arduino/software/cycledrummer/DRONEBEAT01/DRONEBEAT01.ino
+++ arduino/software/cycledrummer/DRONEBEAT01/DRONEBEAT01.ino
@@ -0,0 +1,418 @@
+
+/*
+S1 DRONEBEAT // BICYCLE DRUMMER 0.5
+27.07.2014
+By Serge Defever
+Arduino NANO + Dreamblaster S1
+
+Dreamblaster S1 : http://www.serdashop.com/waveblaster
+Arduino NANO : http://store.arduino.cc/
+
+*/
+#include <Button.h>
+#include <TimerOne.h>
+long calctempodelay = 0;
+long tempodelay = 500;
+long curtimestamp = 0;
+long prevtimestamp = 0;
+long lasttickstamp =0;
+long wheelfactor = 6; // adjust this to modify the pulseperiod to tempo ratio (wheel radius), higher = faster
+int  tickflag = 0; // indicate if time tick has passed
+
+const int bicyclesetup = 0;
+const int pot1setup = 1;
+const int button1Pin = 2;
+const int button2Pin = 3;
+const int button3Pin = 4;
+const int button4Pin = 5;
+const int dreamblaster_enable_pin = 6;
+int potentiopin = 2;
+long potentiovalue = 0;
+int buttonState = 0;
+int prev_buttonState = 0;
+int enabledrumming = 0;
+int enablebassline = 0;
+int enablesynthline = 0;
+long seq_poscnt = 0;
+
+
+
+#define _BASSDRUM_NOTE 0x24
+#define _SNAREDRUM_NOTE 0x26
+#define _CLOSEDHIHAT_NOTE 0x2A
+#define _PEDALHIHAT_NOTE 0x2C
+#define _OPENHIHAT_NOTE 0x2E
+#define _CYMBAL_NOTE 0x31
+
+void midiwrite(int cmd, int pitch, int velocity) {
+
+  Serial.write(cmd);
+  Serial.write(pitch);
+  Serial.write(velocity);
+
+}
+
+
+void midisetup_sam2195_nrpn_send(int channel, int control1,int control2, int value)
+{
+   Serial.write((byte)(0xB0+channel));
+   Serial.write(0x63);
+   Serial.write((byte)control1);
+   Serial.write(0x62);
+   Serial.write((byte)control2);
+   Serial.write(0x06);
+   Serial.write((byte)value);
+}
+
+void midisetup_sam2195_sysexcfg_send(int channelprefix,int channel, int control, int value)
+{
+   Serial.write(0xF0);
+   Serial.write(0x41);
+   Serial.write(0x00);
+   Serial.write(0x42);
+   Serial.write(0x12);
+   Serial.write(0x40);
+   Serial.write((byte)(channelprefix*16+channel));
+   Serial.write((byte)control);
+   Serial.write((byte)value);
+   Serial.write(0x00);
+   Serial.write(0xF7);
+
+}
+
+void midisetup_sam2195_gsreset(void)
+{
+  midisetup_sam2195_sysexcfg_send(0,0,0x7F,0);
+}
+
+void midiprogchange(int cmd, int prog) {
+  Serial.write(cmd);
+  Serial.write(prog);
+}
+
+
+Button button2 = Button(button2Pin,BUTTON_PULLDOWN);
+Button button3 = Button(button3Pin,BUTTON_PULLDOWN);
+Button button4 = Button(button4Pin,BUTTON_PULLDOWN);
+
+
+void basssubseq(long relativpos)
+{
+  switch(relativpos)
+    {
+    case 0 :
+      midiwrite(0x81, 64, 0x00);
+      midiwrite(0x91, 28, 0x70);
+      break;
+    case 4 :
+      midiwrite(0x81, 28, 0x00);
+      midiwrite(0x91, 40, 0x70);
+      break;
+    case 8 :
+      midiwrite(0x81, 40, 0x00);
+      midiwrite(0x91, 52, 0x70);
+      break;
+    case 12:
+      midiwrite(0x81, 52, 0x00);
+      midiwrite(0x91, 64, 0x70);
+      break;
+    default :
+      break;
+    }
+
+}
+
+void synthsubseq(long relativpos)
+{
+  switch(relativpos)
+    {
+    case 0 :
+       midiwrite(0x90, 40, 0x65);
+      break;
+    case 7:
+      midiwrite(0x80, 40, 0x00);
+      break;
+    case 8 :
+      midiwrite(0x90, 52, 0x65);
+      break;
+    case 15:
+      midiwrite(0x80, 52, 0x00);
+      break;
+    default :
+      break;
+    }
+
+}
+void drumseq(long seqpos)
+{
+  char relativpos;
+  char seq_poscnt_mod2;
+  relativpos =seqpos%16;
+  seq_poscnt_mod2 = seqpos%2;
+  if(enabledrumming)
+  {
+    if((seq_poscnt_mod2 == 0) && (relativpos < 14))
+    {
+      midiwrite(0x99, _PEDALHIHAT_NOTE, 0x65);     // fast hi hat midi note
+    }
+
+    switch(relativpos)
+    {
+    case 0 :
+      midiwrite(0x99, _BASSDRUM_NOTE, 0x65);
+      break;
+    case 4:
+      midiwrite(0x99, _SNAREDRUM_NOTE, 0x65);
+      break;
+    case 6 :
+      midiwrite(0x99, _BASSDRUM_NOTE, 0x65);
+      break;
+    case 8 :
+      midiwrite(0x99, _BASSDRUM_NOTE, 0x65);
+      break;
+    case 12:
+      midiwrite(0x99, _SNAREDRUM_NOTE, 0x65);
+      break;
+    case 14:
+      midiwrite(0x99,  _OPENHIHAT_NOTE, 0x65);
+
+      break;
+    default :
+      break;
+    }
+    if(enablebassline)
+    {
+      basssubseq(relativpos);
+    }
+   if(enablesynthline)
+   {
+      synthsubseq(relativpos);
+   }
+  }
+ };
+
+
+void timercallback()
+{
+  lasttickstamp = millis();
+  Timer1.setPeriod(tempodelay * 1000);
+  tickflag = 1;
+}
+
+void setupvoices(void)
+{
+    midiprogchange(0xC0,95);
+    midiprogchange(0xC1,81);
+}
+void SomeButtonPressHandler(Button& butt)
+{
+ if(enabledrumming)
+  {
+    if(butt == button2)
+    {
+      enablesynthline = enablesynthline?0:1;
+    };
+    if(butt == button3)
+    {
+      enablebassline = enablebassline?0:1;
+    };
+
+  }
+  else
+  {
+
+    if(butt == button2)
+    {
+       midiwrite(0x90, 40, 0x70); // switch off possible bass notes
+    };
+    if(butt == button3)
+    {
+      midiwrite(0x99, _SNAREDRUM_NOTE, 0x65);
+    }
+    if(butt == button4)
+    {
+      midiwrite(0x99, _BASSDRUM_NOTE, 0x65);
+    }
+  }
+}
+void stopallnotes(void)
+{
+      midiwrite(0x80, 52, 0x00); // switch off possible synth notes
+      midiwrite(0x80, 40, 0x00); // switch off possible synth notes
+      midiwrite(0x80, 28, 0x00); // switch off possible bass notes
+      midiwrite(0x80, 40, 0x00); // switch off possible bass notes
+      midiwrite(0x80, 52, 0x00); // switch off possible bass notes
+}
+
+
+
+void SomeButtonReleaseHandler(Button& butt)
+{
+  if(enabledrumming)
+  {
+    //..
+  }
+  else
+  {
+
+    if(butt == button2)
+    {
+      midiwrite(0x80, 40, 0x00); // switch off possible bass notes
+    }
+  }
+
+
+}
+
+void PotControl(int potnr, int ctrlVal)
+{
+  if(potnr == 1)
+  {
+     //Serial.println(ctrlVal);
+      midisetup_sam2195_nrpn_send(1,0x01,0x20,(byte)ctrlVal);
+      //midiwrite(0xB0, 0x01,(byte) ctrlVal);  // modulation wheel
+  }
+}
+
+
+void ADC_handle(void)
+{
+  static int prevsensorVal = -1000;
+  if(pot1setup)
+  {
+    int sensorValue = analogRead(A4);
+    int ctrlValue;
+    if(abs(sensorValue-prevsensorVal)>3)  // filter noise from adc input
+    {
+        prevsensorVal = sensorValue;
+        ctrlValue = sensorValue/8;
+        PotControl(1,ctrlValue);
+    }
+  }
+}
+
+
+void SomeButtonHoldHandler(Button& butt)
+{
+  if(butt==button4)
+  {
+        stopdrum();
+  }
+}
+
+void setup() {
+  Serial.begin(31250);
+  analogReference(DEFAULT);
+
+  pinMode(dreamblaster_enable_pin ,OUTPUT);   // enable the dreamblaster module by pulling high /reset
+  digitalWrite(dreamblaster_enable_pin, HIGH);
+  delay(300);  // allow 500ms for the dreamblaster to boot
+  midisetup_sam2195_gsreset();
+  delay(500);  // allow 250 for gs reset
+/*
+  midisetup_sam2195_sysexcfg_send(0x02,0x00,0x01,0x50);  // set mod wheel cutoff
+  midisetup_sam2195_sysexcfg_send(0x02,0x00,0x04,0x00);  // disable mod wheel pitch variation
+  midisetup_sam2195_sysexcfg_send(0x02,0x00,0x05,0x7F);  // set mod wheel tvf depth
+*/
+  midisetup_sam2195_nrpn_send(1,0x01,0x21,(byte)0x7F);  // set resonance for channel 1
+  Timer1.attachInterrupt(timercallback);
+  Timer1.initialize(tempodelay*1000);
+  button2.pressHandler(SomeButtonPressHandler);
+  button2.releaseHandler(SomeButtonReleaseHandler);
+  button3.pressHandler(SomeButtonPressHandler);
+  button3.releaseHandler(SomeButtonReleaseHandler);
+  button4.pressHandler(SomeButtonPressHandler);
+  button4.releaseHandler(SomeButtonReleaseHandler);
+  button4.holdHandler(SomeButtonHoldHandler,1000);
+  setupvoices();
+}
+
+void stopdrum(){
+  enabledrumming = 0;
+  prevtimestamp = 0;
+  curtimestamp = 0;
+  seq_poscnt = 0;
+  stopallnotes();
+}
+
+
+void loop() {
+  long timesincelastbeat;
+  long timetonextbeat;
+
+  ADC_handle();
+  button2.isPressed(); // trigger handling for button
+  button3.isPressed(); // trigger handling for button
+  button4.isPressed(); // trigger handling for button
+  buttonState = digitalRead(button1Pin);
+
+  if(tickflag)
+  {
+    // sequencing time tick
+    drumseq(seq_poscnt);
+    seq_poscnt++;
+    tickflag = 0;
+  }
+
+  if(prev_buttonState!=buttonState)
+  {
+    prev_buttonState = buttonState;
+    if(buttonState == 1)
+    {
+      prevtimestamp =  curtimestamp;
+      curtimestamp = millis();
+      if(prevtimestamp)
+      {
+        calctempodelay = curtimestamp - prevtimestamp;
+        if(calctempodelay > 200  && calctempodelay < 5000)  // if tempo is within range, calc tempo and enable drum
+        {
+          if(enabledrumming == 0)
+          {
+            seq_poscnt = 0;
+            enabledrumming = 1;
+          }
+          tempodelay  = calctempodelay/wheelfactor;
+          timesincelastbeat = curtimestamp - lasttickstamp;
+          if(timesincelastbeat > tempodelay)  // is the beat is going faster, tick immediately (within 10ms)
+          {
+            timetonextbeat = 10;
+          }
+          else
+          {
+            timetonextbeat = tempodelay -timesincelastbeat; // calculate remaining period for next tick
+            if (timetonextbeat < 10)
+            {
+              timetonextbeat = 10;
+            }
+          }
+          Timer1.setPeriod(timetonextbeat * 1000);  // calculate period until next beat
+        }
+      }
+    }
+  }
+  else
+  {
+    if(enabledrumming)
+    {
+      if(curtimestamp)
+      {
+        if( (millis() - curtimestamp  )> 5000)  // automatically stop if no sensor change for longer than 5s
+        {
+          if(bicyclesetup)
+            {
+               stopdrum();
+            }
+        }
+      }
+    }
+  }
+
+}
+
+
+
+
+
+
+
+


Add one second delay for the loop.

Add one second delay for the loop.

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/lgramatikov/celeste.git/'


MotorEncoderConceptAB

MotorEncoderConceptAB

This is the concept code for a Motor Encoder.

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

--- MotorEncodersAB/MotorEncodersAB.ino
+++ MotorEncodersAB/MotorEncodersAB.ino
@@ -0,0 +1,31 @@
+
+const byte motorEncoderA = 2;
+const byte motorEncoderB = 3;
+int countLeft = 0; countRight = 0;
+
+
+void setup() {
+ attachInterrupt(digitalPinToInterrupt(motorEncoderA), A1 , CHANGE);
+ attachInterrupt(digitalPinToInterrupt(motorEncoderB), B1, CHANGE);
+
+
+}
+
+void loop() {
+
+}
+
+void A1() {
+  if(motorEncoderA == motorEncoderB)
+    countLeft--;
+  else
+    countLeft++;
+}
+
+void B1() {
+  if(motorEncoderA == motorEncoderB)
+    countLeft++;
+  else
+    countLeft--;
+}
+


(WIP) Sample: GPS

(WIP) Sample: GPS

error: pathspec 'VirtualShield/examples/Basic-GPS/Basic-GPS.ino' did not match any file(s) known to git

--- VirtualShield/examples/Basic-GPS/Basic-GPS.ino
+++ VirtualShield/examples/Basic-GPS/Basic-GPS.ino
@@ -0,0 +1,84 @@
+/*
+    Copyright(c) Microsoft Open Technologies, Inc. All rights reserved.
+
+    The MIT License(MIT)
+
+    Permission is hereby granted, free of charge, to any person obtaining a copy
+    of this software and associated documentation files(the "Software"), to deal
+    in the Software without restriction, including without limitation the rights
+    to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
+    copies of the Software, and to permit persons to whom the Software is
+    furnished to do so, subject to the following conditions :
+
+    The above copyright notice and this permission notice shall be included in
+    all copies or substantial portions of the Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
+    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+    THE SOFTWARE.
+*/
+
+// Include the ArduinoJson library, a dependency.
+#include <ArduinoJson.h>
+
+// Include the VirtualShield and used shields (Text, Geolocator)
+#include <VirtualShield.h>
+#include <Text.h>
+#include <Geolocator.h>
+
+// Instantiate the shields.
+VirtualShield shield;
+Text screen = Text(shield);
+Geolocator gps = Geolocator(shield);
+
+// Callback event for screen commands
+void screenEvent(ShieldEvent* shieldEvent)
+{
+}
+
+// Callback event for gps events
+void gpsEvent(ShieldEvent* shieldEvent)
+{
+  String lat = String("Lat: ") + String(gps.Latitude);
+  String lon = String("Lon: ") + String(gps.Longitude);
+
+  screen.printAt(3, lat);
+  screen.printAt(4, lon);
+}
+
+// Callback event for pushing 'Refresh', or starting up, or reconnecting
+void refresh(ShieldEvent* shieldEvent)
+{
+  screen.clear();
+  screen.printAt(1, "Basic GPS Lookup");
+}
+
+void setup()
+{
+  // Connect the events to the shields.
+  shield.setOnRefresh(refresh);
+  gps.setOnEvent(gpsEvent);
+  screen.setOnEvent(screenEvent);
+
+  // Begin the shield communication
+  shield.begin();
+}
+
+const long interval = 1000 * 15; //15 seconds;
+long nextGPS = 0;
+
+void loop()
+{
+  // Check GPS coordinates once per 'interval'
+  if (millis() > nextGPS) {
+    nextGPS = millis() + interval;
+    gps.get();
+  }
+
+  // Allow for shield communications.
+  shield.checkSensors();
+}


Added lowpower_mote_v0_1

Added lowpower_mote_v0_1

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

--- lowpower_mote_v0_1/lowpower_mote_v0_1.ino
+++ lowpower_mote_v0_1/lowpower_mote_v0_1.ino
@@ -0,0 +1,26 @@
+#include <LowPower.h>
+#include <RFM69.h>
+#include <SPI.h>
+#include <SPIFlash.h>
+
+#define LED 9
+
+RFM69 radio;
+SPIFlash flash(8, 0xEF30);
+
+void setup() {
+  radio.initialize(RF69_915MHZ, 99, 99);
+  radio.setHighPower();
+  flash.initialize();
+  pinMode(LED, OUTPUT);
+}
+
+void loop() {
+  digitalWrite(LED, HIGH);
+  delay(4000);
+  digitalWrite(LED, LOW);
+  radio.sleep();
+  flash.sleep();
+  LowPower.powerDown(SLEEP_4S, ADC_OFF, BOD_OFF);
+  flash.wakeup();
+}


Add ArduinoProgram1

Add ArduinoProgram1

Add ArduinoProgram1

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

--- arduino/ADXL345/ArduinoProgram1/ArduinoProgram1.ino
+++ arduino/ADXL345/ArduinoProgram1/ArduinoProgram1.ino
@@ -0,0 +1,157 @@
+/*	 Arduino硬體感測器端傳送程式
+ *	 Author：Jimmy HU
+ *	 This program is licensed under Apache License 2.0.
+ *	 電路連接說明：
+ *	---關於GY-80加速度計---
+ *	GY-80 SCL －＞ Arduino Analog Pin A5
+ *	GY-80 SDA －＞ Arduino Analog Pin A4
+ *	Original Code Reference：https://github.com/cedtat/GY-80-sensor-samples/blob/master/adxl345/adxl345.ino
+ *	3 Axis Accelerometer(Analog Devices ADXL345) Datasheet：http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf
+ *	Arduino連接G-sensor，傳輸控制上Arduino為Master端，G-sensor為slave端
+ *
+ */
+//---引用函式庫---
+#include <Wire.h>																		//	加入Wire.h函式庫
+//---定義常數---
+#define Register_ID 0																	//	定義Register_ID常數數值為0
+#define GY80_Acc_reg_pwrctrl 0x2D														//	定義GY80_Acc_reg_pwrctrl(加速度計POWER_CTL暫存器位址)常數為0x2D
+#define Register_X0 0x32																//	定義Register_X0常數數值為0x32
+#define Register_X1 0x33																//	定義Register_X1常數數值為0x33
+#define Register_Y0 0x34																//	定義Register_Y0常數數值為0x34
+#define Register_Y1 0x35																//	定義Register_Y1常數數值為0x35
+#define Register_Z0 0x36																//	定義Register_Z0常數數值為0x36
+#define Register_Z1 0x37																//	定義Register_Z1常數數值為0x37
+//***全域變數宣告區***
+/* 硬體上3 Axis Accelerometer(Analog Devices ADXL345)位址為0x53，轉換至10進位為83，故指定ADXL345_Address數值為83(十進位)
+ */
+int ADXL345_Address = 83;																//	宣告ADXL345_Address整數變數初始數值為83
+double Acc_X,Acc_Y,Acc_Z;																//	宣告X、Y、Z方向加速度數值(以g為單位，1g=9.8m/s)
+double Acc_X_array[10],Acc_Y_array[10],Acc_Z_array[10];									//	宣告Acc_X_array[10],Acc_Y_array[10],Acc_Z_array[10]陣列變數，記錄最近十筆X、Y、Z方向加速度數值(以g為單位，1g=9.8m/s)
+int Acc_X0,Acc_X1,Acc_X_16bit;															//	宣告Acc_X0(加速度計X方向低位元暫存變數),Acc_X1(加速度計X方向高位元暫存變數),Acc_X_16bit(加速度計X方向16位元完整感測資料輸出變數)
+int Acc_Y0,Acc_Y1,Acc_Y_16bit;															//	宣告Acc_Y0(加速度計Y方向低位元暫存變數),Acc_Y1(加速度計Y方向高位元暫存變數),Acc_Y_16bit(加速度計Y方向16位元完整感測資料輸出變數)
+int Acc_Z1,Acc_Z0,Acc_Z_16bit;															//	宣告Acc_Z1(加速度計Z方向低位元暫存變數),Acc_Z0(加速度計Z方向高位元暫存變數),Acc_Z_16bit(加速度計Z方向16位元完整感測資料輸出變數)
+
+//***副程式宣告區***
+void Read_ADXL345_Data(void);															//	宣告Read_ADXL345_Data(讀取ADXL345資料)副程式
+void SerialPrintADX345Data(void);														//	宣告SerialPrintADX345Data(顯示ADXL345數值)副程式
+void SerialPrintUIntData(unsigned int);													//	宣告SerialPrintUIntData副程式
+void SerialPrintIntData(int);															//	宣告SerialPrintIntData副程式
+// the setup function runs once when you press reset or power the board
+// setup程式於按下reset按鈕或通電時執行一次
+void setup()																			//	setup程式
+{																						//	進入setup程式
+	//***設定接腳狀態***
+	pinMode(13, OUTPUT);																//	設定數位接腳13為輸出
+	pinMode(8, INPUT);																	//	設定數位接腳8為輸入
+	Wire.begin();																		//	加入I2C串列傳輸匯流排
+	Serial.begin(9600);																	//	開啟 Serial Port，鮑率為 9600bps (Bits Per Second)
+	delay(100);																			//	延遲0.1秒
+	//***開始測量G sensor資料***
+	Wire.beginTransmission(ADXL345_Address);											//	開始對Slave(從端)進行資料傳輸
+	//	Wire.beginTransmission(address)函數可參考https://www.arduino.cc/en/Reference/WireBeginTransmission
+	Wire.write(GY80_Acc_reg_pwrctrl);													//	傳送暫存器位址0x2D(GY80_Acc_reg_pwrctrl數值)
+	Wire.write(8);																		//	設定POWER_CTL暫存器Measure Bit為1
+	Wire.endTransmission();																//	I2C傳送結束
+}																						//	結束setup程式
+
+// the loop function runs over and over again forever
+// loop程式將不斷重複執行
+void loop()																				//	loop程式
+{																						//	進入loop程式
+	Read_ADXL345_Data();																//	呼叫Read_ADXL345_Data副程式
+	SerialPrintADX345Data();															//	呼叫SerialPrintADX345Data副程式
+	delay(500);
+}																						//	結束loop程式
+
+void Read_ADXL345_Data(void)															//	Read_ADXL345_Data(讀取ADXL345資料)副程式
+{																						//	進入Read_ADXL345_Data(讀取ADXL345資料)副程式
+	//---讀取X方向加速度值---
+	Wire.beginTransmission(ADXL345_Address);											//	傳送資料至Slave(從端)
+	Wire.write(Register_X0);															//	準備讀取X方向加速度值
+	Wire.write(Register_X1);															//	準備讀取X方向加速度值
+	Wire.endTransmission();																//	I2C傳送結束
+	Wire.requestFrom(ADXL345_Address,2);												//	傳送2位元組要求至Slave端(ADXL345_Address)
+	if(Wire.available()<=2)																//	若slave(ADXL345_Address)裝置回傳資料少於要求資料量
+	{																					//	進入if敘述
+		Acc_X0 = Wire.read();															//	讀取X方向加速度值(低8位元)
+		Acc_X1 = Wire.read();															//	讀取X方向加速度值(高8位元)
+		Acc_X1=Acc_X1<<8;																//	將Acc_X1(高8位元)左移8位
+		Acc_X_16bit=Acc_X0+Acc_X1;														//	將X1與X0組合為16位元的X方向加速度數值填入X_out
+	}																					//	結束if敘述
+	//---讀取Y方向加速度值---
+	Wire.beginTransmission(ADXL345_Address);											//	傳送資料至Slave(從端)
+	Wire.write(Register_Y0);															//	準備讀取Y方向加速度值
+	Wire.write(Register_Y1);															//	準備讀取Y方向加速度值
+	Wire.endTransmission();																															 //	I2C傳送結束
+	Wire.requestFrom(ADXL345_Address,2);																									//	傳送2位元組要求至Slave端(ADXL345_Address)
+	if(Wire.available()<=2)																															 //	若slave(ADXL345_Address)裝置回傳資料少於要求資料量
+	{																																										 //	進入if敘述
+		Acc_Y0 = Wire.read();																															 //	讀取Y方向加速度值(低8位元)
+		Acc_Y1 = Wire.read();																															 //	讀取Y方向加速度值(高8位元)
+		Acc_Y1=Acc_Y1<<8;																																	 //	將Acc_Y1(高8位元)左移8位
+		Acc_Y_16bit=Acc_Y0+Acc_Y1;																													//	將Y1與Y0組合為16位元的Y方向加速度數值填入Acc_Y_16bit
+	}																																										 //	結束if敘述
+	//---讀取Z方向加速度值---
+	Wire.beginTransmission(ADXL345_Address);																							//	傳送資料至Slave(從端)
+	Wire.write(Register_Z0);																															//	準備讀取Z方向加速度值
+	Wire.write(Register_Z1);																															//	準備讀取Z方向加速度值
+	Wire.endTransmission();																															 //	I2C傳送結束
+	Wire.requestFrom(ADXL345_Address,2);																									//	傳送2位元組要求至Slave端(ADXL345_Address)
+	if(Wire.available()<=2)																															 //	若slave(ADXL345_Address)裝置回傳資料少於要求資料量
+	{																																										 //	進入if敘述
+		Acc_Z0 = Wire.read();																															 //	讀取Z方向加速度值(低8位元)
+		Acc_Z1 = Wire.read();																															 //	讀取Z方向加速度值(高8位元)
+		Acc_Z1=Acc_Z1<<8;																																	 //	將Acc_Z1(高8位元)左移8位
+		Acc_Z_16bit=Acc_Z0+Acc_Z1;																													//	將Z1與Z0組合為16位元的Z方向加速度數值填入Acc_Z_16bit
+	}																																										 //	結束if敘述
+	//---正規化加速度數值---
+	Acc_X=Acc_X_16bit/256.0;
+	Acc_Y=Acc_Y_16bit/256.0;
+	Acc_Z=Acc_Z_16bit/256.0;
+	//---記錄數值---
+	int loop_number = 0;																																	//	宣告loop_number區域變數供迴圈使用
+	for(loop_number = 10; loop_number > 0; loop_number--)																 //	以for迴圈搬移Acc_X_array、Acc_Y_array、Acc_Z_array陣列歷史資料
+	{																																										 //	進入for迴圈
+		Acc_X_array[loop_number]=Acc_X_array[loop_number-1];																//	搬移Acc_X_array歷史資料
+		Acc_Y_array[loop_number]=Acc_Y_array[loop_number-1];																//	搬移Acc_Y_array歷史資料
+		Acc_Z_array[loop_number]=Acc_Z_array[loop_number-1];																//	搬移Acc_Z_array歷史資料
+	}																																										 //	結束for迴圈
+	Acc_X_array[0]=Acc_X;																																 //	將Acc_X填入Acc_X_array陣列中
+	Acc_Y_array[0]=Acc_Y;																																 //	將Acc_Y填入Acc_Y_array陣列中
+	Acc_Z_array[0]=Acc_Z;																																 //	將Acc_Z填入Acc_Z_array陣列中
+}																																											 //	結束Read_ADXL345_Data(讀取ADXL345資料)副程式
+
+void SerialPrintADX345Data(void)																												//	SerialPrintADX345Data(顯示ADXL345數值)副程式
+{																						//	進入SerialPrintADX345Data(顯示ADXL345數值)副程式
+	//---輸出ADXL345數值至UART介面---
+	Serial.print("X");
+	SerialPrintUIntData(Acc_X * 2048 + 2048);
+	//Serial.print("			 ");
+	//Serial.print("Y");
+	//SerialPrintUIntData(Acc_Y * 2048 + 2048);
+	//Serial.print("			 ");
+	//Serial.print("Z");
+	//SerialPrintUIntData(Acc_Z * 2048 + 2048);
+	//Serial.println("	");
+	Serial.println();
+}																																											 //	結束SerialPrintADX345Data(顯示ADXL345數值)副程式
+
+void SerialPrintUIntData(unsigned int InputData)													//	SerialPrintIntData(SerialPort送出int型態資料)副程式
+{																						//	進入SerialPrintIntData(SerialPort送出int型態資料)副程式
+	Serial.print( ( InputData / 10000 ) % 10 );
+	Serial.print( ( InputData / 1000 ) % 10 );
+	Serial.print( ( InputData / 100 ) % 10 );
+	Serial.print( ( InputData / 10 ) % 10 );
+	Serial.print( ( InputData / 1 ) % 10 );
+}																						//	結束SerialPrintIntData(SerialPort送出int型態資料)副程式
+
+void SerialPrintIntData(int InputData)													//	SerialPrintIntData(SerialPort送出int型態資料)副程式
+{																						//	進入SerialPrintIntData(SerialPort送出int型態資料)副程式
+	Serial.print( ( InputData / 10000 ) % 10 );
+	Serial.print( ( InputData / 1000 ) % 10 );
+	Serial.print( ( InputData / 100 ) % 10 );
+	Serial.print( ( InputData / 10 ) % 10 );
+	Serial.print( ( InputData / 1 ) % 10 );
+}																						//	結束SerialPrintIntData(SerialPort送出int型態資料)副程式
+
+


Changed sketch name and removed debug commands

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

--- Examples/changeName/changeName.ino
+++ Examples/changeName/changeName.ino
@@ -0,0 +1,104 @@
+/*
+ * Change the BT device name
+ *
+ * This works with a Bluetooth terminal. The user is prompted for a new
+ * name which is then written to HC-05.
+ *
+ */
+#include <Arduino.h>
+#include "HC05.h"
+
+/*
+ * Configure this sketch to work with either a software or a hardware
+ * serial port, as configured in HC05.h
+ */
+#ifdef HC05_SOFTWARE_SERIAL
+#include <SoftwareSerial.h>
+HC05 myHC05 = HC05(3, 2, 4, 5);  // cmd, state, rx, tx
+#else
+HC05 myHC05 = HC05(3, 2);  // cmd, state
+#endif
+
+/*
+ * See the ITeadStudio HC-05 datasheet for a full list of commands.
+ */
+String NewNameCmd("AT+NAME=");
+
+
+void setup()
+{
+  myHC05.findBaud();
+}
+
+
+void loop(){
+  char buffer[32];
+  size_t recvd = 0;
+  bool waiting = true;
+  String newName;
+
+  myHC05.println("");
+  myHC05.print("New name? ");
+
+  // Use a timeout that will give reasonablly quick response to the user.
+  myHC05.setTimeout(100);
+  while (waiting)
+  {
+    if (myHC05.available())
+    {
+      recvd = myHC05.readBytes(buffer, 32);
+      for (size_t i = 0; i < recvd; i++)
+      {
+        if (buffer[i] != '\n')
+        {
+          newName += buffer[i];
+          myHC05.print(buffer[i]);
+        }
+        else
+        {
+          myHC05.println(" ");
+          waiting = false;
+          break;
+        }
+      }
+    }
+    delay(100);
+  }
+
+  newName.toCharArray(buffer, 32);
+  newName = NewNameCmd + newName;
+  newName.toCharArray(buffer, 32);
+
+  // make sure there is no pending output to interfere with commands
+  myHC05.flush();
+
+  // The name change command takes extra time.
+  // 1000ms is large enough, but arbitrary.
+  if (myHC05.cmd(buffer,1000))
+  {
+    myHC05.println("Name changed.");
+    myHC05.println("Reconnect or rescan to see the result.");
+    myHC05.println("Disconnecting...");
+    myHC05.flush();
+    myHC05.cmd("AT+DISC", 1000);
+  }
+  else
+  {
+    myHC05.println("Name NOT changed.");
+  }
+
+  // Send a count to the port just to indicate activity.
+  // This will appear after the connection is re-established, or
+  // immediately if the name change command fails.
+  for (uint8_t i = 0; true; i++)
+  {
+    if (i == 0)
+    {
+      myHC05.println("");
+    }
+    myHC05.print(i);
+    myHC05.print('\r');
+    delay(1000);
+  }
+}
+


Add example sketch for food switch.

Add example sketch for food switch.

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

--- vor-arduino/examples/food/food.ino
+++ vor-arduino/examples/food/food.ino
@@ -0,0 +1,73 @@
+#include <Bridge.h>
+#include <YunClient.h>
+
+#include "HttpClient.h"
+#include "vor_led.h"
+#include "vor_switch.h"
+
+#define SERVER_URL "rubix.futurice.com"
+#define SERVER_PORT 80
+#define SERVER_PATH "/messages"
+
+#define USERAGENT "yunmini02"
+
+#define TIMEOUT 20000
+#define DELAY 500
+#define INTERVAL 30000
+
+#define MSG_FORMAT "{\"id\":\"button-food\",\"type\":\"button\"}"
+
+#define SWITCH_PIN 2
+#define LED_PIN 3
+
+YunClient client;
+HttpClient http(client);
+
+VorLed led;
+VorSwitch vorSwitch(SWITCH_PIN);
+int state = HIGH;
+uint64_t intervalTime = 0;
+
+void setup() {
+    Serial.begin(9600);
+
+    led.turnOn();
+    Bridge.begin();
+    led.turnOff();
+    analogWrite(LED_PIN, 255);
+}
+
+void loop() {
+    int value = vorSwitch.read();
+
+    uint64_t now = millis();
+
+    if (state != value || now - intervalTime > INTERVAL) {
+        state = value;
+        intervalTime = now;
+        if (HIGH == state) {
+            post();
+        }
+    }
+}
+
+void post() {
+    int res = http.post(SERVER_URL, SERVER_PATH, USERAGENT, TEXT_PLAIN, MSG_FORMAT);
+    if (0 == res) { // HTTP_SUCCESS in HttpClient.h
+        int code = http.responseStatusCode();
+        Serial.println(code);
+        http.skipResponseHeaders();
+        uint64_t now = millis();
+        char c;
+        while ((http.connected() || http.available()) && ((millis() - now) < TIMEOUT)) {
+            if (http.available()) {
+                c = http.read();
+                Serial.print(c);
+                now = millis();
+            } else {
+                delay(DELAY);
+            }
+        }
+    }
+    http.stop();
+}


Added files via upload

Added files via upload

Arduino program for controlling Charlie's head

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

--- CharlieNeck.ino
+++ CharlieNeck.ino
@@ -0,0 +1,92 @@
+#if (ARDUINO >= 100)
+ #include <Arduino.h>
+#else
+ #include <WProgram.h>
+#endif
+
+#include <Servo.h>
+#include <ros.h>
+#include <std_msgs/UInt16.h>
+#include <Wire.h>
+#include <Adafruit_PWMServoDriver.h>
+Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
+
+ros::NodeHandle  nh;
+
+int xpos = 250;
+int ypos = 175;
+int xserv = 327;
+int yserv = 327;
+int centxmax = 275;
+int centymax = 200;
+int centxmin = 225;
+int centymin = 150;
+
+void servox( const std_msgs::UInt16& cmd_msg)
+{
+  xpos = cmd_msg.data;
+  digitalWrite(13, HIGH-digitalRead(13));  //toggle led
+  if(xpos < centxmin)
+    {
+      if(xserv < 525)
+      {
+       xserv = xserv + 1;
+      }
+    }
+    else if(xpos > centxmax)
+    {
+      if(xserv > 125)
+      {
+       xserv = xserv - 1;
+      }
+    }
+    pwm.setPWM(6,0,xserv);
+    Serial.println("x = ");
+    Serial.println(xserv);
+}
+void servoy( const std_msgs::UInt16& cmd_msg)
+{
+  ypos = cmd_msg.data;
+  digitalWrite(13, HIGH-digitalRead(13));  //toggle led
+  if(ypos < centymin)
+    {
+      if( yserv > 237)
+      {
+        yserv = yserv - 1;
+      }
+    }
+    else if(ypos > centymax)
+    {
+      if( yserv < 341)
+      {
+        yserv = yserv + 1;
+      }
+    }
+    pwm.setPWM(8,0,yserv);
+    Serial.println("y = ");
+    Serial.println(yserv);
+}
+
+
+ros::Subscriber<std_msgs::UInt16> sub1("/face_detector/face_position_X", servox);
+ros::Subscriber<std_msgs::UInt16> sub2("/face_detector/face_position_Y", servoy);
+
+void setup()
+{
+  Serial.begin(57600);
+  pinMode(13, OUTPUT);
+  nh.initNode();
+  nh.subscribe(sub1);
+  nh.subscribe(sub2);
+  #ifdef ESP8266
+    Wire.pins(2, 14);   // ESP8266 can use any two pins, such as SDA to #2 and SCL to #14
+  #endif
+  pwm.begin();
+  pwm.setPWMFreq(60);
+
+}
+
+void loop(){
+  nh.spinOnce();
+  delay(1);
+}


--- ESP/src/ESP.ino
+++ ESP/src/ESP.ino
@@ -346,7 +346,6 @@

 void setupMDNS() {
     DEBUG2(">> Setting up mDNS...\n");
-    _writeFile("/tmp/checkpoint", "invalid", 16);
     if (MDNS.begin(host, ipAddress)) {
         DEBUG2(">> mDNS started.\n");
         MDNS.addService("http", "tcp", 80);
@@ -354,7 +353,6 @@
             ">> http://%s.local/\n",
             host
         );
-        SPIFFS.remove("/tmp/checkpoint");
     } else {
         DEBUG2(">> mDNS setup failed.\n");
     }
@@ -1075,12 +1073,6 @@

 void setup(void) {
     DBG_OUTPUT_PORT.begin(115200);
-    if (SPIFFS.exists("/tmp/checkpoint")) {
-        ESP.eraseConfig();
-        SPIFFS.remove("/tmp/checkpoint");
-        DEBUG2("erased persistent config.\n");
-        resetall();
-    }
     DEBUG2("\n>> ESP starting... " DCHDMI_VERSION "\n");
     DEBUG2(">> %s\n", ESP.getFullVersion().c_str());
     DBG_OUTPUT_PORT.setDebugOutput(false);
@@ -1107,7 +1099,8 @@
     fpgaTask.DoWriteToOSD(0, MENU_WIDTH, (uint8_t*) buff); fpgaTask.ForceLoop();

     if (!inInitialSetupMode) {
-        setupMDNS();
+        // skip MDNS setup, because it can cause random crashes on startup
+        //setupMDNS();
     }

     if (reflashNeccessary && reflashNeccessary2 && reflashNeccessary3) {


added IR sensor

added IR sensor

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

--- Hello_IR_Sensor/Hello_IR_Sensor.ino
+++ Hello_IR_Sensor/Hello_IR_Sensor.ino
@@ -0,0 +1,29 @@
+
+
+int LED = 13; // Use the onboard Uno LED
+int isObstaclePin = A0;  // This is our input pin
+int isObstacle = HIGH;  // HIGH MEANS NO OBSTACLE
+
+void setup() {
+  pinMode(LED, OUTPUT);
+  pinMode(isObstaclePin, INPUT);
+  Serial.begin(9600);
+
+}
+
+void loop() {
+  isObstacle = analogRead(isObstaclePin);
+  Serial.println(isObstacle);
+  if (isObstacle == LOW)
+  {
+    Serial.println("OBSTACLE!!, OBSTACLE!!");
+    digitalWrite(LED, HIGH);
+  }
+  else
+  {
+    Serial.println("clear");
+    digitalWrite(LED, LOW);
+  }
+  delay(200);
+}
+


Returned Keypad-MC17-4x4 to original

Returned Keypad-MC17-4x4 to original

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


working

working

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


Add switchesAndLEDs examples

Add switchesAndLEDs examples

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

--- Photon/IoTlib/examples/switchesAndLEDs/switchesAndLEDs.ino
+++ Photon/IoTlib/examples/switchesAndLEDs/switchesAndLEDs.ino
@@ -0,0 +1,107 @@
+/*******************************************************
+Switches and LEDs ParticleIoT Example
+
+This example contains 4 switches and 4 LEDs:
+
+ * 4 LED Lights
+     - Red   = garage       A3      Photon pin 9
+     - Green = kitchen      RX      Photon pin 4
+     - Blue  = living room  TX      Photon pin 3
+     - Amber = bedroom      WKP     Photon pin 5
+
+ * 4 Switches
+     - Switch 1             D4      Photon pin 17
+     - Switch 2             D5      Photon pin 18
+     - Switch 3             D6      Photon pin 19
+     - Switch 4             D7      Photon pin 20
+
+http://www.github.com/rlisle/ParticleIoT
+
+Written by Ron Lisle
+
+BSD license, check LICENSE for more information.
+All text above must be included in any redistribution.
+
+Changelog:
+2017-03-11: Created switch & leds
+2017-03-07: Initial creation
+********************************************************/
+
+/****************/
+/*** INCLUDES ***/
+/****************/
+#include <IoT.h>
+
+/*****************/
+/*** CONSTANTS ***/
+/*****************/
+// LED pins
+#define kLed1Pin        A3      // pin 9
+#define kLed2Pin        RX      // pin 4
+#define kLed3Pin        TX      // pin 3
+#define kLed4Pin        WKP     // pin 5
+
+// LED light names
+#define kLight1         "garage"        // Can be any name you want
+#define kLight2         "kitchen"       // "
+#define kLight3         "livingroom"    // "
+#define kLight4         "bedroom"       // "
+
+// Switch pins
+#define kSwitch1Pin     D4      // pin 17 Can be any event you want
+#define kSwitch2Pin     D5      // pin 18
+#define kSwitch3Pin     D6      // pin 19
+#define kSwitch4Pin     D7      // pin 20
+
+// Event names can be anything you want, but should indicate activity
+// and not just the name of an appliance.
+#define kEvent1         "sleep"     // Turn off all lights except night lights
+#define kEvent2         "watchtv"   // Dim living room lights
+#define kEvent3         "cook"      // Turn on kitchen lights, fan
+#define kEvent4         "bedtime"   // Turn on bedroom lights, all others off
+#define kEvent5         "kitchen"   // Kitchen temp & humidity
+
+/*****************/
+/*** VARIABLES ***/
+/*****************/
+IoT *iot;
+
+/*************/
+/*** SETUP ***/
+/*************/
+void setup() {
+    initializeIoT();
+    addLights();
+    addSwitches();
+
+    iot->exposeControllers();
+    iot->exposeActivities();
+}
+
+void initializeIoT() {
+    iot = IoT::getInstance();
+    iot->setControllerName("lislerv");
+    iot->setPublishName("RonTest");
+    iot->begin();
+}
+
+void addSwitches() {
+    iot->addSwitch(kSwitch4Pin, kEvent4);
+    iot->addSwitch(kSwitch3Pin, kEvent3);
+    iot->addSwitch(kSwitch2Pin, kEvent2);
+    iot->addSwitch(kSwitch1Pin, kEvent1);
+}
+
+void addLights() {
+    iot->addLight(kLed1Pin, kLight1);
+    iot->addLight(kLed2Pin, kLight2);
+    iot->addLight(kLed3Pin, kLight3);
+    iot->addLight(kLed4Pin, kLight4);
+}
+
+/************/
+/*** LOOP ***/
+/************/
+void loop() {
+    iot->loop(millis());
+}


First working version of the arduino code.

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

--- Pianoduino.ino
+++ Pianoduino.ino
@@ -0,0 +1,223 @@
+/**
+ *
Pianoduino

+ * 61 key MIDI Keyboard with Arduino Uno Code, 24 shiftout outputs, 24 shiftin inputs
+ * 1 resistive touchscreen and 16 analog I/O.
+ * @author Malcolm Davis
+ * @version 0.1
+ * @since 2017-02-03
+ */
+ //Arduino Pins
+ static const int muxAPin = 5;
+ static const int muxBPin = 4;
+ static const int muxCPin = 3;
+ static const int muxReadPin = A0;
+ static const int inClkPin = 7; //Shift in clock
+ static const int loadPin = 6; //Shift in or load input. When high data, shifted. When Low data is loaded from parallel inputs.
+ static const int inEnPin = 8; //Active low
+ static const int inReadPin = 9;
+ static const int dataPin = 11;
+ static const int outClkPin = 12;
+ static const int latchPin = 10;
+ //If a Analog mux is added, just connect the control pins in parallel and add the En pin to the list.
+ static const int muxEn [] = {2};
+
+ //Constants
+ int mask[] = { B00000001, B00000010, B00000100, B00001000, B00010000, B00100000, B01000000, B10000000 };//To read the columns values
+ int blank = B00000000;//To send blank to the register.
+ byte noteOn = B10010000;
+ byte noteOff = B10000000;
+ byte pitchBend = B11100001;
+ static const byte  keyMidi[144]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+                                  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+                                  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+                                  B00101000, B00101000, B00101001, B00101001, B00101010, B00101010, B00101011, B00101011, B00101100, B00101100, B00100111, B00100111,
+                                  B00101110, B00101110, B00101111, B00101111, B00110000, B00110000, 0, 0, 0, 0, B00101101, B00101101,
+                                  B00111010, B00111010, B00111011, B00111011, 0, 0, B00110111, B00110111, B00111000, B00111000, B00111001, B00111001,
+                                  B00110100, B00110100, B00110101, B00110101, B00110110, B00110110, B00110001, B00110001, B00110010, B00110010, B00110011, B00110011,
+                                  B01010010, B01010010, B01010011, B01010011, B01010100, B01010100, B01001111, B01001111, B01010000, B01010000, B01010001, B01010001,
+                                  B01001100, B01001100, B01001101, B01001101, B01001110, B01001110, B01001001, B01001001, B01001010, B01001010, B01001011, B01001011,
+                                  B01000110, B01000110, B01000111, B01000111, B01001000, B01001000, B01000011, B01000011, B01000100, B01000100, B01000101, B01000101,
+                                  B01000000, B01000000, B01000001, B01000001, B01000010, B01000010, B00111101, B00111101, B00111110, B00111110, B00111111, B00111111,
+                                  0, 0, 0, 0, B00111100, B00111100, 0, 0, 0, 0, 0, 0
+                                  };
+
+ //Variables
+ int actualPin = 0;
+ static bool sValue[] = {0, 0, 0}; // S0, S1, S2 values
+ int noteVelocity [144];
+ bool keyState[144];
+ bool rowsRead []= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+ /**
+  * Method to setup the pins and stuffs of the pianoduino.
+  * @param none
+  * @return void
+  */
+void setup() {
+  int i;
+  Serial.begin(115200);
+  pinMode(muxAPin, OUTPUT);
+  pinMode(muxBPin, OUTPUT);
+  pinMode(muxCPin, OUTPUT);
+  pinMode(inClkPin, OUTPUT);
+  pinMode(loadPin, OUTPUT);
+  pinMode(inEnPin, OUTPUT);
+  pinMode(inReadPin, INPUT);
+  pinMode(dataPin, OUTPUT);
+  pinMode(latchPin, OUTPUT);
+  pinMode(outClkPin, OUTPUT);
+  for (i=0; i< sizeof(muxEn)/sizeof(int); i++) {
+    pinMode(muxEn[i], OUTPUT);
+  }
+  for (i=0; i<sizeof(noteVelocity)/sizeof(int);i++){
+    noteVelocity[i]=127;
+  }
+  for (i=0; i<sizeof(keyState)/sizeof(bool);i++){
+    noteVelocity[i]=0;
+  }
+  digitalWrite(loadPin,HIGH); //On HIGH is read ready
+  delay(1000);
+}
+
+
+/**
+ * Method to select a pin of a mux
+ * @param pPin: the mux pin that you want to write or read.
+ * @param pMuxEn: the pin of the mux that you want to read from.
+ * @return void
+ */
+void muxToPin(int pPin, int pMuxEn){
+  sValue[0] = bitRead(pPin, 0);
+  sValue[1] = bitRead(pPin, 1);
+  sValue[2] = bitRead(pPin, 2);
+  for(int i=0; i < sizeof(muxEn)/sizeof(int);i++){
+    digitalWrite(muxEn[i], HIGH);
+  }
+  digitalWrite(pMuxEn, LOW);
+  digitalWrite(muxAPin, sValue[0]);
+  digitalWrite(muxBPin, sValue[1]);
+  digitalWrite(muxCPin, sValue[2]);
+}
+
+/**
+ * Method to shift the registers to a matrix column
+ * @param pColumn the column you wish to shift to.
+ * @return void
+ */
+void shiftToColumn(int pColumn){
+  digitalWrite(latchPin, LOW);
+  if(pColumn <8){
+    shiftOut(dataPin, outClkPin, MSBFIRST, mask[pColumn]);
+    shiftOut(dataPin, outClkPin, MSBFIRST, blank);
+    shiftOut(dataPin, outClkPin, MSBFIRST, mask[pColumn]);
+  }else{
+    shiftOut(dataPin, outClkPin, MSBFIRST, mask[pColumn%8]);
+    shiftOut(dataPin, outClkPin, MSBFIRST, mask[pColumn%8]);
+    shiftOut(dataPin, outClkPin, MSBFIRST, blank);
+  }
+  digitalWrite(latchPin, HIGH);
+  delayMicroseconds(5);
+}
+
+/**
+ * Main loop method
+ * @param none
+ * @return void
+ */
+void loop() {
+  /**for(int i=0; i<8; i++){
+    Serial.print("Y");
+    Serial.print(i);
+    Serial.print(": ");
+    muxToPin(i, muxEn[0]);
+    delay(4000);
+    Serial.println( (map(analogRead(muxReadPin), 0, 1023, 0, 127)));
+    Serial.print(sValue[2]);
+    Serial.print(" ");
+    Serial.print(sValue[1]);
+    Serial.print(" ");
+    Serial.println(sValue[0]);
+  }*/
+  for (int i =0; i<16; i++){
+    shiftToColumn(i);
+    scanRows();
+    for(int j = 0; j < sizeof(rowsRead)/sizeof(byte);j++){
+      if(i<12){
+        if(rowsRead[j]&&!keyState[i+12*j]){
+            keyState[i+12*j] = 1;
+            if((i+12*j)%2==0){
+              keyState[i+12*j+1]=1;
+            }else{
+              keyState[i+12*j-1]=1;
+            }
+            updateVelocity(i+12*j);
+            midiSend(noteOn, keyMidi[i+12*j], 127);
+        }else{
+          if(keyState[i+12*j]&&!rowsRead[j]){
+            keyState[i+12*j] = 0;
+            midiSend(noteOff, keyMidi[i+12*j], 0);
+            noteVelocity[i+12*j]=0;
+            if((i+12*j)%2==0){
+              noteVelocity[i+12*j+1]=0;
+            }else{
+              noteVelocity[i+12*j-1]=0;
+            }
+          }
+        }
+      }
+      else{
+        //The other buttons..
+      }
+    }
+  }
+}
+
+/**
+ * Method that  updates the velocity of a note.
+ * @param pPos the position of the note in the array.
+ */
+void updateVelocity(int pPos){
+  return ;
+}
+
+/**
+ * Method to scan the values of all the inputs of the shiftregisters
+ */
+void scanRows(){
+  digitalWrite(loadPin, LOW); //On Low the parallel data is collected
+  delayMicroseconds(5);
+  digitalWrite(loadPin,HIGH); //On HIGH is read ready
+  delayMicroseconds(5);
+  digitalWrite(inEnPin, LOW); //Active Low
+  shiftIn(inReadPin, inClkPin);
+  digitalWrite(inEnPin, HIGH); //Active Low
+}
+
+/**
+ * Shift in modification method to read varius shift registers.
+ * @param pDatapin the pin to read.
+ * @param pClk the shift registers clock pin.
+ */
+ void shiftIn(int pDatapin, int pClk){
+  for (int i = sizeof(rowsRead)/sizeof(byte)-1; i >=0 ;i--)
+  {
+    digitalWrite(inClkPin, LOW);
+    delayMicroseconds(5);
+    rowsRead[i] = digitalRead(inReadPin);
+    digitalWrite(inClkPin, HIGH);
+  }
+ }
+
+
+/**
+ * Method to send the midi messega.
+ * @param pCmd the midi command code.
+ * @param pPitch the pitch of the note.
+ * @param pVelocity of the note.
+ * @return void
+ */
+void midiSend(byte pCmd, byte pPitch, byte pVelocity) {
+  Serial.write(pCmd);
+  Serial.write(pPitch);
+  Serial.write(pVelocity);
+}


Update

Update

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


add arduino digital matrix writter

add arduino digital matrix writter

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

--- arduinosrc/write_digital_matrix/write_digital_segments.ino
+++ arduinosrc/write_digital_matrix/write_digital_segments.ino
@@ -0,0 +1,80 @@
+const int sensorPin= A0;//The analog sensor is connected to analog pin 0 of the arduino
+
+//ABCDEFG,dp
+const int numeral[10]= {
+B11111100, //0
+B01100000, //1
+B11011010, //2
+B11110010, //3
+B01100110, //4
+B10110110, //5
+B00111110, //6
+B11100000, //7
+B11111110, //8
+B11100110, //9
+};
+
+//pins for decimal point and each segment
+//dp, G, F, E, D, C, B, A
+const int segmentPins[]= { 4, 7, 8, 6, 5, 3, 2, 9};
+// Dx de la placa
+
+const int numberofDigits=4;
+
+const int digitPins[numberofDigits] = { 10, 11, 12, 13}; //digits 1, 2, 3, 4
+
+
+void setup() {
+  // put your setup code here, to run once:
+  for (int i=0; i < 8; i++)
+    pinMode(segmentPins[i], OUTPUT); //set segment and DP pins to output
+
+  //sets the digit pins as outputs
+  for (int i=0; i < numberofDigits; i++)
+    pinMode(digitPins[i], OUTPUT);
+
+  Serial.begin(9600);
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  int value= analogRead(sensorPin);
+  float temp = (value/1024.0)*5000;
+  float cel = temp/10;
+  showNumber(cel);
+  //Serial.println(cel);
+  //Serial.println(value);
+  //delay(1000);
+}
+
+void showNumber (int number)
+{
+  if (number == 0)
+    showDigit (0, numberofDigits-1); //display 0 in the rightmost digit
+  else
+  {
+    for (int digit= numberofDigits-1; digit >=0; digit--)
+    {
+      if (number > 0)
+      {
+        showDigit(number % 10, digit);
+        number= number/10;
+      }
+    }
+  }
+}
+
+//Displays given number on a 7-segment display at the given digit position
+void showDigit (int number, int digit)
+{
+  digitalWrite(digitPins[digit], HIGH);
+  for (int segment= 1; segment < 8; segment++)
+  {
+    boolean isBitSet= bitRead(numeral[number], segment);
+
+    isBitSet= ! isBitSet; //remove this line if common cathode display
+    digitalWrite(segmentPins[segment], isBitSet);
+  }
+  delay(1);
+  digitalWrite(digitPins[digit], LOW);
+}


First draft of Arduino code.

First draft of Arduino code.

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

--- arduino/test_ard/test_ard.ino
+++ arduino/test_ard/test_ard.ino
@@ -0,0 +1,153 @@
+#include <OneWire.h>
+
+const int buffer_size = 128;
+char buffer[128];
+unsigned int read_pos = 0;
+unsigned int write_pos = 0;
+
+unsigned int temp = 99;
+
+int greenLed = 10;
+int redLed   = 11;
+int leds[2] = {greenLed, redLed};
+
+int heater_pins[2] = {12,13};
+int heater_led_pins[2] = {10,11};
+
+#pragma pack(push, 1)
+struct Header {
+  unsigned short msg_size;
+  char           msg_type;
+};
+
+struct HeaterCommand {
+  char heater_idx;
+  bool heater_status;
+};
+
+struct LedCommand {
+  char led_idx;
+  bool led_status;
+};
+
+struct TempUpdate {
+  char temp;
+};
+#pragma pack(pop)
+
+OneWire ds(7);
+byte tempAddr[8];
+
+void setup() {
+  Serial.begin(9600);
+  pinMode(greenLed, OUTPUT);
+  pinMode(redLed,   OUTPUT);
+  read_pos = 0;
+  write_pos = 0;
+  tempAddr[0] = 0;
+}
+
+int readTemperature()
+{
+  byte data[12];
+
+  if (tempAddr[0] == 0)
+  {
+    if ( !ds.search(tempAddr)) {
+      // Found no address
+      tempAddr[0] = 0;
+      ds.reset_search();
+      return 0;
+    }
+
+    if (OneWire::crc8(tempAddr, 7) != tempAddr[7]) {
+      tempAddr[0] = 0;
+      return 0;
+    }
+  }
+
+  ds.reset();
+  ds.select(tempAddr);
+  ds.write(0x44, 1);        // start conversion, with parasite power on at the end
+
+  delay(1000);      // maybe 750ms is enough, maybe not
+  // we might do a ds.depower() here, but the reset will take care of it.
+
+  ds.reset();
+  ds.select(tempAddr);
+  ds.write(0xBE);         // Read Scratchpad
+
+  for ( int i = 0; i < 9; i++) {           // we need 9 bytes
+    data[i] = ds.read();
+  }
+
+  int16_t raw = (data[1] << 8) | data[0];
+  byte cfg = (data[4] & 0x60);
+  // at lower res, the low bits are undefined, so let's zero them
+  if (cfg == 0x00) raw = raw & ~7;  // 9 bit resolution, 93.75 ms
+  else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms
+  else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms
+  //// default is 12 bit resolution, 750 ms conversion time
+  return (float)raw / 16.0;
+}
+
+void loop() {
+  temp = readTemperature();
+
+  while (Serial.available() > 0 && write_pos < buffer_size - 1) {
+    buffer[write_pos++] = Serial.read();
+  }
+
+  while (write_pos - read_pos >= sizeof(struct Header)) {
+    struct Header * hdr = (struct Header *)(buffer + read_pos);
+
+    if (sizeof(struct Header) + hdr->msg_size > write_pos - read_pos)
+      break;
+
+    switch (hdr->msg_type)
+    {
+    case 'H': // HEATER
+      {
+      struct HeaterCommand * cmd = (struct HeaterCommand *)(buffer + read_pos + sizeof(struct Header));
+      //digitalWrite(heater_pins[cmd->heater_idx], cmd->heater_status ? HIGH : LOW);
+      digitalWrite(heater_led_pins[cmd->heater_idx], cmd->heater_status ? HIGH : LOW);
+      }
+      break;
+    case 'B': // BEEP
+      // TODO beep
+      break;
+    case 'L': // LED COMMAND
+      {
+      struct LedCommand * cmd = (struct LedCommand *)(buffer + read_pos + sizeof(struct Header));
+      digitalWrite(leds[cmd->led_idx], cmd->led_status ? HIGH : LOW);
+      }
+      break;
+    case 'D': // DISPLAY LCD
+      // TODO display message
+      break;
+    }
+
+    read_pos += sizeof(struct Header) + hdr->msg_size;
+  }
+
+  if (read_pos > 0)
+  {
+    unsigned int remaining = write_pos - read_pos;
+    for (int i = 0; i < remaining; i++)
+      buffer[i] = buffer[read_pos+i];
+    read_pos = 0;
+    write_pos = remaining;
+  }
+
+  char out_buffer[128];
+  struct Header * hdr = (struct Header *)out_buffer;
+  hdr->msg_type = 't';
+  hdr->msg_size = 1;
+  struct TempUpdate * upd = (struct TempUpdate *)(out_buffer + sizeof(struct Header));
+  upd->temp = temp;
+
+  for (int i = 0; i < sizeof(struct Header) + sizeof(struct TempUpdate); i++)
+    Serial.write(out_buffer[i]);
+
+  //delay(500);
+}


[new] test sending millis()

[new] test sending millis()

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

--- xbee_test_millis.ino
+++ xbee_test_millis.ino
@@ -0,0 +1,41 @@
+#include <SoftwareSerial.h>
+
+#define PAYLOAD_SIZE 4
+
+byte *payload;
+
+// XBee's DOUT (TX) is connected to pin 2 (Arduino's Software RX)
+// XBee's DIN (RX) is connected to pin 3 (Arduino's Software TX)
+SoftwareSerial XBee(2,3); // RX, TX
+
+void setup()
+{
+  // Set up both ports at 9600 baud. This value is most important
+  // for the XBee. Make sure the baud rate matches the config
+  // setting of your XBee.
+  XBee.begin(9600);
+  Serial.begin(9600);
+}
+
+void loop()
+{
+  delay(500);
+
+  //millis() returns an unsigned long
+  payload = longToBytes(millis()); //convert an unsigned long to an array of bytes
+
+  XBee.write(payload, PAYLOAD_SIZE); //size is always size of unsigned long, 4 bytes
+  free(payload); //prevent memory leak
+}
+
+//convert a long to a byte array of length 4
+byte* longToBytes(unsigned long n) {
+  byte* array = new byte[4];
+
+  for (int i=0; i<4; i++) {
+    array[i] = 0xFF & n;
+    n = n >> 8;
+  }
+   return array;
+
+}


7 segment test

7 segment test

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

--- firmware/old/_7SegmentOutTest/_7SegmentOutTest.ino
+++ firmware/old/_7SegmentOutTest/_7SegmentOutTest.ino
@@ -0,0 +1,33 @@
+#define OE A2
+#define LATCH A3
+#define CLK A4
+#define DATA A5
+
+
+//This is the hex value of each number stored in an array by index num
+byte digitOne[10]= {0x6F, 0x09, 0x73, 0x3B, 0x1D, 0x3E, 0x7C, 0x0B, 0x7F, 0x1F};
+byte digitTwo[10]= {0x7B, 0x11, 0x67, 0x37, 0x1D, 0x3E, 0x7C, 0x13, 0x7F, 0x1F};
+
+int i;
+
+void setup(){
+
+  pinMode(LATCH, OUTPUT);
+  pinMode(CLK, OUTPUT);
+  pinMode(DATA, OUTPUT);
+  pinMode(OE, OUTPUT);
+  digitalWrite(OE,LOW);
+}
+
+void loop(){
+
+  for(int i=0; i<10; i++){
+    for(int j=0; j<10; j++){
+      digitalWrite(LATCH, LOW);
+      shiftOut(DATA, CLK, MSBFIRST, ~digitTwo[i]); // digitTwo
+      shiftOut(DATA, CLK, MSBFIRST, ~digitOne[j]); // digitOne
+      digitalWrite(LATCH, HIGH);
+      delay(500);
+    }
+  }
+}


Add ex09_ard_radial: demonstrate radial and ramp controls

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

--- examples/arduino/ex09_ard_radial/ex09_ard_radial.ino
+++ examples/arduino/ex09_ard_radial/ex09_ard_radial.ino
@@ -0,0 +1,225 @@
+//
+// GUIslice Library Examples
+// - Calvin Hass
+// - https://www.impulseadventure.com/elec/guislice-gui.html
+// - https://github.com/ImpulseAdventure/GUIslice
+// - Example 09 (Arduino):
+//     Demonstrate radial and ramp controls
+//     NOTE: The radial and ramp controls are disabled by default, but can
+//           be enabled by GSLC_FEATURE_XGAUGE_RADIAL & GSLC_FEATURE_XGAUGE_RAMP
+//           in the user config.
+//     NOTE: The ramp control is intended only as a demonstration of
+//           a custom control and not intended to be used
+//   - NOTE: This is the simple version of the example without
+//     optimizing for memory consumption. Therefore, it may not
+//     run on Arduino devices with limited memory. A "minimal"
+//     version is located in the "arduino_min" folder which includes
+//     FLASH memory optimization for reduced memory devices.
+//
+// ARDUINO NOTES:
+// - GUIslice_config.h must be edited to match the pinout connections
+//   between the Arduino CPU and the display controller (see ADAGFX_PIN_*).
+//
+
+#include "GUIslice.h"
+#include "GUIslice_drv.h"
+
+// Include any extended elements
+#include "elem/XGauge.h"
+#include "elem/XSlider.h"
+
+// Ensure optional features are enabled in the configuration
+#if !(GSLC_FEATURE_XGAUGE_RADIAL)
+  #error "Config: GSLC_FEATURE_XGAUGE_RADIAL required for this example but not enabled. Please update GUIslice_config."
+#endif
+#if !(GSLC_FEATURE_XGAUGE_RAMP)
+  #error "Config: GSLC_FEATURE_XGAUGE_RAMP required for this example but not enabled. Please update GUIslice_config."
+#endif
+
+// Defines for resources
+
+// Enumerations for pages, elements, fonts, images
+enum { E_PG_MAIN };
+enum {
+  E_ELEM_BOX, E_ELEM_BTN_QUIT, E_ELEM_COLOR,
+  E_RADIAL, E_RAMP, E_SLIDER, E_ELEM_TXT_COUNT
+};
+enum { E_FONT_BTN, E_FONT_TXT, E_FONT_TITLE };
+
+bool      m_bQuit = false;
+
+// Free-running counter for display
+unsigned  m_nCount = 0;
+
+// Instantiate the GUI
+#define MAX_PAGE                1
+#define MAX_FONT                3
+
+// Define the maximum number of elements per page
+#define MAX_ELEM_PG_MAIN          8                 // # Elems total
+#define MAX_ELEM_PG_MAIN_RAM      MAX_ELEM_PG_MAIN  // # Elems in RAM
+
+gslc_tsGui                  m_gui;
+gslc_tsDriver               m_drv;
+gslc_tsFont                 m_asFont[MAX_FONT];
+gslc_tsPage                 m_asPage[MAX_PAGE];
+gslc_tsElem                 m_asPageElem[MAX_ELEM_PG_MAIN_RAM];   // Storage for all elements in RAM
+gslc_tsElemRef              m_asPageElemRef[MAX_ELEM_PG_MAIN];    // References for all elements in GUI
+
+gslc_tsXGauge               m_sXRadial, m_sXRamp;
+gslc_tsXSlider              m_sXSlider;
+
+// Current RGB value for color box
+// - Globals defined here for convenience so that callback
+//   can update R,G,B components independently
+uint8_t   m_nPosR = 255;
+uint8_t   m_nPosG = 128;
+uint8_t   m_nPosB = 0;
+
+// Define debug message function
+static int16_t DebugOut(char ch) { Serial.write(ch); return 0; }
+
+// Quit button callback
+bool CbBtnQuit(void* pvGui, void *pvElemRef, gslc_teTouch eTouch, int16_t nX, int16_t nY)
+{
+  if (eTouch == GSLC_TOUCH_UP_IN) {
+    m_bQuit = true;
+  }
+  return true;
+}
+
+bool CbSlideRadial(void* pvGui, void* pvElemRef, int16_t nPos)
+{
+  gslc_tsGui*     pGui = (gslc_tsGui*)(pvGui);
+  gslc_tsElemRef* pElemRef = (gslc_tsElemRef*)(pvElemRef);
+  gslc_tsElem*    pElem = gslc_GetElemFromRef(pGui, pElemRef);
+
+  char    acTxt[8];
+  int16_t nVal;
+
+  // Fetch the new RGB component from the slider
+  gslc_tsElemRef* pElemRefTmp = NULL;
+  switch (pElem->nId) {
+  case E_SLIDER:
+    nVal = gslc_ElemXSliderGetPos(pGui, pElemRef);
+
+    // Link slider to the radial control
+    pElemRefTmp = gslc_PageFindElemById(pGui, E_PG_MAIN, E_RADIAL);
+    gslc_ElemXGaugeUpdate(pGui, pElemRefTmp, nVal);
+
+    // Link slider to the ramp control
+    pElemRefTmp = gslc_PageFindElemById(pGui, E_PG_MAIN, E_RAMP);
+    gslc_ElemXGaugeUpdate(pGui, pElemRefTmp, nVal);
+
+    // Link slider to the numerical display
+    snprintf(acTxt, 8, "%u", nVal);
+    pElemRefTmp = gslc_PageFindElemById(pGui, E_PG_MAIN, E_ELEM_TXT_COUNT);
+    gslc_ElemSetTxtStr(pGui, pElemRefTmp, acTxt);
+    break;
+
+  default:
+    break;
+  }
+  return true;
+}
+
+
+// Create page elements
+bool InitOverlays()
+{
+  gslc_tsElemRef*  pElemRef = NULL;
+
+  gslc_PageAdd(&m_gui, E_PG_MAIN, m_asPageElem, MAX_ELEM_PG_MAIN_RAM, m_asPageElemRef, MAX_ELEM_PG_MAIN);
+
+  // Background flat color
+  gslc_SetBkgndColor(&m_gui, GSLC_COL_GRAY_DK2);
+
+  // Create Title with offset shadow
+  pElemRef = gslc_ElemCreateTxt(&m_gui, GSLC_ID_AUTO, E_PG_MAIN, (gslc_tsRect) { 2, 2, 320, 50 },
+    (char*)"Directional", 0, E_FONT_TITLE);
+  gslc_ElemSetTxtCol(&m_gui, pElemRef, (gslc_tsColor) { 32, 32, 60 });
+  gslc_ElemSetTxtAlign(&m_gui, pElemRef, GSLC_ALIGN_MID_MID);
+  gslc_ElemSetFillEn(&m_gui, pElemRef, false);
+  pElemRef = gslc_ElemCreateTxt(&m_gui, GSLC_ID_AUTO, E_PG_MAIN, (gslc_tsRect) { 0, 0, 320, 50 },
+    (char*)"Directional", 0, E_FONT_TITLE);
+  gslc_ElemSetTxtCol(&m_gui, pElemRef, (gslc_tsColor) { 128, 128, 240 });
+  gslc_ElemSetTxtAlign(&m_gui, pElemRef, GSLC_ALIGN_MID_MID);
+  gslc_ElemSetFillEn(&m_gui, pElemRef, false);
+
+  // Create background box
+  pElemRef = gslc_ElemCreateBox(&m_gui, E_ELEM_BOX, E_PG_MAIN, (gslc_tsRect) { 10, 50, 300, 180 });
+  gslc_ElemSetCol(&m_gui, pElemRef, GSLC_COL_WHITE, GSLC_COL_BLACK, GSLC_COL_BLACK);
+
+  pElemRef = gslc_ElemXGaugeCreate(&m_gui, E_RADIAL, E_PG_MAIN, &m_sXRadial,
+    (gslc_tsRect) { 210, 140, 80, 80 }, 0, 100, 0, GSLC_COL_YELLOW, false);
+  gslc_ElemSetCol(&m_gui, pElemRef, GSLC_COL_WHITE, GSLC_COL_BLACK, GSLC_COL_BLACK);
+  gslc_ElemXGaugeSetStyle(&m_gui, pElemRef, GSLCX_GAUGE_STYLE_RADIAL);
+  gslc_ElemXGaugeSetIndicator(&m_gui, pElemRef, GSLC_COL_YELLOW, 30, 3, true);
+  gslc_ElemXGaugeSetTicks(&m_gui, pElemRef, GSLC_COL_GRAY_LT1, 8, 5);
+
+  pElemRef = gslc_ElemXGaugeCreate(&m_gui, E_RAMP, E_PG_MAIN, &m_sXRamp,
+    (gslc_tsRect) { 80, 140, 100, 80 }, 0, 100, 50, GSLC_COL_YELLOW, false);
+  gslc_ElemSetCol(&m_gui, pElemRef, GSLC_COL_WHITE, GSLC_COL_BLACK, GSLC_COL_BLACK);
+  gslc_ElemXGaugeSetStyle(&m_gui, pElemRef, GSLCX_GAUGE_STYLE_RAMP);
+
+  pElemRef = gslc_ElemXSliderCreate(&m_gui, E_SLIDER, E_PG_MAIN, &m_sXSlider,
+    (gslc_tsRect) { 20, 60, 140, 20 }, 0, 100, 50, 5, false);
+  gslc_ElemSetCol(&m_gui, pElemRef, GSLC_COL_GREEN, GSLC_COL_BLACK, GSLC_COL_BLACK);
+  gslc_ElemXSliderSetStyle(&m_gui, pElemRef, true, GSLC_COL_GREEN_DK4, 10, 5, GSLC_COL_GRAY_DK2);
+  gslc_ElemXSliderSetPosFunc(&m_gui, pElemRef, &CbSlideRadial);
+
+  pElemRef = gslc_ElemCreateTxt(&m_gui, E_ELEM_TXT_COUNT, E_PG_MAIN, (gslc_tsRect) { 180, 60, 40, 20 },
+    (char*)"", 0, E_FONT_TXT);
+
+  pElemRef = gslc_ElemCreateBtnTxt(&m_gui, E_ELEM_BTN_QUIT, E_PG_MAIN,
+    (gslc_tsRect) { 250, 60, 50, 30 }, (char*)"QUIT", 0, E_FONT_BTN, &CbBtnQuit);
+  gslc_ElemSetCol(&m_gui, pElemRef, GSLC_COL_BLUE_DK2, GSLC_COL_BLUE_DK4, GSLC_COL_BLUE_DK1);
+  gslc_ElemSetTxtCol(&m_gui, pElemRef, GSLC_COL_WHITE);
+
+  return true;
+}
+
+
+void setup()
+{
+  // Initialize debug output
+  Serial.begin(9600);
+  gslc_InitDebug(&DebugOut);
+  //delay(1000);  // NOTE: Some devices require a delay after Serial.begin() before serial port can be used
+
+  // Initialize
+  if (!gslc_Init(&m_gui, &m_drv, m_asPage, MAX_PAGE, m_asFont, MAX_FONT)) { return; }
+
+  // Load Fonts
+  if (!gslc_FontAdd(&m_gui, E_FONT_BTN, GSLC_FONTREF_PTR, NULL, 1)) { return; }
+  if (!gslc_FontAdd(&m_gui, E_FONT_TXT, GSLC_FONTREF_PTR, NULL, 1)) { return; }
+  if (!gslc_FontAdd(&m_gui, E_FONT_TITLE, GSLC_FONTREF_PTR, NULL, 3)) { return; }
+
+  // Create pages display
+  InitOverlays();
+
+  // Start up display on main page
+  gslc_SetPageCur(&m_gui, E_PG_MAIN);
+
+  m_bQuit = false;
+  return;
+}
+
+void loop()
+{
+  // General counter
+  m_nCount++;
+
+  // Periodically call GUIslice update function
+  gslc_Update(&m_gui);
+
+  // In a real program, we would detect the button press and take an action.
+  // For this Arduino demo, we will pretend to exit by emulating it with an
+  // infinite loop. Note that interrupts are not disabled so that any debug
+  // messages via Serial have an opportunity to be transmitted.
+  if (m_bQuit) {
+    gslc_Quit(&m_gui);
+    while (1) {}
+  }
+}
+


Added actual ino

Added actual ino

Only basic functionality. Some crap code.

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

--- goggles9dof.ino
+++ goggles9dof.ino
@@ -0,0 +1,262 @@
+// Googly Eye Goggles
+// By Bill Earl
+// For Adafruit Industries
+//
+// The googly eye effect is based on a physical model of a pendulum.
+// The pendulum motion is driven by accelerations in 2 axis.
+// Eye color varies with orientation of the magnetometer
+#include <Wire.h>
+#include <SPI.h>
+
+#include <Adafruit_Sensor.h>
+#include <Adafruit_LSM9DS0.h>
+#include <Adafruit_Simple_AHRS.h>
+#include <FastLED.h>
+
+
+#define DATAPIN_LEFT    6
+#define CLOCKPIN_LEFT   9
+#define DATAPIN_RIGHT    0
+#define CLOCKPIN_RIGHT   1
+#define NUM_LEDS 21 //Number of LEDS per lense
+
+CRGB leftLense[NUM_LEDS];
+CRGB rightLense[NUM_LEDS];
+
+Adafruit_LSM9DS0 lsm = Adafruit_LSM9DS0();
+sensors_event_t accel, mag, gyro, temp;
+Adafruit_Simple_AHRS ahrs(&lsm.getAccel(), &lsm.getMag());
+
+float pos = 6;  // Starting center position of pupil
+float increment = 2 * 3.14159 / 21; // distance between pixels in radians
+float MomentumH = 0; // horizontal component of pupil rotational inertia
+float MomentumV = 0; // vertical component of pupil rotational inertia
+
+// Tuning constants. (a.k.a. "Fudge Factors)
+// These can be tweaked to adjust the liveliness and sensitivity of the eyes.
+const float friction = 0.999; // frictional damping constant.  1.0 is no friction.
+const float swing = 60;  // arbitrary divisor for gravitational force
+const float gravity = 200;  // arbitrary divisor for lateral acceleration
+const float nod = 7.5; // accelerometer threshold for toggling modes
+
+long nodStart = 0;
+long nodTime = 2000;
+
+bool antiGravity = true;  // The pendulum will anti-gravitate to the top.
+bool mirroredEyes = false; // The left eye will mirror the right.
+
+const float halfWidth = 2.0; // half-width of pupil (in pixels)
+
+// Pi for calculations - not the raspberry type :: 1.25
+const float Pi = 3.14159;
+
+void setupSensor() {
+  // 1.) Set the accelerometer range
+  lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_2G);
+  //lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_4G);
+  //lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_6G);
+  //lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_8G);
+  //lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_16G);
+
+  // 2.) Set the magnetometer sensitivity
+  lsm.setupMag(lsm.LSM9DS0_MAGGAIN_2GAUSS);
+  //lsm.setupMag(lsm.LSM9DS0_MAGGAIN_4GAUSS);
+  //lsm.setupMag(lsm.LSM9DS0_MAGGAIN_8GAUSS);
+  //lsm.setupMag(lsm.LSM9DS0_MAGGAIN_12GAUSS);
+
+  // 3.) Setup the gyroscope
+  lsm.setupGyro(lsm.LSM9DS0_GYROSCALE_245DPS);
+  //lsm.setupGyro(lsm.LSM9DS0_GYROSCALE_500DPS);
+  //lsm.setupGyro(lsm.LSM9DS0_GYROSCALE_2000DPS);
+//  Serial.println("did this?");
+}
+
+void setup(void) {
+   Serial.begin(9600);
+  FastLED.addLeds<APA102, DATAPIN_LEFT, CLOCKPIN_LEFT>(leftLense, NUM_LEDS);
+  FastLED.addLeds<APA102, DATAPIN_RIGHT, CLOCKPIN_RIGHT>(rightLense, NUM_LEDS);
+
+   // Try to initialise and warn if we couldn't detect the chip
+  if (!lsm.begin()) {
+//    Serial.println("Oops ... unable to initialize the LSM9DS0. Check your wiring!");
+    while (1);
+  }
+  setupSensor();
+  resetModes();
+}
+
+// main processing loop
+void loop(void)
+{
+   // Read the magnetometer and determine the compass heading:
+   lsm.getEvent(&accel, &mag, &gyro, &temp);
+
+   sensors_vec_t   orientation;
+   ahrs.getOrientation(&orientation);
+
+   // Calculate the angle of the vector z,x from magnetic North
+//   float heading = atan2(mag.magnetic.x,mag.magnetic.z) * (180 / Pi);
+    float heading = orientation.heading;
+
+   // Normalize to 0-360 for a compass heading
+   if (heading < 0) {
+      heading = 360 + heading;
+   }
+
+   // Check for mode change commands
+//   CheckForNods(lsm);
+
+   // apply a little frictional damping to keep things in control and prevent perpetual motion
+   MomentumH *= friction;
+   MomentumV *= friction;
+
+   // Calculate the horizontal and vertical effect on the virtual pendulum
+   // 'pos' is a pixel address, so we multiply by 'increment' to get radians.
+   float TorqueH = cos(pos * increment);  // peaks at top and bottom of the swing
+   float TorqueV = sin(pos * increment);    // peaks when the pendulum is horizontal
+
+   // Add the incremental acceleration to the existing momentum
+   // This code assumes that the accelerometer is mounted upside-down, level
+   // and with the X-axis pointed forward.  So the Y axis reads the horizontal
+   // acceleration and the inverse of the Z axis is gravity.
+   // For other orientations of the sensor, just change the axis to match.
+   MomentumH += TorqueH * accel.acceleration.z / swing;
+   if (antiGravity) {
+     MomentumV += TorqueV * -accel.acceleration.y / gravity;
+   } else {
+     MomentumV -= TorqueV * -accel.acceleration.y / gravity;
+   }
+
+   // Calculate the new position
+   pos += MomentumH + MomentumV;
+
+   // handle the wrap-arounds at the top
+   while (round(pos) < 0) pos += 21.0;
+   while (round(pos) > 20) pos -= 21.0;
+
+   // Now re-compute the display
+   for (int i = 0; i <21; i++) {
+      // Compute the distance bewteen the pixel and the center
+      // point of the virtual pendulum.
+      float diff = i - pos;
+
+      // Light up nearby pixels proportional to their proximity to 'pos'
+      if (fabs(diff) <= halfWidth) {
+         CRGB color;
+         float proximity = halfWidth - fabs(diff) * 200; //Not being used right now
+
+         // pick a color based on heading & proximity to 'pos'
+         color = selectColor(heading);
+
+         // do both eyes
+         leftLense[i] = color;
+         float rightLenseOffset = i - 10;
+         while (round(rightLenseOffset) < 0) rightLenseOffset += 21.0;
+         while (round(rightLenseOffset) > 20) rightLenseOffset -= 21.0;
+         int rightLenseIndex = fabs(rightLenseOffset);
+         if (mirroredEyes) {
+           rightLense[rightLenseIndex] = color;
+         } else {
+           rightLense[rightLenseIndex] = color;
+         }
+      } else {// all others are off
+         float rightLenseOffset = i - 10;
+         while (round(rightLenseOffset) < 0) rightLenseOffset += 21.0;
+         while (round(rightLenseOffset) > 20) rightLenseOffset -= 21.0;
+         int rightLenseIndex = fabs(rightLenseOffset);
+         leftLense[i] = CRGB(0,0,0);
+         if (mirroredEyes) {
+           rightLense[rightLenseIndex] = CRGB(0,0,0);
+         } else {
+           rightLense[rightLenseIndex] = CRGB(0,0,0);
+         }
+      }
+   }
+   FastLED.show();
+}
+
+// choose a color based on the compass heading and proximity to "pos".
+CRGB selectColor(float heading) {
+     int convertedHeading = map(heading, 0, 360, 0, 255);
+     return CHSV(convertedHeading, 255, 180);
+}
+
+// monitor orientation for mode-change 'gestures'
+void CheckForNods(sensors_event_t event){
+   if (accel.acceleration.x > nod) {
+     if (millis() - nodStart > nodTime) {
+       antiGravity = false;
+       nodStart = millis(); // reset timer
+       spinDown();
+     }
+   } else if (accel.acceleration.x < -(nod + 1)) {
+     if (millis() - nodStart > nodTime) {
+       antiGravity = true;
+       spinUp();
+       nodStart = millis(); // reset timer
+     }
+   } else if (accel.acceleration.y > nod) {
+     if (millis() - nodStart > nodTime) {
+       mirroredEyes = false;
+       spinDown();
+       nodStart = millis(); // reset timer
+     }
+   } else if (accel.acceleration.y < -nod) {
+     if (millis() - nodStart > nodTime) {
+       mirroredEyes = true;
+       spinUp();
+       nodStart = millis(); // reset timer
+      }
+   } else { // no nods in progress
+     nodStart = millis(); // reset timer
+   }
+}
+
+// Reset to default
+void resetModes() {
+   antiGravity = false;
+   mirroredEyes = true;
+
+   /// spin-up
+   spin(CRGB(255, 0, 0), 1, 500);
+   spin(CRGB(0, 255, 0), 1, 500);
+   spin(CRGB(0, 0, 255), 1, 500);
+   spinUp();
+}
+
+// gradual spin up
+void spinUp() {
+   for (int i = 300; i > 0;  i -= 20) {
+     spin(CRGB::White, 1, i);
+   }
+   pos = 0;
+   // leave it with some momentum and let it 'coast' to a stop
+   MomentumH = 3;
+}
+
+// Gradual spin down
+void spinDown() {
+   for (int i = 1; i < 300; i++) {
+     spin(CRGB::White, 1, i += 20);
+   }
+   // Stop it dead at the top and let it swing to the bottom on its own
+   pos = 0;
+   MomentumH = MomentumV = 0;
+}
+
+
+// utility function for feedback on mode changes.
+void spin(CRGB color, int count, int time) {
+  for (int j = 0; j < count; j++) {
+    for (int i = 0; i < 21; i++) {
+      rightLense[i] = color;
+      leftLense[i] = color;
+      FastLED.show();
+      delay(max(time / 21, 1));
+      leftLense[i] = CRGB::Black;
+      rightLense[i] = CRGB::Black;
+      FastLED.show();
+    }
+  }
+}
+


Revert "Revert "Condensed SD Writes into a Function and Added a Check for SD on Serial""

This reverts commit f73c4ef19250114e68ca3d315d17c4ba0d7f8005.

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


Version the arduino code

Version the arduino code

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

--- arduino_sensors/arduino_sensors.ino
+++ arduino_sensors/arduino_sensors.ino
@@ -0,0 +1,109 @@
+#include <Adafruit_Sensor.h>
+#include <Adafruit_LSM303_U.h>
+#include <Adafruit_9DOF.h>
+#include <Adafruit_L3GD20_U.h>
+#include <SPI.h>
+#include <Pixy.h>
+#include <LIDARLite.h>
+#include <Wire.h>
+#include <Timer.h>
+
+#define X_CENTER ((PIXY_MAX_X-PIXY_MIN_X)/2)
+Pixy pixy;
+LIDARLite lidar;
+uint16_t blocks;
+boolean debug = false;
+Timer t;
+String gyroPrint;
+Adafruit_9DOF                dof   = Adafruit_9DOF();
+Adafruit_LSM303_Mag_Unified   mag   = Adafruit_LSM303_Mag_Unified(30302);
+int i;
+
+void printData() {
+  sensors_vec_t orientation;
+  sensors_event_t mag_event;
+  int dif;
+  blocks = -1;
+  char buffer[100];
+  blocks = pixy.getBlocks();
+  // PIXY STUFF
+  String dir;
+  static int i = 0;
+  int CenterOfBlocks;
+  char buf[7];
+
+  if (blocks) {
+    //Serial.println("Block Count: " + String(blocks));
+    if (blocks == 1) {
+      CenterOfBlocks = pixy.blocks[0].x;
+    } else if (blocks == 2) {
+      CenterOfBlocks = (pixy.blocks[0].x + pixy.blocks[1].x) / 2;
+    } else {
+      CenterOfBlocks = 0;
+    }
+    //if (blocks == 1 || blocks == 2) {
+    dif = X_CENTER - CenterOfBlocks;
+    if (dif < -5) {
+      sprintf(buffer, "^%s~%s~%s~", "PIXY", "direction", "right");
+      Serial.print(buffer);
+    } else if (dif > 5) {
+      sprintf(buffer, "^%s~%s~%s~", "PIXY", "direction", "left");
+      Serial.print(buffer);
+    } else {
+      sprintf(buffer, "^%s~%s~%s~", "PIXY", "direction", "straight");
+      Serial.print(buffer);
+    }
+    if (debug) {
+      Serial.println("");
+    }
+
+  }
+
+
+  //LIDAR STUFF
+  sprintf(buffer, "^%s~%s~%d~", "LIDAR", "cm", lidar.distance());
+  Serial.print(buffer);
+  if (debug) {
+    Serial.println("");
+  }
+
+  mag.getEvent(&mag_event);
+  if (dof.magGetOrientation(SENSOR_AXIS_Z, &mag_event, &orientation))
+  {
+    dtostrf(orientation.heading, 5, 2 , buf);
+    sprintf(buffer, "^%s~%s~%s~", "GYRO", "heading", buf);
+    Serial.print(buffer);
+  }
+  if (debug) {
+    Serial.println("");
+  }
+}
+
+void setup() {
+  Serial.begin(115200);
+  pixy.init();
+  if (debug) {
+    Serial.println("PIXY ONLINE");
+  }
+  lidar.begin(0, true);
+  if (debug) {
+    Serial.println("LIDAR ONLINE");
+  }
+  mag.begin();
+  if (debug)
+  {
+    Serial.println("GYRO ONLINE");
+  }
+
+}
+
+void loop() {
+
+  t.update();
+
+}
+
+
+
+
+


calcCharge ready for test suite

calcCharge ready for test suite

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


new readout()

new readout()


bugfix #69

bugfix #69

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


Clear phantom key on hsm_unlock

Clear phantom key on hsm_unlock

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

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


Added arduino source

Added arduino source

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

--- chillduino.ino
+++ chillduino.ino
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2015 FirstBuild
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#include "chillduino.h"
+
+void setup(void) {
+  Chillduino::setup();
+}
+
+void loop(void) {
+  Chillduino::loop();
+}


forgot to change version into 1.0

forgot to change version into 1.0

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


Update Thermal_HUD_bicubic.ino

Update Thermal_HUD_bicubic.ino

Multiple methods of selecting a color were added

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


Commit after tests

Commit after tests

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

--- tests/LogCard/LogCard.ino
+++ tests/LogCard/LogCard.ino
@@ -0,0 +1,61 @@
+#include <Arduino.h>
+
+#include <SD.h>
+#include <SPI.h>
+
+
+#ifndef __SD_H__
+
+#include "../../libraries/SD/src/SD.h"
+#include "../../libraries/SD/src/utility/SdFat.h"
+
+#endif
+
+
+const int chipSelect = 22;
+const char *logFilename = "mid.log";
+
+
+File logFile;
+
+void setup() {
+
+
+    Serial.begin(115200);
+    // see if the card is present and can be initialized:
+    if (!SD.begin(chipSelect)) {
+        Serial.println("Card failed, or not present");
+        // don't do anything more:
+        return;
+    }
+    Serial.println("card initialized.");
+
+
+    logFile = SD.open(logFilename);
+    if (logFile) {
+        Serial.println("mid.log: ");
+        // read from the file until there's nothing else in it:
+        while (logFile.available()) {
+            Serial.write(logFile.read());
+        }
+        // close the file:
+        logFile.close();
+    } else {
+        // if the file didn't open, print an error:
+        Serial.println("error opening mid.log");
+    }
+
+
+    logFile = SD.open(logFilename, FILE_WRITE);
+
+    if (logFile) {
+        logFile.println("test");
+        logFile.close();
+    }
+
+}
+
+void loop() {
+
+
+}


Update Lightning862OrangeAndBlue.ino

Update Lightning862OrangeAndBlue.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/nolanpatrick/spi_leds_862.git/'


successfully tested

successfully tested

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


arduinoのソースを追加

arduinoのソースを追加

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

--- arduino/sketch_my_moter_test/sketch_my_moter_test.ino
+++ arduino/sketch_my_moter_test/sketch_my_moter_test.ino
@@ -0,0 +1,118 @@
+#include <Wire.h>
+
+void setup() {
+  // モーターAの制御用ピン設定
+  pinMode(12, OUTPUT); // 回転方向 (HIGH/LOW)
+  pinMode(9, OUTPUT); // ブレーキ (HIGH/LOW)
+  pinMode(3, OUTPUT); // PWMによるスピード制御 (0-255)
+
+  // モーターBの制御用ピン設定
+  pinMode(13, OUTPUT); // 回転方向 (HIGH/LOW)
+  pinMode(8, OUTPUT); // ブレーキ (HIGH/LOW)
+  pinMode(11, OUTPUT); // PWMによるスピード制御 (0-255)
+
+  Wire.begin(); // join i2c bus (address optional for master)
+  Serial.begin(115200);
+}
+
+void moterA(int dir,int power)
+{
+    // モーターA: フルスピード正転
+    digitalWrite(12, dir > 0 ? HIGH : LOW);
+    digitalWrite(9, dir == 0 ? HIGH : LOW);
+    analogWrite(3, power);
+}
+void moterB(int dir,int power)
+{
+    // モーターA: フルスピード正転
+    digitalWrite(13, dir > 0 ? HIGH : LOW);
+    digitalWrite(8, dir == 0 ? HIGH : LOW);
+    analogWrite(11, power);
+}
+
+int xxx=0;
+void loop(){
+  while (Serial.available())
+  {
+    char c = Serial.read();
+    if(c=='f')
+    {
+      moterA(1,255);
+      moterB(1,255);
+    }
+    if(c=='b')
+    {
+      moterA(-1,255);
+      moterB(-1,255);
+    }
+    if(c=='r')
+    {
+      moterA(1,255);
+      moterB(-1,255);
+    }
+    if(c=='l')
+    {
+      moterA(-1,255);
+      moterB(1,255);
+    }
+    if(c=='1'){
+      moterA(1,255);
+    }
+    if(c=='2'){
+      moterB(1,255);
+    }
+    if(c=='3'){
+      moterA(-1,255);
+    }
+    if(c=='4'){
+      moterB(-1,255);
+    }
+    delay(50);
+    // stop
+    analogWrite(3, 0);
+    analogWrite(11, 0);
+  }
+
+
+#if 0
+  // モーターA: フルスピード正転
+  digitalWrite(12, HIGH);
+  digitalWrite(9, LOW);
+  analogWrite(3, 255);
+  // モーターB: フルスピード正転
+  digitalWrite(13, HIGH);
+  digitalWrite(8, LOW);
+  analogWrite(11, 255);
+  // 2秒間上記設定で回転
+  delay(500);
+
+  // モーターA: フルスピード逆転
+  digitalWrite(12, LOW);
+  digitalWrite(9, LOW);
+  analogWrite(3, 255);
+  // モーターB: フルスピード逆転
+  digitalWrite(13, LOW);
+  digitalWrite(8, LOW);
+  analogWrite(11, 255);
+  // 2秒間上記設定で回転
+  delay(500);
+
+  xxx++;
+  if(xxx%5==0)
+  {
+    // モーターA: フルスピード逆転
+    digitalWrite(12, HIGH);
+    digitalWrite(9, LOW);
+    analogWrite(3, 255);
+    // モーターB: フルスピード逆転
+    digitalWrite(13, HIGH);
+    digitalWrite(8, LOW);
+    analogWrite(11, 255);
+    // 2秒間上記設定で回転
+    delay(2000);
+  }
+#endif
+
+}
+
+


version of randomActsOfColour with the rainbow colours instead of just red and green

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

--- Xmas2013/randomActsOfRainbow/randomActsOfRainbow.ino
+++ Xmas2013/randomActsOfRainbow/randomActsOfRainbow.ino
@@ -0,0 +1,180 @@
+
+#include <G35String.h>
+
+//#define TWO_STRINGS
+
+#ifdef TWO_STRINGS
+  #define LIGHT_COUNT 50
+  #define G35_PIN1 9
+  #define G35_PIN2 10
+  G35String lights1(G35_PIN1, LIGHT_COUNT);
+  G35String lights2(G35_PIN2, LIGHT_COUNT);
+#else
+  #define LIGHT_COUNT 49
+  #define G35_PIN 9
+  G35String lights(G35_PIN, LIGHT_COUNT);
+#endif
+
+// Simple function to get amount of RAM free
+int freeRam () {
+  extern int __heap_start, *__brkval;
+  int v;
+  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
+}
+
+// Colour table for rainbow
+const int COLOURS[] = {COLOR_RED, COLOR_ORANGE, COLOR_YELLOW, COLOR_GREEN,
+                       COLOR_BLUE, COLOR_INDIGO, COLOR_VIOLET};
+const int NCOLOURS = sizeof(COLOURS)/sizeof(int);
+
+// Storage for bitmap of lights 7x8 bits = 56 (we need 50)
+const int bulbBytes = 7;
+#ifdef TWO_STRINGS
+byte bulbs1[bulbBytes];
+byte bulbs2[bulbBytes];
+#else
+byte bulbs[bulbBytes];
+#endif
+
+// Macros to work out which bit of which byte to set..
+#define GETBIT int bit = bulb % 8
+#define GETIND int ind = bulb / 8
+
+// Delays after each bulb change and after each string is done
+#define BETWEEN_BULBS 50
+#define AFTER_STRING 1000
+
+// Clear bitmap
+void clearBulbs(byte bulbs[]) {
+  for (int i=0; i < bulbBytes; i++) {
+    bulbs[i] = 0x00;
+  }
+}
+
+void setBulb(byte bulbs[], const int bulb) {
+  GETBIT;
+  GETIND;
+  bulbs[ind] |= 1 << bit;
+}
+
+void unSetBulb(byte bulbs[], const int bulb) {
+  GETBIT;
+  GETIND;
+  bulbs[ind] &= ~(1 << bit);
+}
+
+bool bulbIsUnset(byte bulbs[], const int bulb) {
+  GETBIT;
+  GETIND;
+  return (bulbs[ind] & (1 << bit)) == 0;
+}
+
+bool bulbIsSet(byte bulbs[], const int bulb) {
+  GETBIT;
+  GETIND;
+  return (bulbs[ind] & (1 << bit)) > 0;
+}
+
+int countBits(byte bulbs[]) {
+  int count=0;
+  for (int bulb=0; bulb < LIGHT_COUNT; bulb++) {
+    GETBIT;
+    GETIND;
+    if ( bulbs[ind] & (1 << bit) ) count++;
+  }
+  return count;
+}
+
+void setup() {
+  Serial.begin (115200);
+  Serial.println(freeRam());
+#ifdef TWO_STRINGS
+  lights1.enumerate();
+  lights2.enumerate();
+  clearBulbs(bulbs1);
+  clearBulbs(bulbs2);
+#else
+  lights.enumerate();
+  clearBulbs(bulbs);
+#endif
+
+  // Assuming analogue pin 0 is floating then this should
+  // give us a different pattern every time, not really but
+  // it will do...
+  randomSeed(analogRead(0));
+}
+
+// Which colour to display
+int colour = 0;
+
+void loop() {
+  #ifdef TWO_STRINGS
+    // Randomly switch on to current colour
+    while ( countBits(bulbs1) < LIGHT_COUNT ||
+            countBits(bulbs2) < LIGHT_COUNT ) {
+
+      // Set the bulb on first string
+      int bulb = random(LIGHT_COUNT);
+      if ( bulbIsUnset(bulbs1, bulb) ) {
+        setBulb(bulbs1, bulb);
+        lights1.set_color(bulb, G35::MAX_INTENSITY, COLOURS[colour]);
+        delay(BETWEEN_BULBS);
+      }
+
+      // Set the bulb on second string
+      bulb = random(LIGHT_COUNT);
+      if ( bulbIsUnset(bulbs2, bulb) ) {
+        setBulb(bulbs2, bulb);
+        lights2.set_color(bulb, G35::MAX_INTENSITY, COLOURS[colour]);
+        delay(BETWEEN_BULBS);
+      }
+    }
+    delay(AFTER_STRING);
+
+    // Randomly switch off
+    while ( countBits(bulbs1) > 0 ||
+            countBits(bulbs2) > 0 ) {
+
+      // Set the bulb on first string
+      int bulb = random(LIGHT_COUNT);
+      if ( bulbIsSet(bulbs1, bulb) ) {
+        unSetBulb(bulbs1, bulb);
+        lights1.set_color(bulb, G35::MAX_INTENSITY, COLOR_BLACK);
+        delay(BETWEEN_BULBS);
+      }
+
+      // Set the bulb on second string
+      bulb = random(LIGHT_COUNT);
+      if ( bulbIsSet(bulbs2, bulb) ) {
+        unSetBulb(bulbs2, bulb);
+        lights2.set_color(bulb, G35::MAX_INTENSITY, COLOR_BLACK);
+        delay(BETWEEN_BULBS);
+      }
+    }
+  #else
+    // Randomly switch on to current colour
+    while ( countBits(bulbs) < LIGHT_COUNT ) {
+      int bulb = random(LIGHT_COUNT);
+      if ( bulbIsUnset(bulbs, bulb) ) {
+        setBulb(bulbs, bulb);
+        lights.set_color(bulb, G35::MAX_INTENSITY, COLOURS[colour]);
+        delay(BETWEEN_BULBS);
+      }
+    }
+    delay(AFTER_STRING);
+
+    // Randomly switch off again...
+    while ( countBits(bulbs) > 0 ) {
+      int bulb = random(LIGHT_COUNT);
+      if ( bulbIsSet(bulbs, bulb) ) {
+        unSetBulb(bulbs, bulb);
+        lights.set_color(bulb, G35::MAX_INTENSITY, COLOR_BLACK);
+        delay(BETWEEN_BULBS);
+      }
+    }
+
+  #endif
+
+  colour++;
+  colour = colour % NCOLOURS;
+}


minor

minor

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


Basic Alarm Interrupt Example Added

Basic Alarm Interrupt Example Added

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

--- examples/AlarmInterrupt/AlarmInterrupt.ino
+++ examples/AlarmInterrupt/AlarmInterrupt.ino
@@ -0,0 +1,44 @@
+#include <DS3231.h>
+#include <Wire.h>
+
+// Clock interrupt pin
+#define CLINT 2
+
+DS3231 Clock;
+
+volatile int tick = 1;
+
+void setup() {
+    // Begin serial communction
+    Serial.begin(19200);
+    Serial.println("DS3231 AlarmInterrupt Example");
+    Serial.println("=============================");
+
+    // Begin I2C communication
+    Wire.begin();
+
+    // Setup alarm two to fire every second
+    Clock.turnOffAlarm(1);
+    Clock.setA1Time(0, 0, 0, 0, 0b01111111, false, false, false);
+    Clock.turnOnAlarm(1);
+    Clock.checkIfAlarm(1);
+
+    // attach clock interrupt
+    pinMode(CLINT, INPUT_PULLUP);
+    attachInterrupt(digitalPinToInterrupt(CLINT), isr_TickTock, FALLING);
+}
+
+void loop() {
+    if (tick) {
+        Serial.println("Tick.");
+        tick = 0;
+        Clock.checkIfAlarm(1);
+    }
+    delay(100);
+}
+
+
+void isr_TickTock() {
+    tick = 1;
+    return;
+}


LIDAR with PIDs

LIDAR with PIDs

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

--- LIDAR_withPIDs/LIDAR_withPIDs/LIDAR_withPIDs.ino
+++ LIDAR_withPIDs/LIDAR_withPIDs/LIDAR_withPIDs.ino
@@ -0,0 +1,228 @@
+
+// Two LIDARs on one side
+
+#include <Wire.h>
+#include <math.h>
+#include <PID_v1.h>
+#include <Servo.h>
+
+#define    LIDARLite_ADDRESS   0x62          // Default I2C Address of LIDAR-Lite.
+#define    RegisterMeasure     0x00          // Register to write to initiate ranging.
+#define    MeasureValue        0x04          // Value to initiate ranging.
+#define    RegisterHighLowB    0x8f          // Register to get both High and Low bytes in 1 call.
+
+//set up servos
+Servo steeringServo;
+Servo motorServo;
+const int steeringPin = 9;
+const int motorPin = 8;
+
+//define PID variables
+double Setpoint_theta, Input_theta, Output_theta, Setpoint_dist, Input_dist, Output_dist;
+//specify initial PID links and tuning
+int KpT = 1;
+int KiT = 0;
+int KdT = 0.5;
+int KpD = 2;
+int KiD = 0;
+int KdD = 0;
+PID PID_theta(&Input_theta, &Output_theta, &Setpoint_theta, KpT, KiT, KdT, DIRECT);
+PID PID_dist(&Input_dist, &Output_dist, &Setpoint_dist, KpD, KiD, KdD, DIRECT);
+
+void getDist(double (&distArray)[4]);
+// Variables to store last state
+double lastDist0;
+double lastDist1;
+// Variables to store current distances
+double dist0;
+double dist1;
+
+//Spacing between LIDARs on vehicle
+double LIDARspacing = 20;
+
+// Power enable switches
+const int switch0 = 12;
+const int switch1 = 13;
+
+// # of LIDAR samples
+int samples = 5;
+
+// Set pi
+const float pi = 3.142;
+
+//---------------------------------------------------------//
+void setup() {
+  // Initialize linked variables
+  Input_theta = 0;
+  Input_dist = 100;
+  Setpoint_theta = 0;
+  Setpoint_dist = 90;
+
+  PID_theta.SetMode(AUTOMATIC);
+  PID_dist.SetMode(AUTOMATIC);
+
+  // Servo range limits
+  PID_theta.SetOutputLimits(-60, 60);
+  PID_dist.SetOutputLimits(-60, 60);
+
+  steeringServo.attach(steeringPin);
+  motorServo.attach(motorPin);
+
+  // Initialize power enable pins
+  pinMode(switch0, OUTPUT);
+  pinMode(switch1, OUTPUT);
+  // Initialize LIDAR0 on and LIDAR1 off
+  digitalWrite(switch0, HIGH);
+  digitalWrite(switch1, LOW);
+
+  // Begin serial
+  Serial.begin(9600);
+  // Open and join irc bus as master
+  Wire.begin();
+  delay(100);
+
+}
+
+void loop() {
+  double distArr[4];
+  getDist(distArr);
+  //  for (int k = 0; k < 4 ; k++) {
+  //    Serial.println(distArr[k]);
+  //    delay(1);
+  //  }
+  //  Serial.println("end");
+//  Serial.print("Dist: ");
+//  Serial.println(distArr[3]);
+//  Serial.print("Angle: ");
+//  Serial.println(distArr[2]);
+
+  // Run the PID loops
+  Input_theta = distArr[2];
+  Input_dist = distArr[3];
+  PID_theta.Compute();
+  PID_dist.Compute();
+
+  motorServo.write(90  );
+  steeringServo.write(90 - Output_theta); // - Output_theta - Output_dist
+//  Serial.print("PID_theta: ");
+//  Serial.println(Output_theta);
+//  Serial.print("PID_dist: ");
+//  Serial.println(Output_dist);
+  delay(15);
+}
+
+
+//---------------------------------------------------------//
+void getDist(double (&distArray)[4]) {
+
+  for (int i = 0; i < 2; i++) {
+    switch (i) {
+      // case 0 is LIDAR0, case 1 is LIDAR1
+      case 0:
+        digitalWrite(switch0, LOW);
+        digitalWrite(switch1, LOW);
+        delay(5);
+        digitalWrite(switch0, HIGH);
+        delay(5);
+        break;
+      case 1:
+        digitalWrite(switch0, LOW);
+        digitalWrite(switch1, LOW);
+        delay(5);
+        digitalWrite(switch1, HIGH);
+        delay(5);
+        break;
+    }
+    //Error checking
+    //    Serial.print("case: ");
+    //    Serial.println(i);
+    //--
+
+    // sum distances so that we can average multiple samples
+    int distSum = 0;
+    int distance;
+
+    for (int j = 0; j < samples; j++) {
+      distance = 0;
+      // This section from LIDAR Lite Wire example
+      //-----------------//
+      Wire.beginTransmission((int)LIDARLite_ADDRESS); // transmit to LIDAR-Lite
+      Wire.write((int)RegisterMeasure); // sets register pointer to  (0x00)
+      Wire.write((int)MeasureValue); // sets register pointer to  (0x00)
+      Wire.endTransmission(); // stop transmitting
+
+      delay(20); // Wait 20ms for transmit
+
+      Wire.beginTransmission((int)LIDARLite_ADDRESS); // transmit to LIDAR-Lite
+      Wire.write((int)RegisterHighLowB); // sets register pointer to (0x8f)
+      Wire.endTransmission(); // stop transmitting
+
+      delay(20); // Wait 20ms for transmit
+
+      Wire.requestFrom((int)LIDARLite_ADDRESS, 2); // request 2 bytes from LIDAR-Lite
+
+      if (2 <= Wire.available()) // if two bytes were received
+      {
+        distance = Wire.read(); // receive high byte (overwrites previous reading)
+        distance = distance << 8; // shift high byte to be high 8 bits
+        distance |= Wire.read(); // receive low byte as lower 8 bits
+      }
+      //-----------------//
+      //low pass filter
+      switch (i) {
+        case 0:
+          if (distance < 0 || distance > 4000) {
+            distance = lastDist0;
+          }
+          distance = 0.7 * distance + 0.3 * lastDist0;
+          lastDist0 = distance;
+          break;
+        case 1:
+          if (distance < 0 || distance > 4000) {
+            distance = lastDist1;
+          }
+          distance = 0.7 * distance + 0.3 * lastDist1;
+          lastDist1 = distance;
+          break;
+      }
+      distSum = distSum + distance;
+      delay(10);
+    }
+    if (i == 0) {
+      dist0 = distSum / samples;
+      //Error checking
+//      Serial.print("dist0: ");
+//      Serial.println(dist0);
+      //--
+      //      distArray[0] = dist0 * 1.0;
+    } else if (i == 1) {
+      dist1 = distSum / samples;
+      // Distance calibration for sensor 2
+      //      dist1 = 46 + ((88 - 46) / (82 - 39)) * (dist1 - 39);
+      dist1 = 6.5 + dist1 * (0.98);
+      //Error checking
+//      Serial.print("dist1: ");
+//      Serial.println(dist1);
+      //--
+      //      distArray[1] = dist1 * 1.0;
+    }
+    double angle = atan((dist0 - dist1) / LIDARspacing);
+    //Error checking
+    //    Serial.print("angle: ");
+    //    Serial.println(angle);
+    //--
+    distArray[2] = angle;
+    double perpDist0 = dist0 * cos(angle);
+    distArray[0] = perpDist0;
+    double perpDist1 = dist1 * cos(angle);
+    distArray[1] = perpDist1;
+    double centerDist = (perpDist0 + perpDist1) / 2;
+    distArray[2] = angle * 180 / 3.142;
+    //Error checking
+    //    Serial.print("centerDist: ");
+    //    Serial.println(centerDist);
+    //--
+    distArray[3] = centerDist;
+    delay(10);
+  }
+}


minor comment

minor comment

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


Added MIDICLOCKDRUM, first test version. Test program for DBSHIELD1 : arduino shield for DreamBlaster X2,S2,.. see https://www.serdashop.com/DBSHIELD1 Demo program usage : connect a midi signal with MIDI Clock to the midi input The DBSHIELD1 will play a drum beat in sync with the clock

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

--- arduino/software/MIDICLOCKDRUM/MIDICLOCKDRUM.ino
+++ arduino/software/MIDICLOCKDRUM/MIDICLOCKDRUM.ino
@@ -0,0 +1,92 @@
+#include <MIDI.h>
+// Test program for DBSHIELD1 : arduino shield for DreamBlaster X2,S2,..
+// see https://www.serdashop.com/DBSHIELD1
+// Demo program usage :
+// connect a midi signal with MIDI Clock to the midi input
+// the DBSHIELD1 will play a drum beat in sync with the clock
+
+
+bool clockison = false;
+int clockcount = 0;
+int seqcount = 0;
+int clockinterval = 6;
+int patternlength = 4;
+MIDI_CREATE_DEFAULT_INSTANCE();
+
+#define GMBASS  36
+#define GMCLOSEHIHAT 42
+
+void handleContinue(void)
+{
+  clockison = true;
+}
+
+void handleStart(void)
+{
+  clockison = true;
+  clockcount = 0;
+}
+
+void handleStop(void)
+{
+  clockison = false;
+
+}
+
+void sequencestep(int seqcount)
+{
+  switch (seqcount)
+  {
+    case 0:
+      MIDI.sendNoteOn(GMBASS, 127, 10);
+      break;
+    case 1:
+    case 2:
+    case 3:
+      MIDI.sendNoteOn(GMCLOSEHIHAT, 127, 10);
+      break;
+  }
+};
+
+void handleClock(void)
+{
+ if(clockison)
+ {
+    if(clockcount>=clockinterval)
+      {
+        clockcount=0;
+        seqcount = seqcount % patternlength;
+        sequencestep(seqcount);
+        seqcount++;
+      }
+    clockcount++;
+ }
+
+}
+void HandleNoteOn(byte channel, byte pitch, byte velocity) {
+// check your pitch, velocity, and channel here
+  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
+}
+void HandleNoteOff(byte channel, byte pitch, byte velocity) {
+// check your pitch, velocity, and channel here
+  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
+}
+
+void setup() {
+  // put your setup code here, to run once:
+  MIDI.begin();
+  MIDI.setHandleNoteOn(HandleNoteOn);
+  MIDI.setHandleNoteOff(HandleNoteOff);
+  MIDI.setHandleClock(handleClock);
+  MIDI.setHandleStart(handleStart);
+  MIDI.setHandleStop(handleStop);
+  MIDI.setHandleContinue(handleContinue);
+  pinMode(LED_BUILTIN, OUTPUT);
+}
+
+
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  MIDI.read();
+}


Update hrm.ino

Update hrm.ino

adding alarm code

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