Initial version of single bench control sketch

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

--- sketches/control/single_bench/single_bench.ino
+++ sketches/control/single_bench/single_bench.ino
@@ -0,0 +1,219 @@
+/**
+ * Control the BlinkMs for a single bench with one painting. Fire off
+ * the appropriate MaxMs at the correct intervals during the daily
+ * operational time.
+ *
+ * The MaxMs that actually control the light pattern for one group
+ * of LED clusters (Blasters) are preloaded with their light
+ * scripts. The MaxMs are connected over an I2C and have device ids
+ * preset also. Note that the RTC has device id 0x68 whcih cannot
+ * be changed.
+ *
+ * TODO finish description of operation
+ */
+
+#define DEBUG
+
+#include <JeeLib.h>
+#include <Wire.h> // needed to avoid a linker error :(
+#include <RTClib.h>
+
+// Start and end hours of operation
+const unsigned char start_hh = 9;
+const unsigned char start_mm = 0;
+const unsigned char stop_hh = 22;
+const unsigned char stop_mm = 0;
+
+// Seconds after starting first MaxM to start second
+const byte maxm2_offset = 30;
+
+// boilerplate for low-power waiting
+ISR(WDT_vect) { Sleepy::watchdogEvent(); }
+
+// The MaxMs are daisy chained off Jeenode port 2
+Port maxms (2);
+
+// RTC based on the DS1307 chip connected via the Ports library
+class RTC_Plug : public DeviceI2C {
+    // shorthand
+    static uint8_t bcd2bin (uint8_t val) { return RTC_DS1307::bcd2bin(val); }
+    static uint8_t bin2bcd (uint8_t val) { return RTC_DS1307::bin2bcd(val); }
+public:
+    RTC_Plug (const PortI2C& port) : DeviceI2C (port, 0x68) {}
+
+    void begin() {}
+
+    void adjust(const DateTime& dt) {
+        send();
+        write(0);
+        write(bin2bcd(dt.second()));
+        write(bin2bcd(dt.minute()));
+        write(bin2bcd(dt.hour()));
+        write(bin2bcd(0));
+        write(bin2bcd(dt.day()));
+        write(bin2bcd(dt.month()));
+        write(bin2bcd(dt.year() - 2000));
+        write(0);
+        stop();
+    }
+
+    DateTime now() {
+      	send();
+      	write(0);
+        stop();
+
+        receive();
+        uint8_t ss = bcd2bin(read(0));
+        uint8_t mm = bcd2bin(read(0));
+        uint8_t hh = bcd2bin(read(0));
+        read(0);
+        uint8_t d = bcd2bin(read(0));
+        uint8_t m = bcd2bin(read(0));
+        uint16_t y = bcd2bin(read(1)) + 2000;
+
+        return DateTime (y, m, d, hh, mm, ss);
+    }
+};
+
+long toMin(const unsigned char hh, const unsigned char mm) {
+    return (hh * 60) + mm;
+}
+
+#ifdef DEBUG
+void doFlash(const Port ldnum, const byte cnt) {
+    byte cntr = cnt;
+    while (cntr > 0) {
+        cntr--;
+        ldnum.digiWrite(1);
+        Sleepy::loseSomeTime(50);
+        ldnum.digiWrite(0);
+        if (cntr < 1) break;
+        Sleepy::loseSomeTime(250);
+    }
+}
+#endif
+
+PortI2C i2cBus (1);
+RTC_Plug RTC (i2cBus);
+
+#ifdef DEBUG
+// LEDs are on ports 3 and 4
+// LED1 flashes once for the MAXM1 task, twice for the MAXM2 task
+Port led1 (3);
+// LED2 flashes once per 10 seconds in a minute (1..6)
+Port led2 (4);
+
+byte led1_on = 0;
+byte led2_on = 0;
+#endif
+
+int is_operational = 0;
+
+long start_min = 0;
+long stop_min = 0;
+
+// Add more tasks for second bench
+enum { MAXM1, MAXM2, OPER_TIME, TASK_LIMIT };
+
+static word schedBuf[TASK_LIMIT];
+Scheduler scheduler (schedBuf, TASK_LIMIT);
+
+void setup () {
+#ifdef DEBUG
+    Serial.begin(57600);
+    Serial.println("Single bench start");
+    Serial.flush();
+#endif
+
+    // Turn the radio off completely
+    rf12_initialize(17, RF12_868MHZ);
+    rf12_sleep(RF12_SLEEP);
+
+    // Convert start hh:mm to a start minutes
+    start_min = toMin(start_hh, start_mm);
+    stop_min = toMin(stop_hh, stop_mm);
+
+#ifdef DEBUG
+    led1.mode(OUTPUT);
+    led2.mode(OUTPUT);
+#endif
+
+    // TODO
+    // Stop the scripts on both MaxMs
+
+    // Start tasks after a pause for the power supply to settle
+    scheduler.timer(OPER_TIME, 15);
+    scheduler.timer(MAXM1, 20);
+}
+
+void loop () {
+    switch (scheduler.pollWaiting()) {
+        // Control first MaxM
+        case MAXM1:
+            /* Serial.print("MAXM1 is operational "); */
+            /* Serial.println(is_operational); */
+            /* Serial.flush(); */
+            if (is_operational == 1) {
+#ifdef DEBUG
+                doFlash(led1, 1);
+#endif
+                // TODO
+                // Start script on first MaxM
+                // TODO need correct amount to reschedule
+                /* Serial.println("MAXM1"); */
+                /* Serial.flush(); */
+
+            }
+            scheduler.timer(MAXM2, 30);
+            scheduler.timer(MAXM1, 100);
+            break;
+
+        // Control second MaxM
+        case MAXM2:
+            if  (is_operational != 1) break;
+
+#ifdef DEBUG
+            doFlash(led1, 2);
+#endif
+            break;
+
+        // Check if within operational time
+        case OPER_TIME:
+            // Get time
+            DateTime now = RTC.now();
+
+            // Loop every 60 seconds
+            const int loop_interval = 60;
+            int sec_til_loop = loop_interval - (now.get() % loop_interval);
+
+            // Check if should be operational and set flag
+            long cur_min = toMin(now.hour(), now.minute());
+            if ((cur_min >= start_min) && (cur_min < stop_min))  {
+                /* Serial.println("Operational"); */
+                /* Serial.flush(); */
+                is_operational = 1;
+                /* Serial.print("is operational "); */
+                /* Serial.println(is_operational); */
+                /* Serial.flush(); */
+            } else {
+                /* Serial.println("Sleep"); */
+                /* Serial.flush(); */
+                is_operational = 0;
+            }
+
+#ifdef DEBUG
+            // Flash LED2 one for every minute in ten if "operational"
+            // otherwise only 1 flash
+            int num_flash = 1;
+            if (is_operational == 1) {
+                num_flash = (now.get() % 600);
+                num_flash = num_flash / 60;
+            }
+            doFlash(led2, num_flash);
+#endif
+
+            // Check reschedule amount aganst RTC
+            scheduler.timer(OPER_TIME, sec_til_loop * 10);
+            break;
+    }
+}


source code

source code

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

--- ArduinoPedometer.ino
+++ ArduinoPedometer.ino
@@ -0,0 +1,57 @@
+/************* Arduino Pedometer with HC-05 ******************
+  This project collects data from the ADXL-335 accelerometer.
+  Arduino processes it and calculates the "No. of Steps" taken
+  from the time of power up. the data is encoded in Json string format
+  and sent serially using a BT module HC-05.
+  ---------------------------------------------------------------------
+  created on 16 Dec 2015
+  by Abhay Shankar Bharadwaj
+  (abhaysbharadwaj@gmail.com)
+  (facebook.com/abhaysbharadwaja)
+  ---------------------------------------------------------------------
+  credits go to Benoit Blanchon for the ArduinoJson library
+  and jatinbatra (http://www.instructables.com/member/jatinbatra/)
+  who created the original pedometer code.
+  ---------------------------------------------------------------------
+  This project code is in the public domain.
+  It is given as is, and any modifications can be done
+  as an open sorce standard. credits to be updated wherever
+  and whenever necessary.
+  ---------------------------------------------------------------------
+  ----------------------- connection details --------------------------
+  ADXL335 accelerometer & Arduino nano:
+  Vcc --> +5v
+  X --> A5
+  Y --> A6
+  Z --> A7
+  Gnd --> gnd
+  BT HC05 Tx to software Rx (D11)
+  BT HC05 Rx to software Tx (D10)
+  you can change the pind in .h file
+  ----------------------------------------------------------------------
+  you must include the "ArduinoJson" and "SoftwareSerial"
+  libraries in arduino's library directory
+  (C:\Program Files (x86)\Arduino\libraries)
+  (or ...\Arduino\libraries)
+  you can download the libraries from:
+  ArduinoJson: https://github.com/bblanchon/ArduinoJson
+  SoftwareSerial: https://github.com/arduino/Arduino/tree/master/hardware/arduino/avr/libraries/SoftwareSerial
+**********************************************************/
+
+#include "ArduinoPedometer.h"
+
+ArduinoPedometer fp; //create an instacne called "fp" for the class "ArduinoPedometer"
+int x;
+
+void setup()
+{
+  fp.calibrate(); // perform calibration to get x,y,z parameters.
+  delay(1000);
+}
+
+void loop()
+{
+  x = fp.getPedo(); //get the no. of steps
+  fp.jsonPrint(x); //print the value in json format in software serial.
+  delay(200);
+}


Create ver4.ino

Create ver4.ino

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

--- Dalal/Robot/ver4.ino
+++ Dalal/Robot/ver4.ino
@@ -0,0 +1,187 @@
+#include <SoftwareSerial.h>
+#include <Motor.h>
+#include <NewPing.h>
+
+#define buzzer 2
+#define trig 8
+#define echo 7
+#define max_dist 100
+
+NewPing frontSonar(trig, echo, max_dist);
+
+int speed = 100;
+
+bool button_control = false;
+bool desktop = false;
+bool voice_control = false;
+
+String voice_command = "";
+
+//motorpins pins = {6, 9, 3, 5};
+motorPins pins = {3, 5, 6, 9};+
+
+Motor motor(pins);
+
+int led = 13;
+
+SoftwareSerial bt(10, 11); //rx tx
+
+float values = -100;
+float yValues = -100;
+
+int x_value = 0;
+int y_value = 0;
+
+int direction = 0;
+
+void setup() {
+  // put your setup code here, to run once:
+  Serial.begin(9600);
+  bt.begin(9600);
+  pinMode(led, OUTPUT);
+  pinMode(buzzer, OUTPUT);
+}
+
+int getX(String value){
+  String x = value.substring(1, value.indexOf(','));
+  return x.toInt();
+}
+
+int getY(String value){
+  String y = value.substring(value.indexOf(',') + 1, value.indexOf(')'));
+  return y.toInt();
+}
+
+String incomingByte = "";
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  if (bt.available() > 0){
+    //values = bt.parseFloat();
+    //yValues = bt.parseFloat();
+
+    //Serial.println("x values: " + String(values) + "\n y values: " + String(yValues));
+    String compositeData = bt.readStringUntil('\n');
+    incomingByte = compositeData;
+
+    Serial.println(compositeData);
+
+    if (compositeData.startsWith("~")) {
+      button_control = true;
+      desktop = false;
+      voice_control = false;
+      if (compositeData.equals("~FORWARD")) {Serial.println("fwd"); direction = 9000;}
+      else if (compositeData.equals("~BACKWARD")) {Serial.println("back"); direction = 10000;}
+      else if (compositeData.equals("~LEFT")) {Serial.println("left"); direction = 11000;}
+      else if (compositeData.equals("~RIGHT")) {Serial.println("right") ; direction = 12000;}
+      else if (compositeData.equals("~STOP")) {Serial.println("stop"); direction = 13000;}
+
+
+    }
+
+
+    else if (compositeData.startsWith("W") ||
+        compositeData.startsWith("S") ||
+        compositeData.startsWith("A") ||
+        compositeData.startsWith("D") ||
+        compositeData.startsWith("q")){
+          Serial.println("data got");
+          desktop = true;
+          voice_control = false;
+          button_control = false;
+        }
+
+
+    else if (compositeData.endsWith("#")){
+        voice_command = compositeData;
+        desktop = false;
+        voice_control = true;
+        button_control = false;
+    }
+
+
+
+    else {
+      button_control = false;
+      desktop = false;
+      voice_control = false;
+      x_value = getX(compositeData);
+      y_value = getY(compositeData);
+    }
+
+//    Serial.println("x: " +  String(x_value));
+//    Serial.println(x);
+
+    delay(10);
+  }
+
+  if (button_control == false && desktop == false && voice_control == false){
+
+
+  if (x_value > -8 && x_value < -3){
+
+
+    Serial.println("FORWARD");
+    motor.go(speed, speed, FORWARD);
+  }
+
+    else if (x_value > 3 && x_value < 8){
+     Serial.println("BACKWARD");
+    motor.go(speed, speed, BACKWARD);
+  }
+
+    else if (y_value > 3 && y_value < 8){
+    Serial.println("LEFT");
+    motor.go(0, speed, LEFT);
+  }
+
+
+  else if (y_value > -8 && y_value < -3){
+
+
+    Serial.println("RIGHT");
+    motor.go(speed, 0, RIGHT);
+  }
+
+  else {
+    motor.go(0, 0, NOWHERE);
+  }
+
+  } else {
+
+    if (direction == 9000){
+      motor.go(speed, speed, FORWARD);
+    } else if (direction == 10000){
+      motor.go(speed, speed, BACKWARD);
+    } else if (direction == 11000){
+
+      motor.go(speed, speed, RIGHT);
+    } else if (direction == 12000){
+      motor.go(speed, speed, LEFT);
+    } else if (direction == 13000){
+      motor.go(0, 0, NOWHERE);
+    }
+  }
+
+
+  if (desktop == true){
+    if (incomingByte.equals("W")) { motor.go(speed, speed, FORWARD); Serial.println("forward");}
+    else if (incomingByte.equals("S")) { motor.go(speed, speed, BACKWARD); Serial.println("backward"); }
+    else if (incomingByte.equals("A")) { motor.go(speed, speed, LEFT); Serial.println("left"); }
+    else if (incomingByte.equals("D")) {motor.go(speed, speed, RIGHT); Serial.println("right");}
+    else  motor.go(0, 0, NOWHERE);
+  }
+
+  if (frontSonar.ping_cm() > 2 && frontSonar.ping_cm() < 10){
+    digitalWrite(buzzer, HIGH);
+  } else digitalWrite(buzzer, LOW);
+
+  if (voice_control == true && desktop == false && button_control == false){
+    if (voice_command.equals("*forward#")) {motor.go(speed, speed, FORWARD); Serial.println("Forward"); }
+    else if (voice_command.equals("*left#")) {motor.go(speed, speed, LEFT); Serial.println("Left");}
+    else if (voice_command.equals("*right#")) {motor.go(speed, speed, RIGHT); Serial.println("Right");}
+    else if (voice_command.equals("*backward#")) {motor.go(speed, speed, BACKWARD); Serial.println("Backward");}
+    else motor.go(0, 0, NOWHERE);
+  }
+
+}


IC2 Scanner: for testing purposes

IC2 Scanner: for testing purposes

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

--- I2Ctest/I2Ctest.ino
+++ I2Ctest/I2Ctest.ino
@@ -0,0 +1,83 @@
+// --------------------------------------
+// i2c_scanner
+//
+// Version 1
+//    This program (or code that looks like it)
+//    can be found in many places.
+//    For example on the Arduino.cc forum.
+//    The original author is not know.
+// Version 2, Juni 2012, Using Arduino 1.0.1
+//     Adapted to be as simple as possible by Arduino.cc user Krodal
+// Version 3, Feb 26  2013
+//    V3 by louarnold
+// Version 4, March 3, 2013, Using Arduino 1.0.3
+//    by Arduino.cc user Krodal.
+//    Changes by louarnold removed.
+//    Scanning addresses changed from 0...127 to 1...119,
+//    according to the i2c scanner by Nick Gammon
+//    http://www.gammon.com.au/forum/?id=10896
+// Version 5, March 28, 2013
+//    As version 4, but address scans now to 127.
+//    A sensor seems to use address 120.
+// Version 6, November 27, 2015.
+//    Added waiting for the Leonardo serial communication.
+//
+//
+// This sketch tests the standard 7-bit addresses
+// Devices with higher bit address might not be seen properly.
+//
+
+#include <Wire.h>
+
+
+void setup()
+{
+  Wire.begin();
+
+  Serial.begin(9600);
+  while (!Serial);             // Leonardo: wait for serial monitor
+  Serial.println("\nI2C Scanner");
+}
+
+
+void loop()
+{
+  byte error, address;
+  int nDevices;
+
+  Serial.println("Scanning...");
+
+  nDevices = 0;
+  for(address = 1; address < 127; address++ )
+  {
+    // The i2c_scanner uses the return value of
+    // the Write.endTransmisstion to see if
+    // a device did acknowledge to the address.
+    Wire.beginTransmission(address);
+    error = Wire.endTransmission();
+
+    if (error == 0)
+    {
+      Serial.print("I2C device found at address 0x");
+      if (address<16)
+        Serial.print("0");
+      Serial.print(address,HEX);
+      Serial.println("  !");
+
+      nDevices++;
+    }
+    else if (error==4)
+    {
+      Serial.print("Unknow error at address 0x");
+      if (address<16)
+        Serial.print("0");
+      Serial.println(address,HEX);
+    }
+  }
+  if (nDevices == 0)
+    Serial.println("No I2C devices found\n");
+  else
+    Serial.println("done\n");
+
+  delay(5000);           // wait 5 seconds for next scan
+}


modify the sending end_exp

modify the sending end_exp

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


for integration

for integration


Update DHTtester.ino

Update DHTtester.ino

Added a 5sec delay between readings. The Adafruit library has a 2sec cache of reading values.

error: pathspec 'Temperature' did not match any file(s) known to git
error: pathspec 'and' did not match any file(s) known to git
error: pathspec 'Humidity/DHTtester/DHTtester.ino' did not match any file(s) known to git


Fix light publish - check for values diff

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


Create sketch_ardrumoid.ino

Create sketch_ardrumoid.ino

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

--- arduino/sketch_ardrumoid.ino
+++ arduino/sketch_ardrumoid.ino
@@ -0,0 +1,51 @@
+int BTNLEDPIN = 8;
+
+void setup() {
+  Serial.begin(115200);
+  pinMode(BTNLEDPIN, OUTPUT);
+}
+  int val0_old , val1_old, val2_old, val3_old, val4_old;
+  int val0;   //Symbal
+  int val1;   //Hihat
+  int val2;  //Snare
+  int val3;  //Tom
+  int val4;  //Kick
+
+
+void loop() {
+
+  val0 = analogRead(0); //Connect the sensor to analog pin 0
+  val1 = analogRead(1);
+  val2 = analogRead(2);
+  val3 = analogRead(3);
+  val4 = analogRead(4);
+
+  if (val0 > 50 && val0 > val0_old) {
+   Serial.print("0");
+   }
+  val0_old = val0;
+  if (val1 > 40 && val1 > val1_old) {
+   Serial.print("1");
+   }
+  val1_old = val1;
+  if (val2 > 40 && val2 > val2_old) {
+   Serial.print("2");
+   }
+  val2_old = val2;
+
+  if (val3 > 40 && val3 > val3_old) {
+      Serial.print("3");
+   }
+  val3_old = val3;
+
+    if (val4 > 1000 && val4 > val4_old +10) {
+      Serial.print("4");
+   }
+  if(val4 > 1020){
+    digitalWrite(BTNLEDPIN, LOW);
+  }else{
+    digitalWrite(BTNLEDPIN, HIGH);
+  }
+  val4_old = val4;
+  delay(13);
+}


changes

changes

something

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/ivegotasthma/washmashine.git/'


Update ProjectHomeAutomation.ino

Update ProjectHomeAutomation.ino

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


First commit

First commit

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

--- TrafficCounter/TrafficCounter.ino
+++ TrafficCounter/TrafficCounter.ino
@@ -0,0 +1,194 @@
+//  The MIT License (MIT)
+//
+//  Copyright (c) 2014 Henrik Olsson
+//
+//  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.
+
+
+/***************************************************************
+ *
+ * Do-It-Yourself TRAFFIC COUNTER
+ *
+ ***************************************************************/
+#include <Adafruit_CC3000.h>
+#include <ccspi.h>
+#include <SPI.h>
+#include <PubSubClient.h>
+
+// These are the interrupt and control pins
+#define ADAFRUIT_CC3000_IRQ   3  // MUST be an interrupt pin!
+// These can be any two pins
+#define ADAFRUIT_CC3000_VBAT  5
+#define ADAFRUIT_CC3000_CS    10
+// Use hardware SPI for the remaining pins
+// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
+Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
+                                         SPI_CLOCK_DIVIDER); // you can change this clock speed but DI
+
+#define WLAN_SSID       "myNetwork"        // cannot be longer than 32 characters!
+#define WLAN_PASS       "myPassword"
+// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
+#define WLAN_SECURITY   WLAN_SEC_WPA2
+
+byte server[] = { 172, 16, 0, 2 };
+
+PubSubClient client(server, 1883, callback, cc3000);
+
+void callback(char* topic, byte* payload, unsigned int length) {
+  // handle message arrived
+}
+
+#define THRESHOLD       2 //change this amount if necessary. tunes sensitivity.
+#define WHEEL_DELAY     50 //number of milliseconds to create accurate readings for cars. prevents bounce.
+#define WHEEL_SPACEING  2.7500 //average spacing between wheels of car (METERS)
+#define CAR_TIMEOUT     3000
+
+int triggerValue; // pressure reading THRESHOLD for identifying a bike is pressing.
+int the_tally; //total amount of sensings.
+int max = 0;
+int isMeasuring = 0;
+int countThis = 0;
+int strikeNumber = 0;
+float firstWheel = 0.0000000;
+float secondWheel= 0.0000000;
+float wheelTime = 0.0000000;
+float speed = 0.0000000;
+
+
+void setup() {
+  pinMode(A0, INPUT);
+  pinMode(2, OUTPUT);
+  pinMode(13, OUTPUT);
+
+  Serial.begin(115200);
+
+  Serial.print("Conecting to WIFI .");
+
+  cc3000.begin();
+
+  Serial.print(".");
+
+  if (!cc3000.deleteProfiles()) {
+    while(1);
+  }
+
+  Serial.print(".");
+  char *ssid = WLAN_SSID;             /* Max 32 chars */
+  if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
+    while(1);
+  }
+
+  Serial.print(".");
+  while (!cc3000.checkDHCP())
+  {
+    Serial.print(".");
+    delay(100); // ToDo: Insert a DHCP timeout!
+  }
+    Serial.println(" OK");
+
+  if (client.connect("arduinoClient")) {
+    client.publish("outTopic","hello world");
+    client.subscribe("inTopic");
+  }
+
+  // read local air pressure and create offset.
+  triggerValue = analogRead(A0) + THRESHOLD;
+  delay(1000);
+  Serial.println("Hello, Welcome to the DIY Traffic Counter");
+  Serial.println("Developed by Tomorrow Lab in NYC");
+  Serial.println("___________________________________________________");
+  Serial.println("");
+  Serial.print("Local Air Pressure: ");
+  Serial.println(triggerValue - THRESHOLD);
+  Serial.println("___________________________________________________");
+
+
+}
+
+void loop() {
+  //Serial.println(analogRead(A0));
+
+  //1 - TUBE IS PRESSURIZED INITIALLY
+  if (analogRead(A0) > triggerValue) {
+    if (strikeNumber == 0 && isMeasuring == 0) { // FIRST HIT
+      Serial.println("");
+      Serial.println("Car HERE. ");
+      firstWheel = millis();
+      isMeasuring = 1;
+    }
+    if (strikeNumber == 1 && isMeasuring == 1) { // SECOND HIT
+      Serial.println("Car GONE.");
+      secondWheel = millis();
+      isMeasuring = 0;
+    }
+  }
+
+
+  //2 - TUBE IS STILL PRESSURIZED
+  while(analogRead(A0) > max && isMeasuring == 1) { //is being pressed, in all cases. to measure the max pressure.
+    max = analogRead(A0);
+  }
+
+
+  //3 - TUBE IS RELEASED
+  if (analogRead(A0) < triggerValue - 1 && countThis == 0) { //released by either wheel
+    if (strikeNumber == 0 && isMeasuring == 1 && (millis() - firstWheel > WHEEL_DELAY)) {
+      strikeNumber = 1;
+    }
+    if (strikeNumber == 1 && isMeasuring == 0 && (millis() - secondWheel > WHEEL_DELAY) ) {
+      countThis = 1;
+    }
+  }
+
+
+  //4 - PRESSURE READING IS ACCEPTED AND RECORDED
+  if ((analogRead(A0) < triggerValue - 1) && ((countThis == 1 && isMeasuring == 0) || ((millis() - firstWheel) > CAR_TIMEOUT) && isMeasuring == 1)) { //has been released for enough time.
+    the_tally++;
+    Serial.print("Pressure Reached = ");
+    Serial.println(max);
+    Serial.print("Current Count = ");
+    Serial.println(the_tally);
+    //Serial.print("time between wheels = ");
+    wheelTime = ((secondWheel - firstWheel)/3600000);
+    //Serial.println(wheelTime);
+    int time = ((millis()/1000)/60) + 1; // the number of seconds since first record.
+    speed = (WHEEL_SPACEING/1000)/wheelTime;
+    if (speed > 0 ) {
+      Serial.print("Estimated Speed (km/h) = ");
+      Serial.println(speed);
+      char tmp[10];
+       dtostrf(speed,1,2,tmp);
+      client.publish("trafffic/count/car",tmp);
+    }
+    else {
+      client.publish("trafffic/count/car","-1");
+    }
+
+    //RESET ALL VALUES
+    max = 0;
+    strikeNumber = 0;
+    countThis = 0;
+    isMeasuring = 0;
+
+  }
+}
+
+
+
+


Got light sensor working with adafruit TSL2591 library and adafruit sensor libraries

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

--- ardesp/light_test/light_test.ino
+++ ardesp/light_test/light_test.ino
@@ -0,0 +1,198 @@
+/* TSL2591 Digital Light Sensor */
+/* Dynamic Range: 600M:1 */
+/* Maximum Lux: 88K */
+
+#include <Wire.h>
+#include <Adafruit_Sensor.h>
+#include "Adafruit_TSL2591.h"
+
+// Example for demonstrating the TSL2591 library - public domain!
+
+// connect SCL to analog 5
+// connect SDA to analog 4
+// connect Vin to 3.3-5V DC
+// connect GROUND to common ground
+
+Adafruit_TSL2591 tsl = Adafruit_TSL2591(2591); // pass in a number for the sensor identifier (for your use later)
+
+/**************************************************************************/
+/*
+    Displays some basic information on this sensor from the unified
+    sensor API sensor_t type (see Adafruit_Sensor for more information)
+*/
+/**************************************************************************/
+void displaySensorDetails(void)
+{
+  sensor_t sensor;
+  tsl.getSensor(&sensor);
+  Serial.println("------------------------------------");
+  Serial.print  ("Sensor:       "); Serial.println(sensor.name);
+  Serial.print  ("Driver Ver:   "); Serial.println(sensor.version);
+  Serial.print  ("Unique ID:    "); Serial.println(sensor.sensor_id);
+  Serial.print  ("Max Value:    "); Serial.print(sensor.max_value); Serial.println(" lux");
+  Serial.print  ("Min Value:    "); Serial.print(sensor.min_value); Serial.println(" lux");
+  Serial.print  ("Resolution:   "); Serial.print(sensor.resolution); Serial.println(" lux");
+  Serial.println("------------------------------------");
+  Serial.println("");
+  delay(500);
+}
+
+/**************************************************************************/
+/*
+    Configures the gain and integration time for the TSL2591
+*/
+/**************************************************************************/
+void configureSensor(void)
+{
+  // You can change the gain on the fly, to adapt to brighter/dimmer light situations
+  //tsl.setGain(TSL2591_GAIN_LOW);    // 1x gain (bright light)
+  tsl.setGain(TSL2591_GAIN_MED);      // 25x gain
+  //tsl.setGain(TSL2591_GAIN_HIGH);   // 428x gain
+
+  // Changing the integration time gives you a longer time over which to sense light
+  // longer timelines are slower, but are good in very low light situtations!
+  tsl.setTiming(TSL2591_INTEGRATIONTIME_100MS);  // shortest integration time (bright light)
+  //tsl.setTiming(TSL2591_INTEGRATIONTIME_200MS);
+  //tsl.setTiming(TSL2591_INTEGRATIONTIME_300MS);
+  //tsl.setTiming(TSL2591_INTEGRATIONTIME_400MS);
+  //tsl.setTiming(TSL2591_INTEGRATIONTIME_500MS);
+  //tsl.setTiming(TSL2591_INTEGRATIONTIME_600MS);  // longest integration time (dim light)
+
+  /* Display the gain and integration time for reference sake */
+  Serial.println("------------------------------------");
+  Serial.print  ("Gain:         ");
+  tsl2591Gain_t gain = tsl.getGain();
+  switch(gain)
+  {
+    case TSL2591_GAIN_LOW:
+      Serial.println("1x (Low)");
+      break;
+    case TSL2591_GAIN_MED:
+      Serial.println("25x (Medium)");
+      break;
+    case TSL2591_GAIN_HIGH:
+      Serial.println("428x (High)");
+      break;
+    case TSL2591_GAIN_MAX:
+      Serial.println("9876x (Max)");
+      break;
+  }
+  Serial.print  ("Timing:       ");
+  Serial.print((tsl.getTiming() + 1) * 100, DEC);
+  Serial.println(" ms");
+  Serial.println("------------------------------------");
+  Serial.println("");
+}
+
+/**************************************************************************/
+/*
+    Program entry point for the Arduino sketch
+*/
+/**************************************************************************/
+void setup(void)
+{
+  Serial.begin(115200);
+
+  Serial.println("Starting Adafruit TSL2591 Test!");
+
+  if (tsl.begin())
+  {
+    Serial.println("Found a TSL2591 sensor");
+  }
+  else
+  {
+    Serial.println("No sensor found ... check your wiring?");
+    while (1);
+  }
+
+  /* Display some basic information on this sensor */
+  displaySensorDetails();
+
+  /* Configure the sensor */
+  configureSensor();
+
+  // Now we're ready to get readings ... move on to loop()!
+}
+
+/**************************************************************************/
+/*
+    Shows how to perform a basic read on visible, full spectrum or
+    infrared light (returns raw 16-bit ADC values)
+*/
+/**************************************************************************/
+void simpleRead(void)
+{
+  // Simple data read example. Just read the infrared, fullspecrtrum diode
+  // or 'visible' (difference between the two) channels.
+  // This can take 100-600 milliseconds! Uncomment whichever of the following you want to read
+  uint16_t x = tsl.getLuminosity(TSL2591_VISIBLE);
+  //uint16_t x = tsl.getLuminosity(TSL2591_FULLSPECTRUM);
+  //uint16_t x = tsl.getLuminosity(TSL2591_INFRARED);
+
+  Serial.print("[ "); Serial.print(millis()); Serial.print(" ms ] ");
+  Serial.print("Luminosity: ");
+  Serial.println(x, DEC);
+}
+
+/**************************************************************************/
+/*
+    Show how to read IR and Full Spectrum at once and convert to lux
+*/
+/**************************************************************************/
+void advancedRead(void)
+{
+  // More advanced data read example. Read 32 bits with top 16 bits IR, bottom 16 bits full spectrum
+  // That way you can do whatever math and comparisons you want!
+  uint32_t lum = tsl.getFullLuminosity();
+  uint16_t ir, full;
+  ir = lum >> 16;
+  full = lum & 0xFFFF;
+  Serial.print("[ "); Serial.print(millis()); Serial.print(" ms ] ");
+  Serial.print("IR: "); Serial.print(ir);  Serial.print("  ");
+  Serial.print("Full: "); Serial.print(full); Serial.print("  ");
+  Serial.print("Visible: "); Serial.print(full - ir); Serial.print("  ");
+  Serial.print("Lux: "); Serial.println(tsl.calculateLux(full, ir));
+}
+
+/**************************************************************************/
+/*
+    Performs a read using the Adafruit Unified Sensor API.
+*/
+/**************************************************************************/
+void unifiedSensorAPIRead(void)
+{
+  /* Get a new sensor event */
+  sensors_event_t event;
+  tsl.getEvent(&event);
+
+  /* Display the results (light is measured in lux) */
+  Serial.print("[ "); Serial.print(event.timestamp); Serial.print(" ms ] ");
+  if ((event.light == 0) |
+      (event.light > 4294966000.0) |
+      (event.light <-4294966000.0))
+  {
+    /* If event.light = 0 lux the sensor is probably saturated */
+    /* and no reliable data could be generated! */
+    /* if event.light is +/- 4294967040 there was a float over/underflow */
+    Serial.println("Invalid data (adjust gain or timing)");
+  }
+  else
+  {
+    Serial.print(event.light); Serial.println(" lux");
+  }
+}
+
+/**************************************************************************/
+/*
+    Arduino loop function, called once 'setup' is complete (your own code
+    should go here)
+*/
+/**************************************************************************/
+void loop(void)
+{
+  // simpleRead();
+  // advancedRead();
+  unifiedSensorAPIRead();
+
+  delay(250);
+}


Simple Fireflies blinking lights sketch

Simple Fireflies blinking lights sketch

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

--- Fireflies/Fireflies/Fireflies.ino
+++ Fireflies/Fireflies/Fireflies.ino
@@ -0,0 +1,27 @@
+
+
+const int pinPot = A0;
+const int pins[] = { 3, 5, 6 };
+const int pinCount = 3;
+
+
+void setup()
+{
+  for (int i = 0; i < pinCount; i++)
+  {
+    pinMode(pins[i], OUTPUT);
+  }
+}
+
+void loop() {
+  int potValue = analogRead(pinPot);
+
+  for (int i = 0; i < pinCount; i++)
+  {
+    int r = random(255 - 32) + 32;
+    analogWrite(pins[i], r);
+  }
+
+  delay(potValue);
+}
+


Create Docking.ino

Create Docking.ino

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

--- 10Docking/Docking.ino
+++ 10Docking/Docking.ino
@@ -0,0 +1,29 @@
+#include <Servo.h>
+
+Servo magnetServo;
+
+void setup(){
+  Serial.begin(9600);
+  pinMode(2, OUTPUT); //relays for LED
+  magnetServo.attach(9);
+  magnetServo.write(1);
+  digitalWrite(2, LOW);
+}
+
+void loop(){
+
+  if (Serial.available()){
+    int i = Serial.read();
+    if (i-48){
+      digitalWrite(2, HIGH);
+      magnetServo.write(90);
+    }
+
+    else{
+      digitalWrite(2, LOW);
+      magnetServo.write(1);
+    }
+
+  }
+  delay(50);
+}


initial commit. Everything working fine

initial commit. Everything working fine

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

--- Bluetooth_Setup/Bluetooth_Setup.ino
+++ Bluetooth_Setup/Bluetooth_Setup.ino
@@ -0,0 +1,191 @@
+#include <SoftwareSerial.h>
+
+/*
+ *  This is a project that helps changing the display name, the pincode and baud rate to the Bluetooth JY-MCU (HC-06) module.
+ *
+ *  It's really helpful the first time you use this module and you don't know the default settings.
+ *
+ *  It scans every baud rate and finds the one that it's currently in use. Then it sets it to the desired one.
+ */
+
+//the RX of the Arduino (in this case pin 6) MUST go in the TX pin on the bluetooth module
+//the TX of the Arduino (in this case pin 7) MUST go in the RX pin on the bluetooth module
+SoftwareSerial bluetoothSerial(7, 6); // RX, TX
+
+// NAME maximum of 20 characters
+char NAME[21] = "UbiPet";
+
+// 4 digit numeric pin
+char PIN[5] = "0000";
+/*
+  character code for BAUD
+  1 for 1200 bps
+  2     2400 bps
+  3     4800 bps
+  4     9600 bps
+  5    19200 bps
+  6    38400 bps
+  7    57600 bps
+  8   115200 bps
+  9   230400 bps
+  A   460800 bps
+  B   921600 bps
+  C  1382400 bps
+*/
+char BAUD = '4';
+
+void setup() {
+  // Open serial communications and wait for port to open:
+  Serial.begin(9600);
+
+  // ------ bluetooth module ------
+  setBluetoothParameters(bluetoothSerial);
+
+  initBluetoothModule(bluetoothSerial);
+
+}
+
+void loop() {
+
+  /*
+   * here you can listen to incoming messages to the module and make actions
+   */
+
+}
+
+void initBluetoothModule(SoftwareSerial btConnection) {
+  Serial.println("Wiping and initializing Bluetooth module...");
+
+  // we wipe the memory to avoid trash on caché. The we initialize the module
+  bluetoothSerial.flush();
+  delay(500);
+  bluetoothSerial.begin(115200);
+  bluetoothSerial.print("$$$");
+  delay(100);
+  bluetoothSerial.println("U,9600,N");
+  bluetoothSerial.begin(9600);
+  delay(2000);
+  bluetoothSerial.print("AT"); // "AT" will respond with "OK" if it is working
+  delay(2000);
+  char response[21];
+  while (bluetoothSerial.available() < 0);
+  bluetoothSerial.readBytes(response, 2);
+
+  String r = "";
+  r.concat(response);
+
+  Serial.println("BT AT response: " + r);
+
+  if (strncmp(response, "OK", 2) == 0)
+  {
+    Serial.println("Module ready! Time to start your awesome project!");
+  }
+  else
+  {
+    Serial.print("Something went wrong :(");
+  }
+}
+
+void setBluetoothParameters(SoftwareSerial btConnection) {
+  char response[21]; // Storage for responses from module
+  int rv = 0; // return value
+  int found = 0; // module found
+
+  Serial.print("Searching for BT Dongle");
+
+  // Search for bluetooth module on all 12 possible baudrates
+  long baud[12] = {1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600, 1382400};
+  for (int a = 0; a < 12; a++)
+  {
+    btConnection.begin(baud[a]);
+    btConnection.write("AT"); // "AT" will respond with "OK" if it is working
+    delay(100);
+    while (btConnection.available() < 0);
+    btConnection.readBytes(response, 2);
+    Serial.println(response);
+    if (strncmp(response, "OK", 2) == 0)
+    {
+      Serial.print("\nBluetooth Module found at BAUD ");
+      Serial.println(baud[a]);
+      found = 1;
+      break;
+    }
+    else
+    {
+      Serial.print(".");
+      //Serial.println(baud[a]);
+    }
+  }
+  if (found == 0)
+  {
+    Serial.println("\nERROR: Blueooth Module not found!");
+    Serial.println("Make sure there are no active bluetooth connections and try again");
+    while (1);
+  }
+  delay(100);
+
+  btConnection.write("AT+VERSION"); // Check the firmware version, because we can
+  while (btConnection.available() < 0);
+  btConnection.readBytes(response, 2);
+  if (strncmp(response, "OK", 2) == 0)
+  {
+    rv = btConnection.readBytes(response, 20);
+    response[rv] = 0;
+    Serial.print("BT Module Firmware Version: ");
+    Serial.println(response);
+  }
+  else
+  {
+    Serial.println("Error checking BT Version");
+  }
+  delay(100);
+
+  btConnection.write("AT+NAME"); // Set the bluetooth device name
+  btConnection.write(NAME);
+  while (btConnection.available() < 0);
+  btConnection.readBytes(response, 9);
+  if (strncmp(response, "OKsetname", 9) == 0)
+  {
+    Serial.print("Setting Name: ");
+    Serial.println(NAME);
+  }
+  else
+  {
+    Serial.println("Error Setting Bluetooth Name");
+  }
+  delay(100);
+
+  btConnection.write("AT+PIN"); // Set the PIN
+  btConnection.write(PIN);
+  while (btConnection.available() < 0);
+  btConnection.readBytes(response, 8);
+  if (strncmp(response, "OKsetPIN", 8) == 0)
+  {
+    Serial.print("Setting PIN: ");
+    Serial.println(PIN);
+  }
+  else
+  {
+    Serial.println("Error Setting Bluetooth PIN");
+    Serial.println(response);
+  }
+  delay(100);
+
+  btConnection.write("AT+BAUD"); // Set the BAUD
+  btConnection.write(BAUD);
+  while (btConnection.available() < 0);
+  btConnection.readBytes(response, 2);
+  if (strncmp(response, "OK", 2) == 0)
+  {
+    rv = btConnection.readBytes(response, 7);
+    response[rv] = 0;
+    Serial.print("Setting BAUD: ");
+    Serial.println(response);
+  }
+  else
+  {
+    Serial.println("Error Setting Bluetooth BAUD");
+    Serial.println(response);
+  }
+  Serial.println("Bluetooth Setup Completed");
+}


initial commit

initial commit

--- firmware/firmware.ino
+++ firmware/firmware.ino
@@ -0,0 +1,400 @@
+// based on https://github.com/fogleman/xy/tree/master/firmware
+
+#include <EEPROM.h>
+#include <Servo.h>
+#include <SoftwareSerial.h>
+#include <Wire.h>
+
+// data stored in eeprom
+static union{
+    struct{
+      char name[8];
+      unsigned char motoADir;
+      unsigned char motoBDir;
+      unsigned char motorSwitch;
+      int height;
+      int width;
+      int speed;
+      int penUpPos;
+      int penDownPos;
+    }data;
+    char buf[64];
+}roboSetup;
+
+float curX,curY,curZ;
+float tarX,tarY,tarZ; // target xyz position
+int tarA,tarB,posA,posB; // target stepper position
+int8_t motorAfw,motorAbk;
+int8_t motorBfw,motorBbk;
+
+int ylimit_pin1 = 12;
+int ylimit_pin2 = 13;
+int xlimit_pin1 = A2;
+int xlimit_pin2 = A3;
+int servopin = A1;
+Servo servoPen;
+
+/************** motor movements ******************/
+void stepperMoveA(int dir)
+{
+  if(dir>0){
+    digitalWrite(11, LOW);
+  }else{
+    digitalWrite(11, HIGH);
+  }
+  digitalWrite(10, HIGH);
+  digitalWrite(10, LOW);
+}
+
+void stepperMoveB(int dir)
+{
+  if(dir>0){
+    digitalWrite(3, LOW);
+  }else{
+    digitalWrite(3, HIGH);
+  }
+  digitalWrite(9, HIGH);
+  digitalWrite(9, LOW);
+}
+
+/************** calculate movements ******************/
+int stepAuxDelay=0;
+int stepdelay_min=250;
+int stepdelay_max=1000;
+#define SPEED_STEP 1
+
+void doMove()
+{
+  int mDelay=stepdelay_max;
+  int speedDiff = -SPEED_STEP;
+  int dA,dB,maxD;
+  float stepA,stepB,cntA=0,cntB=0;
+  int d;
+  dA = tarA - posA;
+  dB = tarB - posB;
+  maxD = max(abs(dA),abs(dB));
+  stepA = (float)abs(dA)/(float)maxD;
+  stepB = (float)abs(dB)/(float)maxD;
+  for(int i=0;(posA!=tarA)||(posB!=tarB);i++){
+    // move A
+    if(posA!=tarA){
+      cntA+=stepA;
+      if(cntA>=1){
+        d = dA>0?motorAfw:motorAbk;
+        posA+=(dA>0?1:-1);
+        // don't move passed limit !
+        if(
+           (d>0 && digitalRead(xlimit_pin2)==1)
+           || (d<0 && digitalRead(xlimit_pin1)==1)){
+          stepperMoveA(d);
+        }
+        cntA-=1;
+      }
+    }
+    // move B
+    if(posB!=tarB){
+      cntB+=stepB;
+      if(cntB>=1){
+        d = dB>0?motorBfw:motorBbk;
+        posB+=(dB>0?1:-1);
+        // don't move passed limit !
+        if(
+           (d>0 && digitalRead(ylimit_pin2)==1)
+           || (d<0 && digitalRead(ylimit_pin1)==1)){
+          stepperMoveB(d);
+        }
+        cntB-=1;
+      }
+    }
+    mDelay=constrain(mDelay+speedDiff,stepdelay_min,stepdelay_max)+stepAuxDelay;
+    delayMicroseconds(mDelay);
+    if((maxD-i)<((stepdelay_max-stepdelay_min)/SPEED_STEP)){
+      speedDiff=SPEED_STEP;
+    }
+  }
+  posA = tarA;
+  posB = tarB;
+}
+
+/******** mapping xy position to steps ******/
+#define WIDTH 380
+#define HEIGHT 310
+#define STEPS_PER_MM 87.58 // the same as 3d printer
+void prepareMove()
+{
+  float dx = tarX - curX;
+  float dy = tarY - curY;
+  float distance = sqrt(dx*dx+dy*dy);
+  if (distance < 0.001)
+    return;
+  tarA = tarX*STEPS_PER_MM;
+  tarB = tarY*STEPS_PER_MM;
+  doMove();
+  curX = tarX;
+  curY = tarY;
+}
+
+void goHome()
+{
+  // stop on either endstop touches
+  while(digitalRead(xlimit_pin2)!=0){
+    stepperMoveA(motorAbk);
+    delayMicroseconds(stepdelay_min);
+  }
+  while(digitalRead(ylimit_pin2)!=0){
+    stepperMoveB(motorBbk);
+    delayMicroseconds(stepdelay_min);
+  }
+  posA = 0;
+  posB = 0;
+  curX = 0;
+  curY = 0;
+}
+
+void initPosition()
+{
+  curX=0; curY=0;
+  posA = 0;posB = 0;
+}
+
+/************** calculate movements ******************/
+void parseCoordinate(char * cmd)
+{
+  char * tmp;
+  char * str;
+  str = strtok_r(cmd, " ", &tmp);
+  tarX = curX;
+  tarY = curY;
+  while(str!=NULL){
+    str = strtok_r(0, " ", &tmp);
+    if(str[0]=='X'){
+      tarX = atof(str+1);
+    }else if(str[0]=='Y'){
+      tarY = atof(str+1);
+    }else if(str[0]=='Z'){
+      tarZ = atof(str+1);
+    }else if(str[0]=='A'){
+      stepAuxDelay = atoi(str+1);
+    }
+  }
+  prepareMove();
+}
+
+void echoRobotSetup()
+{
+  Serial.print("M10 XY ");
+  Serial.print(roboSetup.data.width);Serial.print(' ');
+  Serial.print(roboSetup.data.height);Serial.print(' ');
+  Serial.print(curX);Serial.print(' ');
+  Serial.print(curY);Serial.print(' ');
+  Serial.print("A");Serial.print((int)roboSetup.data.motoADir);
+  Serial.print(" B");Serial.print((int)roboSetup.data.motoBDir);
+  Serial.print(" H");Serial.print((int)roboSetup.data.motorSwitch);
+  Serial.print(" S");Serial.print((int)roboSetup.data.speed);
+  Serial.print(" U");Serial.print((int)roboSetup.data.penUpPos);
+  Serial.print(" D");Serial.println((int)roboSetup.data.penDownPos);
+}
+
+void echoEndStop()
+{
+  Serial.print("M11 ");
+  Serial.print(digitalRead(xlimit_pin1)); Serial.print(" ");
+  Serial.print(digitalRead(xlimit_pin2)); Serial.print(" ");
+  Serial.print(digitalRead(ylimit_pin1)); Serial.print(" ");
+  Serial.println(digitalRead(ylimit_pin2));
+}
+
+void syncRobotSetup()
+{
+  int i;
+  for(i=0;i<64;i++){
+    EEPROM.write(i,roboSetup.buf[i]);
+  }
+}
+
+void parseRobotSetup(char * cmd)
+{
+  char * tmp;
+  char * str;
+  str = strtok_r(cmd, " ", &tmp);
+  while(str!=NULL){
+    str = strtok_r(0, " ", &tmp);
+    if(str[0]=='A'){
+      roboSetup.data.motoADir = atoi(str+1);
+    }else if(str[0]=='B'){
+      roboSetup.data.motoBDir = atoi(str+1);
+    }else if(str[0]=='H'){
+      roboSetup.data.height = atoi(str+1);
+    }else if(str[0]=='W'){
+      roboSetup.data.width = atoi(str+1);
+    }else if(str[0]=='S'){
+      roboSetup.data.speed = atoi(str+1);
+    }
+  }
+  syncRobotSetup();
+}
+
+void parseAuxDelay(char * cmd)
+{
+  char * tmp;
+  strtok_r(cmd, " ", &tmp);
+  stepAuxDelay = atoi(tmp);
+}
+
+void parsePen(char * cmd)
+{
+  char * tmp;
+  strtok_r(cmd, " ", &tmp);
+  int pos = atoi(tmp);
+  servoPen.write(pos);
+}
+
+void parsePenPosSetup(char * cmd)
+{
+  char * tmp;
+  char * str;
+  str = strtok_r(cmd, " ", &tmp);
+  while(str!=NULL){
+    str = strtok_r(0, " ", &tmp);
+    if(str[0]=='U'){
+      roboSetup.data.penUpPos = atoi(str+1);
+    }else if(str[0]=='D'){
+      roboSetup.data.penDownPos = atoi(str+1);
+    }
+  }
+  syncRobotSetup();
+}
+
+void parseMcode(char * cmd)
+{
+  int code;
+  code = atoi(cmd);
+  switch(code){
+    case 1:
+      parsePen(cmd);
+      break;
+    case 2:
+      parsePenPosSetup(cmd);
+      break;
+    case 3:
+      parseAuxDelay(cmd);
+      break;
+    case 5:
+      parseRobotSetup(cmd);
+      break;
+    case 10:
+      echoRobotSetup();
+      break;
+    case 11:
+      echoEndStop();
+      break;
+  }
+}
+
+void parseGcode(char * cmd)
+{
+  int code;
+  code = atoi(cmd);
+  switch(code){
+    case 0:
+    case 1:
+      parseCoordinate(cmd);
+      break;
+    case 28:
+      tarX=0; tarY=0;
+      goHome();
+      break;
+  }
+}
+
+void parseCmd(char * cmd)
+{
+  if(cmd[0]=='G'){
+    parseGcode(cmd+1);
+  }else if(cmd[0]=='M'){
+    parseMcode(cmd+1);
+  }else if(cmd[0]=='P'){
+    Serial.print("POS X");Serial.print(curX);Serial.print(" Y");Serial.println(curY);
+  }
+  Serial.println("OK");
+}
+
+// local data
+void initRobotSetup()
+{
+  int i;
+  for(i=0;i<64;i++){
+    roboSetup.buf[i] = EEPROM.read(i);
+  }
+  if(strncmp(roboSetup.data.name,"XY4",3)!=0){
+    Serial.println("set to default setup");
+    // set to default setup
+    memset(roboSetup.buf,0,64);
+    memcpy(roboSetup.data.name,"XY4",3);
+    roboSetup.data.motoADir = 0;
+    roboSetup.data.motoBDir = 0;
+    roboSetup.data.width = WIDTH;
+    roboSetup.data.height = HEIGHT;
+    roboSetup.data.motorSwitch = 0;
+    roboSetup.data.speed = 80;
+    roboSetup.data.penUpPos = 160;
+    roboSetup.data.penDownPos = 90;
+    syncRobotSetup();
+  }
+  // init motor direction
+  // yzj, match to standard connection of xy
+  // A = x, B = y
+  if(roboSetup.data.motoADir==0){
+    motorAfw=-1;motorAbk=1;
+  }else{
+    motorAfw=1;motorAbk=-1;
+  }
+  if(roboSetup.data.motoBDir==0){
+    motorBfw=-1;motorBbk=1;
+  }else{
+    motorBfw=1;motorBbk=-1;
+  }
+  int spd = 100 - roboSetup.data.speed;
+//  stepdelay_min = spd*10;
+//  stepdelay_max = spd*100;
+}
+
+
+/************** arduino ******************/
+void setup() {
+  pinMode(11, OUTPUT);
+  pinMode(10, OUTPUT);
+  pinMode(3, OUTPUT);
+  pinMode(9, OUTPUT);
+  pinMode(ylimit_pin1,INPUT_PULLUP);
+  pinMode(ylimit_pin2,INPUT_PULLUP);
+  pinMode(xlimit_pin1,INPUT_PULLUP);
+  pinMode(xlimit_pin2,INPUT_PULLUP);
+  Serial.begin(115200);
+  initRobotSetup();
+  initPosition();
+  servoPen.attach(servopin);
+  delay(100);
+  servoPen.write(roboSetup.data.penUpPos);
+  goHome();
+}
+
+char buf[64];
+int8_t bufindex;
+
+void loop() {
+  // echoEndStop();
+  if(Serial.available()){
+    char c = Serial.read();
+    buf[bufindex++]=c;
+    if(c=='\n'){
+      buf[bufindex]='\0';
+      parseCmd(buf);
+      memset(buf,0,64);
+      bufindex = 0;
+    }
+    if(bufindex>=64){
+      bufindex=0;
+    }
+  }
+}


Proper radio initialization has been resurrected

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/katzz0/rc-car.git/'


Adding spinning motor with a button

Adding spinning motor with a button

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

--- sketches/spin_motor/spin_motor.ino
+++ sketches/spin_motor/spin_motor.ino
@@ -0,0 +1,116 @@
+
+
+const int motorPin = 9;
+const int button = 2;
+
+boolean lastButton = LOW;
+boolean currentButton = LOW;
+boolean motorOn = false;
+int runningSpeed = 150; // out of 0-255
+
+void setup()
+{
+  // Set up the motor pin to be an output:
+
+  pinMode(motorPin, OUTPUT);
+  pinMode(button, INPUT);
+
+  // Set up the serial port:
+
+  Serial.begin(9600);
+}
+
+void loop()
+{
+  currentButton = debounce(lastButton);
+  if (lastButton == LOW && currentButton == HIGH) {
+    motorOn = !motorOn;
+    motorOn ? log("motor ON") : log("motor OFF");
+  }
+
+  runningSpeed = constrain(runningSpeed, 0, 255);
+
+  lastButton = currentButton;
+
+  if (motorOn) {
+    runMotor(runningSpeed);
+  } else {
+    stopMotor();
+  }
+}
+
+void log(char *message) {
+  Serial.println(message);
+}
+
+boolean debounce(boolean last)
+{
+  boolean current = digitalRead(button);
+  if (last != current) {
+    delay(5);
+    current = digitalRead(button);
+  }
+
+  return current;
+}
+
+void runMotor(int motorSpeed)
+{
+  int delayTime = 20;
+  analogWrite(motorPin, motorSpeed);
+  delay(delayTime);
+}
+
+void stopMotor() {
+  runMotor(0);
+}
+
+
+// This function will let you type a speed into the serial
+// monitor window. Open the serial monitor using the magnifying-
+// glass icon at the top right of the Arduino window. Then
+// type your desired speed into the small text entry bar at the
+// top of the window and click "Send" or press return. The motor
+// will then operate at that speed. The valid range is 0 to 255.
+
+void serialSpeed()
+{
+  int speed;
+
+  Serial.println("Type a speed (0-255) into the box above,");
+  Serial.println("then click [send] or press [return]");
+  Serial.println();  // Print a blank line
+
+  // In order to type out the above message only once,
+  // we'll run the rest of this function in an infinite loop:
+
+  while(true)  // "true" is always true, so this will loop forever.
+  {
+    // First we check to see if incoming data is available:
+
+    while (Serial.available() > 0)
+    {
+      // If it is, we'll use parseInt() to pull out any numbers:
+
+      speed = Serial.parseInt();
+
+      // Because analogWrite() only works with numbers from
+      // 0 to 255, we'll be sure the input is in that range:
+
+      speed = constrain(speed, 0, 255);
+
+      // We'll print out a message to let you know that the
+      // number was received:
+
+      Serial.print("Setting speed to ");
+      Serial.println(speed);
+
+      // And finally, we'll set the speed of the motor!
+
+      analogWrite(motorPin, speed);
+    }
+  }
+}
+
+
+


First version of zoka13 automagische schoenmaatmeter.

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

--- zomerkamp2013.ino
+++ zomerkamp2013.ino
@@ -0,0 +1,117 @@
+/*
+  Serial Event example
+
+ When new serial data arrives, this sketch adds it to a String.
+ When a newline is received, the loop prints the string and
+ clears it.
+
+ A good test for this is to try it with a GPS receiver
+ that sends out NMEA 0183 sentences.
+
+ Created 9 May 2011
+ by Tom Igoe
+
+ This example code is in the public domain.
+
+ http://www.arduino.cc/en/Tutorial/SerialEvent
+
+ */
+
+#include <Servo.h>
+String inputString = "";         // a string to hold incoming data
+boolean stringComplete = false;  // whether the string is complete
+Servo myservo;  // create servo object to control a servo
+                // a maximum of eight servo objects can be created
+
+int pos = 0;    // variable to store the servo position
+int servopin = 9;
+const int buttonPinRight = 2;     // the number of the pushbutton pin
+const int buttonPinLeft = 3;     // the number of the pushbutton pin
+const int ledPin =  13;      // the number of the LED pin
+
+const int MIN = 0;
+const int MAX = 90;
+const int servoStart = MAX;
+
+// variables will change:
+int rightSensor = 0;         // variable for reading the pushbutton status
+int leftSensor = 0;         // variable for reading the pushbutton status
+
+int _direction = 0; //Can also be -1, to close, +1 to open.
+
+char* buffer;
+
+void setup() {
+  // initialize serial:
+  Serial.begin(9600);
+  // reserve 200 bytes for the inputString:
+  inputString.reserve(200);
+
+  myservo.attach(servopin);  // attaches the servo on pin 9 to the servo object
+  myservo.write(servoStart);
+  pos = servoStart;
+
+  pinMode(ledPin, OUTPUT);
+  pinMode(buttonPinRight, INPUT);
+  pinMode(buttonPinLeft, INPUT);
+}
+
+void loop()
+{
+  rightSensor = digitalRead(buttonPinRight);
+  leftSensor = digitalRead(buttonPinLeft);
+
+  if (rightSensor == HIGH || leftSensor == HIGH)
+  {
+    _direction = 0; //Stop when both bottons pushed
+    Serial.println("BOTH_TOUCH");
+    // clear the string:
+    inputString = "";
+    stringComplete = false;
+  }
+
+  Serial.println(pos);
+
+  if(pos <= MIN)
+  {
+     _direction = 1;
+  }
+
+  if(pos > MAX)
+  {
+    _direction = 0;
+  }
+
+  if(stringComplete)
+  {
+    if(pos >= MAX)
+    {
+      _direction = -1;
+    }
+    stringComplete = false;
+  }
+
+  pos += _direction;
+  myservo.write(pos);
+  delay(20);
+}
+
+/*
+  SerialEvent occurs whenever a new data comes in the
+ hardware serial RX.  This routine is run between each
+ time loop() runs, so using delay inside loop can delay
+ response.  Multiple bytes of data may be available.
+ */
+void serialEvent() {
+  while (Serial.available()) {
+    // get the new byte:
+    char inChar = (char)Serial.read();
+    // add it to the inputString:
+    inputString += inChar;
+    // if the incoming character is a newline, set a flag
+    // so the main loop can do something about it:
+    if (inChar == '\n') {
+      stringComplete = true;
+    }
+  }
+}


fixed library call

fixed library call

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


v6.4 Fix display of Hdop, again.

v6.4 Fix display of Hdop, again.

--- GPSLCD.ino
+++ GPSLCD.ino
@@ -378,9 +378,9 @@

 /* Helper functions start here

-  Ripped off from Electrical Engineering Stack Exchange
+  The following three functions ripped off from Electrical Engineering Stack Exchange
   http://electronics.stackexchange.com/questions/66285/how-to-calculate-day-of-the-week-for-rtc
-  ------------------------------------------------------------
+
    Returns the number of days to the start of the specified year, taking leap
    years into account, but not the shift from the Julian calendar to the
    Gregorian calendar. Instead, it is as though the Gregorian calendar is
@@ -408,9 +408,8 @@
 {
   return (zeller(year, month, day) % 7) + 1;
 }
-//----------------------------------------------------------
-
-// Print the day of the week on the LCD
+
+// Display the day of the week on the LCD
 void displayDayOnLCD(uint8_t day)
 {
   if (day == 7) day = 0;
@@ -427,7 +426,7 @@
   }
 }

-// Compute the cardinal points of the compass
+// Compute the cardinal points of the compass (16 or 8 cardinal points)
 const char* cardinal(double course, bool cardinalSelect)
 {
   if (!cardinalSelect) {
@@ -556,7 +555,9 @@
     float hdop = (float)Hdop / 100.0f; // Hdop in X.X format
     lcd.print(" Hdop:");
     if (hdop < 10.0f) {
-      lcd.print(hdop);
+      lcd.print((uint32_t)hdop);
+      lcd.print(".");
+      lcd.print((uint32_t)((hdop - (uint32_t)hdop) * 10.0f));
     }
     else {
       // Hdop value too large for my LCD, so cross it out


Modified blink_string() so that it does not require a parameter for length.

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


Create sh1106_128x64_i2c.ino

Create sh1106_128x64_i2c.ino

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

--- examples/sh1106_128x64_i2c/sh1106_128x64_i2c.ino
+++ examples/sh1106_128x64_i2c/sh1106_128x64_i2c.ino
@@ -0,0 +1,363 @@
+/*********************************************************************
+This is an example for our Monochrome OLEDs based on SSD1306 drivers
+
+  Pick one up today in the adafruit shop!
+  ------> http://www.adafruit.com/category/63_98
+
+This example is for a 128x64 size display using I2C to communicate
+3 pins are required to interface (2 I2C and one reset)
+
+Adafruit invests time and resources providing this open source code,
+please support Adafruit and open-source hardware by purchasing
+products from Adafruit!
+
+Written by Limor Fried/Ladyada  for Adafruit Industries.
+BSD license, check license.txt for more information
+All text above, and the splash screen must be included in any redistribution
+*********************************************************************/
+
+/*********************************************************************
+I change the adafruit SSD1306 to SH1106
+
+SH1106 driver don't provide several functions such as scroll commands.
+
+*********************************************************************/
+
+#include <SPI.h>
+#include <Wire.h>
+#include <Adafruit_GFX.h>
+#include <Adafruit_SH1106.h>
+
+#define OLED_RESET 4
+Adafruit_SH1106 display(OLED_RESET);
+
+#define NUMFLAKES 10
+#define XPOS 0
+#define YPOS 1
+#define DELTAY 2
+
+
+#define LOGO16_GLCD_HEIGHT 16
+#define LOGO16_GLCD_WIDTH  16
+static const unsigned char PROGMEM logo16_glcd_bmp[] =
+{ B00000000, B11000000,
+  B00000001, B11000000,
+  B00000001, B11000000,
+  B00000011, B11100000,
+  B11110011, B11100000,
+  B11111110, B11111000,
+  B01111110, B11111111,
+  B00110011, B10011111,
+  B00011111, B11111100,
+  B00001101, B01110000,
+  B00011011, B10100000,
+  B00111111, B11100000,
+  B00111111, B11110000,
+  B01111100, B11110000,
+  B01110000, B01110000,
+  B00000000, B00110000 };
+
+#if (SH1106_LCDHEIGHT != 64)
+#error("Height incorrect, please fix Adafruit_SH1106.h!");
+#endif
+
+void setup()   {
+  Serial.begin(9600);
+
+  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
+  display.begin(SH1106_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3D (for the 128x64)
+  // init done
+
+  // Show image buffer on the display hardware.
+  // Since the buffer is intialized with an Adafruit splashscreen
+  // internally, this will display the splashscreen.
+  display.display();
+  delay(2000);
+
+  // Clear the buffer.
+  display.clearDisplay();
+
+  // draw a single pixel
+  display.drawPixel(10, 10, WHITE);
+  // Show the display buffer on the hardware.
+  // NOTE: You _must_ call display after making any drawing commands
+  // to make them visible on the display hardware!
+  display.display();
+  delay(2000);
+  display.clearDisplay();
+
+  // draw many lines
+  testdrawline();
+  display.display();
+  delay(2000);
+  display.clearDisplay();
+
+  // draw rectangles
+  testdrawrect();
+  display.display();
+  delay(2000);
+  display.clearDisplay();
+
+  // draw multiple rectangles
+  testfillrect();
+  display.display();
+  delay(2000);
+  display.clearDisplay();
+
+  // draw mulitple circles
+  testdrawcircle();
+  display.display();
+  delay(2000);
+  display.clearDisplay();
+
+  // draw a white circle, 10 pixel radius
+  display.fillCircle(display.width()/2, display.height()/2, 10, WHITE);
+  display.display();
+  delay(2000);
+  display.clearDisplay();
+
+  testdrawroundrect();
+  delay(2000);
+  display.clearDisplay();
+
+  testfillroundrect();
+  delay(2000);
+  display.clearDisplay();
+
+  testdrawtriangle();
+  delay(2000);
+  display.clearDisplay();
+
+  testfilltriangle();
+  delay(2000);
+  display.clearDisplay();
+
+  // draw the first ~12 characters in the font
+  testdrawchar();
+  display.display();
+  delay(2000);
+  display.clearDisplay();
+
+  // draw scrolling text
+ /* testscrolltext();
+  delay(2000);
+  display.clearDisplay();*/
+
+  // text display tests
+  display.setTextSize(1);
+  display.setTextColor(WHITE);
+  display.setCursor(0,0);
+  display.println("Hello, world!");
+  display.setTextColor(BLACK, WHITE); // 'inverted' text
+  display.println(3.141592);
+  display.setTextSize(2);
+  display.setTextColor(WHITE);
+  display.print("0x"); display.println(0xDEADBEEF, HEX);
+  display.display();
+  delay(2000);
+
+  // miniature bitmap display
+  display.clearDisplay();
+  display.drawBitmap(30, 16,  logo16_glcd_bmp, 16, 16, 1);
+  display.display();
+
+  // invert the display
+  display.invertDisplay(true);
+  delay(1000);
+  display.invertDisplay(false);
+  delay(1000);
+
+  // draw a bitmap icon and 'animate' movement
+  testdrawbitmap(logo16_glcd_bmp, LOGO16_GLCD_HEIGHT, LOGO16_GLCD_WIDTH);
+}
+
+
+void loop() {
+
+}
+
+
+void testdrawbitmap(const uint8_t *bitmap, uint8_t w, uint8_t h) {
+  uint8_t icons[NUMFLAKES][3];
+
+  // initialize
+  for (uint8_t f=0; f< NUMFLAKES; f++) {
+    icons[f][XPOS] = random(display.width());
+    icons[f][YPOS] = 0;
+    icons[f][DELTAY] = random(5) + 1;
+
+    Serial.print("x: ");
+    Serial.print(icons[f][XPOS], DEC);
+    Serial.print(" y: ");
+    Serial.print(icons[f][YPOS], DEC);
+    Serial.print(" dy: ");
+    Serial.println(icons[f][DELTAY], DEC);
+  }
+
+  while (1) {
+    // draw each icon
+    for (uint8_t f=0; f< NUMFLAKES; f++) {
+      display.drawBitmap(icons[f][XPOS], icons[f][YPOS], logo16_glcd_bmp, w, h, WHITE);
+    }
+    display.display();
+    delay(200);
+
+    // then erase it + move it
+    for (uint8_t f=0; f< NUMFLAKES; f++) {
+      display.drawBitmap(icons[f][XPOS], icons[f][YPOS],  logo16_glcd_bmp, w, h, BLACK);
+      // move it
+      icons[f][YPOS] += icons[f][DELTAY];
+      // if its gone, reinit
+      if (icons[f][YPOS] > display.height()) {
+	icons[f][XPOS] = random(display.width());
+	icons[f][YPOS] = 0;
+	icons[f][DELTAY] = random(5) + 1;
+      }
+    }
+   }
+}
+
+
+void testdrawchar(void) {
+  display.setTextSize(1);
+  display.setTextColor(WHITE);
+  display.setCursor(0,0);
+
+  for (uint8_t i=0; i < 168; i++) {
+    if (i == '\n') continue;
+    display.write(i);
+    if ((i > 0) && (i % 21 == 0))
+      display.println();
+  }
+  display.display();
+}
+
+void testdrawcircle(void) {
+  for (int16_t i=0; i<display.height(); i+=2) {
+    display.drawCircle(display.width()/2, display.height()/2, i, WHITE);
+    display.display();
+  }
+}
+
+void testfillrect(void) {
+  uint8_t color = 1;
+  for (int16_t i=0; i<display.height()/2; i+=3) {
+    // alternate colors
+    display.fillRect(i, i, display.width()-i*2, display.height()-i*2, color%2);
+    display.display();
+    color++;
+  }
+}
+
+void testdrawtriangle(void) {
+  for (int16_t i=0; i<min(display.width(),display.height())/2; i+=5) {
+    display.drawTriangle(display.width()/2, display.height()/2-i,
+                     display.width()/2-i, display.height()/2+i,
+                     display.width()/2+i, display.height()/2+i, WHITE);
+    display.display();
+  }
+}
+
+void testfilltriangle(void) {
+  uint8_t color = WHITE;
+  for (int16_t i=min(display.width(),display.height())/2; i>0; i-=5) {
+    display.fillTriangle(display.width()/2, display.height()/2-i,
+                     display.width()/2-i, display.height()/2+i,
+                     display.width()/2+i, display.height()/2+i, WHITE);
+    if (color == WHITE) color = BLACK;
+    else color = WHITE;
+    display.display();
+  }
+}
+
+void testdrawroundrect(void) {
+  for (int16_t i=0; i<display.height()/2-2; i+=2) {
+    display.drawRoundRect(i, i, display.width()-2*i, display.height()-2*i, display.height()/4, WHITE);
+    display.display();
+  }
+}
+
+void testfillroundrect(void) {
+  uint8_t color = WHITE;
+  for (int16_t i=0; i<display.height()/2-2; i+=2) {
+    display.fillRoundRect(i, i, display.width()-2*i, display.height()-2*i, display.height()/4, color);
+    if (color == WHITE) color = BLACK;
+    else color = WHITE;
+    display.display();
+  }
+}
+
+void testdrawrect(void) {
+  for (int16_t i=0; i<display.height()/2; i+=2) {
+    display.drawRect(i, i, display.width()-2*i, display.height()-2*i, WHITE);
+    display.display();
+  }
+}
+
+void testdrawline() {
+  for (int16_t i=0; i<display.width(); i+=4) {
+    display.drawLine(0, 0, i, display.height()-1, WHITE);
+    display.display();
+  }
+  for (int16_t i=0; i<display.height(); i+=4) {
+    display.drawLine(0, 0, display.width()-1, i, WHITE);
+    display.display();
+  }
+  delay(250);
+
+  display.clearDisplay();
+  for (int16_t i=0; i<display.width(); i+=4) {
+    display.drawLine(0, display.height()-1, i, 0, WHITE);
+    display.display();
+  }
+  for (int16_t i=display.height()-1; i>=0; i-=4) {
+    display.drawLine(0, display.height()-1, display.width()-1, i, WHITE);
+    display.display();
+  }
+  delay(250);
+
+  display.clearDisplay();
+  for (int16_t i=display.width()-1; i>=0; i-=4) {
+    display.drawLine(display.width()-1, display.height()-1, i, 0, WHITE);
+    display.display();
+  }
+  for (int16_t i=display.height()-1; i>=0; i-=4) {
+    display.drawLine(display.width()-1, display.height()-1, 0, i, WHITE);
+    display.display();
+  }
+  delay(250);
+
+  display.clearDisplay();
+  for (int16_t i=0; i<display.height(); i+=4) {
+    display.drawLine(display.width()-1, 0, 0, i, WHITE);
+    display.display();
+  }
+  for (int16_t i=0; i<display.width(); i+=4) {
+    display.drawLine(display.width()-1, 0, i, display.height()-1, WHITE);
+    display.display();
+  }
+  delay(250);
+}
+
+/*void testscrolltext(void) {
+  display.setTextSize(2);
+  display.setTextColor(WHITE);
+  display.setCursor(10,0);
+  display.clearDisplay();
+  display.println("scroll");
+  display.display();
+
+  display.startscrollright(0x00, 0x0F);
+  delay(2000);
+  display.stopscroll();
+  delay(1000);
+  display.startscrollleft(0x00, 0x0F);
+  delay(2000);
+  display.stopscroll();
+  delay(1000);
+  display.startscrolldiagright(0x00, 0x07);
+  delay(2000);
+  display.startscrolldiagleft(0x00, 0x07);
+  delay(2000);
+  display.stopscroll();
+}*/


Working at 20ms

Working at 20ms

This is now probably fast enough to work...

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/dkadish/nuit_blanche_ocean.git/'


03

03

Add Example

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

--- Examples/2Buttons.ino
+++ Examples/2Buttons.ino
@@ -0,0 +1,36 @@
+#include <AnalogButton.h>
+
+
+AnalogButton button1(A0, 13); // GND
+AnalogButton button2(A0, 512); // Analogvalue 512
+
+void setup() {
+	//Serial connection.
+	Serial.begin(9600);
+
+	button1.attachClick(button1Klicked);
+	button1.attachDoubleClick(button1DoppelKlicked);
+	button2.attachClick(button2Klicked);
+	button2.attachDoubleClick(button2DoppelKlicked);
+}
+
+// the loop function runs over and over again until power down or reset
+void loop() {
+	button.tick();
+	delay(10);
+}
+
+void button1Klicked(){
+	Serial.println("button1 Klicked");
+}
+
+void button1DoppelKlicked(){
+	Serial.println("button1 DoppelKlicked");
+}
+void button2Klicked(){
+	Serial.println("button2 Klicked");
+}
+
+void button2DoppelKlicked(){
+	Serial.println("button2 DoppelKlicked");
+}


Rajout d'un répertoire 'enroleur-eniri'

Rajout d'un répertoire 'enroleur-eniri'

Création d'un programme pour un lecteur enroleur

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

--- enroleur-eniri/enroleur-eniri.ino
+++ enroleur-eniri/enroleur-eniri.ino
@@ -0,0 +1,141 @@
+//----------------------------------------------------------
+//
+// Lecteur enroleur  de badge
+// Claude Boisgerault le 23-12-16
+// Version 0.1
+// ce programme permet de lire un numéro de badge
+// avec un lecteur en protocol wiegand le paramétrage
+// de lecture du badge se fera par un terminal.
+// Le numéro du badge sera envoyé en émulant le clavier
+// par l'intermédiaire d'un Arduino Léonardo.
+//----------------------------------------------------------
+
+// Déclaration des constantes des broches
+const int DATA_0 = 2; // Raccordement de data 0 sur Broche digital 2
+const int DATA_1 = 3; //Raccordement de data 1 sur Broche digital 3
+
+// --- Déclaration des variables globales ---
+unsigned long temps_debut; // temps de référence
+unsigned long temps_inter; // temps intermédiaire
+unsigned long temps_timeout; // temps du timout
+int valeur_d0 = 0; // variable pour lecture DATA_0
+int valeur_d1 = 0; // variable pour lecture DATA_1
+int resultat = 0; // variable pour calcul
+int finlecture = 0; // flag pour pour la boucle do
+
+//----------------------------------
+// initialisation du microcontroleur
+//----------------------------------
+void setup()   {
+  pinMode (DATA_0, INPUT); //Broche digital 2 en mode entrée
+  pinMode (DATA_1, INPUT); //Broche digital 3 en mode entrée
+  Serial.begin(115200); // vitesse du port série usb à 115200 baud
+}
+
+//-----------------------------
+// début du programme principal
+//-----------------------------
+void loop(){
+  valeur_d0 = digitalRead (DATA_0);
+  valeur_d1 = digitalRead (DATA_1);
+  resultat = valeur_d0 + valeur_d1;
+
+  // On vérifie s'il y a au moins un data à 0
+  if ( resultat < 2 )
+  {
+    // on vérifie s'il y a au moins un data à 1
+    if (resultat > 0 )
+    {
+      finlecture = 1; /* le test de data 0 et 1 est ok on initialise la variable
+                      finlecture pour lancer la boucle "do" "début lecture badge" */
+      //Serial.print ( "-lecture du badge-\n" );
+      //---------------------------
+      // boucle début lecture badge
+      //---------------------------
+      do
+      {
+        valeur_d0 = digitalRead (DATA_0); // on lit l'état de data 0 sur le lecteur
+        valeur_d1 = digitalRead (DATA_1); // on lit l'état de data 1 sur le lecteur
+        resultat = valeur_d0 + (valeur_d1 * 2); /* resultat=3 > pas de valeur de bit envoyé
+                  resultat=2 > valeur de bit 0 envoyé
+                  resultat=1 > valeur de bit 1 envoyé
+                  */
+
+        //---------------------------------------
+        // on lit une valeur de bit de donnée à 0
+        //---------------------------------------
+        if ( resultat == 2 )
+        {
+          Serial.print("0"); // on envoie la nouvelle valeur de bit 0
+          temps_debut = micros(); // top chrono temps référent
+          // boucle de test timeout de data 0
+          do
+          {
+            valeur_d0 = digitalRead (DATA_0); // on lit l'état de data 0 sur le lecteur
+            temps_inter = micros(); // on prend le temps
+            temps_timeout = temps_inter - temps_debut; // on calcul le temps passé
+            if (temps_timeout > 100) // timeout dépassé on arrête la lecture du badge
+            {
+              finlecture = 0; // on oblige la sortie de la boucle "do" début lecture badge
+              Serial.print("!00!"); // on envoie le code erreur !00! timeout  sur data 0
+              //Serial.println( String (temps_timeout));
+            }
+          }while (valeur_d0 == 0);
+        }
+
+        //----------------------------------------
+        // on lit une valeur de  bit de donnée à 1
+        //----------------------------------------
+        if ( resultat == 1 )
+        {
+          Serial.print("1"); // on envoie la nouvelle valeur de bit 1
+          temps_debut = micros();
+          // boucle de test timeout de data 1
+          do
+          {
+            valeur_d1 = digitalRead (DATA_1);// on lit l'état de data 1 sur le lecteur
+            temps_inter = micros(); // on prend le temps
+            temps_timeout = temps_inter - temps_debut; // on calcul le temps passé
+            if (temps_timeout > 100) // timeout dépassé on arrête la lecture du badge
+            {
+              finlecture = 0; // on oblige la sortie de la boucle "do" début lecture badge
+              Serial.print("!01!"); // on envoie le code erreur !01! "timeout sur data 1"
+            }
+
+          }while (valeur_d1 == 0);
+        }
+        //-------------------------------------------------------
+        // il n'y a plus de donnée  data 0 ou 1 envoyé
+        //-------------------------------------------------------
+
+        if ( resultat == 3)
+        {
+          temps_debut = micros();
+           // boucle de test timeout entre 2 donnée de bit
+          do
+          {
+            valeur_d0 = digitalRead (DATA_0); // on lit l'état de data 0 sur le lecteur
+            valeur_d1 = digitalRead (DATA_1); // on lit l'état de data 1 sur le lecteur
+            resultat = valeur_d0 + (valeur_d1 * 2);
+            temps_inter = micros(); // on prend le temps
+            temps_timeout = temps_inter - temps_debut; // on calcul le temps passé
+            if (temps_timeout > 3000) // timeout dépassé on arrête la lecture du badge
+            {
+              finlecture = 0; // on oblige la sortie de la boucle "do" début lecture badge
+              Serial.print("!03!"); // on envoie le code erreur !03! "timeout entre 2 donnée de bit"
+              resultat = 0; // on oblige la sortie de la boucle "do" timeout
+            }
+
+          }while (resultat == 3);
+
+        }
+
+      }while (finlecture == 1); // on sort de la boucle "do" début lecture badge
+      Serial.print("#\n"); // on envoie le code de fin lecture badge avec retour ligne
+
+    }
+
+  }
+} // fin de la boucle Void()
+
+


Motor speed tester

Motor speed tester

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

--- encoder_reader/ros_motor_speed_tester/ros_motor_speed_tester.ino
+++ encoder_reader/ros_motor_speed_tester/ros_motor_speed_tester.ino
@@ -0,0 +1,153 @@
+/*
+ * rosserial Time and TF Example
+ * Publishes a transform at current time
+ */
+
+#include <ros.h>
+#include <ros/time.h>
+#include <tf/transform_broadcaster.h>
+
+// Encoder 0
+#define encoder0PinA  2
+#define encoder0PinB  4
+
+// Encoder 1
+#define encoder1PinA  3
+#define encoder1PinB  5
+
+// Motor 0
+#define motor0Pwm 9
+#define motor0Dir 10
+
+// Motor 1
+#define motor1Pwm 11
+#define motor1Dir 12
+
+volatile unsigned int encoder0Pos = 0;
+volatile unsigned int encoder1Pos = 0;
+
+ros::NodeHandle  nh;
+geometry_msgs::TransformStamped t;
+tf::TransformBroadcaster broadcaster;
+
+char base_link[] = "/base_link";
+char odom[] = "/odom";
+unsigned int counter = 0;
+unsigned int global_counter = 0;
+int motor0 = 0;
+int motor1 = 0;
+
+void motors_cb(int x, int y){
+  int dir0;
+  int dir1;
+  if (x > 0) {
+    dir0 = LOW;
+    motor0 = x;
+  } else {
+    dir0 = HIGH;
+    motor0 = -x;
+  }
+  if (y > 0) {
+    dir1 = LOW;
+    motor1 = y;
+  } else {
+    dir1 = HIGH;
+    motor1 = -y;
+  }
+  analogWrite(motor0Pwm, motor0);
+  analogWrite(motor1Pwm, motor1);
+  digitalWrite(motor0Dir, dir0);
+  digitalWrite(motor1Dir, dir1);
+  counter = 0;
+}
+
+void setup()
+{
+  pinMode(encoder0PinA, INPUT);
+  digitalWrite(encoder0PinA, HIGH);       // turn on pull-up resistor
+  pinMode(encoder0PinB, INPUT);
+  digitalWrite(encoder0PinB, HIGH);       // turn on pull-up resistor
+  attachInterrupt(digitalPinToInterrupt(encoder0PinA), doEncoder0, CHANGE);  // encoder pin on interrupt 0 - pin 2
+
+  pinMode(encoder1PinA, INPUT);
+  digitalWrite(encoder1PinA, HIGH);       // turn on pull-up resistor
+  pinMode(encoder1PinB, INPUT);
+  digitalWrite(encoder1PinB, HIGH);       // turn on pull-up resistor
+  attachInterrupt(digitalPinToInterrupt(encoder1PinA), doEncoder1, CHANGE);  // encoder pin on interrupt 0 - pin 2
+
+  //pinMode(motor0Pwm, OUTPUT);
+  pinMode(motor0Dir, OUTPUT);
+  //pinMode(motor1Pwm, OUTPUT);
+  pinMode(motor1Dir, OUTPUT);
+
+  Serial.begin (9600);
+  Serial.println("start");                // a personal quirk
+}
+
+void loop()
+{
+  int T = 120;
+  global_counter++;
+  // If no new motor command given in 5s, stop motors
+  if (global_counter < T*1) {
+    analogWrite(motor0Pwm, 40);
+    analogWrite(motor1Pwm, 40);
+  } else
+  {
+    counter++;
+  }
+  t.header.frame_id = odom;
+  t.child_frame_id = base_link;
+
+  t.transform.translation.x = encoder0Pos;
+  t.transform.translation.y = encoder1Pos;
+  t.transform.translation.z = counter;
+  t.transform.rotation.x = motor0;
+  t.transform.rotation.y = motor1;
+  t.transform.rotation.z = 0.0;
+  t.transform.rotation.w = 1.0;
+  t.header.stamp = nh.now();
+  t.header.seq = global_counter;
+  broadcaster.sendTransform(t);
+  nh.spinOnce();
+  delay(10);
+}
+
+/* read a rotary encoder with interrupts
+   Encoder hooked up with common to GROUND,
+   encoder0PinA to pin 2, encoder0PinB to pin 4 (or pin 3 see below)
+   it doesn't matter which encoder pin you use for A or B
+
+   uses Arduino pull-ups on A & B channel outputs
+   turning on the pull-ups saves having to hook up resistors
+   to the A & B channel outputs
+
+*/
+
+void doEncoder0() {
+  /* If pinA and pinB are both high or both low, it is spinning
+   * forward. If they're different, it's going backward.
+   *
+   * For more information on speeding up this process, see
+   * [Reference/PortManipulation], specifically the PIND register.
+   */
+  if (digitalRead(encoder0PinA) == digitalRead(encoder0PinB)) {
+    encoder0Pos++;
+  } else {
+    encoder0Pos--;
+  }
+}
+
+void doEncoder1() {
+  /* If pinA and pinB are both high or both low, it is spinning
+   * forward. If they're different, it's going backward.
+   *
+   * For more information on speeding up this process, see
+   * [Reference/PortManipulation], specifically the PIND register.
+   */
+  if (digitalRead(encoder1PinA) == digitalRead(encoder1PinB)) {
+    encoder1Pos++;
+  } else {
+    encoder1Pos--;
+  }
+}


aht temometer try

aht temometer try

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

--- esp8266/AHT15_test/AHT15_test.ino
+++ esp8266/AHT15_test/AHT15_test.ino
@@ -0,0 +1,24 @@
+#include <Adafruit_AHTX0.h>
+//gipio 2 & 0 ???
+//albo sprawdzić: https://github.com/enjoyneering/AHTxx
+Adafruit_AHTX0 aht;
+
+void setup() {
+  Serial.begin(115200);
+  Serial.println("Adafruit AHT10/AHT20 demo!");
+
+  if (! aht.begin()) {
+    Serial.println("Could not find AHT? Check wiring");
+    while (1) delay(10);
+  }
+  Serial.println("AHT10 or AHT20 found");
+}
+
+void loop() {
+  sensors_event_t humidity, temp;
+  aht.getEvent(&humidity, &temp);// populate temp and humidity objects with fresh data
+  Serial.print("Temperature: "); Serial.print(temp.temperature); Serial.println(" degrees C");
+  Serial.print("Humidity: "); Serial.print(humidity.relative_humidity); Serial.println("% rH");
+
+  delay(500);
+}


Create fir.ino

Create fir.ino

initial commit

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


Supplied 5 button remote controls.

Supplied 5 button remote controls.


Added Arduino Code

Added Arduino Code

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

--- mds.ino
+++ mds.ino
@@ -0,0 +1,298 @@
+////////////////////////////////////////////////////////////////////////////////
+//                 *** Motion Detector Shield Arduino Code ***                //
+//                                                                            //
+// This programm should be used together with Motion Detector Shield and an   //
+// Arduino Uno > Rev.3. as well as an Adafruit Data Logging Shield. Much of   //
+// the code is inspired by Adafruits excellent documentation and tutorials.   //
+// See https://www.adafruit.com/product/1141                                  //
+//                                                                            //
+//                                                                            //
+//                            Andreas Genewsky (2016)                         //
+//              Max-Planck Institute for Psychiatry, Munich, Germany          //
+//                                                                            //
+//    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/>.   //
+//                                                                            //
+////////////////////////////////////////////////////////////////////////////////
+
+
+
+#include <SD.h>
+#include "RTClib.h"
+
+#define ECHO_TO_SERIAL   1 // echo data to serial port
+#define WRITE_TO_SD   1 // initialize SD and write data to SD
+
+int flopRST = 9;  // SN74LS423 RESET Pin ... read SN74LS423 documentation
+int SENS_A = 3;   // channel A
+int SENS_B = 4;   // channel B
+int SENS_C = 5;   // channel C
+int SENS_D = 6;   // channel D
+int SENS_E = 7;   // channel E
+int SENS_F = 8;   // channel F
+int AMBIENT = 14; // corresponds to A0 on Arduino UNO, TEMT6000 lightsensor
+int AD1 = 15;     // optional analog input
+int AD2 = 16;     // optional analog input
+int AD3 = 17;     // optional analog input
+float lux = 0.0;  // value necessary for lux calculation
+float lplux = 0.0;  // value necessary for lux calculation
+int sensors[6];   // motion sensor array
+volatile byte state = LOW;  // a variable which changes if motion was detected
+int ledPin = 13;  // the Arduino onboard LED
+int bootup = 0; // a placeholder for the time in milliseconds at bootup
+unsigned int ms = 0;  // a placeholder for the milliseconds between the RTC seconds
+
+
+RTC_DS1307 RTC; // define the Real Time Clock object
+// for the data logging shield, we use digital pin 10 for the SD cs line
+const int chipSelect = 10;
+// the logging file
+File logfile;
+
+void error(char *str) // the definition of an error function
+{
+  Serial.print("error: ");
+  Serial.println(str);
+  while(1);
+}
+
+// here we set the date- and timestamp the logging file
+void dateTime(uint16_t* date, uint16_t* time)
+{
+  DateTime now = RTC.now();
+  *date = FAT_DATE(now.year(), now.month(), now.day());
+  *time = FAT_TIME(now.hour(), now.minute(), now.second());
+}
+
+void setup() {  // the setup function begins
+
+  Serial.begin(57600); // for some debugging purposes
+
+  if (! RTC.begin()) { // starting the RealTimeClock (RTC)
+    Serial.println("Couldn't find RTC");
+    while (1);
+  }
+  // Here we set the clock according to the CPU Time of the programing PC
+  RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));
+  // immediately afterwards we get the milliseconds since bootup
+  bootup = millis();
+
+  // no we set the INPUT & OUTPUT Pins
+  pinMode(flopRST, OUTPUT);
+  pinMode(SENS_A, INPUT);
+  pinMode(SENS_B, INPUT);
+  pinMode(SENS_C, INPUT);
+  pinMode(SENS_D, INPUT);
+  pinMode(SENS_E, INPUT);
+  pinMode(SENS_F, INPUT);
+  pinMode(AMBIENT, INPUT);
+  pinMode(AD1, INPUT);
+  pinMode(AD2, INPUT);
+  pinMode(AD3, INPUT);
+
+  attachInterrupt(0, detected, FALLING);
+  // this links a +5V voltage level at pin 2 (Arduino Interrupt Pin = pinnumber 0)
+  // to the execution of the function 'detected'
+  digitalWrite(flopRST, HIGH);
+
+#if WRITE_TO_SD
+  // we initialize the SD card, and check if we can write on it
+  Serial.print("Initializing SD card...");
+  pinMode(chipSelect, OUTPUT);
+  if (!SD.begin(chipSelect)) {
+    error("Card failed, or not present");
+  }
+  Serial.println("card initialized.");
+
+  // this function generates filenames with incrementing numbers
+  char filename[] = "MOTION00.CSV";
+  for (uint8_t i = 0; i < 100; i++) {
+    filename[6] = i/10 + '0';
+    filename[7] = i%10 + '0';
+    if (! SD.exists(filename)) {
+      SdFile::dateTimeCallback(dateTime);
+      logfile = SD.open(filename, FILE_WRITE);
+      break;  // leave the loop!
+    }
+  }
+
+  if (! logfile) {
+    error("couldnt create file");
+  }
+
+  Serial.print("Logging to: ");
+  Serial.println(filename);
+  // the next line writes the column descriptors to the logging file
+  logfile.println("MONTH,DAY,YEAR,HH,MM,SS,mmm,CH1,CH2,CH3,CH4,CH5,CH6,LUX");
+#endif WRITE_TO_SD
+
+// in order to blank any strange behavior of the SN74LS423 we RESET all of them before we log
+digitalWrite(flopRST, LOW);
+digitalWrite(ledPin, HIGH);
+delay(50);
+digitalWrite(ledPin, LOW);
+digitalWrite(flopRST, HIGH);
+delay(50);
+
+} //end of SETUP
+
+// the loop routine runs over and over again forever:
+void loop() {
+  DateTime now; // here we get the time every loop
+  // we calculate the light intensity in lux
+  // the conversion from voltage to microamps to lux can be found in the datasheet of the TEMT6000
+  lux = (analogRead(AMBIENT) * 0.9765625) * 0.1 + lplux * 0.9;
+  lplux = lux;
+  now = RTC.now();
+  ms = (millis()-bootup)%1000; //here we calculate the <1000 milliseconds
+
+  if (state == HIGH) {          // we enter this loop if an interrupt event has happend
+    detachInterrupt(0);         // ('detected function has run)
+    digitalWrite(flopRST, LOW); // to avoid problems we detach the interrupts
+    digitalWrite(ledPin, HIGH);
+
+    #if ECHO_TO_SERIAL
+      // we will print CommaSeparatedValues (CSV) at the Serial Monitor for:
+      // MONTH,DAY,YEAR,HOUR,MINUTES,SECONDS,MILLISECONDS,CH1,CH2,CH3,CH4,CH5,CH6,LUX
+      if (now.month() < 10) {
+        Serial.print(0);
+      }
+      Serial.print(now.month(), DEC);
+      Serial.print(",");
+      if (now.day() < 10) {
+        Serial.print(0);
+      }
+      Serial.print(now.day(), DEC);
+      Serial.print(",");
+      Serial.print(now.year(), DEC);
+      Serial.print(",");
+      if (now.hour() < 10) {
+        Serial.print(0);
+      }
+      Serial.print(now.hour(), DEC);
+      Serial.print(",");
+      if (now.minute() < 10) {
+        Serial.print(0);
+      }
+      Serial.print(now.minute(), DEC);
+      Serial.print(",");
+      if (now.second() < 10) {
+        Serial.print(0);
+      }
+      Serial.print(now.second(), DEC);
+      Serial.print(",");
+      if (ms < 10) {
+        Serial.print("00");
+      }
+      if ( (ms >= 10) && (ms < 100) ) {
+        Serial.print(0);
+      }
+      Serial.print(ms, DEC);
+
+      for (int i = 0; i < 6; i++) {
+        Serial.print(",");
+        Serial.print(sensors[i]);
+      }
+      Serial.print(',');
+      Serial.println(lux, 1);
+    #endif ECHO_TO_SERIAL
+
+    #if WRITE_TO_SD
+       // we will write some CommaSeparatedValues (CSV) to the logfile for:
+      // MONTH,DAY,YEAR,HH,MM,SS,mmm,CH1,CH2,CH3,CH4,CH5,CH6,LUX
+      if (now.month() < 10) {
+        logfile.print(0);
+      }
+      logfile.print(now.month(), DEC);
+      logfile.print(",");
+      if (now.day() < 10) {
+        logfile.print(0);
+      }
+      logfile.print(now.day(), DEC);
+      logfile.print(",");
+      logfile.print(now.year(), DEC);
+      logfile.print(",");
+      if (now.hour() < 10) {
+        logfile.print(0);
+      }
+      logfile.print(now.hour(), DEC);
+      logfile.print(",");
+      if (now.minute() < 10) {
+        logfile.print(0);
+      }
+      logfile.print(now.minute(), DEC);
+      logfile.print(",");
+      if (now.second() < 10) {
+        logfile.print(0);
+      }
+      logfile.print(now.second(), DEC);
+      logfile.print(",");
+      if (ms < 10) {
+        logfile.print("00");
+      }
+      if ( (ms >= 10) && (ms%1000 < 100) ) {
+        logfile.print(0);
+      }
+      logfile.print(ms, DEC);
+      for (int i = 0; i < 6; i++) {
+        logfile.print(",");
+        logfile.print(sensors[i]);
+        sensors[i] = 0;
+      }
+      logfile.print(',');
+      logfile.println(lux, 1);
+
+      // flush() actually writes the data to the SD card and is very important
+      logfile.flush();
+    #endif WRITE_TO_SD
+
+    // here we basically write 0's in our sensor array to be able to store new events
+    sensors[6];
+
+    // than we RESET the SN74LS423 IC's
+    delay(10);
+    digitalWrite(ledPin, LOW);
+    digitalWrite(flopRST, HIGH);
+    delay(10);
+    // now we arm our interrupt routine again
+    state = LOW;
+    attachInterrupt(0, detected, FALLING);
+  }
+}
+
+void detected() {
+  // the interrupt routine simply checks all the sensor ports if something happend (0-5V)
+  if (state == LOW) {
+    detachInterrupt(0);
+    sensors[0] = digitalRead(SENS_A);
+    sensors[1] = digitalRead(SENS_B);
+    sensors[2] = digitalRead(SENS_C);
+    sensors[3] = digitalRead(SENS_D);
+    sensors[4] = digitalRead(SENS_E);
+    sensors[5] = digitalRead(SENS_F);
+    state = HIGH;
+
+    int sum = 0;
+    for (int i = 0; i < 6; i++) {
+      sum = sum + sensors[i];
+    }
+    if (sum == 0) {
+      state = LOW;
+      attachInterrupt(0, detected, FALLING);
+    }
+  }
+}
+
+
+
+


adding testSerial.ino

adding testSerial.ino

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

--- testSerial.ino
+++ testSerial.ino
@@ -0,0 +1,26 @@
+/*
+   test serial connect with raspberry pi
+Note:		only for arduino mega
+Date:		2013/11/12
+Author:		dajiao
+
+*/
+
+byte num = 0;
+
+void setup(){
+
+	Serial.begin(9600);		// set up serial monitor in computer
+	Serial1.begin(9600);	// set up first serial port in arduino mega
+}
+
+void setup(){
+	if(Serial1.available()>0){
+		num = Serial.read();
+
+		Serial.print("recieved: ");
+		Serial.println(num, DEC);
+		Serial1.println("get it");
+
+	}
+}


Create Gyro.ino

Create Gyro.ino

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

--- Gyro.ino
+++ Gyro.ino
@@ -0,0 +1,227 @@
+// Distributed with a free-will license.
+// Use it any way you want, profit or free, provided it fits in the licenses of its associated works.
+// LSM9DSO
+// This code is designed to work with the TCS3414_I2CS I2C Mini Module available from ControlEverything.com.
+// https://www.controleverything.com/content/Color?sku=LSM9DSO_I2CS#tabs-0-product_tabset-2
+
+#include <application.h>
+#include <spark_wiring_i2c.h>
+
+// LSM9DSO Gyro I2C address is 6A(106)
+#define Addr_Gyro 0x6A
+// LSM9DSO Accl I2C address is 1E(30)
+#define Addr_Accl 0x1E
+
+int xAccl = 0, yAccl =  0, zAccl = 0, xGyro = 0, yGyro = 0, zGyro = 0, xMag = 0, yMag = 0, zMag = 0;
+void setup()
+{
+    // Set variable
+    Particle.variable("i2cdevice", "LSM9DS0");
+    Particle.variable("xAccl", xAccl);
+    Particle.variable("yAccl", yAccl);
+    Particle.variable("zAccl", zAccl);
+    Particle.variable("xGyro", xGyro);
+    Particle.variable("yGyro", yGyro);
+    Particle.variable("zGyro", zGyro);
+    Particle.variable("xMag", xMag);
+    Particle.variable("yMag", yMag);
+    Particle.variable("zMag", zMag);
+
+    // Initialise I2C communication as MASTER
+    Wire.begin();
+    // Initialise Serial Communication, set baud rate = 9600
+    Serial.begin(9600);
+
+    // Start I2C Transmission
+    Wire.beginTransmission(Addr_Gyro);
+    // Select control register 1
+    Wire.write(0x20);
+    // Data rate = 95Hz, X, Y, Z-Axis enabled, power on
+    Wire.write(0x0F);
+    // Stop I2C Transmission
+    Wire.endTransmission();
+
+    // Start I2C Transmission
+    Wire.beginTransmission(Addr_Gyro);
+    // Select control register 4
+    Wire.write(0x23);
+    // Full-scale 2000 dps, continuous update
+    Wire.write(0x30);
+    // Stop I2C Transmission
+    Wire.endTransmission();
+
+    // Start I2C Transmission
+    Wire.beginTransmission(Addr_Accl);
+    // Select control register 1
+    Wire.write(0x20);
+    // Acceleration data rate = 100Hz, X, Y, Z-Axis enabled, power on
+    Wire.write(0x67);
+    // Stop I2C Transmission on the device
+    Wire.endTransmission();
+
+    // Start I2C Transmission
+    Wire.beginTransmission(Addr_Accl);
+    // Select control register 2
+    Wire.write(0x21);
+    // Full scale selection +/- 16g
+    Wire.write(0x20);
+    // Stop I2C Transmission
+    Wire.endTransmission();
+
+    // Start I2C Transmission
+    Wire.beginTransmission(Addr_Accl);
+    // Select control register 5
+    Wire.write(0x24);
+    // Magnetic high resolution, output data rate = 50Hz
+    Wire.write(0x70);
+    // Stop I2C Transmission
+    Wire.endTransmission();
+
+    // Start I2C Transmission
+    Wire.beginTransmission(Addr_Accl);
+    // Select control register 6
+    Wire.write(0x25);
+    // Magnetic full-scale +/- 12 gauss
+    Wire.write(0x60);
+    // Stop I2C Transmission
+    Wire.endTransmission();
+
+    // Start I2C Transmission
+    Wire.beginTransmission(Addr_Accl);
+    // Select control register 7
+    Wire.write(0x26);
+    // Normal mode, magnetic continuous conversion mode
+    Wire.write(0x00);
+    // Stop I2C Transmission
+    Wire.endTransmission();
+    delay(300);
+}
+
+void loop()
+{
+    unsigned int data[6];
+
+    for(int i = 0; i < 6; i++)
+    {
+        // Start I2C Transmission
+        Wire.beginTransmission(Addr_Gyro);
+        // Select data register
+        Wire.write((40+i));
+        // Stop I2C Transmission
+        Wire.endTransmission();
+
+        // Request 1 byte of data
+        Wire.requestFrom(Addr_Gyro, 1);
+
+        // Read 6 bytes of data
+        // xGyro lsb, xGyro msb, yGyro lsb, yGyro msb, zGyro lsb, zGyro msb
+        if(Wire.available() == 1)
+        {
+            data[i] = Wire.read();
+        }
+    }
+
+    // Convert the data
+    xGyro = ((data[1] * 256) + data[0]);
+    if (xGyro > 32767)
+    {
+        xGyro -= 65536;
+    }
+    yGyro = ((data[3] * 256) + data[2]);
+    if (yGyro > 32767)
+    {
+        yGyro -= 65536;
+    }
+    zGyro = ((data[5] * 256) + data[4]);
+    if (zGyro > 32767)
+    {
+        zGyro -= 65536;
+    }
+
+    for(int i = 0; i < 6; i++)
+    {
+        // Start I2C Transmission
+        Wire.beginTransmission(Addr_Accl);
+        // Select data register
+        Wire.write((40+i));
+        // Stop I2C Transmission
+        Wire.endTransmission();
+
+        // Request 1 byte of data
+        Wire.requestFrom(Addr_Accl,1);
+
+        // Read 6 bytes of data
+        // xAccl lsb, xAccl msb, yAccl lsb, yAccl msb, zAccl lsb, zAccl msb
+        if(Wire.available() == 1)
+        {
+            data[i] = Wire.read();
+        }
+    }
+
+    // Convert the data
+    xAccl = ((data[1] * 256) + data[0]);
+    if(xAccl > 32767)
+    {
+      xAccl -= 65536;
+    }
+
+    yAccl = ((data[3] * 256) + data[2]);
+    if(yAccl > 32767)
+    {
+      yAccl -= 65536;
+    }
+
+    zAccl = ((data[5] * 256) + data[4]);
+    if(zAccl > 32767)
+    {
+      zAccl -= 65536;
+    }
+
+    for(int i = 0; i < 6; i++)
+    {
+        // Start I2C Transmission
+        Wire.beginTransmission(Addr_Accl);
+        // Select data register
+        Wire.write((8 + i));
+        // Stop I2C Transmission
+        Wire.endTransmission();
+
+        // Request 1 byte of data
+        Wire.requestFrom(Addr_Accl, 1);
+
+        // Read 6 bytes of data
+        // xMag lsb, xMag msb, yMag lsb, yMag msb
+        // zMag lsb, zMag msb
+        if(Wire.available() == 1)
+        {
+            data[i] = Wire.read();
+        }
+    }
+
+    // Convert the data
+    xMag = ((data[1] * 256) + data[0]);
+    if(xMag > 32767)
+    {
+      xMag -= 65536;
+    }
+    yMag = ((data[3] * 256) + data[2]);
+    if(yMag > 32767)
+    {
+      yMag -= 65536;
+    }
+    zMag = ((data[5] * 256) + data[4]);
+    if(zMag > 32767)
+    {
+      zMag -= 65536;
+    }
+
+    // Output data to dashboard
+    Particle.publish("X-Axis of rotation : ", String(xGyro));
+    Particle.publish("Y-Axis of rotation : ", String(yGyro));
+    Particle.publish("Z-Axis of rotation : ", String(zGyro));
+    delay(1000);
+    Particle.publish("Acceleration in X-Axis : ", String(xAccl));
+    Particle.publish("Acceleration in Y-Axis : ", String(yAccl));
+    Particle.publish("Acceleration in Z-Axis : ", String(zAccl));
+    delay(1000);
+}