Add ServoDiscovery example sketch

Add ServoDiscovery example sketch

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

--- examples/ServoDiscovery/ServoDiscovery.ino
+++ examples/ServoDiscovery/ServoDiscovery.ino
@@ -0,0 +1,226 @@
+#include <HalfDuplexHardwareSerial.h>
+
+#include <DynamixelBus.h>
+
+DynamixelBus dynamixel(Serial1);
+
+#define CONNECTED_SERVO_COUNT 4
+#define MAX_SERVO_ID 4
+
+const char* baudrate[] = {  "unknown", "9600", "19200", "57600", "115200", "200000", "250000", "400000", "500000", "1000000" };
+
+void report(uint8_t* ids, size_t index) {
+
+  uint8_t servoId = ids[index];
+
+  // The discovery operation will have saved the servo's baud rate
+  DynamixelBus::BaudRate baud;
+  dynamixel.getBaudRate(servoId,baud);
+
+  Serial.print(F("Servo #"));
+  Serial.println(servoId);
+
+  // Switch to the servo's baud rate
+  dynamixel.begin(baud);
+
+  // Uncomment the following two statements to change the servo baud rate
+  // dynamixel.setBaudRate(servoId,DynamixelBus::k115200);
+  // dynamixel.begin(DynamixelBus::k115200);
+
+  // Instruct the servo to respond to all instructions for testing purposes
+  dynamixel.setStatusReturnLevel(servoId,DynamixelBus::kRespondToAll);
+
+
+  // Uncomment the following to reset triggers to desired values
+  // dynamixel.setAlarmLedTriggers(servoId,DynamixelBus::kOverloadError | DynamixelBus::kTemperatureLimitError);
+  // dynamixel.setAlarmShutdownTriggers(servoId,DynamixelBus::kOverloadError | DynamixelBus::kTemperatureLimitError);
+
+  // Now capture the current state of the servo..
+  // (No guarantee every one of these calls will succeed!)
+
+  uint16_t servoModelNumber = 12;
+  uint8_t servoFirmwareVersion = 0;
+  uint16_t servoReturnDelayTime = 0;
+  uint16_t servoMinAngle = 0;
+  uint16_t servoMaxAngle = 0;
+  uint8_t servoTemperatureLimit = 0;
+  uint16_t servoLowVoltageLimit = 0;
+  uint16_t servoHighVoltageLimit = 0;
+  uint16_t servoInitialTorqueLimit = 0;
+  uint8_t servoAlarmLedTriggers = 0;
+  uint8_t servoAlarmShutdownTriggers = 0;
+  bool servoTorqueEnable = false;
+  uint8_t servoCWComplianceMargin = 0;
+  uint8_t servoCCWComplianceMargin = 0;
+  uint8_t servoCWComplianceSlope = 0;
+  uint8_t servoCCWComplianceSlope = 0;
+  uint16_t servoGoalPosition = 0;
+  uint16_t servoGoalSpeed = 0;
+  uint16_t servoTorqueLimit = 0;
+  uint16_t servoPresentPosition = 0;
+  uint16_t servoPresentSpeed = 0;
+  uint16_t servoPresentLoad = 0;
+  uint8_t servoPresentLoadDirection = 0;
+  uint16_t servoPresentVoltage = 0;
+  uint8_t servoPresentTemperature = 0;
+  bool servoLock = false;
+  uint16_t servoPunch = 0;
+
+  dynamixel.getModelNumber(servoId,servoModelNumber);
+  dynamixel.getFirmwareVersion(servoId,servoFirmwareVersion);
+  dynamixel.getReturnDelayTime(servoId,servoReturnDelayTime);
+  dynamixel.getAngleLimits(servoId,servoMinAngle,servoMaxAngle);
+  dynamixel.getTemperatureLimit(servoId,servoTemperatureLimit);
+  dynamixel.getVoltageLimits(servoId,servoLowVoltageLimit,servoHighVoltageLimit);
+  dynamixel.getInitialTorqueLimit(servoId,servoInitialTorqueLimit);
+  dynamixel.getAlarmLedTriggers(servoId,servoAlarmLedTriggers);
+  dynamixel.getAlarmShutdownTriggers(servoId,servoAlarmShutdownTriggers);
+  dynamixel.getTorqueEnable(servoId,servoTorqueEnable);
+  dynamixel.getComplianceMargins(servoId,servoCWComplianceMargin,servoCCWComplianceMargin);
+  dynamixel.getComplianceSlopes(servoId,servoCWComplianceSlope,servoCCWComplianceSlope);
+  dynamixel.getGoalPosition(servoId,servoGoalPosition);
+  dynamixel.getGoalSpeed(servoId,servoGoalSpeed);
+  dynamixel.getTorqueLimit(servoId,servoTorqueLimit);
+  dynamixel.getLock(servoId,servoLock);
+  dynamixel.getPunch(servoId,servoPunch);
+  dynamixel.getPresentPosition(servoId,servoPresentPosition);
+  dynamixel.getPresentSpeed(servoId,servoPresentSpeed);
+  dynamixel.getPresentLoad(servoId,servoPresentLoadDirection,servoPresentLoad);
+  dynamixel.getPresentVoltage(servoId,servoPresentVoltage);
+  dynamixel.getPresentTemperature(servoId,servoPresentTemperature);
+
+  Serial.println(F("------------------------------"));
+  Serial.print(F(": ID = "));
+  Serial.println(servoId);
+  Serial.print(F(": Baud Rate = "));
+  Serial.print(baudrate[baud]);
+  Serial.print(F(" ("));
+  Serial.print(baud);
+  Serial.println(F(")"));
+  Serial.print(F(": Model Number = "));
+  Serial.println(servoModelNumber);
+  Serial.print(F(": Firmware Version = "));
+  Serial.println(servoFirmwareVersion);
+  Serial.print(F(": Return Delay Time (usec) = "));
+  Serial.println(servoReturnDelayTime);
+  Serial.print(F(": Angle Limits: cw = "));
+  Serial.print(servoMinAngle);
+  Serial.print(F("/1023 ("));
+  Serial.print((servoMinAngle * 300L / 1023));
+  Serial.print(F("°)  ccw = "));
+  Serial.print(servoMaxAngle);
+  Serial.print(F("/1023 ("));
+  Serial.print((servoMaxAngle * 300L / 1023));
+  Serial.println("°)");
+  Serial.print(F(": Temperature Limit (C) = "));
+  Serial.println(servoTemperatureLimit);
+  Serial.print(F(": Voltage Limits (V): low = "));
+  Serial.print(servoLowVoltageLimit/1000.0);
+  Serial.print(F(" high = "));
+  Serial.println(servoHighVoltageLimit/1000.0);
+  Serial.print(F(": Initial Torque Limit (EEPROM) = "));
+  Serial.print(servoInitialTorqueLimit);
+  Serial.println(F("/1023"));
+  Serial.print(F(": Alarm LED Errors: "));
+  if (servoAlarmLedTriggers & DynamixelBus::kInstructionError) Serial.print(F("instruction, "));
+  if (servoAlarmLedTriggers & DynamixelBus::kOverloadError) Serial.print(F("overload, "));
+  if (servoAlarmLedTriggers & DynamixelBus::kChecksumError) Serial.print(F("checksum, "));
+  if (servoAlarmLedTriggers & DynamixelBus::kRangeError) Serial.print(F("range, "));
+  if (servoAlarmLedTriggers & DynamixelBus::kTemperatureLimitError) Serial.print(F("temperature, "));
+  if (servoAlarmLedTriggers & DynamixelBus::kAngleLimitError) Serial.print(F("angle, "));
+  if (servoAlarmLedTriggers & DynamixelBus::kVoltageLimitError) Serial.print(F("voltage"));
+  Serial.println();
+  Serial.print(F(": Alarm Shutdown Errors: "));
+  if (servoAlarmShutdownTriggers & DynamixelBus::kInstructionError) Serial.print(F("instruction, "));
+  if (servoAlarmShutdownTriggers & DynamixelBus::kOverloadError) Serial.print(F("overload, "));
+  if (servoAlarmShutdownTriggers & DynamixelBus::kChecksumError) Serial.print(F("checksum, "));
+  if (servoAlarmShutdownTriggers & DynamixelBus::kRangeError) Serial.print(F("range, "));
+  if (servoAlarmShutdownTriggers & DynamixelBus::kTemperatureLimitError) Serial.print(F("temperature, "));
+  if (servoAlarmShutdownTriggers & DynamixelBus::kAngleLimitError) Serial.print(F("angle, "));
+  if (servoAlarmShutdownTriggers & DynamixelBus::kVoltageLimitError) Serial.print(F("voltage"));
+
+  Serial.println();
+  Serial.print(F(": Torque Enable = "));
+  Serial.println(servoTorqueEnable ? F("true") : F("false"));
+  Serial.print(F(": Compliance Margins: cw = "));
+  Serial.print(servoCWComplianceMargin);
+  Serial.print(F(" ccw = "));
+  Serial.println(servoCCWComplianceMargin);
+  Serial.print(F(": Compliance Slopes: cw = "));
+  Serial.print(servoCWComplianceSlope);
+  Serial.print(F(" ccw = "));
+  Serial.println(servoCCWComplianceSlope);
+  Serial.print(F(": Goal Position = "));
+  Serial.print(servoGoalPosition);
+  Serial.println(F("/1023"));
+  Serial.print(F(": Goal Speed = "));
+  Serial.print(servoGoalSpeed);
+  Serial.println(F("/1023"));
+  Serial.print(F(": Torque Limit (RAM) = "));
+  Serial.print(servoTorqueLimit);
+  Serial.println(F("/1023"));
+  Serial.print(F(": Present Position = "));
+  Serial.println(servoPresentPosition);
+  Serial.print(F(": Present Speed = "));
+  Serial.println(servoPresentSpeed);
+  Serial.print(F(": Present Load = "));
+  Serial.print(servoPresentLoad);
+  Serial.print(F(" direction = "));
+  Serial.println(servoPresentLoadDirection);
+  Serial.print(F(": Present Voltage (Mv) = "));
+  Serial.println(servoPresentVoltage);
+  Serial.print(F(": Present Temperature (C) = "));
+  Serial.println(servoPresentTemperature);
+  Serial.print(F(": Lock = "));
+  Serial.println(servoLock ? F("true") : F("false"));
+  Serial.print(F(": Punch = "));
+  Serial.print(servoPunch);
+  Serial.println(F("/1023"));
+  Serial.println();
+
+}
+
+void setup() {
+
+  delay(1000);
+
+  Serial.begin(115200);
+  while(Serial.read() == -1);
+
+  Serial.println("DynamixelBus Servo Discovery\n");
+
+  dynamixel.begin(DynamixelBus::k1000000);
+
+  // Must call this method to update internal state even
+  // if the initial baud rate is incorrect as the DynamixelBus
+  // initially assumes a state of kRespondToNone.
+  dynamixel.setStatusReturnLevel(0xFE,DynamixelBus::kRespondToAll);
+  dynamixel.setMaxRetriesOnError(4);
+
+  // Flush input so we don't immediately repeat the discovery process
+  while(Serial.read() != -1);
+}
+
+bool doAgain = true;
+
+void loop() {
+
+  size_t servoCount = 0;
+  uint8_t servoIds[CONNECTED_SERVO_COUNT];
+
+  Serial.println("Starting servo discovery...");
+  servoCount = dynamixel.discover(servoIds,CONNECTED_SERVO_COUNT,MAX_SERVO_ID);
+  if (servoCount == 0) {
+    Serial.println("NO SERVOS WERE FOUND!");
+  }
+  else {
+    Serial.println();
+    for (size_t i=0; i < servoCount; i++) {
+      report(servoIds,i);
+    }
+    Serial.println("Servo discovery complete.");
+  }
+  Serial.println("Press a key to try again...");
+  while(Serial.read() == -1);
+
+}


Added communication with server

Added communication with server

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/MichalMares/Ardularm.git/'


Add tulang sensors

Add tulang sensors

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

--- chapter5/tulang/tulang.ino
+++ chapter5/tulang/tulang.ino
@@ -0,0 +1,26 @@
+int ASignal = A0;
+int LEDPin = 13;
+int val = 380;
+
+void setup() {
+  pinMode(LEDPin, OUTPUT);
+  pinMode(ASignal, INPUT);
+  digitalWrite(LEDPin,LOW);
+  Serial.begin(9600);
+
+}
+
+
+void loop() {
+  int sensorValue = analogRead(ASignal);
+  Serial.println(sensorValue);
+  if(analogRead(ASignal) > val) {
+    digitalWrite(LEDPin, HIGH);
+    delay(300);
+    digitalWrite(LEDPin, LOW);
+    delay(300);
+  } else {
+    digitalWrite(LEDPin,LOW);
+    delay(1000);
+  }
+}


fixed debug loop

fixed debug loop

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


Change Countdown.

Change Countdown.

Use only the first three columns of the 4x4 keypad, ignore ABCD.
Add 'DoNE' text when timer is complete.
Change entry cursor to an underbar.

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


arduino

arduino

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

--- ptp/ptp.ino
+++ ptp/ptp.ino
@@ -0,0 +1,299 @@
+
+#include <math.h>
+//bibliotecas para comunicação I2C com a Bússola HMC5883L
+#include <Wire.h>
+#include <HMC5883L.h>
+
+//controle de 2 DEBUGS dentro da programação
+//o primeiro para o recebimento de dados e outro para a saída respectivamente
+#define DEBUG0 1
+#define DEBUG1 0
+
+//pino do botão que liga ou desliga a thread t_pid
+#define BUTTON 12
+
+//máximo módulo recebido pelo vetor
+#define MODULE_MAX 50
+
+//'baudrate' da saída seria
+#define SERIAL 9600
+
+//número de repetições de leituras na bússola que serão feitas para se ter um valor de retorno
+#define COMPASS_TIME 150
+
+//define a potência mínima que o robô irá se mover
+#define PERCENT_MIN 20
+
+#define PID(a,b,c) a+b+c
+
+//pinos dos motores - ponte H
+int robot_out_0[2] = {3,4}, robot_out_1[2] = {5,6};
+
+float angle_begin, error_angle, error_motor[2], error_velo, m_value; //float de conversão do angulo e dos errors do pid
+
+float p_angle = 0, kp_angle = 1, i_angle = 0, ki_angle = 0;
+
+double v_in[2] = {0,0}, v_robot[2] = {1,0}; //vetores de entrada e do robo
+
+char x_axis[20] = {'0','\0'},  y_axis[20] = {'0','\0'};
+
+boolean button;
+
+HMC5883L compass; //Instância a biblioteca para a bússola
+
+void vector_in()
+{
+//receber o vetor até o ponto
+  char serial_in[20];
+  char c = 0;
+  byte index = 0;
+  while(Serial.available() > 0 && c != '|')
+  {
+    if(index < 19)
+    {
+      c = Serial.read();
+        x_axis[index] = c;
+        index++;
+        x_axis[index] = '\0';
+      }
+  }
+  x_axis[index-1] = '\0';
+
+  index = 0;
+  while(Serial.available() > 0)
+  {
+    if(index < 19)
+     {
+       c = Serial.read();
+       y_axis[index] = c;
+       index++;
+       y_axis[index] = '\0';
+      }
+   }
+  v_in[0] = atof(x_axis);
+  v_in[1] = atof(y_axis);
+
+  m_value = sqrt(pow(v_in[0], 2) + pow(v_in[1], 2));
+
+  if(m_value != 0)
+  {
+    v_in[0] /= m_value;
+    v_in[1] /= m_value;
+  }
+
+   //receber o vetor do robô
+   float angle;
+
+   angle = angle_begin - get_angle();
+
+   v_robot[0] = cos(angle);
+   v_robot[1] = sin(angle);
+
+   if(DEBUG0)
+   {
+    Serial.print(v_in[0]);
+    Serial.print("|");
+    Serial.print(v_in[1]);
+    Serial.print("| Module: ");
+    Serial.println(m_value);
+    Serial.print(v_robot[0]);
+    Serial.print("|");
+    Serial.println(v_robot[1]);
+   }
+}
+
+//função que recebe o ângulo da bússola
+float get_angle()
+{
+
+  float heading; //Variável para armazenar o valor aferido
+  float precisao; //Variável parar o melhorar a precisao do valor aferido
+
+  precisao = 0; //Zera a variável para uma nova leitura
+
+  for(int i=0;i<COMPASS_TIME;i++) //Faz a leitura 100 e armazenar a somatória
+  {
+
+    //Pega os dados necessários para o cálculo da bússola digital
+    MagnetometerScaled scaled = compass.ReadScaledAxis();
+    int MilliGauss_OnThe_XAxis = scaled.XAxis;
+    heading = atan2(scaled.YAxis, scaled.XAxis);
+    float declinationAngle = 0.3889; //Compensação dos polos (São Paulo - Recife)
+    heading += declinationAngle;
+
+    //Converte o valor aferido para angulo
+    if(heading < 0)
+    {
+      heading += 2*PI;
+    }
+
+    if(heading > 2*PI)
+    {
+      heading -= 2*PI;
+    }
+
+    precisao = precisao + heading;
+    delay(1);
+
+  }
+
+  heading = precisao/COMPASS_TIME; //Pega a somatória e tira a média dos valores aferidos
+  return heading;
+}
+
+void pid()
+{
+  double produtoe[2], angle_b;
+  float kp = 1;
+
+  double moviment_sig;
+
+  produtoe[0] = (v_in[0] * v_robot[0]) + (v_in[1] * v_robot[1]); //p.e. do angulo entre o vetor do robô e do vetor de posição recebido
+  produtoe[1] = (v_in[0] * (v_robot[0] * -1)) + (v_in[1] * (v_robot[1] * -1));//p.e. entre o vetor oposto ao robô e do vetor de posição recebido
+  if(acos(produtoe[0]) <= acos(produtoe[1]))
+  {
+    angle_b = acos(produtoe[0]);
+    moviment_sig = 1;
+  }
+  else
+  {
+    angle_b = acos(produtoe[1]);
+    moviment_sig = -1;
+  }
+
+  if(v_in[0] != 0 || v_in[1] != 0)
+    error_angle = angle_b/PI;
+  else
+  {
+    error_angle = 0;
+    i_angle = 0;
+  }
+
+  if(v_robot[0] > v_in[0]) error_angle *= -1; //cálculo do erro para ser aplicado no motor, dependente do ângulo
+
+  p_angle = error_angle * kp_angle;
+  error_angle = PID(p_angle, i_angle, 0); //aplicação da proporcional
+  error_angle = (error_angle - (-1)) * (100 - (-100)) / (1 - (-1)) + (-100);
+
+  error_velo = m_value; //cálculo do erro para ser aplicado no motor, dependente do módulo e da direção em relação ao eixo y
+  error_velo *= kp;
+  error_velo = (error_velo - 0) * ((255 - fabs(error_angle)) - 0) / (MODULE_MAX - 0);
+
+  error_motor[0] = (error_velo + error_angle) * moviment_sig; //saída nos motores proporcionais ao erro
+  error_motor[1] = (error_velo - error_angle) * moviment_sig;
+
+  if(error_motor[0] < ((PERCENT_MIN/100.0)*255.0) && error_motor[0] > ((-PERCENT_MIN/100.0)*255.0))
+    error_motor[0] = 0;
+  if(error_motor[1] < ((PERCENT_MIN/100.0)*255.0) && error_motor[1] > ((-PERCENT_MIN/100.0)*255.0))
+    error_motor[1] = 0;
+
+  if(DEBUG1)
+  {
+    Serial.print("|");
+    Serial.print(error_motor[0]);
+    Serial.print("| . |");             //debug serial sobre a movimentação dos motores
+    Serial.print(error_motor[1]);
+    Serial.println("|");
+  }
+
+  moviment();
+
+}
+
+// função que executa a movimentação do robô
+void moviment()
+{
+  //motor esquerda
+  if(error_motor[0] > 0)
+  {
+    analogWrite(robot_out_0[0], fabs(error_motor[0]));
+    digitalWrite(robot_out_0[1], LOW);
+  }
+  else if(error_motor[0] > 255)
+  {
+    analogWrite(robot_out_0[0], 255);
+    digitalWrite(robot_out_0[1], LOW);
+  }
+  else if(error_motor[0] < 0)
+  {
+    analogWrite(robot_out_0[1], fabs(error_motor[0]));
+    digitalWrite(robot_out_0[0], LOW);
+  }
+  else if(error_motor[0] < -255)
+  {
+    analogWrite(robot_out_0[1], 255);
+    digitalWrite(robot_out_0[0], LOW);
+  }
+  else
+  {
+    digitalWrite(robot_out_0[0], HIGH);
+    digitalWrite(robot_out_0[1], HIGH);
+  }
+
+  //motor direita
+  if(error_motor[0] > 0)
+  {
+    analogWrite(robot_out_1[0], fabs(error_motor[0]));
+    digitalWrite(robot_out_1[1], LOW);
+  }
+  else if(error_motor[0] > 255)
+  {
+    analogWrite(robot_out_1[0], 255);
+    digitalWrite(robot_out_1[1], LOW);
+  }
+  else if(error_motor[0] < 0)
+  {
+    analogWrite(robot_out_1[1], fabs(error_motor[0]));
+    digitalWrite(robot_out_1[0], LOW);
+  }
+  else if(error_motor[0] < -255)
+  {
+    analogWrite(robot_out_1[1], 255);
+    digitalWrite(robot_out_1[0], LOW);
+  }
+  else
+  {
+    digitalWrite(robot_out_1[0], HIGH);
+    digitalWrite(robot_out_1[1], HIGH);
+  }
+}
+
+
+void setup()
+{
+
+  for(int x = 0; x < 2; x++)
+  {
+    pinMode(robot_out_0[x], OUTPUT);
+    pinMode(robot_out_1[x], OUTPUT);
+  }
+
+  pinMode(BUTTON, INPUT);
+
+  Serial.begin(SERIAL);
+
+  Wire.begin(); //Inicia a comunicação o I2C
+
+//Configura a bússola
+  compass = HMC5883L();
+  compass.SetScale(1.3);
+  compass.SetMeasurementMode(Measurement_Continuous);
+
+  angle_begin = get_angle();//seta o cangulo inicial do robo
+}
+
+void loop()
+{
+  button = digitalRead(BUTTON);
+  double time_in_millis = millis();
+
+  vector_in();
+  pid();
+  time_in_millis = millis() - time_in_millis;
+  if(DEBUG0)
+  {
+    Serial.print("time:");
+    Serial.println(time_in_millis);
+  }
+}
+


Tidy up

Tidy up

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/freephases/lenr-logger.git/'


Update ArduinoDemo.ino

Update ArduinoDemo.ino

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


added timer and empty serial prints

added timer and empty serial prints

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


I thought of a way to calibrate the yaw to the direction of where the submarine is facing.

I have not check the code in reality. No rush, if it cannot work just
delete my changes.


Remove encoder interference

Remove encoder interference

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/recursinging/ruitar.git/'


arduino prog

arduino prog

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

--- prog_ptp.ino
+++ prog_ptp.ino
@@ -0,0 +1,299 @@
+
+#include <math.h>
+//bibliotecas para comunicação I2C com a Bússola HMC5883L
+#include <Wire.h>
+#include <HMC5883L.h>
+
+//controle de 2 DEBUGS dentro da programação
+//o primeiro para o recebimento de dados e outro para a saída respectivamente
+#define DEBUG0 1
+#define DEBUG1 0
+
+//pino do botão que liga ou desliga a thread t_pid
+#define BUTTON 12
+
+//máximo módulo recebido pelo vetor
+#define MODULE_MAX 50
+
+//'baudrate' da saída seria
+#define SERIAL 9600
+
+//número de repetições de leituras na bússola que serão feitas para se ter um valor de retorno
+#define COMPASS_TIME 150
+
+//define a potência mínima que o robô irá se mover
+#define PERCENT_MIN 20
+
+#define PID(a,b,c) a+b+c
+
+//pinos dos motores - ponte H
+int robot_out_0[2] = {3,4}, robot_out_1[2] = {5,6};
+
+float angle_begin, error_angle, error_motor[2], error_velo, m_value; //float de conversão do angulo e dos errors do pid
+
+float p_angle = 0, kp_angle = 1, i_angle = 0, ki_angle = 0;
+
+double v_in[2] = {0,0}, v_robot[2] = {1,0}; //vetores de entrada e do robo
+
+char x_axis[20] = {'0','\0'},  y_axis[20] = {'0','\0'};
+
+boolean button;
+
+HMC5883L compass; //Instância a biblioteca para a bússola
+
+void vector_in()
+{
+//receber o vetor até o ponto
+  char serial_in[20];
+  char c = 0;
+  byte index = 0;
+  while(Serial.available() > 0 && c != '|')
+  {
+    if(index < 19)
+    {
+      c = Serial.read();
+        x_axis[index] = c;
+        index++;
+        x_axis[index] = '\0';
+      }
+  }
+  x_axis[index-1] = '\0';
+
+  index = 0;
+  while(Serial.available() > 0)
+  {
+    if(index < 19)
+     {
+       c = Serial.read();
+       y_axis[index] = c;
+       index++;
+       y_axis[index] = '\0';
+      }
+   }
+  v_in[0] = atof(x_axis);
+  v_in[1] = atof(y_axis);
+
+  m_value = sqrt(pow(v_in[0], 2) + pow(v_in[1], 2));
+
+  if(m_value != 0)
+  {
+    v_in[0] /= m_value;
+    v_in[1] /= m_value;
+  }
+
+   //receber o vetor do robô
+   float angle;
+
+   angle = angle_begin - get_angle();
+
+   v_robot[0] = cos(angle);
+   v_robot[1] = sin(angle);
+
+   if(DEBUG0)
+   {
+    Serial.print(v_in[0]);
+    Serial.print("|");
+    Serial.print(v_in[1]);
+    Serial.print("| Module: ");
+    Serial.println(m_value);
+    Serial.print(v_robot[0]);
+    Serial.print("|");
+    Serial.println(v_robot[1]);
+   }
+}
+
+//função que recebe o ângulo da bússola
+float get_angle()
+{
+
+  float heading; //Variável para armazenar o valor aferido
+  float precisao; //Variável parar o melhorar a precisao do valor aferido
+
+  precisao = 0; //Zera a variável para uma nova leitura
+
+  for(int i=0;i<COMPASS_TIME;i++) //Faz a leitura 100 e armazenar a somatória
+  {
+
+    //Pega os dados necessários para o cálculo da bússola digital
+    MagnetometerScaled scaled = compass.ReadScaledAxis();
+    int MilliGauss_OnThe_XAxis = scaled.XAxis;
+    heading = atan2(scaled.YAxis, scaled.XAxis);
+    float declinationAngle = 0.3889; //Compensação dos polos (São Paulo - Recife)
+    heading += declinationAngle;
+
+    //Converte o valor aferido para angulo
+    if(heading < 0)
+    {
+      heading += 2*PI;
+    }
+
+    if(heading > 2*PI)
+    {
+      heading -= 2*PI;
+    }
+
+    precisao = precisao + heading;
+    delay(1);
+
+  }
+
+  heading = precisao/COMPASS_TIME; //Pega a somatória e tira a média dos valores aferidos
+  return heading;
+}
+
+void pid()
+{
+  double produtoe[2], angle_b;
+  float kp = 1;
+
+  double moviment_sig;
+
+  produtoe[0] = (v_in[0] * v_robot[0]) + (v_in[1] * v_robot[1]); //p.e. do angulo entre o vetor do robô e do vetor de posição recebido
+  produtoe[1] = (v_in[0] * (v_robot[0] * -1)) + (v_in[1] * (v_robot[1] * -1));//p.e. entre o vetor oposto ao robô e do vetor de posição recebido
+  if(acos(produtoe[0]) <= acos(produtoe[1]))
+  {
+    angle_b = acos(produtoe[0]);
+    moviment_sig = 1;
+  }
+  else
+  {
+    angle_b = acos(produtoe[1]);
+    moviment_sig = -1;
+  }
+
+  if(v_in[0] != 0 || v_in[1] != 0)
+    error_angle = angle_b/PI;
+  else
+  {
+    error_angle = 0;
+    i_angle = 0;
+  }
+
+  if(v_robot[0] > v_in[0]) error_angle *= -1; //cálculo do erro para ser aplicado no motor, dependente do ângulo
+
+  p_angle = error_angle * kp_angle;
+  error_angle = PID(p_angle, i_angle, 0); //aplicação da proporcional
+  error_angle = (error_angle - (-1)) * (100 - (-100)) / (1 - (-1)) + (-100);
+
+  error_velo = m_value; //cálculo do erro para ser aplicado no motor, dependente do módulo e da direção em relação ao eixo y
+  error_velo *= kp;
+  error_velo = (error_velo - 0) * ((255 - fabs(error_angle)) - 0) / (MODULE_MAX - 0);
+
+  error_motor[0] = (error_velo + error_angle) * moviment_sig; //saída nos motores proporcionais ao erro
+  error_motor[1] = (error_velo - error_angle) * moviment_sig;
+
+  if(error_motor[0] < ((PERCENT_MIN/100.0)*255.0) && error_motor[0] > ((-PERCENT_MIN/100.0)*255.0))
+    error_motor[0] = 0;
+  if(error_motor[1] < ((PERCENT_MIN/100.0)*255.0) && error_motor[1] > ((-PERCENT_MIN/100.0)*255.0))
+    error_motor[1] = 0;
+
+  if(DEBUG1)
+  {
+    Serial.print("|");
+    Serial.print(error_motor[0]);
+    Serial.print("| . |");             //debug serial sobre a movimentação dos motores
+    Serial.print(error_motor[1]);
+    Serial.println("|");
+  }
+
+  moviment();
+
+}
+
+// função que executa a movimentação do robô
+void moviment()
+{
+  //motor esquerda
+  if(error_motor[0] > 0)
+  {
+    analogWrite(robot_out_0[0], fabs(error_motor[0]));
+    digitalWrite(robot_out_0[1], LOW);
+  }
+  else if(error_motor[0] > 255)
+  {
+    analogWrite(robot_out_0[0], 255);
+    digitalWrite(robot_out_0[1], LOW);
+  }
+  else if(error_motor[0] < 0)
+  {
+    analogWrite(robot_out_0[1], fabs(error_motor[0]));
+    digitalWrite(robot_out_0[0], LOW);
+  }
+  else if(error_motor[0] < -255)
+  {
+    analogWrite(robot_out_0[1], 255);
+    digitalWrite(robot_out_0[0], LOW);
+  }
+  else
+  {
+    digitalWrite(robot_out_0[0], HIGH);
+    digitalWrite(robot_out_0[1], HIGH);
+  }
+
+  //motor direita
+  if(error_motor[0] > 0)
+  {
+    analogWrite(robot_out_1[0], fabs(error_motor[0]));
+    digitalWrite(robot_out_1[1], LOW);
+  }
+  else if(error_motor[0] > 255)
+  {
+    analogWrite(robot_out_1[0], 255);
+    digitalWrite(robot_out_1[1], LOW);
+  }
+  else if(error_motor[0] < 0)
+  {
+    analogWrite(robot_out_1[1], fabs(error_motor[0]));
+    digitalWrite(robot_out_1[0], LOW);
+  }
+  else if(error_motor[0] < -255)
+  {
+    analogWrite(robot_out_1[1], 255);
+    digitalWrite(robot_out_1[0], LOW);
+  }
+  else
+  {
+    digitalWrite(robot_out_1[0], HIGH);
+    digitalWrite(robot_out_1[1], HIGH);
+  }
+}
+
+
+void setup()
+{
+
+  for(int x = 0; x < 2; x++)
+  {
+    pinMode(robot_out_0[x], OUTPUT);
+    pinMode(robot_out_1[x], OUTPUT);
+  }
+
+  pinMode(BUTTON, INPUT);
+
+  Serial.begin(SERIAL);
+
+  Wire.begin(); //Inicia a comunicação o I2C
+
+//Configura a bússola
+  compass = HMC5883L();
+  compass.SetScale(1.3);
+  compass.SetMeasurementMode(Measurement_Continuous);
+
+  angle_begin = get_angle();//seta o cangulo inicial do robo
+}
+
+void loop()
+{
+  button = digitalRead(BUTTON);
+  double time_in_millis = millis();
+
+  vector_in();
+  pid();
+  time_in_millis = millis() - time_in_millis;
+  if(DEBUG0)
+  {
+    Serial.print("time:");
+    Serial.println(time_in_millis);
+  }
+}
+


Code for Particle Internet Button

Code for Particle Internet Button

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

--- ollivanderslamp/lightsource.ino
+++ ollivanderslamp/lightsource.ino
@@ -0,0 +1,87 @@
+#include "InternetButton/InternetButton.h"
+
+InternetButton b = InternetButton();
+
+int state = 0;      // the current state of the lamp.  Possible values 0 (off), 1 (on), and 2 (fire)
+int reading;           // the current reading from the input pin
+int myLEDVals[12] = {50,30,20,200,10,120,40,20,50,10,100,10}; // array of flickerValues for realistic fire effect.  Use this to check to if it's ok to change LED color
+int flickerTable[] = { // table with flickering times
+60, 60, 50, 50, 50, 60, 70, 80, 90, 100,
+240,280,320,240,250,200,300,250,250,280,
+120,140,160,240,250,100,150,250,250,140,
+1000,500,700,800,1300,1400,1300,1400,1300,1400,
+240,230,220,100, 80,70,70, 70, 80, 80,
+140,130,120,110,200,210,220,220,100, 90,
+40, 30, 30, 30, 20, 10, 10 };
+
+int lumosPin = A1; // pin for lumos
+int noxPin = A2; // pin for nox
+int incendioPin = A0; // pin for incendio
+
+
+// The code in setup() runs once when the device is powered on or reset. Used for setting up states, modes, etc
+void setup() {
+    // Tell b to get everything ready to go
+    // Use b.begin(1); if you have the original SparkButton, which does not have a buzzer or a plastic enclosure
+    // to use, just add a '1' between the parentheses in the code below.
+    pinMode(lumosPin,INPUT);
+    pinMode(noxPin,INPUT);
+    pinMode(incendioPin,INPUT);
+    analogWrite(lumosPin,LOW);
+    analogWrite(noxPin,LOW);
+    analogWrite(incendioPin,LOW);
+    b.begin();
+}
+
+void lumos() {
+    // turn on LEDS
+   for (int i=0; i <= 11; i++){
+      b.ledOn(i, 255, 255, 255);
+   }
+}
+
+void nox() {
+    // turn off LEDS
+   for (int i=0; i <= 11; i++){
+      b.ledOff(i);
+   }
+}
+
+void incendio() {
+    // LED fire effect.  For each LED, check if the flicker value is zero, if not count it down.  On zero, change color and reset counter randomly.
+   for (int i=0; i <= 11; i++){
+        if (myLEDVals[i]>0) {
+            myLEDVals[i] = myLEDVals[i]-1;
+        } else {
+            b.ledOff(i);
+            int myVal = random(160,255);
+            b.ledOn(i, myVal, myVal, 20);
+            myLEDVals[i] = flickerTable[random((sizeof(flickerTable)/sizeof(int)))];
+        }
+   }
+}
+
+/* loop(), in contrast to setup(), runs all the time. Over and over again.
+Remember this particularly if there are things you DON'T want to run a lot. Like Spark.publish() */
+void loop() {
+    if (analogRead(incendioPin)>4000) {
+        state = 2;
+    }
+    if (analogRead(lumosPin)>4000) {
+        state = 1;
+    }
+    if (analogRead(noxPin)>4000) {
+        state = 0;
+    }
+    // Let's turn an LED on. How about #6, which is at the 6 o'clock position? Let's make it blue and bright.
+    if (state == 0) {
+        nox();
+    }
+    if (state == 1) {
+        lumos();
+    }
+    if (state == 2) {
+        incendio();
+    }
+}
+


ADD - Lidar protocol

ADD - Lidar protocol

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


reset everything to 0 after homing

reset everything to 0 after homing

and some improved debugging

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


Added Yash's sharp and servo combination sketch

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

--- samples/sharp_and_servo/sharp_and_servo.ino
+++ samples/sharp_and_servo/sharp_and_servo.ino
@@ -0,0 +1,45 @@
+/*
+Benjamin Matase, AC Li, Mark (Rick) Moyer, Yash Mittal
+20 February, 2016
+
+An arduino C program used to control a robot to navigate a simulated Mars
+evironment.
+
+Servo setup:   brown-  gnd
+               red  -  5v
+               yellow- servoPin
+*/
+
+#include <Servo.h>
+#include <SharpIR.h>
+
+#define ir A5
+#define model 1080
+
+SharpIR sharp(ir, 10, 90, model); // creates a distance sensor object
+Servo myservo; // create servo object to control a servo
+
+int servoPos = 90; // variable to store the servo position
+int servoInc = 1;
+int servoPin = 9; //pin to put servo output to
+int dis = 0;
+
+void setup()
+{
+  myservo.attach(servoPin); // attaches the servo on pin 9 to the servo object
+  pinMode(ir, INPUT);
+  Serial.begin(9600);
+}
+
+void loop()
+{
+  if(servoPos > 179) {
+    servoInc = -1;
+  } else if(servoPos < 1) {
+    servoInc = 1;
+  }
+  servoPos += servoInc;
+  myservo.write(servoPos);
+
+  dis = sharp.distance();
+}


Delete ESPArto_pinDefRaw.ino

Delete ESPArto_pinDefRaw.ino

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


adicionando Ex1: primeiro programa com ESP8266

--- Ex1.ino
+++ Ex1.ino
@@ -0,0 +1,18 @@
+/*
+  www.CodeDecay.com.br
+  Licença de uso: Apache 2.0
+
+  Neste sketch inicializamos a comunicação
+  serial com o ESP, enviamos comandos
+  e observamos as respostas.
+ */
+
+void setup()
+{
+
+}
+
+void loop()
+{
+
+}


sketch for joystick

sketch for joystick

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/galliva/3D-TTT.git/'


Added LCD example

Added LCD example

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

--- LCD/LCD.ino
+++ LCD/LCD.ino
@@ -0,0 +1,97 @@
+#include <Ninja.h>
+#include <DHT22.h>
+#include <I2C.h>
+#include <aJSON.h>
+#include <Wire.h>
+#include <MMA8453Q.h>
+#include <RCSwitch.h>
+
+#include <Wire.h>
+#include <LiquidCrystal.h>
+
+
+// It is a known issue that conditional includes do not work via the arduino IDE.
+// One must manually comment/uncomment lines as per board type defined in Ninja.h (VRPI10 or V11/V12)
+//#ifdef VRPI10
+#include <NinjaPi.h>
+//#else //V11 or V12
+//#include <Sensors.h>
+//#include <NinjaObjects.h>
+//#endif
+
+LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );
+
+static void didUpdateDisplay(Device *pDisplayDevice);
+static void didUpdateDisplay(Device *pDisplayDevice) {
+  Serial.print("didUpdateDisplay: "); Serial.print(pDisplayDevice->strDATA);
+  Serial.println();
+
+  lcd.clear();
+  lcd.print(pDisplayDevice->strDATA);
+}
+
+
+//Display Device
+#define DEVICES_MAX          10
+Device *devices[DEVICES_MAX + 1]; //null terminated
+
+#define DISPLAY_ROWS          2
+#define DISPLAY_CHARS_PER_ROW 16
+
+const int DISPLAY_STRING_LEN_MAX = DISPLAY_CHARS_PER_ROW * DISPLAY_ROWS;
+char displayText[DISPLAY_STRING_LEN_MAX + 1]; //rcvLEN max is 128
+Device displayDevice = {"0", 0, 240
+    , displayText, DISPLAY_STRING_LEN_MAX, 0, true
+    , &didUpdateDisplay
+};
+//end Display Device
+
+void initDevices()
+{
+  lcd.begin(DISPLAY_CHARS_PER_ROW, DISPLAY_ROWS);
+
+  for (int i=0; i<DEVICES_MAX + 1; i++) {
+    devices[i] = (Device*)0;
+  }
+  strncpy(displayText, "Ninja Blocks", DISPLAY_STRING_LEN_MAX);
+  devices[0] = &displayDevice;
+  didUpdateDisplay(&displayDevice);
+}
+
+void initDefaultPins() {
+  pinMode(RED_LED_PIN, OUTPUT);
+  pinMode(GREEN_LED_PIN, OUTPUT);
+  pinMode(BLUE_LED_PIN, OUTPUT);
+  digitalWrite(RED_LED_PIN, HIGH);            // set the RED LED  Off
+  digitalWrite(GREEN_LED_PIN, HIGH);          // set the GREEN LED Off
+  digitalWrite(BLUE_LED_PIN, HIGH);           // set the BLUE LED Off
+
+#ifdef V11
+  digitalWrite(BLUE_LED_PIN, LOW);           // Power on Status
+#endif
+#if defined(V12) || defined(VRPI10)
+  pinMode(RED_STAT_LED_PIN, OUTPUT);
+  pinMode(GREEN_STAT_LED_PIN, OUTPUT);
+  pinMode(BLUE_STAT_LED_PIN, OUTPUT);
+  digitalWrite(RED_STAT_LED_PIN, HIGH);		// set the RED STAT LED  Off
+  digitalWrite(GREEN_STAT_LED_PIN, HIGH);	        // set the GREEN STAT LED Off
+  digitalWrite(BLUE_STAT_LED_PIN, LOW);	        // Power on Status
+#endif
+}
+
+void setup()
+{
+  Serial.begin(9600);
+  Serial.println();
+  initDefaultPins();
+  initDevices();
+  nOBJECTS.connectDevices(devices);
+
+}
+
+void loop()
+{
+  nOBJECTS.sendObjects();				// Send Ninja Objects
+  nOBJECTS.doReactors();				// Receive Ninja Objects reactors
+}
+


Create robotroam.ino

Create robotroam.ino

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


GET request successfully tested.

GET request successfully tested.

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


Added example using multiple boards

Added example using multiple boards

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

--- examples/MultiThermometer/MultiThermometer.ino
+++ examples/MultiThermometer/MultiThermometer.ino
@@ -0,0 +1,61 @@
+/*
+Read temperatures from multiple Thermocouple Nanoshields.
+
+ Copyright (c) 2013 Circuitar
+ This software is released under the MIT license. See the attached LICENSE file for details.
+ */
+#include <SPI.h>
+#include "Nanoshield_Thermocouple.h"
+
+// Use 6 thermocouples simultaneously
+#define THERMOCOUPLES 6
+
+// Create an array of thermocouples
+Nanoshield_Thermocouple thermocouple[THERMOCOUPLES];
+
+void setup()
+{
+  Serial.begin(115200);
+  Serial.println("------------------");
+  Serial.println(" MultiThermometer");
+  Serial.println("------------------");
+  Serial.println("");
+
+  // Initialize each Thermocouple Nanoshield, selecting the corresponding CS pin
+  for(int i = 0; i < THERMOCOUPLES; i++) {
+    thermocouple[i].begin(i + 5);
+  }
+}
+
+void loop()
+{
+  for(int i = 0; i < THERMOCOUPLES; i++) {
+    // Read thermocouple data
+    thermocouple[i].read();
+
+    // Print thermocouple number
+    Serial.print(i + 1);
+    Serial.print(": ");
+
+    // Print temperature in the serial port, checking for errors
+    if (thermocouple[i].isShortedToVcc()) {
+      Serial.println("Shorted to VCC");
+    }
+    else if (thermocouple[i].isShortedToGnd()) {
+      Serial.println("Shorted to GND");
+    }
+    else if (thermocouple[i].isOpen()) {
+      Serial.println("Open circuit");
+    }
+    else {
+      Serial.print(thermocouple[i].getExternal());
+      Serial.print(", ");
+      Serial.println(thermocouple[i].getInternal());
+    }
+  }
+
+  // Wait for next second
+  delay(1000);
+}
+
+


...sub folder.

...sub folder.

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

--- DrainBattery/DrainBattery.ino
+++ DrainBattery/DrainBattery.ino
@@ -0,0 +1,70 @@
+/**
+ * BatteryDrain.ino
+ *
+ * Copyright (C) 2016 by CommonsLab <info@commonslab.gr>
+ *
+ * Repeatedly request a web page and blink an LED in order to see how long a battery will last.
+ * (Based on LGPLv2 licensed example code of github.com/esp8266/arduino.)
+ */
+
+#include <Arduino.h>
+#include <ESP8266WiFi.h>
+#include <ESP8266WiFiMulti.h>
+#include <ESP8266HTTPClient.h>
+
+ESP8266WiFiMulti MyWiFi;
+
+void setup() {
+    pinMode(LED_BUILTIN, OUTPUT);     // Initialize the LED_BUILTIN pin as an output
+
+    Serial.begin(115200);
+
+    for(uint8_t t = 4; t > 0; t--) {
+        Serial.printf("[SETUP] WAIT %d...\n", t);
+        Serial.flush();
+        delay(1000);
+    }
+
+    MyWiFi.addAP("commons|lab", "PASSWORD");
+
+}
+
+void loop() {
+    // wait for WiFi connection
+    if((MyWiFi.run() == WL_CONNECTED)) {
+
+        digitalWrite(LED_BUILTIN, HIGH);   // Turn the LED on
+
+        HTTPClient http;
+
+        Serial.print("[HTTP] begin...\n");
+        // configure traged server and url
+        //http.begin("https://192.168.1.12/test.html", "7a 9c f4 db 40 d3 62 5a 6e 21 bc 5c cc 66 c8 3e a1 45 59 38"); //HTTPS
+        //http.begin("http://192.168.1.12/test.html"); //HTTP
+        http.begin("http://etherpad.commonslab.gr/"); //HTTP
+
+        Serial.print("[HTTP] GET...\n");
+        // start connection and send HTTP header
+        int httpCode = http.GET();
+
+        // httpCode will be negative on error
+        if(httpCode > 0) {
+            // HTTP header has been send and Server response header has been handled
+            Serial.printf("[HTTP] GET... code: %d\n", httpCode);
+
+            // file found at server
+            if(httpCode == 503) {
+                String payload = http.getString();
+                Serial.println(payload);
+            }
+        } else {
+            Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
+        }
+
+        http.end();
+    }
+    digitalWrite(LED_BUILTIN, LOW);  // Turn the LED off
+
+    delay(1000);
+}
+


Blynk Arduino YUN

Blynk Arduino YUN

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

--- yun/Blynk_Arduino_Yun/Blynk_Arduino_Yun.ino
+++ yun/Blynk_Arduino_Yun/Blynk_Arduino_Yun.ino
@@ -0,0 +1,53 @@
+#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
+#include <Bridge.h>
+#include <BlynkSimpleYun.h>
+
+#include <SimpleTimer.h>
+
+#include <DHT.h>
+#include <DHT_U.h>
+#include <Adafruit_Sensor.h>
+
+#define DHTPIN 2
+#define DHTTYPE DHT11
+
+char auth[] = "<AUTH-KEY>";
+
+SimpleTimer timer;
+
+DHT dht(DHTPIN, DHTTYPE);
+
+#define VPIN_HUMIDITY V1
+#define VPIN_TEMP V2
+
+void setup()
+{
+  Serial.begin(9600);
+  dht.begin();
+  delay(10);
+  Blynk.begin(auth);
+  // Setup a function to be called every second
+  timer.setInterval(10000L, sendUptime);
+}
+
+void sendUptime()
+{
+  //Read the Temp and Humidity from DHT
+  float h = dht.readHumidity();
+  float t = dht.readTemperature();
+  if (isnan(h) || isnan(t)) {
+    return;
+  }
+
+  float hic = dht.computeHeatIndex(t, h, false);
+  Blynk.virtualWrite(1, h);
+  Blynk.virtualWrite(2, t);
+  Blynk.virtualWrite(3, hic);
+}
+
+void loop()
+{
+  Blynk.run();
+  timer.run();
+}
+


1. push

1. push

error: pathspec 'Light' did not match any file(s) known to git
error: pathspec 'and' did not match any file(s) known to git
error: pathspec 'Door/Main.ino' did not match any file(s) known to git


adicionando o código do arduino ao controle de versão

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

--- arduino/leitor_RFID2/leitor_RFID2.ino
+++ arduino/leitor_RFID2/leitor_RFID2.ino
@@ -0,0 +1,146 @@
+//Incluses no cdigo para o funcionamento adequado do leitor de RFID
+#include <SPI.h>
+#include <MFRC522.h>
+
+//Definies de pinos requeridas pela biblioteca
+#define SS_PIN 10
+#define RST_PIN 9
+MFRC522 mfrc522(SS_PIN, RST_PIN);        // Create MFRC522 instance.
+
+//Definies dos pinos dos ledes e do rele
+int ledverde = 14;
+int ledvermelho = 15;
+int rele = 6;
+
+//Variavel auxiliar necessaria para comunicao serial
+int resposta;
+
+void setup() {
+		Serial.begin(9600);        // Initialize serial communications with the PC
+		SPI.begin();                // Init SPI bus
+		mfrc522.PCD_Init();        // Init MFRC522 card
+
+                //definindo os pinos de saida de dados
+		pinMode(ledverde, OUTPUT);
+		pinMode(ledvermelho, OUTPUT);
+		pinMode(rele, OUTPUT);
+                //Garantido que eles estejam desligados ao iniciar o programa
+		digitalWrite(ledverde, LOW);
+		digitalWrite(ledvermelho, LOW);
+		digitalWrite(rele, LOW);
+}
+
+void abri()//funcao que abre a porta e liga o led verde para indicar acesso concedido
+{
+	digitalWrite(ledvermelho,0);
+	digitalWrite(ledverde, 1);
+	digitalWrite(rele, 1);
+	delay(30);
+	digitalWrite(rele, 0);
+	delay(2470);
+	digitalWrite(ledverde,0);
+}
+void nao_entra()//funcao que liga o led vermelho para indicar acesso negado
+{
+	digitalWrite(ledvermelho,1);
+	digitalWrite(ledverde, 0);
+	delay(2500);
+	digitalWrite(ledvermelho,0);
+}
+
+void ponto_entrada()//funcao que abre a porta e deixa o led verde intermotente para indicar que o ponto de entrada foi batido
+{
+        digitalWrite(ledvermelho,0);
+        digitalWrite(ledverde,1);
+        digitalWrite(rele, 1);
+	delay(30);
+	digitalWrite(rele, 0);
+        delay(470);
+        digitalWrite(ledverde,0);
+        delay(500);
+        digitalWrite(ledverde,1);
+        delay(500);
+        digitalWrite(ledverde,0);
+        delay(500);
+        digitalWrite(ledverde,1);
+        delay(500);
+        digitalWrite(ledverde,0);
+}
+
+void ponto_saida()//funcao que deicha o led vermelho itermitente para indicar que o ponto de saida foi batido
+{
+        digitalWrite(ledvermelho,1);
+        digitalWrite(ledverde,0);
+        delay(470);
+        digitalWrite(ledvermelho,0);
+        delay(500);
+        digitalWrite(ledvermelho,1);
+        delay(500);
+        digitalWrite(ledvermelho,0);
+        delay(500);
+        digitalWrite(ledvermelho,1);
+        delay(500);
+        digitalWrite(ledvermelho,0);
+}
+
+
+void serialEvent()//funcao de interrupicao com gatilho serial
+{
+	resposta = Serial.read();
+        resposta -= '0';
+	if (resposta == 1)
+		abri();
+	else if (resposta == 2)
+		ponto_entrada();
+        else if (resposta == 3)
+                ponto_saida();
+        else if(resposta == 0)
+                nao_entra();
+        else if(resposta == 4)
+        {
+          Serial.print("%42*\n");
+          Serial.flush();
+        }
+}
+
+void lerRfid()//funcao para leitura do cartao RFID e repasse do codigo via porta serial padrao 9600
+{
+		// Prepare key - all keys are set to FFFFFFFFFFFFh at chip delivery from the factory.
+		MFRC522::MIFARE_Key key;
+		for (byte i = 0; i < 6; i++) {
+				key.keyByte[i] = 0xFF;
+		}
+		// Look for new cards
+		if ( ! mfrc522.PICC_IsNewCardPresent()) {
+				return;
+		}
+
+		// Select one of the cards
+		if ( ! mfrc522.PICC_ReadCardSerial()) {
+				return;
+		}
+		// Now a card is selected. The UID and SAK is in mfrc522.uid.
+
+		// Dump UDI
+
+                String mensagem = "@";
+		for (byte i = 0; i < mfrc522.uid.size; i++) {
+				 //Serial.println(String(i)+" "+String(mfrc522.uid.uidByte[i]));
+				 mensagem += String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
+				 mensagem += String(mfrc522.uid.uidByte[i]);
+		}
+                mensagem += "#\n";
+		Serial.print(mensagem);
+                Serial.flush();
+
+		// Halt PICC
+		mfrc522.PICC_HaltA();
+
+		// Stop encryption on PCD
+		mfrc522.PCD_StopCrypto1();
+}
+
+void loop()
+{
+	lerRfid();
+}


P2P example

P2P example

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

--- examples/P2P_Receive_LCD/P2P_Receive_LCD.ino
+++ examples/P2P_Receive_LCD/P2P_Receive_LCD.ino
@@ -0,0 +1,71 @@
+// Receive a NDEF message from a Peer and
+// display the payload of the first record on a LCD
+//
+// SeeedStudio NFC shield http://www.seeedstudio.com/depot/NFC-Shield-V20-p-1370.html
+// LCD using the Adafruit backpack http://adafru.it/292
+// Adafruit Liquid Crystal library https://github.com/adafruit/LiquidCrystal
+// Use a Android of BlackBerry phone to send a message to the NFC shield
+
+#include "SPI.h"
+#include "PN532_SPI.h"
+#include "snep.h"
+#include "NdefMessage.h"
+
+#include "Wire.h"
+#include "LiquidCrystal.h"
+
+PN532_SPI pn532spi(SPI, 10);
+SNEP nfc(pn532spi);
+uint8_t ndefBuf[128];
+
+// Connect via i2c, default address #0 (A0-A2 not jumpered)
+LiquidCrystal lcd(0);
+
+void setup() {
+    Serial.begin(9600);
+    // set up the LCD's number of rows and columns:
+    lcd.begin(16, 2);
+    Serial.println("NFC Peer to Peer Example - Receive Message");
+}
+
+void loop() {
+    Serial.println("Waiting for message from a peer");
+    int msgSize = nfc.read(ndefBuf, sizeof(ndefBuf));
+    if (msgSize > 0) {
+        NdefMessage msg  = NdefMessage(ndefBuf, msgSize);
+        msg.print();
+
+        NdefRecord record = msg.getRecord(0);
+
+        int payloadLength = record.getPayloadLength();
+        byte payload[payloadLength];
+        record.getPayload(payload);
+
+        // The TNF and Type are used to determine how your application processes the payload
+        // There's no generic processing for the payload, it's returned as a byte[]
+        int startChar = 0;
+        if (record.getTnf() == TNF_WELL_KNOWN && record.getType() == "T") { // text message
+          // skip the language code
+          startChar = payload[0] + 1;
+        } else if (record.getTnf() == TNF_WELL_KNOWN && record.getType() == "U") { // URI
+          // skip the url prefix (future versions should decode)
+          startChar = 1;
+        }
+
+        // Force the data into a String (might fail for some content)
+        // Real code should use smarter processing
+        String payloadAsString = "";
+        for (int c = startChar; c < payloadLength; c++) {
+          payloadAsString += (char)payload[c];
+        }
+
+        // print on the LCD display
+        lcd.setCursor(0, 0);
+        lcd.print(payloadAsString);
+
+        Serial.println("\nSuccess");
+    } else {
+        Serial.println("Failed");
+    }
+    delay(3000);
+}


add serial blink demo

add serial blink demo

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

--- examples/Ports/blink_serial/blink_serial.ino
+++ examples/Ports/blink_serial/blink_serial.ino
@@ -0,0 +1,30 @@
+/// @dir blink_serial
+/// Controlling and reading out a Blink Plug over the serial port.
+// 2012-12-21 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php
+
+#include <JeeLib.h>
+
+BlinkPlug buttons (1);
+
+void setup () {
+  Serial.begin(57600);
+  // Serial.println("\n[blink_serial]");
+}
+
+void loop () {
+  // listen to incoming commands
+  if (Serial.available())
+    switch (Serial.read()) {
+      case 'A': buttons.ledOn(1); break;
+      case 'a': buttons.ledOff(1); break;
+      case 'B': buttons.ledOn(2); break;
+      case 'b': buttons.ledOff(2); break;
+    }
+  // look for button presses
+  switch (buttons.buttonCheck()) {
+    case BlinkPlug::ON1:  Serial.println("+1"); break;
+    case BlinkPlug::OFF1: Serial.println("-1"); break;
+    case BlinkPlug::ON2:  Serial.println("+2"); break;
+    case BlinkPlug::OFF2: Serial.println("-2"); break;
+  }
+}


Otto can Sense

Otto can Sense

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

--- OTTO_ultrasound/OTTO_ultrasound.ino
+++ OTTO_ultrasound/OTTO_ultrasound.ino
@@ -0,0 +1,831 @@
+//----------------------------------------------------------------
+//-- Zowi basic firmware v2 adapted to Otto
+//-- (c) BQ. Released under a GPL licencse
+//-- 04 December 2015
+//-- Authors:  Anita de Prado: ana.deprado@bq.com
+//--           Jose Alberca:   jose.alberca@bq.com
+//--           Javier Isabel:  javier.isabel@bq.com
+//--           Juan Gonzalez (obijuan): juan.gonzalez@bq.com
+//--           Irene Sanz : irene.sanz@bq.com
+//-----------------------------------------------------------------
+//-- Experiment with all the features that Otto has thanks to Zowi!
+//-----------------------------------------------------------------
+
+#include <Servo.h>
+#include <Oscillator.h>
+#include <EEPROM.h>
+#include <BatReader.h>
+#include <US.h>
+#include <LedMatrix.h>
+#include <EnableInterrupt.h>
+#include <OttoSerialCommand.h>
+OttoSerialCommand SCmd;  //The SerialCommand object
+//-- Otto Library
+#include <Otto.h>
+Otto Otto;  //This is Otto!
+//---------------------------------------------------------
+//-- First step: Configure the pins where the servos are attached
+/*
+         ---------------
+        |     O   O     |
+        |---------------|
+YR 3==> |               | <== YL 2
+         ---------------
+            ||     ||
+            ||     ||
+RR 5==>   -----   ------  <== RL 4
+         |-----   ------|
+*/
+
+  #define PIN_YL 2 //servo[0]
+  #define PIN_YR 3 //servo[1]
+  #define PIN_RL 4 //servo[2]
+  #define PIN_RR 5 //servo[3]
+
+//---Otto Buttons
+#define PIN_SecondButton 6
+#define PIN_ThirdButton 7
+
+///////////////////////////////////////////////////////////////////
+//-- Global Variables -------------------------------------------//
+///////////////////////////////////////////////////////////////////
+
+const char programID[]="Otto_todo"; //Each program will have a ID
+
+const char name_fac='$'; //Factory name
+const char name_fir='#'; //First name
+
+//-- Movement parameters
+int T=1000;              //Initial duration of movement
+int moveId=0;            //Number of movement
+int moveSize=15;         //Asociated with the height of some movements
+
+//---------------------------------------------------------
+//-- Otto has 5 modes:
+//--    * MODE = 0: Otto is awaiting
+//--    * MODE = 1: Dancing mode!
+//--    * MODE = 2: Obstacle detector mode
+//--    * MODE = 3: Noise detector mode
+//--    * MODE = 4: OttoPAD or any Teleoperation mode (listening SerialPort).
+//---------------------------------------------------------
+volatile int MODE=0; //State of Otto in the principal state machine.
+
+volatile bool buttonPushed=false;  //Variable to remember when a button has been pushed
+volatile bool buttonAPushed=false; //Variable to remember when A button has been pushed
+volatile bool buttonBPushed=false; //Variable to remember when B button has been pushed
+
+unsigned long previousMillis=0;
+
+int randomDance=0;
+int randomSteps=0;
+
+bool obstacleDetected = false;
+
+///////////////////////////////////////////////////////////////////
+//-- Setup ------------------------------------------------------//
+///////////////////////////////////////////////////////////////////
+void setup(){
+
+  //Serial communication initialization
+  Serial.begin(115200);
+
+  pinMode(PIN_SecondButton,INPUT);
+  pinMode(PIN_ThirdButton,INPUT);
+
+  //Set the servo pins
+  Otto.init(PIN_YL,PIN_YR,PIN_RL,PIN_RR,true);
+
+  //Uncomment this to set the servo trims manually and save on EEPROM
+    //Otto.setTrims(TRIM_YL, TRIM_YR, TRIM_RL, TRIM_RR);
+    //Otto.saveTrimsOnEEPROM(); //Uncomment this only for one upload when you finaly set the trims.
+
+  //Set a random seed
+  randomSeed(analogRead(A6));
+
+  //Interrumptions
+  enableInterrupt(PIN_SecondButton, secondButtonPushed, RISING);
+  enableInterrupt(PIN_ThirdButton, thirdButtonPushed, RISING);
+
+  //Setup callbacks for SerialCommand commands
+  SCmd.addCommand("S", receiveStop);      //  sendAck & sendFinalAck
+  SCmd.addCommand("L", receiveLED);       //  sendAck & sendFinalAck
+  SCmd.addCommand("T", recieveBuzzer);    //  sendAck & sendFinalAck
+  SCmd.addCommand("M", receiveMovement);  //  sendAck & sendFinalAck
+  SCmd.addCommand("H", receiveGesture);   //  sendAck & sendFinalAck
+  SCmd.addCommand("K", receiveSing);      //  sendAck & sendFinalAck
+  SCmd.addCommand("C", receiveTrims);     //  sendAck & sendFinalAck
+  SCmd.addCommand("G", receiveServo);     //  sendAck & sendFinalAck
+  SCmd.addCommand("D", requestDistance);
+  SCmd.addCommand("N", requestNoise);
+  SCmd.addCommand("B", requestBattery);
+  SCmd.addCommand("I", requestProgramId);
+  SCmd.addDefaultHandler(receiveStop);
+
+  //Otto wake up!
+  Otto.sing(S_connection);
+  Otto.home();
+
+  delay(50);
+  requestBattery();
+
+  //Checking battery
+  OttoLowBatteryAlarm();
+
+ // Animation Uuuuuh - A little moment of initial surprise
+ //-----
+  for(int i=0; i<2; i++){
+      for (int i=0;i<8;i++){
+        if(buttonPushed){break;}
+        Otto.putAnimationMouth(littleUuh,i);
+        delay(150);
+      }
+  }
+ //-----
+
+
+  //Smile for a happy Otto :)
+  if(!buttonPushed){
+    Otto.putMouth(smile);
+    Otto.sing(S_happy);
+    delay(200);
+  }
+
+
+  //If Otto's name is '#' means that Otto hasn't been baptized
+  //In this case, Otto does a longer greeting
+  //5 = EEPROM address that contains first name character
+  if (EEPROM.read(5)==name_fir){
+
+    if(!buttonPushed){
+        Otto.jump(1,700);
+        delay(200);
+    }
+
+    if(!buttonPushed){
+        Otto.shakeLeg(1,T,1);
+    }
+
+    if(!buttonPushed){
+        Otto.putMouth(smallSurprise);
+        Otto.swing(2,800,20);
+        Otto.home();
+    }
+  }
+
+
+  if(!buttonPushed){
+    Otto.putMouth(happyOpen);
+  }
+
+  previousMillis = millis();
+
+}
+
+///////////////////////////////////////////////////////////////////
+//-- Principal Loop ---------------------------------------------//
+///////////////////////////////////////////////////////////////////
+void loop() {
+
+      //-- MODE 2 - Obstacle detector mode
+       if(obstacleDetected){
+              Otto.jump(1,700);
+              Otto.sing(S_superHappy);
+              Otto.walk(1,1300,-1);
+
+
+            delay(100);
+            obstacleDetector();
+            delay(100);
+        }else{
+            Otto.home();
+            obstacleDetector();
+        }
+  }
+
+///////////////////////////////////////////////////////////////////
+//-- Functions --------------------------------------------------//
+///////////////////////////////////////////////////////////////////
+
+//-- Function executed when second button is pushed
+void secondButtonPushed(){
+
+    buttonAPushed=true;
+
+    if(!buttonPushed){
+        buttonPushed=true;
+        Otto.putMouth(smallSurprise);
+    }
+}
+
+//-- Function executed when third button is pushed
+void thirdButtonPushed(){
+
+    buttonBPushed=true;
+
+    if(!buttonPushed){
+        buttonPushed=true;
+        Otto.putMouth(smallSurprise);
+    }
+}
+
+
+//-- Function to read distance sensor & to actualize obstacleDetected variable
+void obstacleDetector(){
+
+   int distance = Otto.getDistance();
+
+        if(distance<15){
+          obstacleDetected = true;
+        }else{
+          obstacleDetected = false;
+        }
+}
+
+
+//-- Function to receive Stop command.
+void receiveStop(){
+
+    sendAck();
+    Otto.home();
+    sendFinalAck();
+
+}
+
+
+//-- Function to receive LED commands
+void receiveLED(){
+
+    //sendAck & stop if necessary
+    sendAck();
+    Otto.home();
+
+    //Examples of receiveLED Bluetooth commands
+    //L 000000001000010100100011000000000
+    //L 001111111111111111111111111111111 (todos los LED encendidos)
+    unsigned long int matrix;
+    char *arg;
+    char *endstr;
+    arg=SCmd.next();
+    //Serial.println (arg);
+    if (arg != NULL) {
+      matrix=strtoul(arg,&endstr,2);    // Converts a char string to unsigned long integer
+      Otto.putMouth(matrix,false);
+    }else{
+      Otto.putMouth(xMouth);
+      delay(2000);
+      Otto.clearMouth();
+    }
+
+    sendFinalAck();
+
+}
+
+
+//-- Function to receive buzzer commands
+void recieveBuzzer(){
+
+    //sendAck & stop if necessary
+    sendAck();
+    Otto.home();
+
+    bool error = false;
+    int frec;
+    int duration;
+    char *arg;
+
+    arg = SCmd.next();
+    if (arg != NULL) { frec=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    arg = SCmd.next();
+    if (arg != NULL) { duration=atoi(arg); } // Converts a char string to an integer
+    else {error=true;}
+
+    if(error==true){
+
+      Otto.putMouth(xMouth);
+      delay(2000);
+      Otto.clearMouth();
+
+    }else{
+
+      Otto._tone(frec, duration, 1);
+    }
+
+    sendFinalAck();
+
+}
+
+
+//-- Function to receive TRims commands
+void receiveTrims(){
+
+    //sendAck & stop if necessary
+    sendAck();
+    Otto.home();
+
+    int trim_YL,trim_YR,trim_RL,trim_RR;
+
+    //Definition of Servo Bluetooth command
+    //C trim_YL trim_YR trim_RL trim_RR
+    //Examples of receiveTrims Bluetooth commands
+    //C 20 0 -8 3
+    bool error = false;
+    char *arg;
+    arg=SCmd.next();
+    if (arg != NULL) { trim_YL=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    arg = SCmd.next();
+    if (arg != NULL) { trim_YR=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    arg = SCmd.next();
+    if (arg != NULL) { trim_RL=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    arg = SCmd.next();
+    if (arg != NULL) { trim_RR=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    if(error==true){
+
+      Otto.putMouth(xMouth);
+      delay(2000);
+      Otto.clearMouth();
+
+    }else{ //Save it on EEPROM
+      Otto.setTrims(trim_YL, trim_YR, trim_RL, trim_RR);
+      Otto.saveTrimsOnEEPROM(); //Uncomment this only for one upload when you finaly set the trims.
+    }
+
+    sendFinalAck();
+
+}
+
+
+//-- Function to receive Servo commands
+void receiveServo(){
+
+    sendAck();
+    moveId = 30;
+
+    //Definition of Servo Bluetooth command
+    //G  servo_YL servo_YR servo_RL servo_RR
+    //Example of receiveServo Bluetooth commands
+    //G 90 85 96 78
+    bool error = false;
+    char *arg;
+    int servo_YL,servo_YR,servo_RL,servo_RR;
+
+    arg=SCmd.next();
+    if (arg != NULL) { servo_YL=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    arg = SCmd.next();
+    if (arg != NULL) { servo_YR=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    arg = SCmd.next();
+    if (arg != NULL) { servo_RL=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    arg = SCmd.next();
+    if (arg != NULL) { servo_RR=atoi(arg); }    // Converts a char string to an integer
+    else {error=true;}
+
+    if(error==true){
+
+      Otto.putMouth(xMouth);
+      delay(2000);
+      Otto.clearMouth();
+
+    }else{ //Update Servo:
+
+      int servoPos[4]={servo_YL, servo_YR, servo_RL, servo_RR};
+      Otto._moveServos(200, servoPos);   //Move 200ms
+
+    }
+
+    sendFinalAck();
+
+}
+
+
+//-- Function to receive movement commands
+void receiveMovement(){
+
+    sendAck();
+
+    if (Otto.getRestState()==true){
+        Otto.setRestState(false);
+    }
+
+    //Definition of Movement Bluetooth commands
+    //M  MoveID  T   MoveSize
+    char *arg;
+    arg = SCmd.next();
+    if (arg != NULL) {moveId=atoi(arg);}
+    else{
+      Otto.putMouth(xMouth);
+      delay(2000);
+      Otto.clearMouth();
+      moveId=0; //stop
+    }
+
+    arg = SCmd.next();
+    if (arg != NULL) {T=atoi(arg);}
+    else{
+      T=1000;
+    }
+
+    arg = SCmd.next();
+    if (arg != NULL) {moveSize=atoi(arg);}
+    else{
+      moveSize =15;
+    }
+}
+
+
+//-- Function to execute the right movement according the movement command received.
+void move(int moveId){
+
+  bool manualMode = false;
+
+  switch (moveId) {
+    case 0:
+      Otto.home();
+      break;
+    case 1: //M 1 1000
+      Otto.walk(1,T,1);
+      break;
+    case 2: //M 2 1000
+      Otto.walk(1,T,-1);
+      break;
+    case 3: //M 3 1000
+      Otto.turn(1,T,1);
+      break;
+    case 4: //M 4 1000
+      Otto.turn(1,T,-1);
+      break;
+    case 5: //M 5 1000 30
+      Otto.updown(1,T,moveSize);
+      break;
+    case 6: //M 6 1000 30
+      Otto.moonwalker(1,T,moveSize,1);
+      break;
+    case 7: //M 7 1000 30
+      Otto.moonwalker(1,T,moveSize,-1);
+      break;
+    case 8: //M 8 1000 30
+      Otto.swing(1,T,moveSize);
+      break;
+    case 9: //M 9 1000 30
+      Otto.crusaito(1,T,moveSize,1);
+      break;
+    case 10: //M 10 1000 30
+      Otto.crusaito(1,T,moveSize,-1);
+      break;
+    case 11: //M 11 1000
+      Otto.jump(1,T);
+      break;
+    case 12: //M 12 1000 30
+      Otto.flapping(1,T,moveSize,1);
+      break;
+    case 13: //M 13 1000 30
+      Otto.flapping(1,T,moveSize,-1);
+      break;
+    case 14: //M 14 1000 20
+      Otto.tiptoeSwing(1,T,moveSize);
+      break;
+    case 15: //M 15 500
+      Otto.bend(1,T,1);
+      break;
+    case 16: //M 16 500
+      Otto.bend(1,T,-1);
+      break;
+    case 17: //M 17 500
+      Otto.shakeLeg(1,T,1);
+      break;
+    case 18: //M 18 500
+      Otto.shakeLeg(1,T,-1);
+      break;
+    case 19: //M 19 500 20
+      Otto.jitter(1,T,moveSize);
+      break;
+    case 20: //M 20 500 15
+      Otto.ascendingTurn(1,T,moveSize);
+      break;
+    default:
+        manualMode = true;
+      break;
+  }
+
+  if(!manualMode){
+    sendFinalAck();
+  }
+
+}
+
+
+//-- Function to receive gesture commands
+void receiveGesture(){
+
+    //sendAck & stop if necessary
+    sendAck();
+    Otto.home();
+
+    //Definition of Gesture Bluetooth commands
+    //H  GestureID
+    int gesture = 0;
+    char *arg;
+    arg = SCmd.next();
+    if (arg != NULL) {gesture=atoi(arg);}
+    else
+    {
+      Otto.putMouth(xMouth);
+      delay(2000);
+      Otto.clearMouth();
+    }
+
+    switch (gesture) {
+      case 1: //H 1
+        Otto.playGesture(OttoHappy);
+        break;
+      case 2: //H 2
+        Otto.playGesture(OttoSuperHappy);
+        break;
+      case 3: //H 3
+        Otto.playGesture(OttoSad);
+        break;
+      case 4: //H 4
+        Otto.playGesture(OttoSleeping);
+        break;
+      case 5: //H 5
+        Otto.playGesture(OttoFart);
+        break;
+      case 6: //H 6
+        Otto.playGesture(OttoConfused);
+        break;
+      case 7: //H 7
+        Otto.playGesture(OttoLove);
+        break;
+      case 8: //H 8
+        Otto.playGesture(OttoAngry);
+        break;
+      case 9: //H 9
+        Otto.playGesture(OttoFretful);
+        break;
+      case 10: //H 10
+        Otto.playGesture(OttoMagic);
+        break;
+      case 11: //H 11
+        Otto.playGesture(OttoWave);
+        break;
+      case 12: //H 12
+        Otto.playGesture(OttoVictory);
+        break;
+      case 13: //H 13
+        Otto.playGesture(OttoFail);
+        break;
+      default:
+        break;
+    }
+
+    sendFinalAck();
+}
+
+//-- Function to receive sing commands
+void receiveSing(){
+
+    //sendAck & stop if necessary
+    sendAck();
+    Otto.home();
+
+    //Definition of Sing Bluetooth commands
+    //K  SingID
+    int sing = 0;
+    char *arg;
+    arg = SCmd.next();
+    if (arg != NULL) {sing=atoi(arg);}
+    else
+    {
+      Otto.putMouth(xMouth);
+      delay(2000);
+      Otto.clearMouth();
+    }
+
+    switch (sing) {
+      case 1: //K 1
+        Otto.sing(S_connection);
+        break;
+      case 2: //K 2
+        Otto.sing(S_disconnection);
+        break;
+      case 3: //K 3
+        Otto.sing(S_surprise);
+        break;
+      case 4: //K 4
+        Otto.sing(S_OhOoh);
+        break;
+      case 5: //K 5
+        Otto.sing(S_OhOoh2);
+        break;
+      case 6: //K 6
+        Otto.sing(S_cuddly);
+        break;
+      case 7: //K 7
+        Otto.sing(S_sleeping);
+        break;
+      case 8: //K 8
+        Otto.sing(S_happy);
+        break;
+      case 9: //K 9
+        Otto.sing(S_superHappy);
+        break;
+      case 10: //K 10
+        Otto.sing(S_happy_short);
+        break;
+      case 11: //K 11
+        Otto.sing(S_sad);
+        break;
+      case 12: //K 12
+        Otto.sing(S_confused);
+        break;
+      case 13: //K 13
+        Otto.sing(S_fart1);
+        break;
+      case 14: //K 14
+        Otto.sing(S_fart2);
+        break;
+      case 15: //K 15
+        Otto.sing(S_fart3);
+        break;
+      case 16: //K 16
+        Otto.sing(S_mode1);
+        break;
+      case 17: //K 17
+        Otto.sing(S_mode2);
+        break;
+      case 18: //K 18
+        Otto.sing(S_mode3);
+        break;
+      case 19: //K 19
+        Otto.sing(S_buttonPushed);
+        break;
+      default:
+        break;
+    }
+
+    sendFinalAck();
+}
+
+//-- Function to send ultrasonic sensor measure (distance in "cm")
+void requestDistance(){
+
+    Otto.home();  //stop if necessary
+
+    int distance = Otto.getDistance();
+    Serial.print(F("&&"));
+    Serial.print(F("D "));
+    Serial.print(distance);
+    Serial.println(F("%%"));
+    Serial.flush();
+}
+
+
+//-- Function to send noise sensor measure
+void requestNoise(){
+
+    Otto.home();  //stop if necessary
+
+    int microphone= Otto.getNoise(); //analogRead(PIN_NoiseSensor);
+    Serial.print(F("&&"));
+    Serial.print(F("N "));
+    Serial.print(microphone);
+    Serial.println(F("%%"));
+    Serial.flush();
+}
+
+
+//-- Function to send battery voltage percent
+void requestBattery(){
+
+    Otto.home();  //stop if necessary
+
+    //The first read of the batery is often a wrong reading, so we will discard this value.
+    double batteryLevel = Otto.getBatteryLevel();
+
+    Serial.print(F("&&"));
+    Serial.print(F("B "));
+    Serial.print(batteryLevel);
+    Serial.println(F("%%"));
+    Serial.flush();
+}
+
+
+//-- Function to send program ID
+void requestProgramId(){
+
+    Otto.home();   //stop if necessary
+
+    Serial.print(F("&&"));
+    Serial.print(F("I "));
+    Serial.print(programID);
+    Serial.println(F("%%"));
+    Serial.flush();
+}
+
+
+//-- Function to send Ack comand (A)
+void sendAck(){
+
+  delay(30);
+
+  Serial.print(F("&&"));
+  Serial.print(F("A"));
+  Serial.println(F("%%"));
+  Serial.flush();
+}
+
+
+//-- Function to send final Ack comand (F)
+void sendFinalAck(){
+
+  delay(30);
+
+  Serial.print(F("&&"));
+  Serial.print(F("F"));
+  Serial.println(F("%%"));
+  Serial.flush();
+}
+
+
+
+//-- Functions with animatics
+//--------------------------------------------------------
+
+void OttoLowBatteryAlarm(){
+
+    double batteryLevel = Otto.getBatteryLevel();
+
+    if(batteryLevel<45){
+
+      while(!buttonPushed){
+
+          Otto.putMouth(thunder);
+          Otto.bendTones (880, 2000, 1.04, 8, 3);  //A5 = 880
+
+          delay(30);
+
+          Otto.bendTones (2000, 880, 1.02, 8, 3);  //A5 = 880
+          Otto.clearMouth();
+          delay(500);
+      }
+    }
+}
+
+void OttoSleeping_withInterrupts(){
+
+  int bedPos_0[4]={100, 80, 60, 120};
+
+  if(!buttonPushed){
+    Otto._moveServos(700, bedPos_0);
+  }
+
+  for(int i=0; i<4;i++){
+
+    if(buttonPushed){break;}
+      Otto.putAnimationMouth(dreamMouth,0);
+      Otto.bendTones (100, 200, 1.04, 10, 10);
+
+    if(buttonPushed){break;}
+      Otto.putAnimationMouth(dreamMouth,1);
+      Otto.bendTones (200, 300, 1.04, 10, 10);
+
+    if(buttonPushed){break;}
+      Otto.putAnimationMouth(dreamMouth,2);
+      Otto.bendTones (300, 500, 1.04, 10, 10);
+
+    delay(500);
+
+    if(buttonPushed){break;}
+      Otto.putAnimationMouth(dreamMouth,1);
+      Otto.bendTones (400, 250, 1.04, 10, 1);
+
+    if(buttonPushed){break;}
+      Otto.putAnimationMouth(dreamMouth,0);
+      Otto.bendTones (250, 100, 1.04, 10, 1);
+
+    delay(500);
+  }
+
+  if(!buttonPushed){
+    Otto.putMouth(lineMouth);
+    Otto.sing(S_cuddly);
+  }
+
+  Otto.home();
+  if(!buttonPushed){Otto.putMouth(happyOpen);}
+
+}


Create ArduinoShield.ino

Create ArduinoShield.ino

Arduino Shield provided by Open Energy Monitor in Wales

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

--- OpenEnergyMonitor/ArduinoShield.ino
+++ OpenEnergyMonitor/ArduinoShield.ino
@@ -0,0 +1 @@
+Sketch to follow including libraries


Change Default Mode

Change Default Mode

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/sbonami/bot-sketch.git/'


First Uno Ethernet example

First Uno Ethernet example

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

--- examples/uno-ethernet.ino
+++ examples/uno-ethernet.ino
@@ -0,0 +1,52 @@
+#include <SPI.h>
+#include <Ethernet.h>
+#include <Owly.h>
+
+// Update these with values suitable for your network.
+byte mac[]    = {  0x90, 0xA2, 0xDA, 0x0D, 0xC0, 0x7F };
+IPAddress ip(192, 168, 1, 123);
+
+EthernetClient ethClient;
+
+Owly owly("input_username", "input_password", ethClient);
+
+void setup()
+{
+  // Uno Ethernet Shield Start
+  Ethernet.begin(mac, ip);
+
+  // Let the hardware relax
+  delay(2000);
+
+  if(owly.Connect())
+  {
+    // Publish a message!
+    owly.Publish("your_topic", "your_value");
+
+    // Four blinks for success!
+    blink();
+    blink();
+    blink();
+    blink();
+  }
+  else
+  {
+    // Two blinks for error!
+    blink();
+    blink();
+  }
+}
+
+void loop()
+{
+  // Loop and keep the connection open.
+  owly.Loop();
+}
+
+void blink()
+{
+  digitalWrite(13, HIGH);
+  delay(500);
+  digitalWrite(13, LOW);
+  delay(100);
+}


Varying Nightlight

Varying Nightlight

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

--- src/varying_nightlight/varying_nightlight.ino
+++ src/varying_nightlight/varying_nightlight.ino
@@ -0,0 +1,25 @@
+const int sensorPin = 0;
+const int ledPin = 9;
+
+int value = 0;
+int ledLevel = 0;
+
+void setup()
+{
+  analogReference(DEFAULT); // not necessary
+  pinMode(ledPin, OUTPUT);
+  Serial.begin(9600);
+}
+
+void loop()
+{
+  value = analogRead(sensorPin);
+
+  value = constrain(value, 750, 900); // if < 750, value = 750; if > 900, value = 900
+  ledLevel = map(value, 750, 900, 255, 0); // map 750 -> 255 and 900 -> 0
+
+  // Serial.println(value);
+
+  analogWrite(ledPin, ledLevel);
+}
+


fixed typho

fixed typho

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

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


Add a sort of intensity wave option

Add a sort of intensity wave option

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

--- Xmas2013/WavyWavy/WavyWavy.ino
+++ Xmas2013/WavyWavy/WavyWavy.ino
@@ -0,0 +1,83 @@
+
+#include <G35String.h>
+
+//#define TWO_STRINGS
+
+#ifdef TWO_STRINGS
+  #define LIGHT_COUNT 50
+  #define G35_PIN1 9
+  #define G35_PIN2 10
+  G35String lights1(G35_PIN1, LIGHT_COUNT);
+  G35String lights2(G35_PIN2, LIGHT_COUNT);
+  const int middle = 0;
+#else
+  #define LIGHT_COUNT 49
+  #define G35_PIN 9
+  G35String lights(G35_PIN, LIGHT_COUNT);
+  const int middle = LIGHT_COUNT/2;
+#endif
+
+// Simple function to get amount of RAM free
+int freeRam () {
+  extern int __heap_start, *__brkval;
+  int v;
+  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
+}
+
+// Colour table for rainbow
+const int COLOURS[] = {COLOR_BLUE, COLOR_RED, COLOR_ORANGE, COLOR_YELLOW, COLOR_GREEN};
+const int NCOLOURS = sizeof(COLOURS)/sizeof(int);
+
+// Counter - to insert a long pause, occasionally
+int pause = 0;
+
+// Width of half a string
+const float width = (float) LIGHT_COUNT/2.0;
+
+// 2*pi, roughly
+const float twoPi = 6.283185;
+
+// pre-compute 2*pi/(half of LIGHT_COUNT)
+const float mul = 2.0*twoPi/(float) LIGHT_COUNT;
+
+int getIntensity(const int bulb, const int centre) {
+  float x = mul * (float) (bulb-centre);
+  return int(G35::MAX_INTENSITY*(0.95*abs(sin(x))+0.05));
+}
+
+void setup() {
+  Serial.begin (115200);
+  Serial.println(freeRam());
+#ifdef TWO_STRINGS
+  lights1.enumerate();
+  lights2.enumerate();
+#else
+  lights.enumerate();
+#endif
+}
+
+void loop() {
+  int offset = 0;
+  for (int colIndex=0; colIndex<NCOLOURS; colIndex++) {
+    int colour = COLOURS[colIndex];
+    for (int repeat=0; repeat < 250; repeat++) {
+      // Update all bulbs
+      #ifdef TWO_STRINGS
+      for (int bulb=0; bulb < LIGHT_COUNT; bulb++) {
+      #else
+      for (int bulb=0; bulb <= LIGHT_COUNT/2; bulb++) {
+      #endif
+        int intensity = getIntensity(bulb,middle+offset);
+        #ifdef TWO_STRINGS
+          lights1.set_color(bulb, intensity, colour);
+          lights2.set_color(bulb, intensity, colour);
+        #else
+          lights.set_color(middle+bulb, intensity, colour);
+          lights.set_color(middle-bulb, intensity, colour);
+        #endif
+      }
+      delay(100);
+      offset++;
+    }
+  }
+}


codigo em .ino

codigo em .ino

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

--- SeguidorDeParede.ino
+++ SeguidorDeParede.ino
@@ -0,0 +1,98 @@
+#include <Servo.h>
+
+Servo rodaDireita;
+Servo rodaEsquerda;
+
+int echoFrontal = 2;
+int trigFrontal = 3;
+int echoLateral = 8;
+int trigLateral = 7;
+
+void setup( ){
+  pinMode(trigFrontal,OUTPUT);
+  pinMode(echoFrontal,INPUT);
+  pinMode(trigLateral,OUTPUT);
+  pinMode(echoLateral,INPUT);
+  digitalWrite(trigFrontal,LOW);
+  digitalWrite(trigLateral,LOW);
+  rodaEsquerda.attach(5);
+  delay(1);
+  rodaDireita.attach(6);
+  rodaEsquerda.write(90);
+  rodaDireita.write(90);
+}
+
+int dispararPulso (int pinEcho, int pinTrig){
+  float tempo;
+  digitalWrite(pinTrig, HIGH);
+  delayMicroseconds(10);
+  digitalWrite(pinTrig, LOW);
+  tempo = pulseIn(pinEcho, HIGH,4500);
+  return tempo;
+}
+
+int calcularDistancia (int pinEcho, int pinTrig){
+  return dispararPulso(pinEcho,pinTrig)/29.4/2;
+}
+
+void esquerda(int velocidadeD,int velocidadeE){
+  rodaEsquerda.write((90-velocidadeD));
+  rodaDireita.write((90-velocidadeE));
+}
+
+void frente(int velocidadeD, int velocidadeE){
+  velocidadeE = (velocidadeE / 1.5);
+  rodaEsquerda.write((90+velocidadeE));
+  rodaDireita.write((90-velocidadeD));
+}
+
+int distancia;
+int ultimaDistancia;
+int erro,x,y,dt;
+int kd=10,kp=3;
+float i,ki = 0.001;
+int cons = 15;
+
+void definirErro(int setPoint){
+  ultimaDistancia = distancia;
+  distancia = calcularDistancia(echoLateral,trigLateral);
+  if(distancia > 0){
+    erro =  setPoint - distancia;
+    i += (erro*dt*ki);
+    x = cons + ((erro*kp) + (kd*(distancia - ultimaDistancia)/dt) + i);
+    y = cons - ((erro*kp) + (kd*(distancia - ultimaDistancia)/dt) + i);
+  }
+  if(distancia == 0){
+    x = 10;
+    y = 15;
+  }
+}
+
+int temp ;
+int tempFinal = millis();
+void calcularTempo(){
+  temp = tempFinal;
+  tempFinal = millis();
+  dt = (tempFinal - temp);
+}
+
+int distanciaFrontal;
+void definirRota(){
+  distanciaFrontal = calcularDistancia(echoFrontal,trigFrontal);
+  if(distanciaFrontal > 0 && distanciaFrontal <= 12){
+    esquerda(20,20);
+    delay(1000);
+    i=0;
+    distancia = 0;
+    distanciaFrontal = 0;
+  }else{
+    definirErro(20);
+    frente(x,y);
+  }
+}
+
+void loop() {
+  calcularTempo();
+  delay(5);
+  definirRota();
+}


Creating adaptive_lighting_rev1

Creating adaptive_lighting_rev1

Created the file

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

--- adaptive_lighting_rev1/adaptive_lighting_rev1.ino
+++ adaptive_lighting_rev1/adaptive_lighting_rev1.ino
@@ -0,0 +1,33 @@
+/*
+Adaptive Lighting System
+======== ======== ======
+rev v.1
+#test program for adaptive lighting
+#controls the brightness of an led according to the amount of light present
+#connects the sensor at pin A0 and the LED at pin 9
+#the input is read and the voltage value is send serially
+#the prograam varies it's PWM according to the input voltage
+*/
+
+//al-adaptive lighting
+
+#define alinput A0
+#define aloutput 9
+
+float alsensor,alvoltage;
+int albrightness;
+
+void setup()
+{
+  Serial.begin(9600);
+}
+
+void loop()
+{ alsensor = analogRead(alinput); //read the sensor value
+  albrightness = alsensor / 4; //convert the value from 10-bit resolution to 8-bit res
+  alvoltage = alsensor * (5 / 1024); //convert the value into actual voltage range 0-5V
+  Serial.print("The voltage is: ");  //prints the voltage through serial
+  Serial.println(alvoltage);
+  analogWrite(aloutput,albrightness); //output the PWM to the LED
+  delay(500);
+}


added simple scope example

added simple scope example

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

--- utils/LCD_ScopeExample/LCD_ScopeExample.ino
+++ utils/LCD_ScopeExample/LCD_ScopeExample.ino
@@ -0,0 +1,44 @@
+// simple (real-time) sinewave refresh and draw
+
+// test LCD screen dimensions with 2 pots connected on A0 and A1 (x, y)
+
+#include <UTFT.h>
+
+int px=0, x=1;
+float py=0, y=0;
+float sinewave;
+float inc = 0.1;
+
+UTFT lcd(CTE32HR,38,39,40,41);
+
+void setup(){
+  Serial.begin(9600);
+  lcd.InitLCD(LANDSCAPE);
+  lcd.clrScr();
+}
+
+void loop(){
+  if(Serial.available() > 0){
+    inc = Serial.parseFloat();
+    Serial.println(inc);
+  }
+
+  // draw sine behind
+  lcd.setColor(VGA_RED);
+  sinewave+= inc;
+  if(sinewave>6.28) sinewave = 0.f;
+  py = y;
+  y = 160-(sin(sinewave) * 80.f);
+
+  x++;
+  if(x > 479) x = 0;
+  px = x-1;
+  lcd.drawLine(px, py, x, y);
+
+  //clear vertical line ahead
+  lcd.setColor(VGA_BLACK);
+  if(x<1) lcd.drawLine(0, 0, 0, 319);
+  lcd.drawLine(x+1, 0, x+1, 319);
+
+  delay(5);
+}


hall sensor voorwiel

hall sensor voorwiel

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/quinten991/PenO3OnTrack.git/'


Just deleted a line at the beginning

Just deleted a line at the beginning

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


Add Arduino firm for left gripper-v6

Add Arduino firm for left gripper-v6

error: pathspec 'jsk_arc2017_baxter/firmware/gripper_v6/sensor_manager_left_sparkfun/sensor_manager_left_sparkfun.ino' did not match any file(s) known to git

--- jsk_arc2017_baxter/firmware/gripper_v6/sensor_manager_left_sparkfun/sensor_manager_left_sparkfun.ino
+++ jsk_arc2017_baxter/firmware/gripper_v6/sensor_manager_left_sparkfun/sensor_manager_left_sparkfun.ino
@@ -0,0 +1,268 @@
+#include <SPI.h>
+#include <ros.h>
+#include <Wire.h>
+#include <jsk_arc2017_baxter/GripperSensorStates.h>
+
+#define WIRE Wire
+
+/***** GLOBAL CONSTANTS *****/
+
+#define VCNL4040_ADDR 0x60 //7-bit unshifted I2C address of VCNL4040
+
+//Command Registers have an upper byte and lower byte.
+#define PS_CONF1 0x03
+//#define PS_CONF2 //High byte of PS_CONF1
+#define PS_CONF3 0x04
+//#define PS_MS //High byte of PS_CONF3
+#define PS_DATA_L 0x08
+//#define PS_DATA_M //High byte of PS_DATA_L
+
+
+#define NSENSORS 5
+#define PCA9547D_RESET 32
+#define LOOP_TIME 50  // loop duration in ms
+
+/***** ROS *****/
+ros::NodeHandle  nh;
+jsk_arc2017_baxter::GripperSensorStates gripper_sensor_msg;
+ros::Publisher gripper_sensor_pub("lgripper_sensors", &gripper_sensor_msg);
+uint32_t proximities[NSENSORS];
+
+
+uint16_t dig_T1;
+int16_t dig_T2;
+int16_t dig_T3;
+uint16_t dig_P1;
+int16_t dig_P2;
+int16_t dig_P3;
+int16_t dig_P4;
+int16_t dig_P5;
+int16_t dig_P6;
+int16_t dig_P7;
+int16_t dig_P8;
+int16_t dig_P9;
+
+int ChgI2CMultiplexer(unsigned char adrs,unsigned char ch)
+{
+  unsigned char c;
+  int  ans;
+
+  Wire.beginTransmission(adrs);
+  c = ch & 0x07;
+  c = c | 0x08;
+  Wire.write(c);
+  ans = Wire.endTransmission();
+
+  return ans ;
+}
+
+void measure_proximity()
+{
+  int i;
+  for(i=0;i<NSENSORS;i++)
+  {
+    ChgI2CMultiplexer(0x70, i);
+    proximities[i] = readFromCommandRegister(PS_DATA_L);
+    delay(1);
+  }
+
+  gripper_sensor_msg.proximities = proximities;
+  gripper_sensor_msg.proximities_length = NSENSORS;
+}
+
+void measure_pressure_and_flex()
+{
+  float press_act = 0.0;
+  unsigned long int pres_raw, temp_raw;
+  readData(&pres_raw, &temp_raw);
+  press_act = (float)calibration_P(pres_raw, calibration_T(temp_raw)) / 100.0;
+  gripper_sensor_msg.pressure = press_act;
+
+  delay(1);
+
+  gripper_sensor_msg.r_finger_flex = analogRead(A0);
+  gripper_sensor_msg.l_finger_flex = analogRead(A1);
+}
+
+
+void initVCNL4040()
+{
+  //Clear PS_SD to turn on proximity sensing
+  //byte conf1 = 0b00000000; //Clear PS_SD bit to begin reading
+  byte conf1 = 0b00001110; //Integrate 8T, Clear PS_SD bit to begin reading
+  byte conf2 = 0b00001000; //Set PS to 16-bit
+  //byte conf2 = 0b00000000; //Clear PS to 12-bit
+  writeToCommandRegister(PS_CONF1, conf1, conf2); //Command register, low byte, high byte
+
+  delay(1);
+  //Set the options for PS_CONF3 and PS_MS bytes
+  byte conf3 = 0x00;
+  byte ms = 0b00000001; //Set IR LED current to 75mA
+  //byte ms = 0b00000010; //Set IR LED current to 100mA
+  //byte ms = 0b00000110; //Set IR LED current to 180mA
+  //byte ms = 0b00000111; //Set IR LED current to 200mA
+  writeToCommandRegister(PS_CONF3, conf3, ms);
+}
+
+//Reads a two byte value from a command register
+unsigned int readFromCommandRegister(byte commandCode)
+{
+  Wire.beginTransmission(VCNL4040_ADDR);
+  Wire.write(commandCode);
+  Wire.endTransmission(false); //Send a restart command. Do not release bus.
+
+  Wire.requestFrom(VCNL4040_ADDR, 2); //Command codes have two bytes stored in them
+
+  unsigned int data = Wire.read();
+  data |= Wire.read() << 8;
+
+  return (data);
+}
+
+
+//Write a two byte value to a Command Register
+void writeToCommandRegister(byte commandCode, byte lowVal, byte highVal)
+{
+  Wire.beginTransmission(VCNL4040_ADDR);
+  Wire.write(commandCode);
+  Wire.write(lowVal); //Low byte of command
+  Wire.write(highVal); //High byte of command
+  Wire.endTransmission(); //Release bus
+}
+
+
+void setup()
+{
+  nh.getHardware()->setBaud(115200);
+  nh.initNode();
+  nh.advertise(gripper_sensor_pub);
+
+  pinMode(PCA9547D_RESET, OUTPUT);
+  digitalWrite(PCA9547D_RESET, HIGH);
+  Wire.begin();
+
+  int i;
+  for(i=0;i<NSENSORS;i++)
+  {
+    ChgI2CMultiplexer(0x70,i);
+    initVCNL4040(); //Configure sensor
+  }
+
+  pinMode(SS,OUTPUT);
+  SPI.setClockDivider(SPI_CLOCK_DIV8);
+  SPI.begin();
+  initBME();
+  readTrim();
+}
+
+
+void loop()
+{
+  unsigned long time;
+  time = millis();
+
+  delay(1);
+
+  measure_proximity();
+  measure_pressure_and_flex();
+
+  gripper_sensor_pub.publish(&gripper_sensor_msg);
+
+  while (millis() < time + LOOP_TIME); // enforce constant loop time
+
+  nh.spinOnce();
+}
+
+void initBME()
+{
+  digitalWrite(SS, LOW);
+  SPI.transfer((0xF5 & 0x7F));
+  SPI.transfer(0xA0);
+  SPI.transfer((0xF4 & 0x7F));
+  SPI.transfer(0x27);
+  digitalWrite(SS, HIGH);
+}
+
+void readTrim()
+{
+  uint8_t data[24];
+  int i;
+  digitalWrite(SS, LOW);
+  SPI.transfer((0x88 | 0x80));
+  for (i = 0; i < 24; i++)
+  {
+    data[i] = SPI.transfer(0);
+  }
+  digitalWrite(SS, HIGH);
+
+  dig_T1 = (data[1] << 8) | data[0];
+  dig_T2 = (data[3] << 8) | data[2];
+  dig_T3 = (data[5] << 8) | data[4];
+  dig_P1 = (data[7] << 8) | data[6];
+  dig_P2 = (data[9] << 8) | data[8];
+  dig_P3 = (data[11] << 8) | data[10];
+  dig_P4 = (data[13] << 8) | data[12];
+  dig_P5 = (data[15] << 8) | data[14];
+  dig_P6 = (data[17] << 8) | data[16];
+  dig_P7 = (data[19] << 8) | data[18];
+  dig_P8 = (data[21] << 8) | data[20];
+  dig_P9 = (data[23] << 8) | data[22];
+}
+
+void readData(unsigned long int * pres_raw, unsigned long int * temp_raw)
+{
+  uint8_t data[8];
+  int i;
+  digitalWrite(SS, LOW);
+  SPI.transfer((0xF7 | 0x80));
+  for (i = 0; i < 8; i++)
+  {
+    data[i] = SPI.transfer(0x00);
+  }
+  digitalWrite(SS, HIGH);
+  *pres_raw = data[0];
+  *pres_raw = ((*pres_raw) << 8) | data[1];
+  *pres_raw = ((*pres_raw) << 4) | (data[2] >> 4);
+  *temp_raw = data[3];
+  *temp_raw = ((*temp_raw) << 8) | data[4];
+  *temp_raw = ((*temp_raw) << 4) | (data[5] >> 4);
+}
+
+signed long int calibration_T(signed long int adc_T)
+{
+
+  signed long int var1, var2, T;
+  var1 = ((((adc_T >> 3) - ((signed long int)dig_T1 << 1))) * ((signed long int)dig_T2)) >> 11;
+  var2 = (((((adc_T >> 4) - ((signed long int)dig_T1)) * ((adc_T >> 4) - ((signed long int)dig_T1))) >> 12) * ((signed long int)dig_T3)) >> 14;
+
+  return (var1 + var2);
+}
+
+unsigned long int calibration_P(signed long int adc_P, signed long int t_fine)
+{
+  signed long int var1, var2;
+  unsigned long int P;
+  var1 = (((signed long int)t_fine) >> 1) - (signed long int)64000;
+  var2 = (((var1 >> 2) * (var1 >> 2)) >> 11) * ((signed long int)dig_P6);
+  var2 = var2 + ((var1 * ((signed long int)dig_P5)) << 1);
+  var2 = (var2 >> 2) + (((signed long int)dig_P4) << 16);
+  var1 = (((dig_P3 * (((var1 >> 2) * (var1 >> 2)) >> 13)) >> 3) + ((((signed long int)dig_P2) * var1) >> 1)) >> 18;
+  var1 = ((((32768 + var1)) * ((signed long int)dig_P1)) >> 15);
+  if (var1 == 0)
+  {
+      return 0;
+  }
+  P = (((unsigned long int)(((signed long int)1048576) - adc_P) - (var2 >> 12))) * 3125;
+  if (P < 0x80000000)
+  {
+      P = (P << 1) / ((unsigned long int) var1);
+  }
+  else
+  {
+      P = (P / (unsigned long int)var1) * 2;
+  }
+  var1 = (((signed long int)dig_P9) * ((signed long int)(((P >> 3) * (P >> 3)) >> 13))) >> 12;
+  var2 = (((signed long int)(P >> 2)) * ((signed long int)dig_P8)) >> 13;
+  P = (unsigned long int)((signed long int)P + ((var1 + var2 + dig_P7) >> 4));
+  return P;
+}


Simple firmware to test a button

Simple firmware to test a button

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

--- Particle/testbutton.ino
+++ Particle/testbutton.ino
@@ -0,0 +1,30 @@
+int led = D7; // LED is connected to D0
+int pushButton = D4; // Push button is connected to D2
+int ledstate = LOW;
+
+// This routine runs only once upon reset
+void setup()
+{
+  pinMode(led, OUTPUT); // Initialize D0 pin as output
+  pinMode(pushButton, INPUT_PULLUP);
+  // Initialize D2 pin as input with an internal pull-up resistor
+}
+
+// This routine loops forever
+void loop()
+{
+  int pushButtonState;
+
+  pushButtonState = digitalRead(pushButton);
+
+  if(pushButtonState == LOW)
+  { // If we push down on the push button
+      if (ledstate == LOW) {
+        digitalWrite(led, HIGH);
+        ledstate = HIGH;
+      } else {
+        digitalWrite(led, LOW);
+        ledstate = LOW;
+      }
+  }
+}


Update Datalogger.ino

Update Datalogger.ino

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


Bumping version for release.

Bumping version for release.

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/FirstBuild/pizzaduino.git/'


added controller Arduino sketch for esp8266

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

--- controller/WiFiClient_esp.ino
+++ controller/WiFiClient_esp.ino
@@ -0,0 +1,105 @@
+/*
+ *  Customized script from original WiFiClient example from sparkfun.com
+ *
+ */
+
+#include <ESP8266WiFi.h>
+
+// insert your WIFI SSID and PSK
+const char WiFiSSID[] = "xxx" ;
+const char WiFiPSK[] = "yyy";
+
+
+const int RIGHT =5;
+const int LEFT = 2;
+const int UP = 14;
+const int DOWN = 0;
+const int BUT1 = 16;
+const int BUT2 = 12;
+const int BUT3 = 13;
+const int BUT4 = 4;
+
+//insert RaspiPi IP adress
+const char HOST[] = "xxx.xxx.xxx.xxx";
+
+
+void setup() {
+  Serial.begin(115200);
+  delay(100);
+  pinMode(RIGHT,INPUT_PULLUP);
+  pinMode(LEFT,INPUT_PULLUP);
+  pinMode(UP,INPUT_PULLUP);
+  pinMode(DOWN,INPUT_PULLUP);
+  pinMode(BUT1,INPUT);
+  pinMode(BUT2,INPUT_PULLUP);
+  pinMode(BUT3,INPUT_PULLUP);
+  pinMode(BUT4,INPUT_PULLUP);
+
+  // We start by connecting to a WiFi network
+
+  WiFi.begin(WiFiSSID, WiFiPSK);
+
+  while (WiFi.status() != WL_CONNECTED) {
+    delay(500);
+    Serial.print(".");
+  }
+  Serial.println("");
+  Serial.println("WiFi connected");
+  Serial.println("IP address: ");
+  Serial.println(WiFi.localIP());
+}
+
+int value = 0;
+
+void loop() {
+  delay(5000);
+  ++value;
+
+  Serial.print("connecting to ");
+  Serial.println(HOST);
+
+  // Use WiFiClient class to create TCP connections
+  WiFiClient client;
+  const int Port = 4711;
+  if (!client.connect(HOST, Port)) {
+    Serial.println("connection failed");
+    return;
+  }
+  byte message = 0x00;
+  byte oldmessage = 0x80;
+  while(true)
+  {
+
+
+    message = 0x00;
+    if (!digitalRead(LEFT)) bitSet(message,0);
+    if (!digitalRead(RIGHT)) bitSet(message,1);
+    if (!digitalRead(UP)) bitSet(message,2);
+    if (!digitalRead(DOWN)) bitSet(message,3);
+    if (!digitalRead(BUT1)) bitSet(message,4);
+    if (!digitalRead(BUT2)) bitSet(message,5);
+    if (!digitalRead(BUT3)) bitSet(message,6);
+    if (!digitalRead(BUT4)) bitSet(message,7);
+
+    if (oldmessage != message)
+    {
+      uint8_t * sbuf = (uint8_t *)malloc(1);
+      sbuf[0]=message;
+      client.write((uint8_t *)sbuf, 1);
+      yield();
+      //Serial.write(message);
+      free(sbuf);
+      oldmessage = message;
+    }
+     else
+     {
+      delay(5);
+     }
+
+
+  }
+
+  Serial.println();
+  Serial.println("closing connection");
+}
+


Arduino code

Arduino code

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

--- arduino/flicker_flame_2.ino
+++ arduino/flicker_flame_2.ino
@@ -0,0 +1,136 @@
+// Arduino code to make RGB LEDs flicker like they're on fire
+// Copyright (c) 2012 Philip Beber
+
+// connections from arduino to RGB amplifier:
+// pin 9 to input/R (red wire)
+// pin 10 to input/G (green wire)
+// pin 11 to input/B (blue wire)
+// pin 5V to input/V+ (white wire)
+
+// connections from lights to RGB amplifier
+// red to output/R
+// green to output/G
+// blue to output/B
+// black to output/V+
+
+// connect RGB amplifier to 12V supply (where it says power + - )
+
+// connect arduino to 12V supply
+
+
+int redPin = 9;
+int greenPin = 10;
+int bluePin = 11;
+
+
+int normalize(int intensity)
+{
+  if(intensity < 0)
+  {
+    intensity = 0;
+  }
+  else if (intensity > 255)
+  {
+    intensity = 255;
+  }
+
+  return intensity;
+}
+
+//
+// 0 - off. 255 = full on
+//
+void setPin(int pinNumber, int intensity)
+{
+  intensity = normalize((65536L - (long)intensity * (long)intensity) / 256);
+
+  analogWrite(pinNumber, intensity);
+}
+
+
+void setup()
+{
+pinMode(redPin, OUTPUT);
+pinMode(greenPin, OUTPUT);
+pinMode(bluePin, OUTPUT);
+
+}
+
+/*
+int redLength = 400;
+int yellowLength = 200;
+int
+int randomRed() {
+  return random(128);
+}
+
+int randomGreen
+*/
+
+unsigned long nextYellowOn = 0;
+unsigned long nextYellowOff = 0;
+unsigned long nextRed = 0;
+unsigned long nextWhiteOn = 0;
+unsigned long whiteLength = 200;
+int red = 0;
+int yellow = 0;
+int white = 0;
+unsigned long lastMillis = -1;
+
+void loop() {
+
+  int timeNow = millis();
+  if(lastMillis > timeNow)
+  {
+    nextYellowOn = 0;
+    nextYellowOff = 0;
+    nextRed = 0;
+    red = 0;
+    yellow = 0;
+  }
+
+  lastMillis = timeNow;
+
+  if(nextRed < timeNow)
+  {
+    nextRed = timeNow + random(300);
+    red = random(256);
+  }
+
+  if(nextYellowOn < timeNow)
+  {
+    nextYellowOn = timeNow + random(100);
+    yellow = random(127);
+
+    if(nextYellowOff == 0)
+    {
+      nextYellowOff = timeNow + random(2000);
+    }
+  }
+
+  if(nextYellowOff < timeNow)
+  {
+    yellow = 0;
+    nextYellowOn = timeNow + random(1000);
+    nextYellowOff = 0;
+  }
+
+  if((nextWhiteOn + whiteLength) < timeNow)
+  {
+    white = 0;
+    nextWhiteOn = timeNow + random(5000);
+  }
+  else if(nextWhiteOn < timeNow)
+  {
+    white = random(256);
+  }
+
+  int actualRed = normalize(red + yellow + white);
+  int actualGreen = normalize(yellow / 2 + white / 3);
+  int actualBlue = white / 4;
+
+  setPin(redPin, actualRed);
+  setPin(greenPin, actualGreen);
+  setPin(bluePin, actualBlue);
+
+}


add retry on read dht and on send rfm12b payload

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/timson/yaws.git/'


Add bufer for read sonic distance.

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/kkaczkowski/Hoover.git/'