Arduino code

Arduino code

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

--- ADAS-Arduino/ADAS-Arduino.ino
+++ ADAS-Arduino/ADAS-Arduino.ino
@@ -0,0 +1,108 @@
+//call the library and define the rx and tx pins for send and receive
+#include <SoftwareSerial.h>
+SoftwareSerial bluetooth(10,11);  //RX,TX
+
+//char used to read the input
+char data=0;
+
+//put a led in pin 5 in arduino
+int led = 5;
+
+//pot setup and value
+int potPin=A0;
+int potValue=0;
+
+
+//temp setup and value
+int tempPin=A1;
+float readValue , realValue;
+int finalValue;
+
+//ldr setup and value
+int ldrPin=A2;
+int ldrValue;
+
+//button setup
+int button =6;
+int button_state=0;
+
+int flag=0;
+
+int leds=3;
+
+
+
+void setup() {
+
+//intainalize the Serial and the bluetooth with 9600 boot rat
+Serial.begin(9600);
+bluetooth.begin(9600);
+
+//define the input and the output for the arduio
+pinMode(led,OUTPUT);
+pinMode(potPin,INPUT);
+pinMode(tempPin,INPUT);
+pinMode(ldrPin,INPUT);
+pinMode(leds,OUTPUT);
+pinMode(button,INPUT);
+
+}
+
+void loop() {
+
+//read the value from the pot
+potValue =analogRead(potPin);
+
+//read the value from the temp
+readValue=analogRead(tempPin);
+realValue = readValue*5 /1023;
+finalValue = realValue*100;
+
+//read value from LDR
+ldrValue=analogRead(ldrPin);
+
+button_state=digitalRead(button);
+
+sendAndroidValues();
+
+    if(bluetooth.available()){
+      data = bluetooth.read();
+      if(data == 'o'){
+        digitalWrite(led,HIGH);
+        }
+        else if(data == 'f'){
+          digitalWrite(led,LOW);
+          }
+      }
+}
+
+
+
+
+//send the value from the sensor over serial to BT module
+void sendAndroidValues()
+{
+  //put # before the value so that the app know that new data send
+  bluetooth.print('#');
+
+  bluetooth.print(finalValue);
+  bluetooth.print('+');
+
+  bluetooth.print(ldrValue);
+  bluetooth.print('+');
+
+ //put the sensors value
+  bluetooth.print(potValue);
+  bluetooth.print('+');
+
+  //put the button state
+  bluetooth.print(button_state);
+  bluetooth.print('+');
+
+
+  //used to end the transimssion
+  bluetooth.print('~');
+  bluetooth.println();
+  //add delay to eliminate missed data
+  delay(150);
+  }


Create V3.2.ino

Create V3.2.ino

error: pathspec 'Firmware/BB-UNIT/OLD/V3.2.ino' did not match any file(s) known to git

--- Firmware/BB-UNIT/OLD/V3.2.ino
+++ Firmware/BB-UNIT/OLD/V3.2.ino
@@ -0,0 +1,1173 @@
+String FIRMWARE_VERSION = "0.3.3"; // Software Version
+int channel             = 1;       // Remote channel : Put the same of your remote
+
+
+/*
+  - OPEN BB-X -
+ A open source BB-8 for create you own BB-8!
+ ###########################################
+
+ https://github.com/Gruniek/OPEN-BB-X
+ Made by Daniel M/Gruniek/
+
+ Compatible only with an Arduino MEGA 2560 and the specific PCB.
+ PCB Link : https://github.com/Gruniek/OPEN-BB-X/tree/master/Head/Stabiliser/PCB
+
+ --------------
+ - Change log -
+ --------------
+ 12/2016
+ =========
+ - Cleaning variable name
+ - Add RF433Mhz command for the Head and the controller
+ - Add choise the channel
+
+ 11/2016
+ =========
+ - Conversion for a Arduino Mega 2560 Board
+ - ADD motor A and B
+ - FIX alls bug for stabilisation
+ - ADD BOOT, STAT, ROTATE command
+ - ADD Z motor configuration and production
+ - ADD BOOT mode, for initilize or reinizialize the Droid position
+
+ 10/2016
+ ==========
+ - Add PID for X and Y
+
+
+ To do list
+ ==========
+ - Add Z rotation controller
+ - Add Rx/Tx from the motherboard for change de coordinate of the head,
+  rotate the head and report to the remote the status off all sensors/positiom.
+
+
+  Big thanks for http://r2builders.fr/ !
+  Initial project : http://r2builders.fr/forum/viewtopic.php?f=26&t=3928&hilit=BB8+par+MOUS
+
+  ===============
+  EXEMPLE COMMAND
+  ===============
+
+  // IT IS MANDATORY TO ADD 'c<YOUR CHANNEL>' for use commands. //
+
+  < SET >
+  'SET x87 y75 h3 \n'        // SET a new setpoint for x and y with 3degree of Hysteressis
+  'SET x90 y90 i1 j0 k1 \n'  // SET an inversion of the sensor X Y and invert the direction of X
+
+    x = SETPOINT for X
+  y = SETPOINT for Y
+  m = MULTIPLIER FOR THE SPEED OF THE MOTOR X and Y
+  i = INVERT the angle sensor ( X = Y and Y = X )
+  j = INVERT the direction of X
+  k = INVERT the direction of Y
+  h = SET a new HYSTERESSIS
+
+  < BOOT >
+  'BOOT \n'  // LAUNCH TEST for X, Y and Z -> Return X and Y to initial SETPOINT (x90 y90 ) and Z to ZERO
+
+  < RUN >
+  'RUN \n'   // RUN the code in production mode (Recieved all data, X and Y runing for the SETPOINT poistion and Z folow the remote controll
+
+  < STOP >
+  'STOP \n'  // STOP the production mode. All motors are stopped.
+
+  < ROTATE >
+  'ROTATE d1 s100 \n'   // ROTATE Z motor on the RIGHT DIRECTION (d0 LEFT, d1 RIGHT) WITH the SPEED at 1000/100 = 10 step/sec = 18dec/sec
+
+  < STAT >
+  'STAT \n' // It is all data SENDED to the remote
+
+  < ENABLE >
+  'ENABLE a1 x1 z1 \n'    // ENABLE MOTOR AB, XY and Z (a = AB, x=XY, z = Z | 0 = desabled | 1 = enabled )
+
+
+
+  FOR AFTER
+  http://tutorial.cytron.com.my/2014/05/15/wireless-uart-with-arduino-and-433mhz-or-434mhz-module/
+  note : 10, 11, 12, 13, 14, 15, 50, 51, 52, 53
+
+Library used :
+- 128x64 OLED screen : https://github.com/adafruit/Adafruit_SSD1306
+- MPU6050            : https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050
+
+
+
+
+*/
+
+#include "Wire.h"
+//#include "MPU6050.h"
+#include "SoftwareSerial.h"
+#include <SPI.h>
+#include <Adafruit_GFX.h>
+#include <Adafruit_SSD1306.h>
+
+#define OLED_RESET 4
+Adafruit_SSD1306 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
+//#include <SPI.h>
+//#include <nRF24L01.h>
+//#include <RF24.h>
+
+
+//===============//
+// YOU CAN TOUCH //
+//===============//
+
+// HC-12
+bool ifHead = false; // True if the head are wireless connected
+SoftwareSerial controler(10, 11); // RX, TX // For the renote communication
+SoftwareSerial head(12, 13);   // RX, TX // For the head communication
+
+
+// RF24
+//RF24 radio(54, 55);
+
+// MPU6050
+
+//MPU6050 accelgyroIC1(0x69); // HEAD
+//MPU6050 accelgyroIC2(0x69); // BODY
+
+//MPU6050 accelgyro;
+
+int16_t ax, ay, az;
+int16_t gx, gy, gz;
+
+
+//int16_t axb, ayb, azb;
+//int16_t gxb, gyb, gzb;
+
+
+// MOTOR CONFIGURATION // YOU CAN TOUCH THIS
+
+bool    INVERT_A       = false; // INVERT THE A MOTOR DIRECTION
+bool    INVERT_B       = false; // INVERT THE B MOTOR DIRECTION
+bool    INVERT_X       = false; // INVERT THE X MOTOR DIRECTION
+bool    INVERT_Y       = true;  // INVERT THE Y MOTOR DIRECTION
+bool    INVERT_XY      = false; // INVERT X Y AXIAL
+
+int     MIN_X          = 45;    // SET THE MIN INCLINAISON FOR X
+int     MAX_X          = 135;   // SET THE MAX INCLINAISON FOR X
+int     MIN_Y          = 45;    // SET THE MIN INCLINAISON FOR Y
+int     MAX_Y          = 135;   // SET THE MAX INCLINAISON FOR Y
+
+int     ETALON_X       = 0;     // AJUSTEMENT FOR X
+int     ETALON_Y       = 0;    // AJUSTEMENT FOR Y
+int     ETALON_B_X     = 0;     // AJUSTEMENT FOR X
+int     ETALON_B_Y     = -6;    // AJUSTEMENT FOR Y
+
+int     HYSTERESIS     = 1;     // HYSTERESSIS FOR THE ANGLE CALCULATION
+
+//=====================//
+// NOW YOU CAN'T TOUCH //
+//=====================//
+
+//PINOUT
+
+//#define PIN_ENABLE_A     33      // Activation off all stepper
+//#define PIN_ENABLE_B     27      // Activation off all stepper
+
+#define PIN_STEP_A       4      // PIN STEP FOR X
+#define PIN_DIR_A        5      // PIN DIRECTION FOR X
+#define PIN_STEP_B       6      // PIN STEP FOR X
+#define PIN_DIR_B        7      // PIN DIRECTION FOR X
+#define PIN_ENABLE_AB    9
+
+#define PIN_ENABLE_X     43
+#define PIN_STEP_X       51      // PIN STEP FOR X        //26
+#define PIN_DIRECTION_X  53      // PIN DIRECTION FOR X   //24
+#define PIN_X_MS_1       45
+#define PIN_X_MS_2       47
+#define PIN_X_MS_3       49
+
+#define PIN_ENABLE_Y     31
+#define PIN_STEP_Y       39       // PIN STEP FOR Y       // 4
+#define PIN_DIRECTION_Y  41       // PIN DIRECTION FOR Y  // 3
+#define PIN_Y_MS_1       33
+#define PIN_Y_MS_2       35
+#define PIN_Y_MS_3       37
+
+#define PIN_ENABLE_Z     23
+#define PIN_STEP_Z       27      // PIN STEP FOR Y
+#define PIN_DIRECTION_Z  29       // PIN DIRECTION FOR Y
+#define PIN_Z_MS_1       25
+#define Z_POSITION       22
+
+#define BP_LEFT          52
+#define BP_RIGH          50
+
+#define LED_1            48
+#define LED_2            46
+#define LED_3            44
+#define LED_4            42
+#define LED_5            40
+#define LED_6            38
+
+#define TRIGGER_LIGHT    24      // PIN TRIGGER FOR START/STOP THE LIGHTING INSIDE THE BALL
+#define LIGHTING         26      // PIN FOR FEED THE LIGHTING
+
+#define POWER_1          28
+#define POWER_2          30
+#define AUX_1			 32
+#define AUX_2            34
+#define AUX_3            36
+
+#define BUZZER           3
+
+#define PING             13
+#define PIN_RESET        12
+
+
+//#define LIGHT            20      // Pin for turn on/off lighting on the ball (Great for a technical maintenance ;) )
+
+//#define CURRENT          0
+//#define VOLTAGE          6
+
+// I2C
+int  I2C_ADRESS         = 1;
+
+// MOTOR VARIABLE
+int  SPEED_A            = 0;
+int  SPEED_B            = 0;
+bool RUN_A              = false;
+bool RUN_B              = false;
+bool DIRECTION_A        = true;   // true = Front | false = back
+bool DIRECTION_B        = true;   // true = Front | false = back
+
+int  x                  = 0;
+int  y                  = 0;
+int  bx                 = 0;
+int  by                 = 0;
+int  vx                 = 0;
+int  vy                 = 0;
+
+int  SPEED_X            = 0;
+int  SPEED_Y            = 0;
+int  SPEED_Z            = 0;
+int  SETPOINT_X         = 90;
+int  SETPOINT_Y         = 90;
+
+//int  Z_ANGLE            = 0;
+bool NEW_DATA           = false;
+
+int  MULTIPLIER         = 15;
+int  EMERGENCY_STOP     = 11; // PIN
+int  E_STOP             = 12; // PIN
+bool EMG_STOP           = false;
+
+int  TMP_DATA[30];
+
+bool RUN_X              = false;
+bool RUN_Y              = false;
+bool RUN_               = false;
+bool DIRECT_X           = false; // false = Gauche / true = droite
+bool DIRECT_Y           = false; // false = Gauche / true = droite
+bool DIRECT_Z           = false; // false = Gauche / true = droite
+
+bool X_OK               = false;
+bool Y_OK               = false;
+bool Z_OK               = false;
+
+bool PRODUCTION         = false;
+bool LED_PING           = false;
+bool BOOT               = false;
+bool TEST_SEQUENCE      = false;
+bool ENABLE_MOTOR_AB    = false;
+bool ENABLE_MOTOR_X     = false;
+bool ENABLE_MOTOR_Y     = false;
+bool ENABLE_MOTOR_Z     = false;
+bool STAT_RUN           = false;
+
+unsigned long previousMillisX = 0;
+unsigned long previousMillisY = 0;
+unsigned long previousMillisZ = 0;
+unsigned long previousMillisA = 0;
+unsigned long previousMillisB = 0;
+unsigned long currentA = 0;
+unsigned long currentB = 0;
+
+unsigned long trigGyro = 1000;
+unsigned long trigSec  = 1000;
+unsigned long trigG    = 0;
+unsigned long trigS    = 0;
+
+
+unsigned char returnBuffer[8],counter=0; //buffer where the received data will be stored
+unsigned char fullBuffer=0;              //0: buffer not full, 1: buffer is full
+int yawPitchRoll[3];
+
+
+//=============================================================================//
+//   SETUP
+//=============================================================================//
+void setup()
+{
+  Serial.begin(115200);
+
+
+  display.begin(SSD1306_SWITCHCAPVCC, 0x3D);  // initialize with the I2C addr 0x3D (for the 128x64)
+  display.display();
+  display.clearDisplay();
+
+  // PINMODE
+  pinMode( PIN_RESET       , OUTPUT );
+
+  pinMode( PIN_ENABLE_AB   , OUTPUT );
+  pinMode( PIN_ENABLE_X    , OUTPUT );
+  pinMode( PIN_ENABLE_Y    , OUTPUT );
+  pinMode( PIN_ENABLE_Z    , OUTPUT );
+
+  pinMode( PIN_DIRECTION_X , OUTPUT );
+  pinMode( PIN_STEP_X      , OUTPUT );
+  pinMode( PIN_X_MS_1      , OUTPUT );
+  pinMode( PIN_X_MS_2      , OUTPUT );
+  pinMode( PIN_X_MS_3      , OUTPUT );
+
+  pinMode( PIN_DIRECTION_Y , OUTPUT );
+  pinMode( PIN_STEP_Y      , OUTPUT );
+  pinMode( PIN_Y_MS_1      , OUTPUT );
+  pinMode( PIN_Y_MS_2      , OUTPUT );
+  pinMode( PIN_Y_MS_3      , OUTPUT );
+
+  pinMode( PIN_ENABLE_Z    , OUTPUT );
+  pinMode( PIN_STEP_Z      , OUTPUT );
+  pinMode( PIN_DIRECTION_Z , OUTPUT );
+  pinMode( PIN_Z_MS_1      , OUTPUT );
+  pinMode( Z_POSITION      , OUTPUT );
+
+  pinMode( PIN_DIR_A       , OUTPUT );
+  pinMode( PIN_STEP_A      , OUTPUT );
+
+  pinMode( PIN_DIR_B       , OUTPUT );
+  pinMode( PIN_STEP_B      , OUTPUT );
+
+  pinMode( TRIGGER_LIGHT   , INPUT );
+  pinMode( LIGHTING        , OUTPUT );
+
+  pinMode( LED_1           , OUTPUT );
+  pinMode( LED_2           , OUTPUT );
+  pinMode( LED_3           , OUTPUT );
+  pinMode( LED_4           , OUTPUT );
+  pinMode( LED_5           , OUTPUT );
+  pinMode( LED_6           , OUTPUT );
+
+  pinMode( BUZZER          , OUTPUT );
+  pinMode( POWER_1         , OUTPUT );
+  pinMode( POWER_2         , OUTPUT );
+
+  pinMode( AUX_1           , OUTPUT );
+  pinMode( AUX_2           , OUTPUT );
+  pinMode( AUX_3           , OUTPUT );
+
+  pinMode( BP_LEFT         , INPUT  );
+  pinMode( BP_RIGH         , INPUT  );
+
+
+
+  // SERIAL
+
+  // Blabla, blablabla
+  Serial.println("==================================================");
+  Serial.println("  _______ ______     _     _  ______  ____ ______ ");
+  Serial.println(" (____   (____  )   | |   | |/ ___  |(____|______)");
+  Serial.println("  ____)  )____)  )__| |   | | |   | | | |   | |   ");
+  Serial.println(" |  __  (|  __  (___) |   | | |   | | | |   | |   ");
+  Serial.println(" | |__)  ) |__)  )  | |___| | |   | |_| |_  | |   ");
+  Serial.println(" |______/|______/   |______/|_|   |_(_____) |_|   ");
+  Serial.println("==================================================");
+  Serial.println("                                                  ");
+  Serial.println("            _ Astromech Industrie _               ");
+  Serial.println("      > https://github.com/Gruniek/BB-UNIT <      ");
+  Serial.println("           > http://r2builders.fr/ <              ");
+  Serial.println("                                                  ");
+  Serial.println("           > Code by Daniel Mostosi <             ");
+  Serial.println("                                                  ");
+  Serial.println("                Report an issues?                 ");
+  Serial.println("    https://github.com/Gruniek/BB-UNIT/issues     ");
+  Serial.println("                                                  ");
+  Serial.print("           FIRMWARE VERSION : ");
+  Serial.print(FIRMWARE_VERSION);
+  Serial.println("               ");
+  Serial.println("==================================================");
+
+  Serial.println(" ");
+  Serial.println("[1]-Booting up...");
+
+  // Start of the I2C protocol
+  Serial.print("[2]-Initializing I2C devices...  I2C ADRESS :");
+  Serial.println(I2C_ADRESS);
+  Wire.begin(I2C_ADRESS);
+  delay(1000);
+
+  // Start the GY-25 6050 Gyroscope
+  Serial.println("[3]-Connect to the GY-25-6050 HEAD: ");
+  Serial1.begin(115200);
+  delay(1000);
+  Serial1.write(0XA5);
+  Serial1.write(0X52);
+
+
+  // END OF BOOT/SETUP
+  Serial.println("=====================");
+  Serial.println("Booting successfull !");
+  Serial.println("=====================");
+}
+
+//=============================================================================//
+//   LOOP
+//=============================================================================//
+void loop()
+{
+  unsigned long currentG = millis(); // millis();
+
+  if (currentG - trigG  >= trigGyro && PRODUCTION)
+  {
+    trigG = currentG;
+
+    // GET MOTION HEAD
+    //-------------------------------------------------------------------------//
+
+    if(fullBuffer == 1 && returnBuffer[0]==0xAA && returnBuffer[7]==0x55)   //Check if buffer is full and if packet is correct
+    {
+        //Convert raw data to angle
+        yawPitchRoll[0]=(returnBuffer[1]<<8|returnBuffer[2])/100;
+        yawPitchRoll[1]=(returnBuffer[3]<<8|returnBuffer[4])/100;
+        yawPitchRoll[2]=(returnBuffer[5]<<8|returnBuffer[6])/100;
+
+        //Print angles
+
+		ax = yawPitchRoll[0];
+    	ay = yawPitchRoll[1];
+    	ay = yawPitchRoll[2];
+
+    	if(INVERT_XY)
+    	{
+    		x = (ax + ETALON_X + 90);
+    		y = (ay + ETALON_Y + 90);
+
+    		//y = (((ax / 180) + ETALON_X) + 90);
+      		//x = (((ay / 180) + ETALON_Y) + 90);
+      	/*	Serial.print("X=");
+      		Serial.print(x);
+      		Serial.print(" Y=");
+      		Serial.println(y);
+      	*/
+    	}
+    	else
+    	{
+    		y = (ax + ETALON_X + 90);
+    		x = (ay + ETALON_Y + 90);
+    		//x = (((ax / 180) + ETALON_X) + 90);
+      		//y = (((ay / 180) + ETALON_Y) + 90);
+    	}
+    }
+
+    fullBuffer=0;
+    angleModulePortEvent();         // Checks if data has been received
+  }
+
+
+
+
+  char msg[64];
+  if (Serial.available() > 0)
+  {
+    Serial.readBytesUntil('\n', msg, sizeof msg);
+    NEW_DATA = true;
+  }
+
+  // DATA IN //
+  if(NEW_DATA)
+  {
+    NEW_DATA = false;
+
+    if (strcmp(strtok(msg, " "), "SET") == 0)
+    {
+      Serial.println("UPDATE SETPOINT");
+      // trouvÃ© le message
+      char *p;
+      while ((p = strtok(NULL, " ")) != NULL)
+      {
+        int val = atoi(p + 1);
+        switch (*p)
+        {
+          case 'x':
+            SETPOINT_X  = val; // SETPOINT_X #1
+            break;
+          case 'y':
+            SETPOINT_Y  = val; // SETPOINT_Y #2
+            break;
+          case 'm':
+            MULTIPLIER = val; // MULTIPLIER #3
+            break;
+          case 'i':
+            INVERT_XY  = val; // INVERT_XY #4
+            break;
+          case 'j':
+            INVERT_X   = val; // INVERT_X #5
+            break;
+          case 'k':
+            INVERT_Y   = val; // INVERT_Y #6
+            break;
+          case 'h':
+            HYSTERESIS = val; // HYSTERESIS #7
+            break;
+        }
+      }
+    }
+
+    if (strcmp(strtok(msg, " "), "RUN") == 0)
+    {
+   		Serial.println("ROll BB-8 ROLL !");
+        PRODUCTION  = true;
+    }
+
+    if (strcmp(strtok(msg, " "), "STOP") == 0)
+    {
+    	Serial.println("STOP");
+        PRODUCTION  = false;
+    }
+
+    if (strcmp(strtok(msg, " "), "DIE") == 0)
+    {
+   		software_Reset() ;
+    }
+
+    if (strcmp(strtok(msg, " "), "RESET") == 0)
+    {
+      Serial.println("=      HARD RESET       =");
+      delay(1000);
+      Serial.println("=           3           =");
+      delay(1000);
+      Serial.println("=           2           =");
+      delay(1000);
+      Serial.println("=           1           =");
+      delay(1000);
+      Serial.println("= Going to sleep Neo... =");
+      delay(1000);
+      software_Reset() ;
+    }
+
+    if (strcmp(strtok(msg, " "), "STAT") == 0)
+    {
+		STAT_RUN = !STAT_RUN;
+    }
+
+    if (strcmp(strtok(msg, " "), "TEST") == 0)
+    {
+      char *p;
+      while ((p = strtok(NULL, " ")) != NULL)
+      {
+        int val = atoi(p + 1);
+        switch (*p)
+        {
+          case 'c':
+        	Serial.println("");
+        	TEST_SEQUENCE  = true;
+          break;
+        }
+      }
+    }
+
+
+
+    if (strcmp(strtok(msg, " "), "ROTATE") == 0) // ROTATE d1 s100  <-- Rotate Z right, 18c/sec
+    {
+      // trouvÃ© le message
+      char *p;
+      while ((p = strtok(NULL, " ")) != NULL)
+      {
+        int val = atoi(p + 1);
+        switch (*p)
+        {
+          case 'd':
+            DIRECT_Z  = val; // DIRECT_Z #8
+            break;
+          case 's':
+            SPEED_Z   = val; // SPEED_Z #9
+            break;
+        }
+      }
+    }
+
+    if (strcmp(strtok(msg, " "), "MOVE") == 0)
+    {
+      Serial.println("UPDATE SETPOINT");
+      // trouvÃ© le message
+      char *p;
+      while ((p = strtok(NULL, " ")) != NULL)
+      {
+        int val = atoi(p + 1);
+        switch (*p)
+        {
+          case 'a':
+            SPEED_A = val; // SPEED_A #10
+            break;
+          case 'b':
+            SPEED_B = val; // SPEED_B #11
+            break;
+          case 'c':
+            DIRECTION_A = val; // DIRECTION_A #12
+            break;
+          case 'd':
+            DIRECTION_B = val; // DIRECTION_B #13
+            break;
+        }
+      }
+    }
+
+    if (strcmp(strtok(msg, " "), "ENABLE") == 0)
+    {
+      char *p;
+      while ((p = strtok(NULL, " ")) != NULL)
+      {
+        int val = atoi(p + 1);
+        switch (*p)
+        {
+          case 'a':
+            ENABLE_MOTOR_AB  = val; // ENABLE_MOTOR_AB
+            if(ENABLE_MOTOR_AB)
+      		{
+      			digitalWrite(ENABLE_MOTOR_AB, 1);
+      			Serial.println("Motor A and B Enabled");
+      		}
+      		else
+      		{
+      			digitalWrite(ENABLE_MOTOR_AB, 0);
+      			Serial.println("Motor A and B Desabled");
+      		}
+          break;
+
+          case 'x':
+            ENABLE_MOTOR_X  = val; // ENABLE_MOTOR_XY
+            if(ENABLE_MOTOR_X)
+    		{
+      			digitalWrite(ENABLE_MOTOR_X, 1);
+      			Serial.println("Motor X Enabled");
+      		}
+      		else
+      		{
+      			digitalWrite(ENABLE_MOTOR_X, 0);
+      			Serial.println("Motor X Desabled");
+      		}
+          break;
+
+          case 'Y':
+            ENABLE_MOTOR_X  = val; // ENABLE_MOTOR_XY
+            if(ENABLE_MOTOR_Y)
+      		{
+      			digitalWrite(ENABLE_MOTOR_Y, 1);
+      			Serial.println("Motor Y Enabled");
+      		}
+      		else
+      		{
+      			digitalWrite(ENABLE_MOTOR_Y, 0);
+      			Serial.println("Motor Y Desabled");
+      		}
+          break;
+
+          case 'z':
+            ENABLE_MOTOR_Z   = val; // ENABLE_MOTOR_Z
+            if(ENABLE_MOTOR_Z)
+      		{
+      			digitalWrite(ENABLE_MOTOR_Z, 1);
+      			Serial.println("Motor Z Enabled");
+      		}
+      		else
+      		{
+      			digitalWrite(ENABLE_MOTOR_Z, 0);
+      			Serial.println("Motor Z Desabled");
+      		}
+          break;
+        }
+      }
+    }
+
+  }
+
+//  digitalWrite( PIN_ENABLE_A, ENABLE_MOTOR_AB );
+//  digitalWrite( PIN_ENABLE_B, ENABLE_MOTOR_XY );
+
+
+  /*if(BOOT)
+  {
+//    ENABLE_MOTOR_AB = true;
+    ENABLE_MOTOR_XY = true;
+//    ENABLE_MOTOR_Z  = true;
+digitalWrite(PIN_ENABLE_XY, ENABLE_MOTOR_XY);
+    // SET X IN POSITION
+    if(x < 90) DIRECT_X = false;
+    else DIRECT_X = true;
+
+    if(INVERT_X)
+    {
+      if(DIRECT_X) DIRECT_X = false;
+      else DIRECT_X = true;
+    }
+    digitalWrite(PIN_DIRECTION_X, DIRECT_X); // dirX
+
+    if(x > (SETPOINT_X + HYSTERESIS || (x < SETPOINT_X - HYSTERESIS || !X_OK )))
+    {
+      digitalWrite(PIN_STEP_X, 1);
+      delayMicroseconds( 500 );
+      digitalWrite(PIN_STEP_X, 0);
+      delayMicroseconds( 500 );
+    }
+    else
+    {
+      if(!X_OK)
+      {
+        Serial.println("BOOT x1 ");
+        X_OK = true;
+        delay(2000);
+      }
+    }
+
+    // SET Y IN POSITION
+    if(y < 90) DIRECT_Y = false;
+    else DIRECT_Y = true;
+
+    if(INVERT_Y)
+    {
+      if(DIRECT_Y) DIRECT_Y = false;
+      else DIRECT_Y = true;
+    }
+    digitalWrite(PIN_DIRECTION_Y, DIRECT_Y); // dirX
+
+    if(y > (SETPOINT_Y + HYSTERESIS) || (y < SETPOINT_Y - HYSTERESIS || !Y_OK))
+    {
+      digitalWrite(PIN_STEP_Y, 1);
+      delayMicroseconds( 500 );
+      digitalWrite(PIN_STEP_Y, 0);
+      delayMicroseconds( 500 );
+    }
+    else
+    {
+      if(!Y_OK)
+      {
+        Serial.println("BOOT y1 ");
+        Y_OK = true;
+        delay(2000);
+      }
+    }
+/*
+    // SET Z IN POSITION
+    if(!digitalRead(Z_POSITION))
+    {
+      digitalWrite(PIN_STEP_Z, 1);
+      delayMicroseconds( 500 );
+      digitalWrite(PIN_STEP_Z, 0);
+      delayMicroseconds( 500 );
+    }
+    else
+    {
+      if(!Z_OK)
+      {
+        Serial.println("BOOT z1 ");
+        Z_OK = true;
+        Z_ANGLE = 0;
+        delay(2000);
+      }
+    }
+*/
+ /*   if( X_OK && Y_OK)
+    {
+      Serial.println("STAT b1 ");
+      Serial.println("Booting UP OK!");
+      Serial.println("SEND 'RUN \n' for start the PRODUCTION");
+      BOOT = false;
+    }
+  }
+*/
+  // PRODUCTION CODE
+  //-------------------------------------------------------------------------//
+  if(PRODUCTION)  //- PRODUCTION && !EMG_STOP
+  {
+
+/*    ENABLE_MOTOR_AB = true;*/
+ //   ENABLE_MOTOR_XY = true;
+//    ENABLE_MOTOR_Z  = true;
+
+
+/*
+
+    //======================================================================
+    //        d8888
+    //       d88888
+    //  d88P888
+    //     d88P 888
+    //    d88P  888
+    //   d88P   888
+    //  d8888888888
+    // d88P     888
+    //======================================================================
+    // MOTOR A (Left)
+
+    // Run the motor
+    if(SPEED_A > 0) RUN_A = true;
+    else RUN_A = false;
+    SPEED_A = 1000 / SPEED_A;
+
+    // Motor direction / With inversion
+    if(INVERT_A)
+    {
+      if(DIRECTION_A) DIRECTION_A = false;
+      else DIRECTION_A = true;
+    }
+    digitalWrite(PIN_DIR_A, DIRECTION_A); // Set the direction
+
+    // Send Step inpultion to the motor
+    unsigned long currentA = millis(); // millis();
+    if (currentA - previousMillisA >= SPEED_A)
+    {
+      previousMillisA = currentA;
+
+      if(RUN_A)
+      {
+        digitalWrite(PIN_STEP_A, 1);
+        delayMicroseconds( 500 );
+        digitalWrite(PIN_STEP_A, 0);
+        delayMicroseconds( 500 );
+      }
+    }
+
+    //======================================================================
+    // 888888b.
+    // 888  "88b
+    // 888  .88P
+    // 8888888K.
+    // 888  "Y88b
+    // 888    888
+    // 888   d88P
+    // 8888888P"
+    //======================================================================
+    // MOTOR B (Right)
+
+    // Run the motor
+    if(SPEED_B > 0) RUN_B = true;
+    else RUN_B = false;
+    SPEED_B = 1000 / SPEED_B;
+
+    // Motor direction / With inversion
+    if(INVERT_B)
+    {
+      if(DIRECTION_B) DIRECTION_B = false;
+      else DIRECTION_B = true;
+    }
+    digitalWrite(PIN_DIR_B, DIRECTION_B); // Set the direction
+
+    // Send Step inpultion to the motor
+    unsigned long currentB = millis(); // millis();
+    if (currentB - previousMillisB >= SPEED_B)
+    {
+      previousMillisB = currentB;
+
+      if(RUN_B)
+      {
+        digitalWrite(PIN_STEP_B, 1);
+        delayMicroseconds( 500 );
+        digitalWrite(PIN_STEP_B, 0);
+        delayMicroseconds( 500 );
+      }
+    }
+*/
+    //======================================================================
+    // Y88b   d88P
+    //  Y88b d88P
+    //   Y88o88P
+    //    Y888P
+    //    d888b
+    //   d88888b
+    //  d88P Y88b
+    // d88P   Y88b
+    //======================================================================
+
+
+//digitalWrite(PIN_ENABLE_XY, ENABLE_MOTOR_XY);
+    // Direction
+    if(x < 90) DIRECT_X = false;
+    else DIRECT_X = true;
+
+    if(INVERT_X)
+    {
+      if(DIRECT_X) DIRECT_X = false;
+      else DIRECT_X = true;
+    }
+    digitalWrite(PIN_DIRECTION_X, DIRECT_X); // dirX
+
+    // Si ont doit demarer le moteur
+    if(x > (SETPOINT_X + HYSTERESIS) || (x < SETPOINT_X - HYSTERESIS ))
+    {
+
+      if(x > MIN_X && x < MAX_X) RUN_X = true;
+      else RUN_X = false;
+    }
+    else RUN_X = false;
+
+    // Calcul du PID X
+    if(x < SETPOINT_X) vx = (SETPOINT_X - x);
+    if(x == 0) vx = 0;
+    if(x > SETPOINT_X) vx = (x - SETPOINT_X);
+
+    SPEED_X = 1000 / (vx);
+    SPEED_X = SPEED_X * MULTIPLIER; // DEL
+    if(SPEED_X < 15) SPEED_X = 15;
+
+    // Mise en route du moteur
+    unsigned long currentX = millis();
+//RUN_X = true;
+
+    if (currentX - previousMillisX >= SPEED_X)
+    {
+      previousMillisX = currentX;
+
+      if(RUN_X)
+      {
+        //Serial.println("stepX");
+        digitalWrite(PIN_STEP_X, 1);
+        delayMicroseconds( 500 );
+        digitalWrite(PIN_STEP_X, 0);
+        delayMicroseconds( 500 );
+      }
+    }
+
+
+
+    //======================================================================
+    // Y88b   d88P
+    //  Y88b d88P
+    //   Y88o88P
+    //    Y888P
+    //     888
+    //     888
+    //     888
+    //     888
+    //======================================================================
+
+    // Direction
+    if(y < 90) DIRECT_Y = false;
+    else DIRECT_Y = true;
+    if(INVERT_Y)
+    {
+      if(DIRECT_Y) DIRECT_Y = false;
+      else DIRECT_Y = true;
+    }
+    digitalWrite(PIN_DIRECTION_Y, DIRECT_Y);
+
+    // Si ont doit demarer le moteur
+    if(y > (SETPOINT_Y + HYSTERESIS) || (y < SETPOINT_Y - HYSTERESIS ))
+    {
+      if(y > MIN_Y && y < MAX_Y) RUN_Y = true;
+      else RUN_Y = false;
+    }
+    else RUN_Y = false;
+
+    // Calcul du PID Y
+    if(y < SETPOINT_Y) vy = (SETPOINT_Y - y);
+    if(y == 0) vy = 0;
+    if(y > SETPOINT_Y) vy = (y - SETPOINT_Y);
+
+    SPEED_Y = 1000 / (vy);
+    SPEED_Y = SPEED_Y * MULTIPLIER; // DEL
+    if(SPEED_Y < 15) SPEED_Y = 15;
+
+    // Mise en route du moteur
+    unsigned long currentY = millis(); // millis();
+
+    if (currentY - previousMillisY >= SPEED_Y)
+    {
+      previousMillisY = currentY;
+
+      if(RUN_Y)
+      {
+        digitalWrite(PIN_STEP_Y, 1);
+        delayMicroseconds( 500 );
+        digitalWrite(PIN_STEP_Y, 0);
+        delayMicroseconds( 500 );
+      }
+    }
+
+/*
+    //======================================================================
+    // 8888888888P
+    //       d88P
+    //      d88P
+    //     d88P
+    //    d88P
+    //   d88P
+    //  d88P
+    // d8888888888
+    //======================================================================
+
+    digitalWrite(PIN_DIRECTION_Z, DIRECT_Z);
+    if(SPEED_Z != 0)
+    {
+      unsigned long currentZ = millis();
+
+      if (currentZ - previousMillisZ >= SPEED_Z)
+      {
+        previousMillisZ = currentZ;
+
+        digitalWrite(PIN_STEP_Y, 1);
+        delayMicroseconds( 500 );
+        digitalWrite(PIN_STEP_Y, 0);
+        delayMicroseconds( 500 );
+        if(DIRECT_Z) Z_ANGLE++;
+        else Z_ANGLE--;
+      }
+    }
+
+    if(Z_ANGLE == 201) Z_ANGLE = 0;
+    if(Z_ANGLE == -1)  Z_ANGLE = 0;
+*/
+  }
+
+  // TRIGGER / SEC
+  //-------------------------------------------------------------------------//
+  unsigned long currentS = millis(); // millis();
+
+  if (currentS - trigS  >= trigSec)
+  {
+    trigS = currentS;
+
+    // PING
+    if(LED_PING) LED_PING = false;
+    else LED_PING = true;
+    digitalWrite(PING, LED_PING);
+/*
+    // IF THE MPU6050 ARE ALWAYS CONNECTED, IF NOT, HE RECONNECT AUTOMATICLY
+    if(!accelgyro.testConnection());
+    //if(!accelgyroIC1.testConnection());
+    {
+      PRODUCTION = false;
+      EMG_STOP = true;
+      accelgyro.initialize();
+      //accelgyroIC1.initialize();
+      //if(accelgyro.testConnection())
+      if(accelgyro.testConnection()) PRODUCTION = true;
+    }
+*/
+
+
+    // SEND STATUT
+    // ON SERIAL USB
+
+
+    if(STAT_RUN)
+    {
+    	Serial.print("STAT > ");
+    	Serial.print("X = ");
+    	Serial.print(x);
+    	Serial.print(" / y = ");
+    	Serial.print(y);
+    	Serial.print(" / SETPOINT X = ");
+    	Serial.print(SETPOINT_X);
+    	Serial.print(" / SETPOINT Y = ");
+    	Serial.print(SETPOINT_Y);
+
+		Serial.println(" ");
+    }
+  } // ENF OF PRODUCTION
+} // END OF LOOP
+
+// VOID FOR TAKE THE CURRENT
+int current(int Cpin)
+{
+  int mVperAmp = 185; // use 100 for 20A Module and 66 for 30A Module
+  int RawValue = 0;
+  int ACSoffset = 2500;
+  double Voltage = 0;
+  double Amps = 0;
+
+  RawValue = analogRead(Cpin);
+  Voltage = (RawValue / 1024.0) * 5000; // Gets you mV
+  Amps = ((Voltage - ACSoffset) / mVperAmp);
+
+  return(Amps);
+}
+
+// VOID FOR TAKE THE BATTERY VOLTAGE
+int voltage(int Vpin)
+{
+  float vout = 0.0;
+  float vin = 0.0;
+  float R1 = 100000.0; // resistance of R1 (100K) -see text!
+  float R2 = 10000.0; // resistance of R2 (10K) - see text!
+  int value = 0;
+
+  value = analogRead(Vpin);
+  vout = (value * 5.0) / 1024.0;
+  vin = vout / (R2 / (R1 + R2));
+  if (vin < 0.09) vin = 0.0;
+
+  return(vin);
+}
+
+
+
+// LOGO
+/*
+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 };
+  */
+
+
+  static const unsigned char PROGMEM logo_16_[] =
+{
+B00000001, B10000000,
+B00000010, B01000000,
+B00000100, B00011000,
+B00001000, B00000010,
+B00010000, B00000001,
+B01000000, B00000001,
+B00100000, B00011000,
+B00010000, B00000000,
+B00000100, B01000000,
+B00000001, B10000000,
+ };
+
+
+void angleModulePortEvent()
+{
+  while (Serial1.available())
+  {
+    returnBuffer[counter]=(unsigned char)Serial1.read();
+    if(counter==0&&returnBuffer[0]!=0xAA) return;            //wait for start character
+    counter++;
+    if(counter==8)
+    {
+       counter=0;
+       fullBuffer=1;                                        //mark buffer as full
+    }
+  }
+}
+
+void software_Reset() // Restarts program from beginning but does not reset the peripherals and registers
+{
+	asm volatile ("  jmp 0");
+}


backup

backup

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


Organized everything

Organized everything

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

--- BLDC_Step/BLDC_Step.ino
+++ BLDC_Step/BLDC_Step.ino
@@ -0,0 +1,163 @@
+#define OFF 0
+#define SEN A2
+#include "TimerOne.h"
+
+
+
+volatile int Speed = 170;
+int isReady = 0;
+int states = 7;
+int count = 0;
+volatile int noSpeedCount = 0;
+double Time = 0;
+unsigned long startTime = 0;
+unsigned long endTime = 0;
+int prevState = 7;
+volatile int rpm = 0.0;
+
+
+void setup() {
+  Serial.begin(115200);
+  pinMode(22, INPUT_PULLUP); //Yellow
+  pinMode(24, INPUT_PULLUP); //Green
+  pinMode(26, INPUT_PULLUP); //White
+
+  pinMode(7, OUTPUT); //MOSI  Rp
+  pinMode(6, OUTPUT); //5  Bp
+  pinMode(5, OUTPUT); //4  Yn
+  pinMode(4, OUTPUT); //3  Rn
+  pinMode(3, OUTPUT); //2  Bn
+  pinMode(2, OUTPUT); //1  Yp
+
+  pinMode(A2, INPUT); //Throttle
+
+  Timer1.initialize(50000);
+  Timer1.attachInterrupt(defSpeed);
+  startTime = millis();
+  turnOff();
+}
+
+void defSpeed(){
+  //Speed = map(analogRead(SEN), 175, 869, 0, 200);
+  Speed = 150;
+  if(Speed < 0)
+    Speed = 0;
+
+  ++noSpeedCount;
+  if(noSpeedCount >= 5){
+    rpm = 0;
+    noSpeedCount = 0;
+  }
+
+}
+
+void loop() {
+  states = ((digitalRead(22) << 2) + (digitalRead(24) << 1) + digitalRead(26));
+  Serial.print(states);Serial.print('\t');Serial.print(Speed);Serial.print('\t');Serial.print(rpm);Serial.print('\t');Serial.println(isReady);
+  if(prevState != states){
+     ++count;
+     prevState = states;
+  }
+
+  if(count >= 45){
+    endTime = millis();
+    Time = endTime - startTime;
+    Time = Time / 1000;
+    rpm = 60/Time;
+    count = 0;
+    startTime = millis();
+    noSpeedCount = 0;
+  }
+
+  if(isReady > 0){
+   switch (states) {
+
+   case 1: //GOOD to self
+     analogWrite(5, OFF); //BN
+     analogWrite(4, OFF); //YP
+     analogWrite(7, OFF);   //YN
+     analogWrite(3, OFF);   //RP
+     analogWrite(6, Speed);   //RN
+     analogWrite(2, Speed);   //BP
+     break;
+
+   case 2: //GOOD to self
+     analogWrite(6, OFF);   //RN
+     analogWrite(7, OFF);   //YN
+     analogWrite(4, OFF);   //BP
+     analogWrite(3, OFF);   //RP
+     analogWrite(5, Speed); //BN
+     analogWrite(2, Speed); //YP
+     break;
+
+   case 3: //GOOD to self
+     analogWrite(7, OFF);   //YN
+     analogWrite(4, OFF);   //BP
+     analogWrite(3, OFF);   //RP
+     analogWrite(5, OFF); //BN
+     analogWrite(6, Speed);   //RN
+     analogWrite(2, Speed); //YP
+     break;
+
+   case 4:
+     analogWrite(6, OFF);   //RN
+     analogWrite(7, OFF);   //YN
+          analogWrite(2, OFF); //YP
+     analogWrite(4, OFF);   //BP
+          analogWrite(5, Speed); //BN
+     analogWrite(3, Speed);   //RP
+
+
+     break;
+
+   case 5:
+     analogWrite(6, OFF);   //RN
+     analogWrite(7, OFF);   //YN
+     analogWrite(4, OFF);   //BP
+     analogWrite(3, OFF);   //RP
+     analogWrite(5, Speed); //BN
+     analogWrite(2, Speed); //YP
+     break;
+
+   case 6://good to self
+     analogWrite(6, OFF);   //RN
+     analogWrite(7, OFF);   //YN
+     analogWrite(4, OFF);   //BP
+     analogWrite(2, OFF); //YP
+     analogWrite(5, Speed); //BN
+     analogWrite(3, Speed);   //RP
+
+     break;
+
+   case 7:
+     turnOff();
+     break;
+    }
+   --isReady;
+  }
+  else{
+    turnOff();
+  }
+}
+
+void turnOff(){
+  digitalWrite(2, LOW);
+  digitalWrite(3, LOW);
+  digitalWrite(4, LOW);
+  digitalWrite(5, LOW);
+  digitalWrite(6, LOW);
+  digitalWrite(7, LOW);
+}
+
+void serialEvent(){
+  while(Serial.available()) {
+    char inChar = (char)Serial.read();
+    if(inChar == ' '){
+      isReady = 5;
+      Serial.println("Going ");
+      return;
+    }
+  }
+  return;
+}
+


Manejo del puerto serie

Manejo del puerto serie

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

--- LM4F_E003/LM4F_E003.ino
+++ LM4F_E003/LM4F_E003.ino
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ *
+ *                  Manejo del puerto serie
+ *
+ *******************************************************************************
+ * FileName:        LM4F_E002
+ * Processor:       EX-LM4F120XL
+ * Complier:        Energia 0101e0017
+ * Author:          Pedro Sánchez (MrChunckuee)
+ * Blog:            http://mrchunckuee.blogspot.com/
+ * Email:           mrchunckuee.psr@gmail.com
+ * Description:     Este ejemplo basico para el manejo del puerto serial
+ *******************************************************************************
+ * Rev.         Date            Comment
+ *   v1.00      14/10/2016      Creación del firmware
+ ******************************************************************************/
+
+unsigned char inputByte = 0; // incoming serial byte
+
+void setup(){
+// start serial port at 9600 bps
+  Serial.begin(9600);
+  pinMode(RED_LED, OUTPUT);
+  pinMode(BLUE_LED, OUTPUT);
+  pinMode(GREEN_LED, OUTPUT);
+}
+
+void loop(){
+  if (Serial.available() > 0) {
+    inputByte = Serial.read(); // get incoming byte
+    switch(inputByte){
+      case 'a':
+        digitalWrite(RED_LED,HIGH);
+        Serial.print("LED Rojo encendido\n");
+      break;
+      case 'b':
+        digitalWrite(RED_LED,LOW);
+        Serial.print("LED Rojo apagado");
+      break;
+      case 'c':
+        digitalWrite(GREEN_LED,HIGH);
+        Serial.print("LED Verde encendido");
+      break;
+      case 'd':
+        digitalWrite(GREEN_LED,LOW);
+       Serial.print("LED Verde apagado");
+      break;
+      case 'e':
+        digitalWrite(BLUE_LED,HIGH);
+        Serial.print("LED Azul encendido");
+      break;
+      case 'f':
+        digitalWrite(BLUE_LED,LOW);
+        Serial.print("LED Azul apagado");
+      break;
+      case 'g':
+        digitalWrite(RED_LED,LOW);
+        digitalWrite(GREEN_LED,LOW);
+        digitalWrite(BLUE_LED,LOW);
+        Serial.print("LEDs apagados");
+      break;
+      default:
+        digitalWrite(RED_LED,LOW);
+        digitalWrite(GREEN_LED,LOW);
+        digitalWrite(BLUE_LED,LOW);
+      break;
+    }
+  }
+}
+
+


added encoder test

added encoder test

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

--- projects/musicbox/MusicBox.ino
+++ projects/musicbox/MusicBox.ino
@@ -0,0 +1,27 @@
+
+const int kDelayMs = 500;
+const int kValueTableSize = 14 * 2;
+uint16_t sValueTable[kValueTableSize];
+
+void setup()
+{
+  Serial.begin(9600);
+
+  for (int idx = 0; idx < kValueTableSize; idx++)
+  {
+    unsigned int shift = idx % (sizeof(int) * 8);
+    sValueTable[idx] = 1 << shift;
+  }
+}
+
+void loop()
+{
+  static int sTableIdx = 0;
+
+  Serial.write(highByte(sValueTable[sTableIdx]));
+  Serial.write(lowByte(sValueTable[sTableIdx]));
+  delay(kDelayMs);
+
+  sTableIdx = (sTableIdx + 1) % kValueTableSize;
+}
+


Add files via upload

Add files via upload

Improvements made to state machine logic.

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


Add working code for the arduino uno

Add working code for the arduino uno

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

--- arduino/VoteVisualizer.ino
+++ arduino/VoteVisualizer.ino
@@ -0,0 +1,79 @@
+// VoteVisualization
+//
+// Author: sven.mentl@gmail.com
+// Released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library
+
+#include <Adafruit_NeoPixel.h>
+#include <avr/power.h>
+
+// Digital I/O Pin connected to Data In of the NeoPixel Ring
+#define PIN            13
+
+// Number of NeoPixels
+#define NUMPIXELS      24
+
+// Configuration of NeoPixels
+Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
+
+// Constants
+const uint32_t RED = pixels.Color(255, 0, 0);
+const uint32_t GREEN = pixels.Color(0, 255, 0);
+const uint32_t BLUE = pixels.Color(0, 0, 255);
+const uint32_t OFF = pixels.Color(0, 0, 0);
+const int START_SEQUENCE_BLINK_DELAY = 200;
+
+void setup() {
+
+  // Setup the serial connection
+  Serial.begin(9600);
+
+  // Initialize the NeoPixel library
+  pixels.begin();
+
+  // Display the start sequence to show that the right code is loaded and that the arduino is ready to be used
+  startSequence();
+}
+
+void loop() {
+
+  // Blocking call
+  if (Serial.available() > 0) {
+
+    // A value between 0 and 1 is expected on the serial line.
+    // The value expresses the ratio of positive votes in relation to all votes.
+    float ratio = Serial.parseFloat();
+    if(ratio < 0 || ratio > 1) return;
+
+    int numberOfGreens = (ratio * 24)+0.5;
+    lightFirstXInGreenRestInRed(numberOfGreens);
+  }
+}
+
+void lightFirstXInGreenRestInRed(int numberOfGreens){
+
+  for(int i=0; i<numberOfGreens; i++){
+   pixels.setPixelColor(i, GREEN);
+  }
+  for(int i=0+numberOfGreens; i<NUMPIXELS; i++){
+   pixels.setPixelColor(i, RED);
+  }
+  pixels.show();
+}
+
+void startSequence(){
+ for(int j=0; j<10; j++){
+   lightAllLeds(BLUE);
+   delay(START_SEQUENCE_BLINK_DELAY);
+   lightAllLeds(OFF);
+   delay(START_SEQUENCE_BLINK_DELAY);
+ }
+}
+
+void lightAllLeds(uint32_t color) {
+ for(int i=0; i<NUMPIXELS; i++){
+   pixels.setPixelColor(i, color);
+  }
+  pixels.show();
+}
+
+


from now on we accept commands for all motors

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/trinamic/T-Bone.git/'


a better, smoother algorithm implemented

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/JackBDu/robot-tour-guide.git/'


ATWIN Kura Sample

ATWIN Kura Sample

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/TheBeachMaster/AfricasTalkingIOT.git/'


hmm, somehow we cannot set x_target in start config??


Blinking LED

Blinking LED

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

--- iot/iot.ino
+++ iot/iot.ino
@@ -0,0 +1,13 @@
+int led = 13;
+
+void setup() {
+  // Initialize LED output
+  pinMode(led, OUTPUT);
+}
+
+void loop() {
+  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
+  delay(1000);               // wait for a second
+  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
+  delay(1000);               // wait for a second
+}


Update line-following_withQTR.ino

Update line-following_withQTR.ino

error: pathspec 'code' did not match any file(s) known to git
error: pathspec 'dump/line-following_withQTR.ino' did not match any file(s) known to git


Initial commit from Vincent's source.

Initial commit from Vincent's source.

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

--- drone/WebServerESC/WebServerESC.ino
+++ drone/WebServerESC/WebServerESC.ino
@@ -0,0 +1,286 @@
+/*
+ * Allows control of an Electronic Speed Controller (ESC) via a web server.
+ * The request happens through a GET http method.
+ */
+
+#include <Servo.h>
+#include <WiServer.h>
+
+
+// Definizione Variabili Globali Stato Led
+byte thestart = 0;  // Stato led rosso
+
+
+
+#define WIRELESS_MODE_INFRA	1
+#define WIRELESS_MODE_ADHOC	2
+
+// Wireless configuration parameters ----------------------------------------
+unsigned char local_ip[] = {192,168,1,60};	// IP address of WiShield
+unsigned char gateway_ip[] = {192,168,1,254};	// router or gateway IP address
+unsigned char subnet_mask[] = {255,255,255,0};	// subnet mask for the local network
+const prog_char ssid[] PROGMEM = {"2WIRE689"};		// max 32 bytes
+
+unsigned char security_type = 2;	// 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2
+
+// WPA/WPA2 passphrase
+const prog_char security_passphrase[] PROGMEM = {"1872822821"};	// max 64 characters
+
+// WEP 128-bit keys
+// sample HEX keys
+prog_uchar wep_keys[] PROGMEM = { 0x83, 0x7A, 0xAF, 0x74, 0xEC,	// Key 0
+				  0x5F, 0xE5, 0x65, 0x9F, 0xF2,	// Key 1
+				  0x69, 0x61, 0x53, 0x1C, 0x51, // Key 2
+				  0xB5, 0x6F, 0xBE, 0xCB, 0x6B,	// Key 3
+				};
+
+// setup the wireless mode
+// infrastructure - connect to AP
+// adhoc - connect to another WiFi device
+unsigned char wireless_mode = WIRELESS_MODE_INFRA;
+
+unsigned char ssid_len;
+unsigned char security_passphrase_len;
+// End of wireless configuration parameters ----------------------------------------
+
+
+// This is our page serving function that generates web pages
+boolean sendMyPage(char* URL) {
+
+    // Check if the requested URL matches "/"
+    if (strcmp(URL, "/") == 0) {
+        Invia_Pagina_Web();
+        // URL was recognized
+        return true;
+    }
+
+
+    // Se URL richieso corrisponde a "?OPERATION=ACCENDI_ROSSO
+	  if (strcmp (URL, "/?OPERATION=OFF") == 0) {
+           thestart = 1;
+           Invia_Pagina_Web();
+	   move_to_start();
+
+
+	    return (true);
+	  }
+
+	  // Se URL richieso corrisponde a "?OPERATION=SPEGNI_ROSSO"
+	  if (strcmp (URL, "/?OPERATION=ON") == 0) {
+	    thestart = 0;
+            Invia_Pagina_Web();
+	    move_to_end();
+	    return (true);
+	  }
+
+
+	  if (strcmp (URL, "/?OPERATION=90") == 0) {
+	    thestart = 0;
+	    Invia_Pagina_Web();
+            move_to_ninty();
+	    return (true);
+	  }
+
+
+
+
+    // URL not found
+    return false;
+}
+
+
+
+int PIN_BLUEII = 8;
+int PIN_RED = 7;
+
+int greenVal = 1;   // Initial values are Red full, Green and Blue off
+int i = 0;     // Loop counter
+
+int ledPin = 13; // pin for the LED
+int buttonPin = 6; // input pin of pushbutton
+int val = 0; // variable for reading the pin status
+
+
+
+
+
+// IP Address for www.weather.gov
+uint8 ip[] = {184,168,17,1};
+
+// A request that gets the latest METAR weather data for LAX
+//GETrequest getWeather(ip, 80, "www.onebuttonalert.com", "/makevoicecall/?accesscode=iHHusuLm2uNe&customersid=14");
+
+//GETrequest getWeathersms(ip, 80, "www.onebuttonalert.com", "/makesmsnow/?accesscode=iHHusuLm2uNe&customersid=14");
+
+
+
+
+
+// This is our motor.
+Servo myMotor;
+
+// This is the final output
+// written to the motor.
+String incomingString;
+
+void arm(){
+  // arm the speed controller, modify as necessary for your ESC
+  setSpeed(0);
+  delay(3000); //delay 1 second,  some speed controllers may need longer
+}
+
+void setSpeed(int speed){
+  // speed is from 0 to 100 where 0 is off and 100 is maximum speed
+  //the following maps speed values of 0-100 to angles from 0-180,
+  // some speed controllers may need different values, see the ESC instructions
+  int angle = map(speed, 0, 100, 0, 180);
+  myMotor.write(angle);
+}
+
+
+
+
+void setup() {
+
+  // Put the motor to Arduino pin #9
+  myMotor.attach(8);
+  arm();
+  myMotor.write(70);
+
+  // Required for I/O from Serial monitor
+  Serial.begin(57600);
+  Serial.println("Starting WiFi");
+  // Print a startup message
+ // Serial.println("initializing");
+
+  // pinMode(PIN_BLUEII, OUTPUT);
+//   pinMode(PIN_RED , OUTPUT);
+ //  pinMode(ledPin, OUTPUT); // declare LED as output
+  // pinMode(buttonPin, INPUT); // declare pushbutton as input
+
+
+  // Initialize WiServer and have it use the sendMyPage function to serve pages
+  WiServer.init(sendMyPage);
+
+  // Enable Serial output and ask WiServer to generate log messages (optional)
+ // Serial.begin(9600);  // ...set up the serial ouput on 0004 style
+  //Serial.begin(57600);
+  WiServer.enableVerboseMode(false);
+}
+
+
+
+
+
+void loop(){
+
+  //val = digitalRead(buttonPin); // read input value
+
+//if (val == HIGH) { // check if the input is HIGH (button released)
+//digitalWrite(PIN_BLUEII, LOW); // turn LED OFF
+
+//} else {
+//digitalWrite(PIN_BLUEII, HIGH ); // turn LED ON
+
+ // a request to server page to make a sms
+  // getWeathersms.submit();
+
+  // getWeather.submit();
+ //  delay(50);
+
+    // A request to server page make a call
+ //  getWeather.submit();
+
+
+//}
+
+  // Run WiServer
+  WiServer.server_task();
+  delay(10);
+
+
+
+
+}
+
+
+
+
+	void Invia_Pagina_Web() {
+	  // Usando le funzioni WiServer.print trasmette al pagina Web da visualizzare
+	  WiServer.print ("");
+	  WiServer.print ("");
+WiServer.print ("<meta http-equiv=""content-type"" content=""text/html; charset=utf-8"" />");
+//WiServer.print ("<meta http-equiv=""refresh"" content=""25;url=http://192.168.1.60"" />");
+WiServer.print ("<title>OneButtonAlert Device</title>");
+//WiServer.print ("<link rel=""stylesheet"" type=""text/css"" media=""One Button Alert"" href=""http://onebuttonalert.com/buttonpressed/demo.css"" />");
+
+
+
+	  WiServer.print ("");
+	  WiServer.print ("
");
+
+
+
+	 // WiServer.print ("

");
+	  WiServer.print ("
");
+	  WiServer.print ("
");
+	  WiServer.print ("Device Local IP Address Status
");
+	  WiServer.print ("");
+
+          WiServer.print (local_ip[0], DEC);
+	  WiServer.print (".");
+	  WiServer.print (local_ip[1], DEC);
+	  WiServer.print (".");
+	  WiServer.print (local_ip[2], DEC);
+	  WiServer.print (".");
+	  WiServer.print (local_ip[3], DEC);
+
+          WiServer.print ("
");
+
+	  if (thestart == 0) {
+	   WiServer.print ("
<form>Engine Motor - ON
");
+	   WiServer.print ("<method=GET>");
+           WiServer.print ("<select name=""OPERATION"" id=""OPERATION"" style=""font-size:50px""><option value=""OFF"">Turn ON</option><option value=""ON"">Turn OFF</option><option value=""90"">90</option></select>");
+	   WiServer.print ("
<input type=submit value=SUBMIT style=""font-size:50px"">
</form>

");
+	 }
+	  else {
+	   WiServer.print ("
<form> Engine Motor - OFF
");
+	   WiServer.print ("<method=GET>");
+           WiServer.print ("<select name=""OPERATION"" id=""OPERATION"" style=""font-size:50px""><option value=""OFF"">Turn ON</option><option value=""ON"">Turn OFF</option><option value=""90"">90</option></select>");
+          // WiServer.print ("<select name=""OPERATION"" id=""OPERATION"" style=""font-size:50px""><option value=""OFF"">Turn OFF</option><option value=""90"">POWER UP</option></select>");
+	   WiServer.print ("<input type=submit value=SUBMIT ></form>

");
+	 }
+
+
+	  WiServer.print ("
");
+	}
+
+
+
+	void move_to_start() {
+
+         myMotor.write(80);
+
+
+
+//delay(500); // delay 1000ms, this allows the previous instruction to be finished.
+
+	}
+
+	// Spegne il led rosso
+	void move_to_end() {
+
+         myMotor.write(70);
+
+
+	}
+
+
+
+	void move_to_ninty() {
+
+         myMotor.write(90);
+
+
+	}


"Hello World" test

"Hello World" test

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

--- sketches/tests/hello/hello.ino
+++ sketches/tests/hello/hello.ino
@@ -0,0 +1,15 @@
+/**
+ * The usual "Hello World" to show the JeeNode
+ * can at least talk out the serial interface.
+ *
+ * 2015-08-14 <bill@jamimi.com> http://opensource.org/licenses/mit-license.php
+ */
+
+void setup () {
+  Serial.begin(57600);
+}
+
+void loop () {
+  Serial.println("Hello, world");
+  delay(1000);
+}


Added example to test servo in combination with FSR.

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

--- examples/fsr_servo_example/fsr_servo_example.ino
+++ examples/fsr_servo_example/fsr_servo_example.ino
@@ -0,0 +1,41 @@
+/* FSR testing sketch.
+
+Connect one end of FSR to 5V, the other end to Analog 0.
+Then connect one end of a 20K resistor from Analog 0 to ground
+Connect Servo data pin to pin 3 on the Arduino. */
+
+
+#include <Servo.h>
+
+#define fsrAnalogPin A0 // FSR is connected to analog 0
+#define servoPin 3 // Servo connected to pin 3
+
+Servo myservo;  // create servo object to control a servo
+// twelve servo objects can be created on most boards
+
+int fsrReading;      // the analog reading from the FSR resistor divider
+bool isClosed = false;
+
+void setup(void) {
+  Serial.begin(9600);   // We'll send debugging information via the Serial monitor
+  myservo.attach(servoPin);
+}
+
+void loop(void) {
+  fsrReading = analogRead(fsrAnalogPin);
+  Serial.print("Analog reading = ");
+  Serial.println(fsrReading);
+
+  if(fsrReading > 200){
+    if(!isClosed){
+      delay(10000);
+      myservo.write(170);
+      isClosed = true;
+    }
+  } else {
+    myservo.write(0);
+    isClosed = false;
+  }
+
+  delay(100);
+}


add neo pixel test

add neo pixel test

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

--- testing/arduino/NeoPixel.ino
+++ testing/arduino/NeoPixel.ino
@@ -0,0 +1,134 @@
+#include <Adafruit_NeoPixel.h>
+#ifdef __AVR__
+  #include <avr/power.h>
+#endif
+
+#define PIN 6
+
+// Parameter 1 = number of pixels in strip
+// Parameter 2 = Arduino pin number (most are valid)
+// Parameter 3 = pixel type flags, add together as needed:
+//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
+//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
+//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
+//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
+//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
+Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);
+
+// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
+// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
+// and minimize distance between Arduino and first pixel.  Avoid connecting
+// on a live circuit...if you must, connect GND first.
+
+void setup() {
+  // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
+  #if defined (__AVR_ATtiny85__)
+    if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
+  #endif
+  // End of trinket special code
+
+
+  strip.begin();
+  strip.show(); // Initialize all pixels to 'off'
+}
+
+void loop() {
+  // Some example procedures showing how to display to the pixels:
+  colorWipe(strip.Color(255, 0, 0), 50); // Red
+  colorWipe(strip.Color(0, 255, 0), 50); // Green
+  colorWipe(strip.Color(0, 0, 255), 50); // Blue
+//colorWipe(strip.Color(0, 0, 0, 255), 50); // White RGBW
+  // Send a theater pixel chase in...
+  theaterChase(strip.Color(127, 127, 127), 50); // White
+  theaterChase(strip.Color(127, 0, 0), 50); // Red
+  theaterChase(strip.Color(0, 0, 127), 50); // Blue
+
+  rainbow(20);
+  rainbowCycle(20);
+  theaterChaseRainbow(50);
+}
+
+// Fill the dots one after the other with a color
+void colorWipe(uint32_t c, uint8_t wait) {
+  for(uint16_t i=0; i<strip.numPixels(); i++) {
+    strip.setPixelColor(i, c);
+    strip.show();
+    delay(wait);
+  }
+}
+
+void rainbow(uint8_t wait) {
+  uint16_t i, j;
+
+  for(j=0; j<256; j++) {
+    for(i=0; i<strip.numPixels(); i++) {
+      strip.setPixelColor(i, Wheel((i+j) & 255));
+    }
+    strip.show();
+    delay(wait);
+  }
+}
+
+// Slightly different, this makes the rainbow equally distributed throughout
+void rainbowCycle(uint8_t wait) {
+  uint16_t i, j;
+
+  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
+    for(i=0; i< strip.numPixels(); i++) {
+      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
+    }
+    strip.show();
+    delay(wait);
+  }
+}
+
+//Theatre-style crawling lights.
+void theaterChase(uint32_t c, uint8_t wait) {
+  for (int j=0; j<10; j++) {  //do 10 cycles of chasing
+    for (int q=0; q < 3; q++) {
+      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
+        strip.setPixelColor(i+q, c);    //turn every third pixel on
+      }
+      strip.show();
+
+      delay(wait);
+
+      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
+        strip.setPixelColor(i+q, 0);        //turn every third pixel off
+      }
+    }
+  }
+}
+
+//Theatre-style crawling lights with rainbow effect
+void theaterChaseRainbow(uint8_t wait) {
+  for (int j=0; j < 256; j++) {     // cycle all 256 colors in the wheel
+    for (int q=0; q < 3; q++) {
+      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
+        strip.setPixelColor(i+q, Wheel( (i+j) % 255));    //turn every third pixel on
+      }
+      strip.show();
+
+      delay(wait);
+
+      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
+        strip.setPixelColor(i+q, 0);        //turn every third pixel off
+      }
+    }
+  }
+}
+
+// Input a value 0 to 255 to get a color value.
+// The colours are a transition r - g - b - back to r.
+uint32_t Wheel(byte WheelPos) {
+  WheelPos = 255 - WheelPos;
+  if(WheelPos < 85) {
+    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
+  }
+  if(WheelPos < 170) {
+    WheelPos -= 85;
+    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
+  }
+  WheelPos -= 170;
+  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
+}


Arduino sketch for IoT & APRS

Arduino sketch for IoT & APRS

This sketch reports your weather data to bit ThingSpeak and APRS-IS.

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/W4KRL/D1M-WX1-Weather-Station.git/'


jerk is only read for controlled motors

jerk is only read for controlled motors


* 첫 커밋

* 첫 커밋

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

--- Arduino/Arduino.ino
+++ Arduino/Arduino.ino
@@ -0,0 +1,422 @@
+#include <SoftwareSerial.h>
+#include <EEPROM.h>
+
+#define WIFI_RX 2
+#define WIFI_TX 3
+
+#define FAN_CTR 9
+#define PW_CTR 6
+
+#define LED_PIN 13
+#define RESET_PIN 0
+#define DHT22_PIN 7
+#define WATERGAUGE_PIN 2
+
+#define BUFF_SIZE 512
+#define DEBUG
+
+#define RES_OK "\r\nOK"
+#define RES_OK_LEN 4
+#define RES_ERROR "\r\nERROR"
+#define RES_ERROR_LEN 7
+#define RES_NC "no change\r\n"
+#define RES_NC_LEN 11
+#define RES_UNKNOWN "\r\n"
+#define RES_UNKNOWN_LEN 2
+
+#define VER 102
+#define MODE_BOOT 0
+#define MODE_SETUP 1
+#define MODE_RUN 2
+#define MODE_ERROR 3
+
+#define DELAY_PUSH_SETUP 5000
+#define DELAY_LED_SETUP 500
+
+typedef struct Config {
+  uint8_t version = VER;
+  uint8_t mode = MODE_BOOT;
+  char ssid[32] = "unknown";
+  char pass[32] = "unknown";
+  char serverAddr[64] = "unknown";
+  int port = 80;
+  uint8_t tailVersion = VER;
+} CONFIG;
+
+
+
+uint8_t sendATCmd(const char* cmd,int timeout = 0,uint8_t* buffer = NULL, int bufSize = 16);
+uint8_t checkResString(char ch, uint8_t idx);
+void intoSetupMode();
+void setMode();
+void showStatusLed();
+void saveData(const void* data, int start, int length);
+void loadData(void* data, int offset, int length);
+bool checkConfig(CONFIG* config);
+void printConfig(CONFIG* config);
+
+
+CONFIG _config;
+SoftwareSerial wifi(WIFI_RX, WIFI_TX);
+long _lastClickMillis = 0;
+long _lastOnLedMillis = 0;
+int _bufferIdx = 0;
+uint8_t _buffer[BUFF_SIZE];
+
+
+
+
+void setup() {
+  pinMode(LED_PIN,OUTPUT);
+  //pinMode(RESET_PIN,INPUT);
+  wifi.begin(9600);
+  #ifdef DEBUG
+    Serial.begin(9600);
+    Serial.println("debug :: Ready..");
+  #endif
+  loadData(&_config, 0, sizeof(_config));
+  if(!checkConfig(&_config)) {
+    _config = Config();
+    #ifdef DEBUG
+    Serial.println("debug :: FAIL LOAD CONFIG");
+    printConfig(&_config);
+    #endif
+  }
+  #ifdef DEBUG
+  else {
+    printConfig(&_config);
+  }
+  #endif
+
+
+
+
+}
+
+void loop() {
+   if(analogRead(RESET_PIN) > 400) {
+      if(_lastClickMillis == 0) {
+         #ifdef DEBUG
+          Serial.println("debug : down reset");
+         #endif
+         _lastClickMillis = millis();
+      } else if(millis() - _lastClickMillis > DELAY_PUSH_SETUP) {
+        intoSetupMode();
+      }
+   } else if(_config.mode != MODE_SETUP)  {
+      //reset();
+   } else {
+      _lastClickMillis = 0;
+      #ifdef DEBUG
+      //Serial.println("debug : up reset");
+      #endif
+   }
+   showStatusLed();
+
+   if(_config.mode == MODE_SETUP && wifi.available()) {
+      byte data = wifi.read();
+      _buffer[_bufferIdx % BUFF_SIZE] = data;
+      _bufferIdx++;
+      #ifdef DEBUG
+        Serial.write((char)data);
+      #endif
+      /*if(.find("+IPD,")) {
+         int connectionId = esp8266.read()-48; // subtract 48 because the read() function returns
+                                               // the ASCII decimal value and 0 (the first decimal number) starts at 48
+         String webpage = "
Hello
&lth2>World!
<button>LED1</button>";
+         String cipSend = "AT+CIPSEND=";
+         cipSend += connectionId;
+         cipSend += ",";
+         cipSend +=webpage.length();
+         cipSend +="\r\n";
+         sendData(cipSend,1000,DEBUG);
+         sendData(webpage,1000,DEBUG);
+         webpage="<button>LED2</button>";
+         cipSend = "AT+CIPSEND=";
+         cipSend += connectionId;
+         cipSend += ",";
+         cipSend +=webpage.length();
+         cipSend +="\r\n";
+
+         sendData(cipSend,1000,DEBUG);
+         sendData(webpage,1000,DEBUG);
+
+         String closeCommand = "AT+CIPCLOSE=";
+         closeCommand+=connectionId; // append connection id
+         closeCommand+="\r\n";
+         sendData(closeCommand,3000,DEBUG);
+      }*/
+   }
+
+
+}
+
+
+void showStatusLed() {
+  int delayMillis = 0;
+  if(_config.mode == MODE_SETUP) {
+    delayMillis = DELAY_LED_SETUP;
+  }
+  if(millis() - _lastOnLedMillis < delayMillis) {
+        digitalWrite(LED_PIN, HIGH);
+   } else if(millis() - _lastOnLedMillis < (delayMillis + delayMillis))  {
+      digitalWrite(LED_PIN, LOW);
+   } else if(millis() - _lastOnLedMillis > (delayMillis + delayMillis))  {
+      _lastOnLedMillis = millis();
+      digitalWrite(LED_PIN, HIGH);
+   }
+}
+void setMode() {
+  if(_config.mode == MODE_SETUP) {
+      intoSetupMode();
+  }
+}
+
+void intoSetupMode() {
+  if(_config.mode == MODE_SETUP) return;
+  _config.mode = MODE_SETUP;
+  saveData(&_config,0,sizeof(_config));
+  sendATCmd("AT+RST\r\n", 2000);
+  sendATCmd("AT+CWMODE=2\r\n");
+  sendATCmd("AT+CIPMUX=1\r\n");
+  sendATCmd("AT+CIPSERVER=1,80\r\n");
+}
+
+uint8_t sendATCmd(const char* cmd,int timeout,uint8_t* buffer, int bufSize) {
+  boolean isBufferAllocationed = false;
+  int bufIdx = 0;
+  uint8_t resIdx = 0;
+  uint8_t data = 0;
+  uint8_t result = 0;
+  long lastMs = millis();
+  wifi.print(cmd);
+  if(buffer == NULL) {
+     buffer = new uint8_t[bufSize];
+     isBufferAllocationed = true;
+  }
+  while(!wifi.available() && (millis() - lastMs < timeout || timeout == 0));
+  while(millis() - lastMs < timeout || timeout == 0) {
+    while(wifi.available()) {
+       data = wifi.read();
+       #ifdef DEBUG
+        Serial.write((char)data);
+       #endif
+       buffer[bufIdx % bufSize] = data;
+       bufIdx++;
+       if(timeout == 0) {
+         result = checkResString(data, resIdx++);
+         if(result == 0) {
+            resIdx = 0;
+         } else if((result & 0x80) == 0x80) {
+            result = result & 0x7f;
+            #ifdef DEBUG
+              Serial.println();
+              if(result == RES_OK_LEN)
+                  Serial.println("debug :: OK res checked.");
+              else if(result == RES_ERROR_LEN)
+                  Serial.println("debug :: ERROR res check. ");
+              else if(result == RES_NC_LEN)
+                  Serial.println("debug :: no change res checked.");
+            #endif
+            timeout = 1;
+            break;
+         }
+       }
+    }
+  }
+  while(wifi.available()) {
+     wifi.read();
+  }
+  if(isBufferAllocationed) {
+    delete[] buffer;
+  }
+  return result;
+}
+
+uint8_t checkResString(char ch, uint8_t idx) {
+  if(idx < RES_UNKNOWN_LEN && ch == RES_UNKNOWN[idx]) {
+     return RES_UNKNOWN_LEN;
+  } else if(idx < RES_OK_LEN && ch == RES_OK[idx]) {
+     if(idx == RES_OK_LEN - 1) {
+       return RES_OK_LEN | 0x80;
+     }
+     return RES_OK_LEN;
+  } else if(idx < RES_ERROR_LEN && ch == RES_ERROR[idx]) {
+    if(idx == RES_ERROR_LEN - 1) {
+       return RES_ERROR_LEN | 0x80;
+     }
+     return RES_ERROR_LEN;
+  } else if(idx < RES_NC_LEN && ch == RES_NC[idx]) {
+    if(idx == RES_NC_LEN - 1) {
+       return RES_NC_LEN | 0x80;
+     }
+     return RES_NC_LEN;
+  }
+  return 0;
+}
+
+
+void loadData(void* data, int offset, int length) {
+    uint8_t* pos = (uint8_t*)data;
+    for(int i = 0; --length; ++i,++pos) {
+       *pos = EEPROM.read(i);
+    }
+}
+
+void saveData(const void* data, int start, int length) {
+  const uint8_t* pos = (const uint8_t*)data;
+  Serial.println(length);
+  int ln = length;
+  for(int i = start; --length; ++i,++pos) {
+      EEPROM.write(i, *pos);
+  }
+  #ifdef DEBUG
+      Serial.begin(9600);
+      Serial.println("debug :: config saved");
+   #endif
+}
+
+bool checkConfig(CONFIG* config) {
+  return config->tailVersion == VER && config->version == VER;
+}
+
+void printConfig(CONFIG* config) {
+  Serial.println("debug :: version - " + String(config->version));
+  Serial.println("debug :: version2 - " + String(config->tailVersion));
+  Serial.println("debug :: mode - " + String(config->mode));
+  Serial.println("debug :: ssid - " + String(config->ssid));
+  Serial.println("debug :: pass - " + String(config->pass));
+  Serial.println("debug :: serverAddr - " + String(config->serverAddr));
+  Serial.println("debug :: port - " + String(config->port));
+}
+
+/*
+  byte buffer[256];
+  SwSerial.print("AT+CIPSTART=\"TCP\",\"httpbin.org\",80\r\n");
+  delay(2000);
+  while(!SwSerial.available());
+  while(SwSerial.available()) {
+      Serial.print((char)SwSerial.read());
+  }
+  String cmd = "GET /ip HTTP/1.0\r\n\r\n";
+  SwSerial.print("AT+CIPSEND=");
+  SwSerial.print(cmd.length());
+  SwSerial.print("\r\n");
+
+  if (SwSerial.find(">")) {
+    Serial.print(">");
+  }
+  else {
+    SwSerial.print("AT+CIPCLOSE=AT+CIPCLOSE\r\n");
+    Serial.println("connect timeout");
+    delay(1000);
+    return;
+  }
+
+  SwSerial.print(cmd);
+  long lastMs = millis();
+  while(!SwSerial.available());
+  while(millis() - lastMs < 5000) {
+      if(SwSerial.available()) {
+        byte data = SwSerial.read();
+        Serial.print((char)data);
+      }
+  }
+  Serial.println("====");
+  delay(1000);
+
+
+
+  SwSerial.print("AT+CIPCLOSE=AT+CIPCLOSE\r\n");
+
+  while(!SwSerial.available());
+  while(millis() - lastMs < 5000) {
+      if(SwSerial.available()) {
+        byte data = SwSerial.read();
+        Serial.print((char)data);
+      }
+  }*/
+  /*
+   // 시리얼 버퍼를 비운다.
+    int delayt = 0;
+   Serial.flush();
+   byte buffer[10];
+   int idx = 0;
+   Serial.print("dealy : ");
+   // 버퍼에 값이 들어올 때 까지 대기.
+   while(!Serial.available());
+   // HC-06 으로 명령어를 날린다.
+   while(Serial.available()) {
+      Serial.readBytes(buffer, 10);
+   }
+   String aa = "";
+   aa += (char*)buffer;
+   delayt = aa.toInt();
+   Serial.println(delayt);
+   Serial.print("cmd : ");
+   // 버퍼에 값이 들어올 때 까지 대기.
+   while(!Serial.available());
+   // HC-06 으로 명령어를 날린다.
+   while(Serial.available()) {
+      data = Serial.read();
+      if(data == -1) break;
+      SwSerial.print(data);
+      Serial.print(data);
+      // 시리얼 통신에서는 9600bps 기준으로
+      // read 를 사용할 때 1ms 의 딜레이를 줘야 한다.
+      delayMicroseconds(84);
+   }
+   SwSerial.print("\r\n");
+   Serial.println();
+   // HC-06에서 처리할 시간을 준다.
+   Serial.print("return : ");
+   // HC-06 으로 부터 받아온 리턴 값을 출력한다.
+   while(!SwSerial.available()) {}
+   delayMicroseconds(84);
+   boolean isO = false;
+   boolean isK = false;
+   long lastMs = millis();
+   while((!isO || !isK) && millis() - lastMs < delayt) {
+      data = SwSerial.read();
+      if(data == -1) continue;
+      Serial.print(data);
+      //delayMicroseconds(84);
+
+
+      if(data == 'O') {
+        isO = true;
+      }
+      else if(isO && data == 'K') {
+        isK = true;
+      }
+      else {
+        isO = false;
+        isK = false;
+      }
+   }
+   Serial.print("\n\n");*/
+   /*
+   analogWrite(9,255);
+   analogWrite(6,255);
+  SwSerial.println("OKOK + 1\r\n");
+   // 데이터가 들어올때 까지 대기.
+  while(!SwSerial.available());
+  digitalWrite(ledPin, HIGH);
+  while(SwSerial.available()) {
+    data = SwSerial.read();
+    buffer[index++] = data;
+    // 버퍼가 꽉 찼거나 문자열이 끝났을 때,
+    // 루프에서 나간다.
+    if(index == BUFF_SIZE || data == '\0') break;
+    // 9600bps 기준으로 delay 를 1ms 을 줘야 한다.
+    delay(1);
+  }
+  // 블루투스를 통하여 받은 데이터를 되돌려준다.
+  for(uint8_t i = 0; i < index; ++i) {
+    SwSerial.write(buffer[i]);
+  }
+  SwSerial.print("\r\n");
+  index = 0;
+  int val = analogRead(1);
+  SwSerial.println(val);*/
+


Create dragino_rs485_mqtt.ino

Create dragino_rs485_mqtt.ino

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

--- au/dragino_rs485_mqtt.ino
+++ au/dragino_rs485_mqtt.ino
@@ -0,0 +1,173 @@
+#include "RS485_protocol.h"
+#include <SoftwareSerial.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <Process.h>
+#include "MQTTclient.h"
+
+const byte ENABLE_PIN = 4;
+const byte LED_PIN = 3;
+
+#define MQTT_HOST "190.97.168.236"
+char message_buff[100];
+
+int val1 = 0;
+int val2 = 0;
+int val3 = 0;
+int val4 = 0;
+long values []= {0,0,0,0};
+
+SoftwareSerial rs485 (9, 10);  // receive pin, transmit pin
+
+// callback routines
+
+void fWrite (const byte what)
+  {
+  rs485.write (what);
+  }
+
+int fAvailable ()
+  {
+  return rs485.available ();
+  }
+
+int fRead ()
+  {
+  return rs485.read ();
+  }
+
+void setup()
+{ Serial.begin(9600);
+  Bridge.begin();
+  mqtt.begin(MQTT_HOST, 1883);
+  rs485.begin (38400);
+  pinMode (ENABLE_PIN, OUTPUT);  // driver output enable
+ pinMode (LED_PIN, OUTPUT);  // built-in LED
+ mqtt.publish("test/uno", "OK dragino");
+ mqtt.subscribe("rr/temp", someEvent);
+}  // end of setup
+
+byte old_level = 0;
+
+void loop()
+{ mqtt.monitor();
+/*
+  long level = random(20,32);
+
+  if (level == old_level)
+    return;
+
+
+  byte msg [] = {
+     1,    // device 1
+     2,    // turn light on
+     level // to what level
+  };
+
+  // send to slave
+  digitalWrite (ENABLE_PIN, HIGH);  // enable sending
+  sendMsg (fWrite, msg, sizeof msg);
+  digitalWrite (ENABLE_PIN, LOW);  // disable sending
+
+  // receive response
+  byte buf [10];
+  byte received = recvMsg (fAvailable, fRead, buf, sizeof buf);
+
+  digitalWrite (LED_PIN, received == 0);  // turn on LED if error
+
+  // only send once per successful change
+  if (received)
+    old_level = level;*/
+
+}  // end of loop
+
+
+void someEvent(const String& topic, const String& subtopic, const String& message) {
+
+int i = 0;
+  for(i=0; i<32; i++) {
+    message_buff[i] = message[i];
+  }
+  message_buff[i] = '\0';
+
+
+  String pubString = "" + String(message) + "";
+   pubString.toCharArray(message_buff, pubString.length()+1);
+
+  Serial.print("topic: ");
+  Serial.println(topic);
+  Serial.print("message: ");
+  Serial.println(message);
+
+  //int integer = 25;
+ // String integer = hola;
+
+parse();
+
+//String msgStringi = String(message_buff);
+//int x = msgStringi.toInt();
+
+
+  mqtt.publish("test/dos", val3);
+long level = random(20,32);
+ byte msg [] = {
+     1,    // device 1
+     val1,    // turn light on
+     val2,
+     val3,
+     val4 // to what level
+  };
+
+  // send to slave
+  digitalWrite (ENABLE_PIN, HIGH);  // enable sending
+  sendMsg (fWrite, msg, sizeof msg);
+
+ //sendMsg (fWrite,(byte *) &message, sizeof msg);
+
+
+  digitalWrite (ENABLE_PIN, LOW);  // disable sending
+
+  // receive response
+  byte buf [10];
+  byte received = recvMsg (fAvailable, fRead, buf, sizeof buf);
+
+  digitalWrite (LED_PIN, received == 0);  // turn on LED if error
+
+  // only send once per successful change
+  if (received)
+    old_level = level;
+
+
+
+}
+
+void parse()
+{
+
+     char separator[] = ",";
+
+     char *result = NULL;
+     int index = 0;
+
+     result = strtok( message_buff, separator );
+     while( (result != NULL) && (index < 4) ) {
+       Serial.print(  result );
+       Serial.println( );
+     values[index++] = atol(result);    // become to values
+
+     result = strtok( NULL, separator );
+     }
+
+
+      val1 = values[0];
+      val2 = values[1];
+      val3 = values[2];
+      val4 = values[3];
+
+Serial.print("valor 1: "); Serial.println(val1);
+Serial.print("valor 2: "); Serial.println(val2);
+Serial.print("valor 3: "); Serial.println(val3);
+Serial.print("valor 4: "); Serial.println(val4);
+
+
+}


Add ESP32 example

Add ESP32 example

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

--- examples/Boards_WiFi/ESP32/ESP32.ino
+++ examples/Boards_WiFi/ESP32/ESP32.ino
@@ -0,0 +1,52 @@
+/**************************************************************
+ * Blynk is a platform with iOS and Android apps to control
+ * Arduino, Raspberry Pi and the likes over the Internet.
+ * You can easily build graphic interfaces for all your
+ * projects by simply dragging and dropping widgets.
+ *
+ *   Downloads, docs, tutorials: http://www.blynk.cc
+ *   Blynk community:            http://community.blynk.cc
+ *   Social networks:            http://www.fb.com/blynkapp
+ *                               http://twitter.com/blynk_app
+ *
+ * Blynk library is licensed under MIT license
+ * This example code is in public domain.
+ *
+ **************************************************************
+ * This example runs directly on ESP32 chip.
+ *
+ * You need to install this for ESP32 development:
+ *   https://github.com/espressif/arduino-esp32
+ *
+ * Please be sure to select the right ESP32 module
+ * in the Tools -> Board menu!
+ *
+ * Change WiFi ssid, pass, and Blynk auth token to run :)
+ *
+ **************************************************************/
+
+#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
+#include <WiFi.h>
+#include <WiFiClient.h>
+#include <BlynkSimpleEsp32.h>
+
+// You should get Auth Token in the Blynk App.
+// Go to the Project Settings (nut icon).
+char auth[] = "YourAuthToken";
+
+// Your WiFi credentials.
+// Set password to "" for open networks.
+char ssid[] = "YourNetworkName";
+char pass[] = "YourPassword";
+
+void setup()
+{
+  Serial.begin(9600);
+  Blynk.begin(auth, ssid, pass);
+}
+
+void loop()
+{
+  Blynk.run();
+}
+


Made a copy of lcd_nav.ino and modified it to use a Nokia 5110 display. It is using the driver from https://github.com/adafruit/Adafruit-PCD8544-Nokia-5110-LCD-library

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

--- examples/pcd8544_nav/pcd8544_nav.ino
+++ examples/pcd8544_nav/pcd8544_nav.ino
@@ -0,0 +1,173 @@
+/*
+ * pcd8544_nav.ino - Example code using the menu system library
+ *
+ * This example shows using the menu system with a pcd8544 LCD display
+ * (controlled over serial).
+ *
+ * Copyright (c) 2016 arduino-menusystem
+ * Licensed under the MIT license (see LICENSE)
+ */
+
+#include <MenuSystem.h>
+#include <SPI.h>
+#include <Adafruit_GFX.h>
+#include <Adafruit_PCD8544.h>
+
+// Menu variables
+MenuSystem ms;
+Menu mm("ROOT Title");
+MenuItem mm_mi1("Lvl1-Item1(I)");
+MenuItem mm_mi2("Lvl1-Item2(I)");
+Menu mu1("Lvl1-Item3(M)");
+MenuItem mu1_mi1("Lvl2-Item1(I)");
+
+// Software SPI (slower updates, more flexible pin options):
+// pin 7 - Serial clock out (SCLK)
+// pin 6 - Serial data out (DIN)
+// pin 5 - Data/Command select (D/C)
+// pin 4 - LCD chip select (CS)
+// pin 3 - LCD reset (RST)
+//Adafruit_PCD8544 lcd = Adafruit_PCD8544(7, 6, 5, 4, 3);
+
+// Hardware SPI (faster, but must use certain hardware pins):
+// SCK is LCD serial clock (SCLK) - this is pin 13 on Arduino Uno
+// MOSI is LCD DIN - this is pin 11 on an Arduino Uno
+// pin 5 - Data/Command select (D/C)
+// pin 4 - LCD chip select (CS)
+// pin 3 - LCD reset (RST)
+Adafruit_PCD8544 lcd = Adafruit_PCD8544(5, 4, 3);
+// Note with hardware SPI MISO and SS pins aren't used but will still be read
+// and written to during SPI transfer.  Be careful sharing these pins!
+
+#define PCD8544_CHAR_HEIGHT 8
+
+// Menu callback function
+// In this example all menu items use the same callback.
+
+void on_item1_selected(MenuItem* p_menu_item)
+{
+  lcd.setCursor(0,2*PCD8544_CHAR_HEIGHT);
+  lcd.print("Item1 Selectd");
+  lcd.display();
+  delay(1500); // so we can look the result on the LCD
+}
+
+void on_item2_selected(MenuItem* p_menu_item)
+{
+  lcd.setCursor(0,2*PCD8544_CHAR_HEIGHT);
+  lcd.print("Item2 Selectd");
+  lcd.display();
+  delay(1500); // so we can look the result on the LCD
+}
+
+void on_item3_selected(MenuItem* p_menu_item)
+{
+  lcd.setCursor(0,2*PCD8544_CHAR_HEIGHT);
+  lcd.print("Item3 Selectd");
+  lcd.display();
+  delay(1500); // so we can look the result on the LCD
+}
+
+// Standard arduino functions
+
+void setup()
+{
+  Serial.begin(9600);
+  lcd.begin();
+  // you can change the contrast around to adapt the display
+  // for the best viewing!
+  lcd.setContrast(60);
+
+  #ifdef HIDE_SPLASH
+  lcd.clearDisplay();
+  #else
+  lcd.display(); // show splashscreen
+  delay(2000);
+  #endif // HIDE_SPLASH
+
+  lcd.setTextSize(1);
+
+  serialPrintHelp();
+  Serial.println("Setting up the menu.");
+  // Menu setup
+  /*
+  Menu Structure:
+   -Item1
+   -Item2
+   -Item3
+   --Item1
+
+   */
+  mm.add_item(&mm_mi1, &on_item1_selected);
+  mm.add_item(&mm_mi2, &on_item2_selected);
+  mm.add_menu(&mu1);
+  mu1.add_item(&mu1_mi1, &on_item3_selected);
+  ms.set_root_menu(&mm);
+  Serial.println("Menu setted.");
+  displayMenu();
+}
+
+void loop()
+{
+  // Handle serial commands
+  serialHandler();
+
+  // Wait for two seconds so the output is viewable
+  //delay(2000);
+}
+
+void displayMenu() {
+  lcd.clearDisplay();
+  lcd.setCursor(0,0*PCD8544_CHAR_HEIGHT);
+  // Display the menu
+  Menu const* cp_menu = ms.get_current_menu();
+
+  //lcd.print("Current menu name: ");
+  lcd.print(cp_menu->get_name());
+  lcd.setCursor(0,1*PCD8544_CHAR_HEIGHT);
+  lcd.print(cp_menu->get_selected()->get_name());
+  lcd.display();
+}
+
+void serialHandler() {
+  char inChar;
+  if((inChar = Serial.read())>0) {
+    switch (inChar) {
+    case 'w': // Previus item
+      ms.prev();
+      displayMenu();
+      break;
+    case 's': // Next item
+      ms.next();
+      displayMenu();
+      break;
+    case 'a': // Back pressed
+      ms.back();
+      displayMenu();
+      break;
+    case 'd': // Select pressed
+      ms.select();
+      displayMenu();
+      break;
+    case '?':
+    case 'h': // Display help
+      serialPrintHelp();
+      break;
+    default:
+      break;
+    }
+  }
+}
+
+void serialPrintHelp() {
+  Serial.println("***************");
+  Serial.println("w: go to previus item (up)");
+  Serial.println("s: go to next item (down)");
+  Serial.println("a: go back (right)");
+  Serial.println("d: select \"selected\" item");
+  Serial.println("?: print this help");
+  Serial.println("h: print this help");
+  Serial.println("***************");
+
+}
+


Added #4.

Added #4.

error: pathspec '4.Blink' did not match any file(s) known to git
error: pathspec 'LED' did not match any file(s) known to git
error: pathspec 'via' did not match any file(s) known to git
error: pathspec 'Internet.ino' did not match any file(s) known to git


ESP8266 BlinkWithoutDelay

ESP8266 BlinkWithoutDelay

error: pathspec 'hardware/esp8266com/esp8266/libraries/esp8266/examples/BlinkWithoutDelay/BlinkWithoutDelay.ino' did not match any file(s) known to git

--- hardware/esp8266com/esp8266/libraries/esp8266/examples/BlinkWithoutDelay/BlinkWithoutDelay.ino
+++ hardware/esp8266com/esp8266/libraries/esp8266/examples/BlinkWithoutDelay/BlinkWithoutDelay.ino
@@ -0,0 +1,33 @@
+/*
+ ESP8266 BlinkWithoutDelay by Simon Peter
+ Blink the blue LED on the ESP-01 module
+ Based on the Arduino Blink without Delay example
+ This example code is in the public domain
+*/
+
+const int ledPin =  1;  // The blue LED on the ESP-01 module is connected to GPIO1
+                        // (which is also the TXD pin; so we cannot use
+                        // Serial.print() at the same time
+
+int ledState = LOW;
+
+unsigned long previousMillis = 0;
+const long interval = 1000;
+
+void setup() {
+  pinMode(ledPin, OUTPUT);
+}
+
+void loop()
+{
+  unsigned long currentMillis = millis();
+  if(currentMillis - previousMillis >= interval) {
+    previousMillis = currentMillis;
+    if (ledState == LOW)
+      ledState = HIGH;  // Note that this switches the LED *off*
+    else
+      ledState = LOW;   // Note that this switches the LED *on*
+    digitalWrite(ledPin, ledState);
+  }
+}
+


Enhanced included example into Single Channel.

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

--- examples/SingleChannel/SingleChannel.ino
+++ examples/SingleChannel/SingleChannel.ino
@@ -0,0 +1,191 @@
+/**
+ * MIDI Leds example - Shows how all classes can be put together to create a nice MIDI Leds display controller.
+ * Because I only have a Teensy 3.1 available for testing, it is not guaranteed to work on other platforms.
+ * This Leds display controller also considers MIDI pedals for enhanced visualisation.
+ *
+ * This example uses only a single MIDI channel to work, making it simpler and easier to the eye.
+ *
+ * The event handling chain is as follows:
+ * MIDI input -> Damper Pedal -> Soft Pedal -> Sostenuto Pedal -> MidiLeds
+ *
+ * Hugo Hromic - http://github.com/hhromic
+ * MIT license
+ */
+
+#include <cmath>
+#include <Arduino.h>
+#include <FastLED.h>
+#include <MidiLeds.h>
+#include <MidiDamperPedal.h>
+#include <MidiSoftPedal.h>
+#include <MidiSostenutoPedal.h>
+
+#define DATA_PIN 2          // LED strip data pin
+#define STATUS_LED_PIN 13   // Teensy 3.1 onboard LED
+#define NOTE_MIN 0x15       // note 21 (first note on standard 88 keys keyboard)
+#define NOTE_MAX 0x6C       // note 108 (last note on standard 88 keys keyboard)
+#define NOTES_CHANNEL 1     // What MIDI channel to listen for notes and pedals?
+#define CONTROL_CHANNEL 16  // What MIDI channel to listen for parameter control?
+#define TIME_RANGE 5000     // Time range for setting parameters from MIDI control messages
+#define NUM_LEDS (NOTE_MAX - NOTE_MIN + 1)
+
+//***********************************************************************
+// Global objects
+
+elapsedMillis elapsedTime;
+CRGB leds[NUM_LEDS];
+MidiLeds midiLeds(leds, NOTE_MIN, NOTE_MAX);
+MidiDamperPedal damperPedal;
+MidiDamperPedal softPedal;
+MidiDamperPedal sostenutoPedal;
+
+//***********************************************************************
+// Main setup and loop functions
+// Make sure you check the FastLED.addLeds() function call.
+
+void setup() {
+    // Allow time for Leds power-up
+    delay(2000);
+    pinMode(STATUS_LED_PIN, OUTPUT);
+
+    // Init FastLED
+    FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
+    FastLED.setDither(0);
+    FastLED.setCorrection(TypicalSMD5050);
+
+    // Init pedals handlers
+    damperPedal.setHandleNoteOn(damperNoteOn);
+    damperPedal.setHandleNoteOff(damperNoteOff);
+    softPedal.setHandleNoteOn(softNoteOn);
+    sostenutoPedal.setHandleNoteOn(sostenutoNoteOn);
+    sostenutoPedal.setHandleNoteOff(sostenutoNoteOff);
+
+    // Init USB MIDI handlers
+    usbMIDI.setHandleNoteOn(onNoteOn);
+    usbMIDI.setHandleNoteOff(onNoteOff);
+    usbMIDI.setHandleControlChange(onControlChange);
+}
+
+void loop() {
+    digitalWrite(STATUS_LED_PIN, HIGH);
+    usbMIDI.read();
+    midiLeds.tick(elapsedTime);
+    FastLED.show();
+}
+
+//***********************************************************************
+// Message handlers for the pedals
+
+void damperNoteOn(uint8_t note, uint8_t velocity) {
+    softPedal.noteOn(note, velocity);
+}
+
+void damperNoteOff(uint8_t note) {
+    sostenutoPedal.noteOff(note);
+}
+
+void softNoteOn(uint8_t note, uint8_t velocity) {
+    sostenutoPedal.noteOn(note, velocity);
+}
+
+void sostenutoNoteOn(uint8_t note, uint8_t velocity) {
+    midiLeds.noteOn(note, velocity);
+}
+
+void sostenutoNoteOff(uint8_t note) {
+    midiLeds.noteOff(note);
+}
+
+//***********************************************************************
+// Message handlers for MIDI input
+
+void onNoteOn(uint8_t channel, uint8_t note, uint8_t velocity) {
+    if (channel == NOTES_CHANNEL)
+        damperPedal.noteOn(note, velocity);
+    digitalWrite(STATUS_LED_PIN, LOW);
+}
+
+void onNoteOff(uint8_t channel, uint8_t note, uint8_t velocity) {
+    if (channel == NOTES_CHANNEL)
+        damperPedal.noteOff(note);
+    digitalWrite(STATUS_LED_PIN, LOW);
+}
+
+void onControlChange(uint8_t channel, uint8_t control, uint8_t value)  {
+    // Process control channel controls
+    if (channel == CONTROL_CHANNEL) {
+        switch (control) {
+            case 0x00: // Bank Select
+                switch (value) {
+                    case 0x00: midiLeds.setColorMapper(MidiColorMapper::COLOR_MAP); initNotes(); break;
+                    case 0x01: midiLeds.setColorMapper(MidiColorMapper::RAINBOW); initNotes(); break;
+                    case 0x02: midiLeds.setColorMapper(MidiColorMapper::FIXED_COLOR); initNotes(); break;
+                }
+                break;
+            case 0x20: // Bank Select (fine)
+                switch (value) {
+                    case 0x00: midiLeds.setNoteColorMap(MidiNoteColors::AEPPLI_1940); initNotes(); break;
+                    case 0x01: midiLeds.setNoteColorMap(MidiNoteColors::BELMONT_1944); initNotes(); break;
+                    case 0x02: midiLeds.setNoteColorMap(MidiNoteColors::BERTRAND_1734); initNotes(); break;
+                    case 0x03: midiLeds.setNoteColorMap(MidiNoteColors::BISHOP_1893); initNotes(); break;
+                    case 0x04: midiLeds.setNoteColorMap(MidiNoteColors::FIELD_1816); initNotes(); break;
+                    case 0x05: midiLeds.setNoteColorMap(MidiNoteColors::HELMHOLTZ_1910); initNotes(); break;
+                    case 0x06: midiLeds.setNoteColorMap(MidiNoteColors::JAMESON_1844); initNotes(); break;
+                    case 0x07: midiLeds.setNoteColorMap(MidiNoteColors::KLEIN_1930); initNotes(); break;
+                    case 0x08: midiLeds.setNoteColorMap(MidiNoteColors::NEWTON_1704); initNotes(); break;
+                    case 0x09: midiLeds.setNoteColorMap(MidiNoteColors::RIMINGTON_1893); initNotes(); break;
+                    case 0x0A: midiLeds.setNoteColorMap(MidiNoteColors::SCRIABIN_1911); initNotes(); break;
+                    case 0x0B: midiLeds.setNoteColorMap(MidiNoteColors::SEEMANN_1881); initNotes(); break;
+                    case 0x0C: midiLeds.setNoteColorMap(MidiNoteColors::ZIEVERINK_2004); initNotes(); break;
+                }
+                break;
+            case 0x4D: // Vibrato Depth
+                midiLeds.setFixedHue(round(0xFF * (value * 1.0f / 0x7F))); initNotes(); break;
+            case 0x49: // Attack Time
+                midiLeds.setAttackTime(round(TIME_RANGE * (value * 1.0f / 0x7F))); break;
+            case 0x4B: // Decay Time
+                midiLeds.setDecayTime(round(TIME_RANGE * (value * 1.0f / 0x7F))); break;
+            case 0x46: // Sound Variation
+                midiLeds.setSustainLevel(1.0f * (value * 1.0f / 0x7F)); break;
+            case 0x48: // Release Time
+                midiLeds.setReleaseTime(round(TIME_RANGE * (value * 1.0f / 0x7F))); break;
+            case 0x47: // Timbre Intensity
+                midiLeds.setIgnoreVelocity(value < 0x40 ? false : true); break;
+            case 0x4A: // Brightness
+                midiLeds.setBaseBrightness(value); initNotes(); break;
+            case 0x7B: // All Notes Off
+                midiLeds.allNotesOff(); break;
+            case 0x79: // Reset All Controllers
+                midiLeds.resetAllControllers(); break;
+        }
+    }
+
+    // Process notes channel controls
+    if (channel == NOTES_CHANNEL) {
+        switch (control) {
+            case 0x40: // Damper Pedal
+                if (value < 0x40) damperPedal.release();
+                else damperPedal.press();
+                break;
+            case 0x42: // Sostenuto Pedal
+                if (value < 0x40) sostenutoPedal.release();
+                else sostenutoPedal.press();
+                break;
+            case 0x43: // Soft Pedal
+                if (value < 0x40) softPedal.release();
+                else softPedal.press();
+                break;
+        }
+    }
+    digitalWrite(STATUS_LED_PIN, LOW);
+}
+
+//***********************************************************************
+// Quickly send Note On and Note Off messages to re-init Leds
+
+void initNotes() {
+  for (uint8_t i=NOTE_MIN; i<=NOTE_MAX; i++) {
+    midiLeds.noteOn(i, 0x00);
+    midiLeds.noteOff(i);
+  }
+}


Environment sensors

Environment sensors

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

--- SensorimotorController/SenseAndMove/EnvironmentSensor.ino
+++ SensorimotorController/SenseAndMove/EnvironmentSensor.ino
@@ -0,0 +1,218 @@
+/**
+ * The S goes pulled down with 10k ohms resistence connected to ground.
+ * The S goes to A0, analog output (pulled down from the resistor).
+ *
+ * The (-) goes to 5V
+ *
+ * The middle is not being used.
+ *
+ * Callibration:
+ *
+ * Above light: 700
+ * Dark room: 500
+ * Lightern above: 1000
+ * Finger on top: 260
+ */
+
+#define c 261
+#define d 294
+#define e 329
+#define f 349
+#define g 391
+#define gS 415
+#define a 440
+#define aS 455
+#define b 466
+#define cH 523
+#define cSH 554
+#define dH 587
+#define dSH 622
+#define eH 659
+#define fH 698
+#define fSH 740
+#define gH 784
+#define gSH 830
+#define aH 880
+//frequencies for the tones we're going to use
+//used http://home.mit.bme.hu/~bako/tonecalc/tonecalc.htm to get these
+
+
+
+int photoresistorPin = A3; // analog input
+int sensorPin = A2;   // Analog input
+int speakerPin = 11;
+
+int soundSensorValue = 0;
+int minSoundThreshold = 54;
+
+double analogValue;
+double minLightValue = 650.0; // min analog value to turn on LED
+
+void setupEnvironmentSensor() {
+  // sets up pin input/output
+  pinMode(photoresistorPin, INPUT);
+  pinMode(sensorPin, INPUT);
+  pinMode(speakerPin, OUTPUT);
+}
+
+void beep (unsigned char speakerPin, int frequencyInHertz, long timeInMilliseconds)
+{
+    digitalWrite(ledPin, HIGH);
+    //use led to visualize the notes being played
+
+    int x;
+    long delayAmount = (long)(1000000/frequencyInHertz);
+    long loopTime = (long)((timeInMilliseconds*1000)/(delayAmount*2));
+    for (x=0;x<loopTime;x++)
+    {
+        digitalWrite(speakerPin,HIGH);
+        delayMicroseconds(delayAmount);
+        digitalWrite(speakerPin,LOW);
+        delayMicroseconds(delayAmount);
+    }
+
+    digitalWrite(ledPin, LOW);
+    //set led back to low
+
+    delay(20);
+    //a little delay to make all notes sound separate
+}
+
+
+void march()
+{
+    //for the sheet music see:
+    //http://www.musicnotes.com/sheetmusic/mtd.asp?ppn=MN0016254
+    //this is just a translation of said sheet music to frequencies / time in ms
+    //used 500 ms for a quart note
+
+    beep(speakerPin, a, 500);
+    beep(speakerPin, a, 500);
+    beep(speakerPin, a, 500);
+    beep(speakerPin, f, 350);
+    beep(speakerPin, cH, 150);
+
+    beep(speakerPin, a, 500);
+    beep(speakerPin, f, 350);
+    beep(speakerPin, cH, 150);
+    beep(speakerPin, a, 1000);
+    //first bit
+
+    beep(speakerPin, eH, 500);
+    beep(speakerPin, eH, 500);
+    beep(speakerPin, eH, 500);
+    beep(speakerPin, fH, 350);
+    beep(speakerPin, cH, 150);
+
+    beep(speakerPin, gS, 500);
+    beep(speakerPin, f, 350);
+    beep(speakerPin, cH, 150);
+    beep(speakerPin, a, 1000);
+    //second bit...
+
+    beep(speakerPin, aH, 500);
+    beep(speakerPin, a, 350);
+    beep(speakerPin, a, 150);
+    beep(speakerPin, aH, 500);
+    beep(speakerPin, gSH, 250);
+    beep(speakerPin, gH, 250);
+
+    beep(speakerPin, fSH, 125);
+    beep(speakerPin, fH, 125);
+    beep(speakerPin, fSH, 250);
+    delay(250);
+    beep(speakerPin, aS, 250);
+    beep(speakerPin, dSH, 500);
+    beep(speakerPin, dH, 250);
+    beep(speakerPin, cSH, 250);
+    //start of the interesting bit
+
+    beep(speakerPin, cH, 125);
+    beep(speakerPin, b, 125);
+    beep(speakerPin, cH, 250);
+    delay(250);
+    beep(speakerPin, f, 125);
+    beep(speakerPin, gS, 500);
+    beep(speakerPin, f, 375);
+    beep(speakerPin, a, 125);
+
+    beep(speakerPin, cH, 500);
+    beep(speakerPin, a, 375);
+    beep(speakerPin, cH, 125);
+    beep(speakerPin, eH, 1000);
+    //more interesting stuff (this doesn't quite get it right somehow)
+
+    beep(speakerPin, aH, 500);
+    beep(speakerPin, a, 350);
+    beep(speakerPin, a, 150);
+    beep(speakerPin, aH, 500);
+    beep(speakerPin, gSH, 250);
+    beep(speakerPin, gH, 250);
+
+    beep(speakerPin, fSH, 125);
+    beep(speakerPin, fH, 125);
+    beep(speakerPin, fSH, 250);
+    delay(250);
+    beep(speakerPin, aS, 250);
+    beep(speakerPin, dSH, 500);
+    beep(speakerPin, dH, 250);
+    beep(speakerPin, cSH, 250);
+    //repeat... repeat
+
+    beep(speakerPin, cH, 125);
+    beep(speakerPin, b, 125);
+    beep(speakerPin, cH, 250);
+    delay(250);
+    beep(speakerPin, f, 250);
+    beep(speakerPin, gS, 500);
+    beep(speakerPin, f, 375);
+    beep(speakerPin, cH, 125);
+
+    beep(speakerPin, a, 500);
+    beep(speakerPin, f, 375);
+    beep(speakerPin, c, 125);
+    beep(speakerPin, a, 1000);
+    //and we're done \ó/
+}
+
+
+bool isBarking() {
+  bool retval = false;
+  soundSensorValue = analogRead(sensorPin);
+
+  if (soundSensorValue>minSoundThreshold) {
+    digitalWrite (ledPin, HIGH);
+    beep(speakerPin, a, 10);
+    retval = true;
+  }
+
+  if (debug) { Serial.print("Sound:");Serial.println (soundSensorValue, DEC); }
+
+  sensor.sound = soundSensorValue;
+
+  return retval;
+}
+
+bool isDark() {
+  bool retval = false;
+  // reads analog input
+  analogValue = analogRead(photoresistorPin);
+  // if input is less than minLightValue turn on LED
+
+  if (analogValue < minLightValue) {
+    digitalWrite(ledPin, HIGH);
+    retval = true;
+  } else {
+     digitalWrite(ledPin, LOW);
+  }
+  if (debug) {Serial.println(analogValue);}
+
+  // reads photoresistor every half second
+  //delay(500);
+  sensor.light = analogValue;
+  return retval;
+}
+
+void buzz() {
+  beep(speakerPin, a, 300);
+}


Added a simple bit-banging PWM app to drive a piezoelectric speaker

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