Standalone mode (no serial connexion required)

--- ethernet-tester.ino
+++ ethernet-tester.ino
@@ -2,6 +2,8 @@

 // -----------------------------------------------------------------------------
 // Hardware Mapping - Arduino Leonardo
+
+#define ENABLE_SERIAL 0

 template<int Pin>
 class ToggleButton : public Bounce
@@ -56,6 +58,7 @@
 static const byte sDecrPin = 21; // A3
 static const byte sIncrPin = 22; // A4
 static const byte sGndPin  = 23; // A5
+static const byte sLedPin  = 13; // LED

 ToggleButton<sModePin> sModeButton;
 ToggleButton<sIncrPin> sIncrButton;
@@ -75,7 +78,7 @@
 };

 byte sRunningMode = RunningMode::automatic;
-byte sCurrentStep = 0;
+byte sCurrentStep = 7;

 // -----------------------------------------------------------------------------

@@ -89,8 +92,10 @@
         if (sModeButton.process())
         {
             sRunningMode = !sRunningMode;
+#if ENABLE_SERIAL
             Serial.print("Running Mode: ");
             Serial.println(sRunningMode ? "manual" : "automatic");
+#endif
             return true;
         }
         delay(sSleepTime);
@@ -112,8 +117,14 @@
 {
     digitalWrite(sOutputPins[inPrevious],   LOW);
     digitalWrite(sOutputPins[sCurrentStep], HIGH);
+#if ENABLE_SERIAL
     Serial.print("Pin ");
     Serial.println(sCurrentStep + 1);
+#else
+    digitalWrite(sLedPin, HIGH);
+    delay(50);
+    digitalWrite(sLedPin, LOW);
+#endif
 }

 // -----------------------------------------------------------------------------
@@ -173,10 +184,14 @@
     {
         pinMode(sOutputPins[i], OUTPUT);
     }
+#if ENABLE_SERIAL
     Serial.begin(115200);
     while (!Serial);
     Serial.print("Ready. Running mode: ");
     Serial.println(sRunningMode ? "manual" : "automatic");
+#else
+    pinMode(sLedPin, OUTPUT);
+#endif
 }

 void loop()


I don't know what changed here, but it doesn't look broken.

--- MoveActuator/MoveSteeringSerial/MoveSteeringSerial.ino
+++ MoveActuator/MoveSteeringSerial/MoveSteeringSerial.ino
@@ -1,10 +1,10 @@
-#include <Settings.h>
+//#include <Settings.h>
 #include <Servo.h>
 Servo steer;
 void setup() {
   // put your setup code here, to run once:
-  pinMode(BRAKE_OUT_PIN, OUTPUT);
-  steer.attach(STEER_OUT_PIN);
+  //pinMode(BRAKE_OUT_PIN, OUTPUT);
+  steer.attach(7);
   Serial.begin(9600);
 }
 int sig = 1500; //195


Use root cert, not fingerprint for api.github.com (#7490)

In the HTTPS example we were using a fingerprint which changes almost
daily as the github.com certificates are regenerated.  Replace this with
a trust anchor based on the ultimate root CA that github.com uses to
sign their certificates.  Assuming they don't change CAs, this
certificate should be good until 2030+

Fixes #7489


2017-04-08 bug fixes (#43)

2017-04-08 bug fixes (#43)

* Change motor controller time out to 0.75, fix return for trex init, upgrade baud to 115200, fix bumper pub bug

--- Arduino/victoria_teensy_ros_node/victoria_teensy_ros_node.ino
+++ Arduino/victoria_teensy_ros_node/victoria_teensy_ros_node.ino
@@ -123,9 +123,6 @@
 geometry_msgs::Pose2D pose;

 // Debug publishers
-char debug_str[80];
-std_msgs::String ros_debug_msg;
-
 victoria_debug_msgs::TeensyDebug teensy_debug_msg;
 ros::Publisher ros_teensy_debug_pub("teensy_debug", &teensy_debug_msg);

@@ -149,6 +146,7 @@
   ros_nh.subscribe(ros_cmd_vel_sub);

   // Initialize and connect to ros
+  ros_nh.getHardware()->setBaud(115200);
   ros_nh.initNode();
   while(!ros_nh.connected()) {
     ros_nh.spinOnce();
@@ -177,7 +175,7 @@
     ros_param_helper.getParam("cmd_vel_timeout_threshold", 0.5);

   motor_controller_cmd_timeout =
-    ros_param_helper.getParam("motor_controller_cmd_timeout", 0.5);
+    ros_param_helper.getParam("motor_controller_cmd_timeout", 0.75);

   ticks_per_radian =
     ros_param_helper.getParam("victoria_ticks_per_radian", 9072);
@@ -461,7 +459,6 @@
   int rawBumperLeft = analogRead(BUMPER_LEFT_PIN);
   int rawBumperRight = analogRead(BUMPER_RIGHT_PIN);

-
   double bumperLeft = MAX_FORCE_LEFT_BUMPER
                         * ((rawBumperLeft - MIN_RAW_LEFT_BUMPER) / RANGE_RAW_LEFT_BUMPER);
   double bumperRight = MAX_FORCE_RIGHT_BUMPER
@@ -477,8 +474,8 @@
   ros_bumper_right_msg.max_value = MAX_FORCE_RIGHT_BUMPER;
   ros_bumper_right_msg.value = bumperRight;

-  ros_raw_imu_pub.publish(&ros_bumper_left_msg);
-  ros_raw_imu_pub.publish(&ros_bumper_right_msg);
+  ros_bumper_left_pub.publish(&ros_bumper_left_msg);
+  ros_bumper_right_pub.publish(&ros_bumper_right_msg);
 }

 /*
@@ -525,6 +522,10 @@
   return total / NUM_VEL_SAMPLES;
 }

+/*
+ * Starts up the TReX motor controller. Returns false if
+ * started without any error.
+ */
 bool startTRex() {
   // TODO(mwomack): Move all the TRex stuff into a helper class!

@@ -540,7 +541,7 @@
   trex.write(0x55); // constant format byte 1
   trex.write(0x2A); // constant format byte 2
   while (!trex.available()) {}
-  return (trex.read() == 0x00);
+  return (trex.read() != 0x00);
 }

 // Callback for blink


Update victoria_teensy_ros_node.ino

Update victoria_teensy_ros_node.ino

Update comments
Add setting of last_odom_publish_time
Add callbacks for imu and magnetometer
Set TICKS_PER_RADIAN value

--- Arduino/victoria_teensy_ros_node/victoria_teensy_ros_node.ino
+++ Arduino/victoria_teensy_ros_node/victoria_teensy_ros_node.ino
@@ -50,7 +50,7 @@
 double motor_right_speed;

 // Victoria constants
-#define TICKS_PER_RADIAN 11 // TODO(mwomack): Need the real value here
+#define TICKS_PER_RADIAN 9072 // TODO(mwomack): Verify real value
 #define TRACK_RADIUS 0.235  // in meters
 #define WHEEL_RADIUS 0.127  // in meters
 #define MAX_SPEED 4.71      // in meters/second
@@ -68,8 +68,8 @@
 ros::Time last_encoder_read_time;

 #define NUM_VEL_SAMPLES 10
-double ang_vel_samples_l[NUM_VEL_SAMPLES];
-double ang_vel_samples_r[NUM_VEL_SAMPLES];
+double ang_v_samples_l[NUM_VEL_SAMPLES];
+double ang_v_samples_r[NUM_VEL_SAMPLES];
 int velocity_index = 0;

 // IMU and Magnetometer
@@ -99,6 +99,7 @@
 geometry_msgs::TransformStamped ros_odom_transform;
 tf::TransformBroadcaster ros_odom_broadcaster;

+// Position variables
 double x;
 double y;
 double th;
@@ -194,6 +195,16 @@
     publish_odom_freq_hz = 100;
   }

+  int publish_imu_freq_hz;
+  if (!ros_nh.getParam("publish_imu_freq_hz", &publish_imu_freq_hz)) {
+    publish_odom_freq_hz = 2;
+  }
+
+  int publish_magnetometer_freq_hz;
+  if (!ros_nh.getParam("publish_magnetometer_freq_hz", &publish_magnetometer_freq_hz)) {
+    publish_odom_freq_hz = 2;
+  }
+
   // Initialize broadcasters
   ros_odom_transform.header.frame_id = ros_odom_header_frame_id;
   ros_odom_transform.child_frame_id = ros_odom_child_frame_id;
@@ -210,6 +221,8 @@
   // Setup Timer callbacks
   timer.every((1.0/read_encoders_freq_hz) * 1000, doReadEncoders);
   timer.every((1.0/publish_odom_freq_hz) * 1000, doPublishOdom);
+  timer.every((1.0/publish_imu_freq_hz) * 1000, doPublishImu);
+  timer.every((1.0/publish_magnetometer_freq_hz) * 1000, doPublishMagnetometer);
   timer.every(BLINK_DURATION, doBlink);

   current_time = ros_nh.now();
@@ -285,11 +298,11 @@
     return;
   }

-  // Calculate linear wheel velocity
+  // Calculate wheel linear velocity
   double vl = cmd_vel_msg.linear.x - (cmd_vel_msg.angular.z * TRACK_RADIUS);
   double vr = cmd_vel_msg.linear.x + (cmd_vel_msg.angular.z * TRACK_RADIUS);

-  // Calculate angular velocity
+  // Calculate wheel angular velocity
   double wl = vl / WHEEL_RADIUS;
   double wr = vr / WHEEL_RADIUS;

@@ -313,8 +326,8 @@
   unsigned long diff_r = new_encoder_right_pos - encoder_right_pos;
   double diff_t = current_time.toSec() - last_encoder_read_time.toSec();

-  ang_vel_samples_l[velocity_index] = (diff_l/TICKS_PER_RADIAN)/diff_t;
-  ang_vel_samples_r[velocity_index] = (diff_r/TICKS_PER_RADIAN)/diff_t;
+  ang_v_samples_l[velocity_index] = (diff_l/TICKS_PER_RADIAN)/diff_t;
+  ang_v_samples_r[velocity_index] = (diff_r/TICKS_PER_RADIAN)/diff_t;

   velocity_index = (velocity_index + 1) % NUM_VEL_SAMPLES;
   encoder_left_pos = new_encoder_left_pos;
@@ -322,20 +335,31 @@
   last_encoder_read_time = current_time;
 }

+/*
+ * Publish odometry to ros.
+ */
 void doPublishOdom() {
   ros::Time current_time = ros_nh.now();
-  double wl = getAngularVelocityFromSamples(ang_vel_samples_l);
-  double wr = getAngularVelocityFromSamples(ang_vel_samples_r);
+
+  // Get the current wheel angular velocity
+  double wl = getAngularVelocityFromSamples(ang_v_samples_l);
+  double wr = getAngularVelocityFromSamples(ang_v_samples_r);
+
+  // Convert to wheel linear velocity
   double vl = wl * WHEEL_RADIUS;
   double vr = wr * WHEEL_RADIUS;
+
+  // Calculate robot vx and vth
   double vx = (vl + vr)/2;
   double vth = (vr - vl)/(2 * TRACK_RADIUS);

+  // Calculate the deltas since
   double dt = current_time.toSec() - last_odom_publish_time.toSec();
   double delta_x = (vx * cos(th)) * dt;
   double delta_y = (vx * sin(th)) * dt;
   double delta_th = vth * dt;

+  // Update position
   x += delta_x;
   y += delta_y;
   th += delta_th;
@@ -368,11 +392,56 @@
   ros_odom_msg.twist.twist.angular.z = vth;

   ros_odom_pub.publish(&ros_odom_msg);
+
+  // Remember current time for next publish
+  last_odom_publish_time = current_time;
+}
+
+/*
+ * Publish imu data to ros.
+ */
+void doPublishImu() {
+  // TODO(mwomack)
+}
+
+/*
+ * Publish magnetometer data to ros.
+ */
+void doPublishMagnetometer() {
+  // TODO(mwomack)
+}
+
+/*
+ * Sets the speed for the motors. Values are expected
+ * to be between -1 and 1. Values outside this range
+ * will be pinned.
+ */
+void setMotors(double motor_left_speed, double motor_right_speed) {
+  byte command_byte_left = 0xC4;
+  if (motor_left_speed < 0) {
+    command_byte_left = command_byte_left | 0x01;
+  } else {
+    command_byte_left = command_byte_left | 0x02;
+  }
+  int trex_left_speed = min(127, 127.0 * abs(motor_left_speed));
+
+  byte command_byte_right = 0xCC;
+  if (motor_right_speed < 0) {
+    command_byte_right = command_byte_right | 0x02;
+  } else {
+    command_byte_right = command_byte_right | 0x01;
+  }
+  int trex_right_speed = min(127, 127.0 * abs(motor_right_speed));
+
+  trex.write(command_byte_left);
+  trex.write((byte)trex_left_speed);
+  trex.write(command_byte_right);
+  trex.write((byte)trex_right_speed);
 }

 /*
  * Returns the calculated angular velocity from all of
- * the samples. Right now it just returns the average
+ * the samples. currently it just returns the average
  * of all the samples.
  */
 double getAngularVelocityFromSamples(double* samples) {
@@ -381,34 +450,6 @@
     total += samples[count];
   }
   return total/10.0;
-}
-
-/*
- * Sets the speed for the motors. Values are expected
- * to be between -1 and 1. Values outside this range
- * will be pinned.
- */
-void setMotors(double motor_left_speed, double motor_right_speed) {
-  byte command_byte_left = 0xC4;
-  if (motor_left_speed < 0) {
-    command_byte_left = command_byte_left | 0x01;
-  } else {
-    command_byte_left = command_byte_left | 0x02;
-  }
-  int trex_left_speed = min(127, 127.0 * abs(motor_left_speed));
-
-  byte command_byte_right = 0xCC;
-  if (motor_right_speed < 0) {
-    command_byte_right = command_byte_right | 0x02;
-  } else {
-    command_byte_right = command_byte_right | 0x01;
-  }
-  int trex_right_speed = min(127, 127.0 * abs(motor_right_speed));
-
-  trex.write(command_byte_left);
-  trex.write((byte)trex_left_speed);
-  trex.write(command_byte_right);
-  trex.write((byte)trex_right_speed);
 }

 // Callback for blink


Minor change to example comment

Minor change to example comment

Can't be the right word! ;)

--- build/shared/examples/02.Digital/Debounce/Debounce.ino
+++ build/shared/examples/02.Digital/Debounce/Debounce.ino
@@ -41,7 +41,7 @@
 int lastButtonState = LOW;   // the previous reading from the input pin

 // the following variables are unsigned long's because the time, measured in miliseconds,
-// will quickly become a bigger number than can't be stored in an int.
+// will quickly become a bigger number than can be stored in an int.
 unsigned long lastDebounceTime = 0;  // the last time the output pin was toggled
 unsigned long debounceDelay = 50;    // the debounce time; increase if the output flickers


Fix tabs

Fix tabs

--- teensy3/libraries/TeensyRTC/examples/TeensyRTCExample.ino
+++ teensy3/libraries/TeensyRTC/examples/TeensyRTCExample.ino
@@ -35,6 +35,6 @@
 }

 void loop() {
-    logTime();
-    delay(1000);
+	logTime();
+	delay(1000);
 }


Updated for long, misc

Updated for long, misc

--- OpenCR/turtlebot3_core_monster/turtlebot3_core_monster.ino
+++ OpenCR/turtlebot3_core_monster/turtlebot3_core_monster.ino
@@ -34,6 +34,9 @@
 // Bumpers, cliffs, buttons, encoders, battery of Turtlebot3
 turtlebot3_msgs::SensorState sensor_state_msg;
 ros::Publisher sensor_state_pub("sensor_state", &sensor_state_msg);
+
+// Create a 2nd sensor state msg to read from the encoders behind
+turtlebot3_msgs::SensorState sensor_state2_msg;

 // IMU of Turtlebot3
 sensor_msgs::Imu imu_msg;


Fixed call of BNO constructor? Renamed global variable due to compilation error.

--- test/Arduino/MicroView/MicroView_ino/MicroView_ino.ino
+++ test/Arduino/MicroView/MicroView_ino/MicroView_ino.ino
@@ -38,14 +38,14 @@
 #define BNO055_SAMPLERATE_DELAY_MS (100)

 // stores the callibration status data
-uint8_t system = 0;
+uint8_t systemCalib = 0;
 uint8_t gyro   = 0;
 uint8_t accel  = 0;
 uint8_t mag    = 0;

-Adafruit_BNO055 bno = Adafruit_BNO055(55);
+Adafruit_BNO055 bno = Adafruit_BNO055(0X0C);

 /**************************************************************************/
 /*
@@ -134,7 +134,7 @@
   /* Get the four calibration values (0..3) */
   /* Any sensor data reporting 0 should be ignored, */
   /* 3 means 'fully calibrated" */
-  bno.getCalibration(&system, &gyro, &accel, &mag);
+  bno.getCalibration(&systemCalib, &gyro, &accel, &mag);
 }

@@ -151,7 +151,7 @@

   /* The data should be ignored until the system calibration is > 0 */
   //Serial.print("\t");
-  if (!system)
+  if (!systemCalib)
   {
     uView.clear(PAGE);
     uView.setCursor(0, 0*fontHeight);
@@ -169,7 +169,7 @@
   // Sys
   uView.setCursor(0, 1*fontHeight);
   uView.print("Sys:  ");
-  uView.print(system, DEC);
+  uView.print(systemCalib, DEC);

   // Gyrocope
   uView.setCursor(0, 2*fontHeight);
@@ -292,7 +292,7 @@

   uView.setCursor(0, 4*fontHeight);
   uView.print("System: ");
-  uView.print(system);
+  uView.print(systemCalib);

   uView.display();


displaySensorStatus changed to OLED

displaySensorStatus changed to OLED

--- test/Arduino/MicroView/MicroView_ino/MicroView_ino.ino
+++ test/Arduino/MicroView/MicroView_ino/MicroView_ino.ino
@@ -87,9 +87,8 @@

   // show it
   uView.display();
-
-  delay(500);
-}
+}
+

 /**************************************************************************/
 /*
@@ -103,16 +102,23 @@
   system_status = self_test_results = system_error = 0;
   bno.getSystemStatus(&system_status, &self_test_results, &system_error);

-  /* Display the results in the Serial Monitor */
-  Serial.println("");
-  Serial.print("System Status: 0x");
-  Serial.println(system_status, HEX);
-  Serial.print("Self Test:     0x");
-  Serial.println(self_test_results, HEX);
-  Serial.print("System Error:  0x");
-  Serial.println(system_error, HEX);
-  Serial.println("");
-  delay(500);
+  /* Display the results */
+  uView.clear(PAGE);
+
+  uView.setCursor(0, 0*fontHeight);
+  uView.print("System:0x");
+  uView.print(system_status, HEX);
+
+  uView.setCursor(0, 1*fontHeight);
+  uView.print("Test:  0x");
+  uView.print(self_test_results, HEX);
+
+  uView.setCursor(0, 2*fontHeight);
+  uView.print("Error: 0x");
+  uView.print(system_error, HEX);
+
+  // show it
+  uView.display();
 }

 /**************************************************************************/
@@ -171,9 +177,6 @@
   uView.print("Sensortest");
   uView.display();

-  //Serial.begin(9600);
-  //Serial.println("Orientation Sensor Test");
-  //Serial.println("");

   /* Initialise the sensor */
   if(!bno.begin())
@@ -181,9 +184,8 @@
     uView.clear(PAGE);
     uView.setCursor(0,0);
     /* There was a problem detecting the BNO055 ... check your connections */
-    //Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
     uView.println("Ooops, no    BNO055 detected!");
-    uView.print("Please reset HW.");
+    uView.print("Please check I2C.");
     uView.display();

     while(1);
@@ -193,9 +195,11 @@

   /* Display some basic information on this sensor */
   displaySensorDetails();
+  delay(1000);

   /* Optional: Display current status */
   displaySensorStatus();
+  delay(1000);

   bno.setExtCrystalUse(true);
 }


More precise instruction for USB

More precise instruction for USB

--- examples/BoardsAndShields/Arduino_Serial_USB/Arduino_Serial_USB.ino
+++ examples/BoardsAndShields/Arduino_Serial_USB/Arduino_Serial_USB.ino
@@ -25,8 +25,15 @@
  * 3. Run the script (script located in "scripts" folder of library root,
  *    e.g. 'blynk-library/scripts') for redirecting traffic to server:
  *
- *      for Windows:         blynk-ser.bat
- *      for Linux and OSX:   ./blynk-ser.sh (may need to run with sudo)
+ *      for Windows:
+ *                     1. Open cmd.exe
+ *                     2. write : (your way to blynk-ser.bat folder) example: "cd C:\blynk-library-0.3.1\blynk-library-0.3.1\scripts"
+ *                     3. write : "blynk-ser.bat -c COM4" (where COM4 is port with your Arduino)
+ *                     4. And press "Enter" , press "Enter" and press "Enter"
+ *
+ *      for Linux and OSX:
+ *
+ *                    ./blynk-ser.sh (may need to run with sudo)
  *
  *    You can specify port, baud rate, and server endpoint like this:
  *      ./blynk-ser.sh -c <serial port> -b <baud rate> -s <server address> -p <server port>


Update COA_Arduino_with_ethernet.ino

Update COA_Arduino_with_ethernet.ino

--- Examples/Arduino-and-PHP/Arduino/COA_Arduino_with_ethernet.ino
+++ Examples/Arduino-and-PHP/Arduino/COA_Arduino_with_ethernet.ino
@@ -5,7 +5,7 @@
 			 | |  | | | |/ _ \
 			 | |__| |_| / ___ \
         		  \____\___/_/   \_\
-                 Conor's Obscurification Algorithm
+                   Conor's Obfuscation Algorithm

   Conor Walsh 2014 - 2015
      Website: http://www.conorwalsh.net


Update to add DSTRCLib

Update to add DSTRCLib

--- TinyScreenClockAndDisplay/TinyScreenClockAndDisplay.ino
+++ TinyScreenClockAndDisplay/TinyScreenClockAndDisplay.ino
@@ -27,7 +27,7 @@
 int buttonReleased=0;
 int countdown = 0;

-char notificationLine1[20]="Release 2.9.2";
+char notificationLine1[20]="Release 3.0.0";

 void setup(void) {
   Wire.begin();


Parameter tuning from 3/26 workday (#36)

* Change set point to reference velocity.
* Tuning parameters for track radius and wheel radius

--- Arduino/victoria_teensy_ros_node/victoria_teensy_ros_node.ino
+++ Arduino/victoria_teensy_ros_node/victoria_teensy_ros_node.ino
@@ -172,10 +172,10 @@
     ros_param_helper.getParam("victoria_ticks_per_radian", 9072);

   track_radius =
-    ros_param_helper.getParam("victoria_track_radius", 0.235);
+    ros_param_helper.getParam("victoria_track_radius", 0.255);

   wheel_radius =
-    ros_param_helper.getParam("victoria_wheel_radius", 0.127);
+    ros_param_helper.getParam("victoria_wheel_radius", 0.875);

   max_speed =
     ros_param_helper.getParam("victoria_max_speed", 4.71);


Add Blog Post URL

Add Blog Post URL

--- SegaMasterSystem_GamePad_USB/SegaMasterSystem_GamePad_USB.ino
+++ SegaMasterSystem_GamePad_USB/SegaMasterSystem_GamePad_USB.ino
@@ -1,5 +1,6 @@
 /* Sega Master System (SMS) Control Pad to USB
  * Auth: John Milner / jfrmilner
+ * Blog Post URL: https://jfrmilner.wordpress.com/2016/07/17/arduino-project-sega-master-system-sms-control-pad-to-windowslinux-retropie-usb/
  *
  * Date
  * July 2016


More fixes

More fixes

--- UniversalButtons/examples/PerformanceTest/PerformanceTest.ino
+++ UniversalButtons/examples/PerformanceTest/PerformanceTest.ino
@@ -42,7 +42,7 @@
   buttons.setStateChangeCallback(&button_handler);

   Serial.print("Button struct size: ");
-  Serial.println(sizeof(Button));
+  Serial.println(sizeof(button_t));

   Serial.print("UniversalButtons class size: ");
   Serial.println(sizeof(UniversalButtons));


determined that pins 0 and 2 should not be used as I/O

--- Code/ESP32_oled_nav_neo_touch/ESP32_oled_nav_neo_touch.ino
+++ Code/ESP32_oled_nav_neo_touch/ESP32_oled_nav_neo_touch.ino
@@ -33,10 +33,10 @@
 //int navBtn = 0;

 // Nav button
-const int buttonPin1 = 0;    // upper right
-const int buttonPin2 = 2;    // select
+//const int buttonPin1 = 0;    // upper right <<< this pin reserved for programming
+//const int buttonPin2 = 2;    // select      <<< this pin reserved for programming
 const int buttonPin3 = 15;   // upper left
-const int buttonPin4 = 18;   // lower right << no signal - soldering issue?
+const int buttonPin4 = 18;   // lower right
 const int buttonPin5 = 19;   // lower left

 // https://github.com/Serpent999/ESP32_Touch_LED/blob/master/Touch_LED/Touch_LED.ino
@@ -56,8 +56,8 @@
   u8x8.setFont(u8x8_font_pxplusibmcga_r);
   u8x8.setFlipMode(1);        //remove if screen is flipped

-  pinMode(buttonPin1, INPUT);
-  pinMode(buttonPin2, INPUT);
+  //pinMode(buttonPin1, INPUT);
+  //pinMode(buttonPin2, INPUT);
   pinMode(buttonPin3, INPUT);
   pinMode(buttonPin4, INPUT);
   pinMode(buttonPin5, INPUT);
@@ -87,7 +87,7 @@

   // LOW is button pressed
   u8x8.setFont(u8x8_font_victoriamedium8_u);
-
+/*
   // Center button
   if(digitalRead(buttonPin2) == 0){
     u8x8.drawString(0,0,"X BUTTON");
@@ -103,7 +103,7 @@
   }else{
     u8x8.drawString(0,1,"  TOP RIGHT");
   }
-
+*/
   // Upper left
   if(digitalRead(buttonPin3) == 0){
     u8x8.drawString(0,2,"X TOP LEFT");


Update sketch_onewire_DS18x20.ino

Update sketch_onewire_DS18x20.ino

--- OneWire/sketch_onewire_DS18x20.ino
+++ OneWire/sketch_onewire_DS18x20.ino
@@ -11,6 +11,9 @@

    See the README.md file for a brief reference to the functions of
    the OneWire library.
+
+   Author : Canali Marco
+   Date : 11/11/2014

 */


Fix mqtt message error.

Fix mqtt message error.

--- Arduino/coopController/coopController.ino
+++ Arduino/coopController/coopController.ino
@@ -767,7 +767,7 @@
       // states are in sync at other end of MQTT connection.
       mqtt.publish("coop/status", "fan|off", 2, 0);
       mqtt.publish("coop/status", "light|off", 2, 0);
-      mqtt.publish("coop/status", "heater|off", 2, 0);
+      mqtt.publish("coop/status", "water heater|off", 2, 0);
     }
     // Only fetch new sensor data if it's been long enough since the last reading.
     if (lastReading == 0 ||


Update enroleur-galaxy.ino

Update enroleur-galaxy.ino

correction commentaire ligne 198


Fix wind direction table for 10K resistor and 3.3v.

--- arduino/monitor/monitor.ino
+++ arduino/monitor/monitor.ino
@@ -42,6 +42,8 @@

   pinMode(DIO_XBEE_SLEEP, OUTPUT);
   digitalWrite(DIO_XBEE_SLEEP, HIGH);
+
+  pinMode(AIO_WIND_DIRECTION, INPUT);

   xbeeSerial.begin(9600);
   Serial.begin(9600);
@@ -93,34 +95,27 @@
 void sendWeatherUpdate(Stream &out)
 {
   String msg = "?";
-  msg += "hi=test1";
+  msg += "ms=";
+  msg += millis();
+  msg += "wd=";
+  msg += getWindDirection();
   msg += "&hi2=test2";
   out.println(msg);
 }

 int getWindDirection()
-// read the wind direction sensor, return heading in degrees
 {
   unsigned int adc = averageAnalogRead(AIO_WIND_DIRECTION);

-  // TODO: Will these be different for 3.3v?
+  if (adc <= 94) return 90;
+  if (adc <= 186) return 135;
+  if (adc <= 288) return 180;
+  if (adc <= 461) return 45;
+  if (adc <= 628) return 225;
+  if (adc <= 783) return 0;
+  if (adc <= 884) return 315;
+  if (adc <= 941) return 270;

-  if (adc < 380) return (113);
-  if (adc < 393) return (68);
-  if (adc < 414) return (90);
-  if (adc < 456) return (158);
-  if (adc < 508) return (135);
-  if (adc < 551) return (203);
-  if (adc < 615) return (180);
-  if (adc < 680) return (23);
-  if (adc < 746) return (45);
-  if (adc < 801) return (248);
-  if (adc < 833) return (225);
-  if (adc < 878) return (338);
-  if (adc < 913) return (0);
-  if (adc < 940) return (293);
-  if (adc < 967) return (315);
-  if (adc < 990) return (270);
   return (-1);
 }


Changed a bit how the rivals move is retrieved

--- tictactoe/tictactoe.ino
+++ tictactoe/tictactoe.ino
@@ -164,17 +164,9 @@
     printMsg("Wait for your rival's move.");

     // 1- Check rival move, wait until it happens
-    waitForMove = true;
     int rival_move = -1;
-    while(waitForMove){
-      rival_move = getMove();
-      // Wait and check again
-      if (rival_move < 0){
-        delay(100);
-      } else{
-        waitForMove = false;
-      }
-    }
+    rival_move = getMove();
+
     // 2- Update color status
     if (rival_move > -1 && rival_move  < 9){
       redStatus[rival_move] = 1;


fixed bug in sendMove()

fixed bug in sendMove()

--- tictactoe/tictactoe.ino
+++ tictactoe/tictactoe.ino
@@ -465,17 +465,17 @@
   //If ack -> notReceived = false
   //If wait_for_rival -> delay 1000
   while(notReceived){
-  }
-  String res = sendAndWait(MSG_DO_MOVE + SEP_CHAR_COMMANDS + player_id + SEP_CHAR_PARAMETERS  + player_move +  END_CHAR);
-  String command = getCommand(res);
-  if (command.startsWith(CMD_ACK)){
-    Serial.println("Sent");
-    notReceived = false;
-  }
-  else if (command.startsWith(CMD_WAIT_FOR_RIVAL)){
-    Serial.println("Waiting for the rival to retrieve previous move...");
-    delay(1000);
-  }
+    String res = sendAndWait(MSG_DO_MOVE + SEP_CHAR_COMMANDS + player_id + SEP_CHAR_PARAMETERS  + player_move +  END_CHAR);
+    String command = getCommand(res);
+    if (command.startsWith(CMD_ACK)){
+      Serial.println("Sent");
+      notReceived = false;
+    }
+    else if (command.startsWith(CMD_WAIT_FOR_RIVAL)){
+      Serial.println("Waiting for the rival to retrieve previous move...");
+      delay(1000);
+    }
+  }
 }

 void sendMsg(String msg){


Added support for changing gain of ADC

Added support for changing gain of ADC

gain can be selected as 2,4,8,16

--- software/arduino/light-current-read/light-current-read.ino
+++ software/arduino/light-current-read/light-current-read.ino
@@ -6,7 +6,7 @@

 unsigned char bh1750_address = 35;

-unsigned int current_gain = 16;
+unsigned int current_gain = 4;

 void setup(void)
 {
@@ -57,6 +57,10 @@

   // read current
  switch (current_gain) {
+    case 2:
+      ads.setGain(GAIN_TWO);      // 2x gain   +/- 2.048V  1 bit = 0.0625mV
+      multiplier = 0.0625F;      // 2x gain   +/- 2.048V  1 bit = 0.0625mV
+      break;
     case 4:
       ads.setGain(GAIN_FOUR);       // 4x gain   +/- 1.024V  1 bit = 0.03125mV
       multiplier = 0.03125F;  // 4x gain   +/- 1.024V  1 bit = 0.03125mV


Small adjustment to intro spiel

Small adjustment to intro spiel

--- pic32/libraries/Ethernet/examples/WebGraph/WebGraph.ino
+++ pic32/libraries/Ethernet/examples/WebGraph/WebGraph.ino
@@ -29,7 +29,7 @@
  */

 /*  This small demo illustrates how you can build up graphics using
- *  SVG which is basically an XML file.   The analog inputs 0-5 are
+ *  SVG which is basically an XML file.  The analog inputs 0-5 are
  *  periodically read and stored in an array of historical readings.
  *  A web request to the root page ("/") then includes images pointing
  *  to 6 SVG urls (/graph*.svg) which then produce live graphical


loop speech

loop speech

--- examples/SpeechTX/SpeechTX.ino
+++ examples/SpeechTX/SpeechTX.ino
@@ -254,6 +254,10 @@
   radio.initialize();
   radio.setRfPower(0);
   radio.frequency(145010);
+}
+
+void loop() {
+

   radio.waitForChannel(); // wait for the channel to be empty

@@ -275,7 +279,5 @@
   voice.say(spFIRE);

   radio.setModeReceive();
+  delay(10000);
 }
-
-void loop() {
-}


added a movable pixel that is controlled via joystick added an FPS counter to the top left screen

--- roguelike/roguelike.ino
+++ roguelike/roguelike.ino
@@ -1,19 +1,88 @@
-int UpDown    = 0;
-int LeftRight = 0;
+#include <Adafruit_GFX.h>   //Core graphics library
+#include <Adafruit_ST7735.h> //hardware-specific library
+#include <SPI.h> //??
+
+// For the breakout, you can use any 2 or 3 pins
+// These pins will also work for the 1.8" TFT shield
+#define TFT_CS     10
+#define TFT_RST    0  // you can also connect this to the Arduino reset
+                      // in which case, set this #define pin to 0!
+#define TFT_DC     8
+
+// Option 1 (recommended): must use the hardware SPI pins
+// (for UNO thats sclk = 13 and sid = 11) and pin 10 must be
+// an output. This is much faster - also required if you want
+// to use the microSD card (see the image drawing example)
+Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,  TFT_DC, TFT_RST);
+
+// Option 2: use any pins but a little slower!
+#define TFT_SCLK 13   // set these to be whatever pins you like!
+#define TFT_MOSI 11   // set these to be whatever pins you like!
+//Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

+int playerX;
+int playerY;
+int playerSpeed = 5;
+
+
+//clock stuff
+long startTime;
+int count = 0;
+int lastFPS = 0;
+
 void setup() {
+   // Use this initializer if you're using a 1.8" TFT
+  tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab
+  tft.setRotation(1);
+  tft.fillScreen(ST7735_BLACK);
+
+  playerX = tft.width() / 2;
+  playerY = tft.height() / 2;
+
+  startTime = millis();
   //setup serial communication
-  Serial.begin(9600);
+  //Serial.begin(9600);
 }

-void loop() {
-  UpDown = analogRead(A7);
-  LeftRight = analogRead(A6);
-  Serial.print("UpDown = ");
-  Serial.print(UpDown, DEC);
-  Serial.print(", LeftRight = ");
-  Serial.println(LeftRight, DEC);
-  delay(200);
+void movePlayer()
+{
+  float UpDown = ((analogRead(A7) / 1020.0) - 0.5) * -1;
+  float LeftRight = ((analogRead(A6) / 1020.0) - 0.5 ) * -1;

+  playerX = playerX + (int)(playerSpeed * LeftRight);
+  if (playerX > tft.width()) playerX = tft.width();
+  if (playerX < 0) playerX = 0;
+
+  playerY = playerY + (int)(playerSpeed * UpDown);
+  if (playerY > tft.height()) playerY = tft.height();
+  if (playerY < 0) playerY = 0;
+}
+
+void printFPS(int fps, uint64_t color)
+{
+  tft.setCursor(1,1);
+  tft.setTextColor(color);
+  tft.setTextSize(2);
+  tft.print(fps, DEC);
+}
+
+void loop() {
+  printFPS(lastFPS, ST7735_WHITE);
+
+  count++;
+  if (millis() - startTime >= 1000)
+  {
+    printFPS(lastFPS, ST7735_BLACK);
+    lastFPS = count;
+
+    startTime = millis();
+    count = 0;
+  }
+
+  tft.drawPixel(playerX, playerY, ST7735_BLACK);
+  movePlayer();
+
+  tft.drawPixel(playerX, playerY, ST7735_WHITE);
+  //delay(10);
 }


default timeout now doubled and blinking led

--- LightSwitch.ino
+++ LightSwitch.ino
@@ -2,7 +2,8 @@
 #define LIGHT2 6
 #define BTN1 9
 #define BTN2 8
-#define TICKER 6000
+#define LED 13
+#define TICKER 12000    // TICKER * DELAY => Timeout in ms
 #define DELAY 10

 #include "switch.h"
@@ -12,12 +13,25 @@

 void setup()
 {
-    //so far nothing here...
+    pinMode(OUTPUT, LED);
 }
+
+int ledCount = 0;
+bool ledOn = true;

 void loop()
 {
     Sw1.handle();
     Sw2.handle();
+
+    // Blink the LED
+    ledCount++;
+    if(ledCount > 100)
+    {
+        ledCount = 0;
+        ledOn = !ledOn;
+        digitalWrite(LED, ledOn);
+    }
+
     delay(DELAY);
 }


Abstractions ahoy

Abstractions ahoy

--- Goggles.ino
+++ Goggles.ino
@@ -1,16 +1,13 @@
-// Low power NeoPixel goggles example.  Makes a nice blinky display
-// with just a few LEDs on at any time.
-
 #include <Adafruit_NeoPixel.h>

 #define PIN 16
 #define BUTTON 9
+#define DELAY 35

 Adafruit_NeoPixel pixels = Adafruit_NeoPixel(32, PIN);

 uint8_t  mode   = 0, // Current animation effect
          offset = 0; // Position of spinny eyes
-uint32_t color  = 0xFF0000; // Start red
 uint32_t prevTime;

 void setup() {
@@ -25,28 +22,35 @@

   switch(mode) {

-   case 0:
-    for(i=0; i<32; i++) {
-      uint32_t c = 0;
-      if(((offset + i) & 7) < 2) c = color; // 4 pixels on...
-      pixels.setPixelColor(   i, c); // First eye
-     // pixels.setPixelColor(31-i, c); // Second eye (flipped)
-    }
-    pixels.show();
-    offset++;
-    delay(50);
+  case 0:
+    wheel(0xFF0000);
+    break;
+  case 1:
+    wheel(0x00FF00);
+    break;
+  case 2:
+    wheel(0x0000FF);
     break;
   }

   t = millis();
-  if((t - prevTime) > 2000) {      // Every 8 seconds...
-    mode++;                        // Next mode
-    if(mode > 0) {                 // End of modes?
-      mode = 0;                    // Start modes over
-      color >>= 8;                 // Next color R->G->B
-      if(!color) color = 0xFF0000; // Reset to red
+  if((t - prevTime) > DELAY * 16) {
+    mode++;
+    if(mode > 2) {
+      mode = 0;
     }
     for(i=0; i<32; i++) pixels.setPixelColor(i, 0);
     prevTime = t;
   }
 }
+
+void wheel(uint32_t colour) {
+  for(int i=0; i<32; i++) {
+    uint32_t c = 0;
+    if(((offset + i) & 7) < 2) c = colour;
+    pixels.setPixelColor(   i, c);
+  }
+  pixels.show();
+  offset++;
+  delay(DELAY);
+}


Changed pins to match updated schematic

Changed pins to match updated schematic

--- Modules/Action/Number/ArduinoCodes/NumberATmega/NumberATmega.ino
+++ Modules/Action/Number/ArduinoCodes/NumberATmega/NumberATmega.ino
@@ -32,7 +32,7 @@

 #include <SignalProcessing.h>

-int display[7] = {6,5,7,8,9,10,11};           // Pins for Segments A-G
+int display[7] = {10,9,0,1,2,8,5};           // Pins for Segments A-G
 int input_pin = A0;                           // pin 23 on ATmega328
 int filter_size = 15;                         // Noise reduction filter size


set {x,y,z}

set {x,y,z}

--- sketchbook/printer/printer.ino
+++ sketchbook/printer/printer.ino
@@ -15,6 +15,17 @@
     while(!Serial);
 }

+void setPos(int & pos, Motor & motor) {
+    if (!configured) {
+        errConf();
+        return();
+    }
+    int to = Serial.parseInt();
+    motor.rotateSteps(to - pos);
+    pos = to;
+    succes();
+}
+
 void cmdMotor(int & pos, Motor & motor) {
     int steps = Serial.parseInt();
     pos += steps;
@@ -30,8 +41,12 @@
         Serial.print(var);
         Serial.write('\n');
     } else {
-        Serial.write("err not configured\n");
+        errConf();
     }
+}
+
+void errConf() {
+     Serial.write("err not configured\n");
 }

 void succes() {
@@ -50,7 +65,7 @@
                     motorZ.rotateSteps(-posZ);
                     succes();
                 } else {
-                    Serial.write("err not configured\n");
+                    errConf();
                 }
             case '!': // set config
                 while (!Serial.available());
@@ -62,6 +77,15 @@
                         break;
                     case '!': // unset reference point
                         configured = false;
+                        break;
+                    case 'x':
+                        setPos(posX, motorX);
+                        break;
+                    case 'y':
+                        setPos(posY, motorY);
+                        break;
+                    case 'z':
+                        setPos(posZ, motorZ);
                         break;
                     default:
                         Serial.write("err unknown config\n");


cleaned up and commented ZumoMotorExample

--- ZumoMotors/examples/ZumoMotorExample/ZumoMotorExample.ino
+++ ZumoMotors/examples/ZumoMotorExample/ZumoMotorExample.ino
@@ -1,59 +1,92 @@
-/*
- * range of valid speeds is -400 to 400
+#include <ZumoMotors.h>
+
+/*
+ * This example uses the ZumoMotors library to drive each motor on the Zumo
+ * forward, then backward. The yellow user LED is on when a motor should be
+ * running forward and off when a motor should be running backward. If a
+ * motor on your Zumo has been flipped, you can correct its direction by
+ * uncommenting the call to flipLeftMotor() or flipRightMotor() in the setup()
+ * function.
  */

-#include <ZumoMotors.h>
+#define LED_PIN 13

 ZumoMotors motors;

-void setup() {
-  pinMode(13, OUTPUT);
-  motors.flipLeftMotor(false);
-  motors.flipRightMotor(false);
+void setup()
+{
+  pinMode(LED_PIN, OUTPUT);
+
+  // uncomment one or both of the following lines if your motors' directions need to be flipped
+  //motors.flipLeftMotor(true);
+  //motors.flipRightMotor(true);
 }

-void loop() {
-  // flash led
-  digitalWrite(13, HIGH);
-  delay(100);
-  digitalWrite(13, LOW);
-  delay(100);
+void loop()
+{
+  // run left motor forward

-  // run right motor
+  digitalWrite(LED_PIN, HIGH);
+
+  for (int speed = 0; speed <= 400; speed++)
+  {
+    motors.setLeftSpeed(speed);
+    delay(2);
+  }
+
+  for (int speed = 400; speed >= 0; speed--)
+  {
+    motors.setLeftSpeed(speed);
+    delay(2);
+  }
+
+  // run left motor backward
+
+  digitalWrite(LED_PIN, LOW);
+
+  for (int speed = 0; speed >= -400; speed--)
+  {
+    motors.setLeftSpeed(speed);
+    delay(2);
+  }
+
+  for (int speed = -400; speed <= 0; speed++)
+  {
+    motors.setLeftSpeed(speed);
+    delay(2);
+  }
+
+  // run right motor forward
+
+  digitalWrite(LED_PIN, HIGH);
+
   for (int speed = 0; speed <= 400; speed++)
   {
     motors.setRightSpeed(speed);
-    delay(1);
+    delay(2);
+  }
+
+  for (int speed = 400; speed >= 0; speed--)
+  {
+    motors.setRightSpeed(speed);
+    delay(2);
   }

-  for (int speed = 400; speed >= -400; speed--)
+  // run right motor backward
+
+  digitalWrite(LED_PIN, LOW);
+
+  for (int speed = 0; speed >= -400; speed--)
   {
     motors.setRightSpeed(speed);
-    delay(1);
+    delay(2);
   }

   for (int speed = -400; speed <= 0; speed++)
   {
     motors.setRightSpeed(speed);
-    delay(1);
+    delay(2);
   }

-  // run left motor
-  for (int speed = 0; speed <= 400; speed++)
-  {
-    motors.setLeftSpeed(speed);
-    delay(1);
-  }
-
-  for (int speed = 400; speed >= -400; speed--)
-  {
-    motors.setLeftSpeed(speed);
-    delay(1);
-  }
-
-  for (int speed = -400; speed <= 0; speed++)
-  {
-    motors.setLeftSpeed(speed);
-    delay(1);
-  }
+  delay(500);
 }


Fixed minimal test

Fixed minimal test

--- testsuite/REV20Minimal/REV20Minimal.ino
+++ testsuite/REV20Minimal/REV20Minimal.ino
@@ -27,7 +27,7 @@
 // Debug output flag
 #define DEBUG
 // REV7 / DORM1 all-in-one valve unit, secure TX.
-//#define CONFIG_DORM1
+#define CONFIG_TRV20_PROTO
 // Get defaults for valve applications.
 #include <OTV0p2_valve_ENABLE_defaults.h>
 // All-in-one valve unit (DORM1).
@@ -64,14 +64,13 @@
 // OBJECTS & VARIABLES
 /**
  * Peripherals present on REV7
- * - Pot        Set input to Hi-Z?  +
+ * - Pot        Set input to Hi-Z?
  * - PHT        IO_POWER_UP LOW
  * - Encoder    IO_POWER_UP LOW
  * - LED        Set pin HIGH?
  * - Button     Set to INPUT
- * - H-Bridge   Control pins HIGH, Current sense set to input.  +
- * - SHT21      read() once.        +
- * - RFM23B     ??                  +
+ * - H-Bridge   Control pins HIGH, Current sense set to input.
+ * - TMP112     read() once.
  * - XTAL       Setup and leave running?
  * - UART       Disable
  */
@@ -90,34 +89,22 @@
 OTV0P2BASE::SupplyVoltageCentiVolts Supply_cV;

 /*
- * Radio instance
- */
-static constexpr bool RFM23B_allowRX = false;
-
-static constexpr uint8_t RFM23B_RX_QUEUE_SIZE = OTRFM23BLink::DEFAULT_RFM23B_RX_QUEUE_CAPACITY;
-static constexpr int8_t RFM23B_IRQ_PIN = -1;// PIN_RFM_NIRQ;
-// XXX Is it really worth having a separate primary radio in this case?
-OTRFM23BLink::OTRFM23BLink<OTV0P2BASE::V0p2_PIN_SPI_nSS, RFM23B_IRQ_PIN, RFM23B_RX_QUEUE_SIZE, RFM23B_allowRX> PrimaryRadio;//RFM23B;
-///* constexpr */ OTRadioLink::OTRadioLink &PrimaryRadio = RFM23B
-// Pick an appropriate radio config for RFM23 (if it is the primary radio).
-// Nodes talking on fast GFSK channel 0.
-static const uint8_t nPrimaryRadioChannels = 1;
-static const OTRadioLink::OTRadioChannelConfig RFM23BConfigs[nPrimaryRadioChannels] = {
-    // GFSK channel 0 full config, RX/TX, not in itself secure.
-    OTRadioLink::OTRadioChannelConfig(OTRFM23BLink::StandardRegSettingsGFSK57600, true), };
+ * TMP112 instance
+ */
+OTV0P2BASE::RoomTemperatureC16_TMP112 TemperatureC16;

 /*
- * SHT21 instance
- */
-OTV0P2BASE::RoomTemperatureC16_SHT21 TemperatureC16; // SHT21 impl.
+ * SHT21 instance XXX Disabled
+ */
+//OTV0P2BASE::RoomTemperatureC16_SHT21 TemperatureC16; // SHT21 impl.

 // HUMIDITY_SENSOR_SUPPORT is defined if at least one humidity sensor has support compiled in.
 // Simple implementations can assume that the sensor will be present if defined;
 // more sophisticated implementations may wish to make run-time checks.
 // If SHT21 support is enabled at compile-time then its humidity sensor may be used at run-time.
-// Singleton implementation/instance.
-typedef OTV0P2BASE::HumiditySensorSHT21 RelHumidity_t;
-RelHumidity_t RelHumidity;
+//// Singleton implementation/instance.
+//typedef OTV0P2BASE::HumiditySensorSHT21 RelHumidity_t;
+//RelHumidity_t RelHumidity;

 /**
  * Temp pot
@@ -160,7 +147,7 @@
 void panic()
 {
     // Reset radio and go into low-power mode.
-    PrimaryRadio.panicShutdown();
+//    PrimaryRadio.panicShutdown();
     // Power down almost everything else...
     OTV0P2BASE::minimisePowerWithoutSleep();
     pinMode(OTV0P2BASE::LED_HEATCALL_L, OUTPUT);
@@ -213,11 +200,6 @@
     if(!::OTV0P2BASE::HWTEST::calibrateInternalOscWithExtOsc()) { panic(F("Xtal")); } // Async clock not running or can't tune.
 //    if(!::OTV0P2BASE::HWTEST::check32768HzOsc()) { panic(F("xtal")); } // Async clock not running correctly.

-    // Initialise the radio, if configured, ASAP because it can suck a lot of power until properly initialised.
-    PrimaryRadio.preinit(NULL);
-    // Check that the radio is correctly connected; panic if not...
-    if(!PrimaryRadio.configure(nPrimaryRadioChannels, RFM23BConfigs) || !PrimaryRadio.begin()) { panic(F("r1")); }
-
     // Buttons should not be activated DURING boot for user-facing boards; an activated button implies a fault.
     // Check buttons not stuck in the activated position.
     if(fastDigitalRead(BUTTON_MODE_L) == LOW) { panic(F("b")); }
@@ -236,10 +218,11 @@
     DEBUG_SERIAL_PRINT_FLASHSTRING("T: ");
     DEBUG_SERIAL_PRINT(heat);
     DEBUG_SERIAL_PRINTLN();
-    const uint8_t rh = RelHumidity.read();
-    DEBUG_SERIAL_PRINT_FLASHSTRING("RH%: ");
-    DEBUG_SERIAL_PRINT(rh);
-    DEBUG_SERIAL_PRINTLN();
+// SHT21 not present by default.
+//    const uint8_t rh = RelHumidity.read();
+//    DEBUG_SERIAL_PRINT_FLASHSTRING("RH%: ");
+//    DEBUG_SERIAL_PRINT(rh);
+//    DEBUG_SERIAL_PRINTLN();
     const int light = AmbLight.read();
     DEBUG_SERIAL_PRINT_FLASHSTRING("L: ");
     DEBUG_SERIAL_PRINT(light);
@@ -255,7 +238,6 @@
     OTV0P2BASE::LED_HEATCALL_OFF();

     // Do OpenTRV-specific (late) setup.
-    PrimaryRadio.listen(false);

     // Long delay after everything set up to allow a non-sleep power measurement.
     delay(10000);
@@ -287,21 +269,4 @@
  * 20161111/0e6ec96     REV7:   1.5 (1.1) @ 2.5 V       REV11:  0.45 (0.03) @ 2.5 V
  * 20161111/f2eed5e     REV7:   0.46 (0.04) @ 2.5 V
  */
-
-/**
- * @note    REV7 Power consumption investigation.
- *          Figures are not overly accurate due to hot airgun changing board temp. Shouldn't make enough of a difference for our purposes.
- * Baseline:                1.08 mA
- * - Motor decoupling caps: 1.08 mA
- * - Potentiometer:         1.02 mA
- * - BAV99 Suppressors:     1.02 mA
- * - TANT RF decoupling:    1.01 mA
- * - Motor diodes:          1.01 mA
- * - Op Amp:                0.99 mA
- * - Inductor:              178 mA (I think this is due to ML+MR being held high)
- * - H-Bridge Transistors:  0.99 mA
- * - All decoupling:        0.98 mA
- * - All H-Bridge resistors:0.98 mA
- * - Encoder:               0.98 mA
- * - Some resistors:        0.48 mA
- */
+


Remove sketch file and put to another repo jsiot/arduino-spp13

--- Arduino/sketchhome/SerialIO.ino
+++ Arduino/sketchhome/SerialIO.ino
@@ -1,39 +0,0 @@
-/**
-*
-*
-*/
-
-char inData[2];
-
-char inChar;
-
-byte index=0;
-
-int LED = 13;
-
-void setup(){
-  pinMode(LED, OUTPUT);
-
-  Serial.begin(57600);
-  Serial.println('Serial IO');
-  Serial.println('---------');
-  Serial.println();
-}
-
-void loop(){
-if (Serial.available() > 0) {
-
-                 // Baca karakter dari Tx/Rx (USB)
-                 inChar = Serial.read();
-                 Serial.print(inChar);
-
-                 digitalWrite(LED, HIGH);
-                 if(inChar == '1'){
-                     digitalWrite(LED, HIGH);
-                     delay(1000);
-                 }else {
-                     digitalWrite(LED, LOW);
-                     delay(1000);
-                 }
-        }
-}


non-working versio

non-working versio

--- signalboxes/kelberg/kelberg.ino
+++ signalboxes/kelberg/kelberg.ino
@@ -2,37 +2,36 @@
 // #include <Servo.h>  /* Only for library detection */
 #include <Bounce2.h>

-// Pins
-// ====
-//
 // Red LEDs named after the signal/switch lever/etc they're for.
-int LED_SWITCH_5 = 1;
-int LED_SWITCH_1 = 1;
-int LED_SIGNAL_A2 = 1;
-int LED_SIGNAL_A1 = 1;
-int LED_SWITCHING_PERMISSION = 1;
-int LED_ROUTE_A = 1;
-int LED_ROUTE_BERENBACH = 1;
+// Labeled as a8-a15, so 89-82
+int PIN_LED_SWITCH_5 = 89;  // a8
+int PIN_LED_SWITCH_1 = 88;
+int PIN_LED_SIGNAL_A2 = 87;
+int PIN_LED_SIGNAL_A1 = 86;
+int PIN_LED_SWITCHING_PERMISSION = 85;
+int PIN_LED_ROUTE_A = 84;
+int PIN_LED_ROUTE_BERENBACH = 83;
 // White LED
-int LED_ROUTE_A_FIXED = 1;
+int PIN_LED_ROUTE_A_FIXATION = 82;  // a15
+
 // Levers and lock
-int LEVER_SWITCH_5 = 1;
-int LEVER_SWITCH_1 = 1;
-int LEVER_SIGNAL_A2 = 1;
-int LEVER_SIGNAL_A1 = 1;
-int LOCK_SWITCHING_PERMISSION = 1;
+int PIN_LEVER_SWITCH_5 = 78;  // d22
+int PIN_LEVER_SWITCH_1 = 76;  // d24
+int PIN_LEVER_SIGNAL_A2 = 74;  // d26
+int PIN_LEVER_SIGNAL_A1 = 72;  // d28
+int PIN_LOCK_SWITCHING_PERMISSION = 58;  // d32
 // Route levers
-int LEVER_ROUTE_A1 = 1;
-int LEVER_ROUTE_A2 = 1;
-int LEVER_ROUTE_BERENBACH1 = 1;
-int LEVER_ROUTE_BERENBACH2 = 1;
+int PIN_LEVER_ROUTE_A1 = 54;  // d36
+int PIN_LEVER_ROUTE_A2 = 50;  // d38
+int PIN_LEVER_ROUTE_BERENBACH1 = 52;  // d40
+int PIN_LEVER_ROUTE_BERENBACH2 = 42;  // d42
 // Push button for route fixing
-int BUTTON_ROUTE_A_FIXED = 1;
+int PIN_BUTTON_ROUTE_A_FIXATION = 38;  // d46
 // Output pins (pull to 0 means go out of the ground position)
-int OUTPUT_SWITCH_5 = 1;
-int OUTPUT_SWITCH_1 = 1;
-int OUTPUT_SIGNAL_A1 = 1;
-int OUTPUT_SIGNAL_A2 = 1;
+int PIN_OUTPUT_SWITCH_5 = 6;  // pwm 2 TODO
+int PIN_OUTPUT_SWITCH_1 = 7;  // pwm 3 TODO
+int PIN_OUTPUT_SIGNAL_A1 = 1;  // pwm 4 TODO
+int PIN_OUTPUT_SIGNAL_A2 = 5;  // pwm 5 TODO

 // Array index numbers. These are columns in the locking table.
 int SWITCH_5 = 0;
@@ -42,7 +41,7 @@
 int ROUTE_A2 = 4;
 int ROUTE_BERENBACH1 = 5;
 int ROUTE_BERENBACH2 = 6;
-int ROUTE_A_FIXED = 7;
+int ROUTE_A_FIXATION = 7;
 int SIGNAL_A1 = 8;
 int SIGNAL_A2 = 9;

@@ -56,6 +55,10 @@
 boolean blocked [ARRAY_SIZE] = { false, false, false, false, false, false, false, false, false, false };
 boolean requirements_fulfilled [ARRAY_SIZE] = { true, true, true, false, false, false, false, false, false, false };
 boolean position_is_ok [ARRAY_SIZE] = { true, true, true, true, true, true, true, true, true, true };
+
+
+// Actual levers/buttons/locks.
+Bounce levers [ARRAY_SIZE];

 boolean movement_allowed (int number) {
@@ -93,19 +96,19 @@
   }

   // Requirements fulfilled by the route levers and/or the route fixer.
-  requirements_fulfilled[ROUTE_A_FIXED] = false;
+  requirements_fulfilled[ROUTE_A_FIXATION] = false;
   requirements_fulfilled[SIGNAL_A1] = false;
   requirements_fulfilled[SIGNAL_A2] = false;
   if (current_position[ROUTE_A1] == MINUS ||
       current_position[ROUTE_A2] == MINUS) {
-    requirements_fulfilled[ROUTE_A_FIXED] = true;
+    requirements_fulfilled[ROUTE_A_FIXATION] = true;
   }
   if (current_position[ROUTE_A2] == MINUS &&
-      current_position[ROUTE_A_FIXED] == MINUS) {
+      current_position[ROUTE_A_FIXATION] == MINUS) {
     requirements_fulfilled[SIGNAL_A2] = true;
   }
   if (current_position[ROUTE_A1] == MINUS &&
-      current_position[ROUTE_A_FIXED] == MINUS) {
+      current_position[ROUTE_A_FIXATION] == MINUS) {
     requirements_fulfilled[SIGNAL_A1] = true;
   }

@@ -117,8 +120,8 @@
   // blocks a route lever.

   // Reset all blocks.
-  for (int i = 0; i < ARRAY_SIZE; i++) {
-    blocked[i] = false;
+  for (int number = 0; number < ARRAY_SIZE; number++) {
+    blocked[number] = false;
   }

   // Route levers block each other. And they block switches.
@@ -158,18 +161,25 @@
   }

   // Route fixation blocks routes.
-  if (current_position[ROUTE_A_FIXED] == MINUS) {
+  if (current_position[ROUTE_A_FIXATION] == MINUS) {
     blocked[ROUTE_A1] = true;
     blocked[ROUTE_A2] = true;
     // Special case: also keep yourself blocked (it is only un-blocked by
     // moving a signal back to PLUS).
-    blocked[ROUTE_A_FIXED] = true;
+    blocked[ROUTE_A_FIXATION] = true;
   }
 }

 void change_position(int number,
                      int new_position) {
+  if (new_position == MINUS) {
+    digitalWrite(13, HIGH);
+  }
+  else {
+    digitalWrite(13, LOW);
+  }
+
   current_position[number] = new_position;
   position_is_ok[number] = true;
   update_requirements();
@@ -178,7 +188,7 @@
   // Special case: signals going back to PLUS free the route fixation.
   if (number == SIGNAL_A1 || number == SIGNAL_A2) {
     if (new_position == PLUS) {
-      change_position(ROUTE_A_FIXED, PLUS);
+      change_position(ROUTE_A_FIXATION, PLUS);
     }
   }
 }
@@ -202,11 +212,94 @@
 }

+void update_single_lever_led(int pin, int number) {
+  if (position_is_ok[number] == false) {
+    if ((millis() % 1000) > 500) {
+      digitalWrite(pin, HIGH);
+    }
+    else {
+      digitalWrite(pin, LOW);
+    }
+  }
+  else {
+    if (movement_allowed(number)) {
+      digitalWrite(pin, LOW);
+    }
+    else {
+      digitalWrite(pin, HIGH);
+    }
+  }
+}
+
+/* void update_single_lever_led(int pin, int number) { */
+/*   if ((millis() % 1000) > 500) { */
+/*     digitalWrite(pin, HIGH); */
+/*   } */
+/*   else { */
+/*     digitalWrite(pin, LOW); */
+/*   } */
+/* } */
+
+// xxxx
+
 void setup() {
-  // TODO: attach the pins and hook up react_to_movement() functions.
+  pinMode(13, OUTPUT);
+  digitalWrite(13, LOW);
+
+  // Attach the pins and hook up react_to_movement() functions.
+  for (int number = 0; number < ARRAY_SIZE; number++) {
+    levers[number] = Bounce();
+  }
+
+  levers[SWITCH_5].attach(PIN_LEVER_SWITCH_5, INPUT_PULLUP);
+  levers[SWITCH_1].attach(PIN_LEVER_SWITCH_1, INPUT_PULLUP);
+  levers[SWITCHING_PERMISSION].attach(PIN_LOCK_SWITCHING_PERMISSION, INPUT_PULLUP);
+  levers[ROUTE_A1].attach(PIN_LEVER_ROUTE_A1, INPUT_PULLUP);
+  levers[ROUTE_A2].attach(PIN_LEVER_ROUTE_A2, INPUT_PULLUP);
+  levers[ROUTE_BERENBACH1].attach(PIN_LEVER_ROUTE_BERENBACH1, INPUT_PULLUP);
+  levers[ROUTE_BERENBACH2].attach(PIN_LEVER_ROUTE_BERENBACH2, INPUT_PULLUP);
+  levers[SIGNAL_A1].attach(PIN_LEVER_SIGNAL_A1, INPUT_PULLUP);
+  levers[SIGNAL_A2].attach(PIN_LEVER_SIGNAL_A2, INPUT_PULLUP);
+  levers[ROUTE_A_FIXATION].attach(PIN_BUTTON_ROUTE_A_FIXATION, INPUT_PULLUP);
+
+  for (int number = 0; number < ARRAY_SIZE; number++) {
+    levers[number].interval(20);
+  }
+  // Special case: route fixation button should take a second to activate.
+  levers[ROUTE_A_FIXATION].interval(1000);
+
+  // Attach the LEDs.
+  pinMode(PIN_LED_SWITCH_5, OUTPUT);
+  pinMode(PIN_LED_SWITCH_1, OUTPUT);
+  pinMode(PIN_LED_SIGNAL_A2, OUTPUT);
+  pinMode(PIN_LED_SIGNAL_A1, OUTPUT);
+  pinMode(PIN_LED_SWITCHING_PERMISSION, OUTPUT);
+  pinMode(PIN_LED_ROUTE_A, OUTPUT);
+  pinMode(PIN_LED_ROUTE_BERENBACH, OUTPUT);
+  pinMode(PIN_LED_ROUTE_A_FIXATION, OUTPUT);
+
+  // TODO: look up the initial lever positions and update accordingly.
 }

 void loop() {
-  // TODO: update the LEDs and update the outgoing pins.
-}
+  for (int number = 0; number < ARRAY_SIZE; number++) {
+    levers[number].update();
+    if (levers[number].rose()) {
+      react_to_movement(number, PLUS);
+    }
+    if (levers[number].fell()) {
+      react_to_movement(number, MINUS);
+    }
+  }
+  // TODO: update the LEDs.
+  update_single_lever_led(PIN_LED_SWITCH_5, SWITCH_5);
+  update_single_lever_led(PIN_LED_SWITCH_1, SWITCH_1);
+  update_single_lever_led(PIN_LED_SIGNAL_A1, SIGNAL_A1);
+  update_single_lever_led(13, SIGNAL_A1);
+  update_single_lever_led(PIN_LED_SIGNAL_A2, SIGNAL_A2);
+  update_single_lever_led(PIN_LED_SWITCHING_PERMISSION, SWITCHING_PERMISSION);
+  // TODO: Update other three leds
+
+  // TODO: update the outgoing pins.
+}


handle always OTA

handle always OTA

--- client/RGB_control/RGB_control.ino
+++ client/RGB_control/RGB_control.ino
@@ -20,7 +20,7 @@

 #define DEBUG false //debug output
-String Version = "v0.0.1";
+String Version = "v0.0.2";

 const uint8_t r1Pin = D1,
               g1Pin = D2,
@@ -256,6 +256,7 @@

 void loop() {
+  ArduinoOTA.handle();
   while(!mqttClient.connected()) {
     mqttTryReconnect();
     ArduinoOTA.handle();


refactored LED statuses to be global booleans

--- nerdigalli.ino
+++ nerdigalli.ino
@@ -23,6 +23,8 @@
 char displayString[] = "x x x x x"; // = "x x x x x" as start value
 int numberOfChangedSteps = 0;
 boolean finished = false; //game is finished
+boolean isRedOn = 0;
+boolean isGreenOn = 0;

 void setup()
 {
@@ -73,16 +75,16 @@
     displayString[i*2] = randomValue;
   }

-  int isRedOn = random(0, 2);
-  int isGreenOn = random(0, 2);
+  isRedOn = random(0, 2);
+  isGreenOn = random(0, 2);

-  if(isRedOn == 1) {
+  if(isRedOn) {
     digitalWrite(8,HIGH);
   } else {
     digitalWrite(8,LOW);
   }

-  if(isGreenOn == 1) {
+  if(isGreenOn) {
     digitalWrite(7,HIGH);
   } else {
     digitalWrite(7,LOW);
@@ -91,3 +93,8 @@
   numberOfChangedSteps++;
   Serial.println(numberOfChangedSteps);
 }
+
+void calculateResult()
+{
+
+}


updated example to match others

updated example to match others

--- examples/AdafruitHuzzahESP8266_SSL/AdafruitHuzzahESP8266_SSL.ino
+++ examples/AdafruitHuzzahESP8266_SSL/AdafruitHuzzahESP8266_SSL.ino
@@ -11,7 +11,7 @@
 #include <MQTTClient.h>

 const char *ssid = "ssid";
-const char *pass = "password";
+const char *pass = "pass";

 WiFiClientSecure net;
 MQTTClient client;
@@ -21,9 +21,9 @@
 void connect(); // <- predefine connect() for setup()

 void setup() {
-  Serial.begin(115200);
+  Serial.begin(9600);
   WiFi.begin(ssid, pass);
-  client.begin("domain.com",8883, net); // MQTT broker documents to use port 8883 for SSL, change as necessary
+  client.begin("broker.shiftr.io", 8883, net); // MQTT brokers usually use port 8883 for secure connections

   connect();
 }
@@ -36,14 +36,13 @@
   }

   Serial.print("\nconnecting...");
-  while (!client.connect("arduino", "admin", "admin")) // order: clientid,username,password; change as necessary
-{
+  while (!client.connect("arduino", "try", "try")) {
     Serial.print(".");
   }

   Serial.println("\nconnected!");

-  client.subscribe("/example/+/+");
+  client.subscribe("/example");
   // client.unsubscribe("/example");
 }

@@ -59,7 +58,6 @@
   if(millis() - lastMillis > 1000) {
     lastMillis = millis();
     client.publish("/hello", "world");
-    Serial.println("tets");
   }
 }


Update SW01_Humidity_Measurement.ino

Update SW01_Humidity_Measurement.ino

--- examples/SW01_Humidity_Measurement/SW01_Humidity_Measurement.ino
+++ examples/SW01_Humidity_Measurement/SW01_Humidity_Measurement.ino
@@ -3,23 +3,19 @@
 	Digital Temperature, Pressure and Humidity Sensor

 	You can buy one on our store!
-	-----> https://xinabox.cc/SW01/
+	-----> https://xinabox.cc/products/SW01

 	This example request a humidity meausrement to be
 	made by the SW01 and display the data over the Serial
 	bus.
-
-	Currently Supported on the following ☒CHIP:
-	- CW01
-	- CC01
-	- CR01
+
+	Supported on the all ☒CHIPs

 	The sensor communicates over the I2C Bus.
-
+
 	------------------------TIPS--------------------------
-	Change this line ----->Wire.begin(2,14);
-	to this			 ----->Wire.begin();
-	to allow this sensor to communicate with CC01 and CR01
+	Comment out this line ----->Wire.pins(2, 14); for support
+	on other devices

 *************************************************************/

@@ -31,6 +27,9 @@
 void setup(){
 	// Start the Serial Monitor
 	Serial.begin(115200);
+
+	// Set the I2C Pins for CW01
+	Wire.pins(2, 14);

 	// Start the I2C Comunication
 	Wire.begin(2,14);


added switching off functionality

added switching off functionality

--- Arduino/BasementLightExample/BasementLightExample.ino
+++ Arduino/BasementLightExample/BasementLightExample.ino
@@ -103,6 +103,16 @@
     }
   }

+  // if all buttons are pressed, then turn off
+  boolean allPressed = true;
+  for(int y = 0; y < 3; y++) {
+    if(!buttonState[y]) allPressed = false;
+  }
+  if(allPressed) {
+    setBrightnessAll(0);
+    state = 255;
+  }
+
   // Put animation updates here
   // The animations are handled with millis
   // This will allow you to do other stuff while the animation is running


correct pin for encoder

correct pin for encoder

--- code/arduino/motors/motors.ino
+++ code/arduino/motors/motors.ino
@@ -32,10 +32,10 @@

 // Encoder wheel pins
 // IMP_ENCODER_{LEFT,RIGHT}_PIN should be interrupt pins.
-const int IMP_ENCODER_LEFT_PIN = 3;
-const int IMP_ENCODER_RIGHT_PIN = 2;
-const int DIRECTION_LEFT_PIN = 5;
-const int DIRECTION_RIGHT_PIN = 4;
+const int IMP_ENCODER_LEFT_PIN = 2;
+const int IMP_ENCODER_RIGHT_PIN = 3;
+const int DIRECTION_LEFT_PIN = 4;
+const int DIRECTION_RIGHT_PIN = 5;

 // Motor pins.
 const int PWM_MOTOR_LEFT = 10;


Revert "Update RetroWatchArduino.ino"

Revert "Update RetroWatchArduino.ino"

This reverts commit ff6bd6d3c45779e00917cc5b357306ca3e3e0c83.

--- RetroWatch_Arduino/RetroWatchArduino/RetroWatchArduino.ino
+++ RetroWatch_Arduino/RetroWatchArduino/RetroWatchArduino.ino
@@ -33,7 +33,7 @@
 #include <Adafruit_SSD1306.h>
 #include <math.h>
 #include "bitmap.h"
-#include <SPI.h>
+
 ///////////////////////////////////////////////////////////////////
 //----- OLED instance
 #define OLED_RESET 9


Small cleaning

Small cleaning

--- examples/FloatyBall/FloatyBall.ino
+++ examples/FloatyBall/FloatyBall.ino
@@ -9,23 +9,23 @@

 Arduboy display;

-int gameFPS = 1000/30;
+int gameFPS = 1000/30;

 // Things that make the game work the way it do
-const int pipeArraySize = 4;	// For the for loops, at current settings only 3 sets of pipes can be onscreen at once
-int pipes[2][pipeArraySize];	// Row 0 for x values, row 1 for gap location
-int pipeWidth = 12;
-int pipeGapHeight = 30;
+const int pipeArraySize = 4;  // For the for loops, at current settings only 3 sets of pipes can be onscreen at once
+int pipes[2][pipeArraySize];  // Row 0 for x values, row 1 for gap location
+int pipeWidth = 12;
+int pipeGapHeight = 30;
 int pipeCapWidth = 2;
-int pipeCapHeight = 3;			// Caps push back into the pipe, it's not added length
-int pipeMinHeight = 8;			// Higher values center the gaps more
-int pipeGenTimer = 30;			// How many frames until a new pipe is generated
-
-int ballY = 32;					// Floaty's starting height
-int ballX = 64;					// Floaty's X Axis
+int pipeCapHeight = 3;        // Caps push back into the pipe, it's not added length
+int pipeMinHeight = 8;        // Higher values center the gaps more
+int pipeGenTimer = 30;        // How many frames until a new pipe is generated
+
+int ballY = 32;               // Floaty's starting height
+int ballX = 64;               // Floaty's X Axis
 int ballRadius = 4;
-int ballFlapper = ballRadius;	// Floaty's wing length
-int jumpHeight = -6;			// Jumping is negative because 0 is up
+int ballFlapper = ballRadius; // Floaty's wing length
+int jumpHeight = -6;          // Jumping is negative because 0 is up

@@ -37,7 +37,7 @@
 int gameScoreVY = 0;
 int gameScoreRiser = 0;
 int gameHighScore = 0;
-int pipeGenCount = 0;			// Frame counter to generate new pipes
+int pipeGenCount = 0;  // Frame counter to generate new pipes
 int ballVY = 0;
 unsigned long lTime;


Add an example of sendRaw() to IRsendDemo.ino (#270)

People seem to ask how to do this fairly regularly (#269).
Adding an example of it.


Updated to reflect recent changes.

Updated to reflect recent changes.

--- examples/SerialTest/SerialTest.ino
+++ examples/SerialTest/SerialTest.ino
@@ -17,6 +17,7 @@

 void setup(){
   Serial.begin(115200);
+  TC1.begin();
   pinMode(10, OUTPUT);
   digitalWrite(10, HIGH);
 }
@@ -66,5 +67,5 @@
 //  }else{
 //    Serial.println();
   }
-  delay(100);
+  delay(1000);
 }


update example

update example

--- examples/clock_sevenseg_ds1307/clock_sevenseg_ds1307.ino
+++ examples/clock_sevenseg_ds1307/clock_sevenseg_ds1307.ino
@@ -11,8 +11,8 @@
 // ----> http://www.adafruit.com/products/878
 // ----> https://www.adafruit.com/products/264
 //
-// Adafruit invests time and resources providing this open source code,
-// please support Adafruit and open-source hardware by purchasing
+// Adafruit invests time and resources providing this open source code,
+// please support Adafruit and open-source hardware by purchasing
 // products from Adafruit!
 //
 // Written by Tony DiCola for Adafruit Industries.
@@ -73,7 +73,7 @@
     // This line sets the DS1307 time to the exact date and time the
     // sketch was compiled:
     rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
-    // Alternatively you can set the RTC with an explicit date & time,
+    // Alternatively you can set the RTC with an explicit date & time,
     // for example to set January 21, 2014 at 3am you would uncomment:
     //rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
   }
@@ -81,7 +81,7 @@

 void loop() {
   // Loop function runs over and over again to implement the clock logic.
-
+
   // Check if it's the top of the hour and get a new time reading
   // from the DS1307.  This helps keep the clock accurate by fixing
   // any drift.
@@ -135,7 +135,7 @@
     clockDisplay.writeDigitNum(1, 0);
     // Also pad when the 10's minute is 0 and should be padded.
     if (minutes < 10) {
-      clockDisplay.writeDigitNum(2, 0);
+      clockDisplay.writeDigitNum(3, 0);
     }
   }


Add more servos

Add more servos

--- examples/servo_point_controler/servo_point_controler.ino
+++ examples/servo_point_controler/servo_point_controler.ino
@@ -27,7 +27,7 @@

 //Module definitions
-#define NUM_SERVOS 5      //number of servos
+#define NUM_SERVOS 8      //number of servos
 //first 2 are to indicate which servo is on. 2 bytes to indicate to togle. 2 for start and end angle
 #define VAR_PER_SERVO 6  //variables per servo
 #define SPEED 50        //servo speed
@@ -57,7 +57,7 @@
 //pins where the servos are attached
 //pins 9,10 and 15 don't work for many servos. servo library limitation
 //byte servopins[]={2,3,4,5,6,7,8,11,12,13,14,16,17,18,19,20};//,19,20,21,22,23,24,25,26,27,28,29,30};
-byte servopins[]={2,3,4,5,6};//,19,20,21,22,23,24,25,26,27,28,29,30};
+byte servopins[]={1,2,3,4,5,6,7,8};//,19,20,21,22,23,24,25,26,27,28,29,30};
 byte active_servo[2];
 byte togle_servo[2];

@@ -65,7 +65,8 @@
 void setup(){

   pinMode(PUSH_BUTTON,INPUT);//debug push button
-  Serial.begin(115200);
+  //Serial.begin(115200);
+  Serial.end();

   //Configuration data for the node
   cbus.getNodeId()->setNodeName("MODSERV",7);  //node name
@@ -78,7 +79,7 @@
   cbus.setStdNN(999); //standard node number

   if (digitalRead(PUSH_BUTTON)==LOW){
-    Serial.println("Setup new memory");
+   // Serial.println("Setup new memory");
     cbus.setUpNewMemory();
     cbus.setSlimMode();
     cbus.saveNodeFlags();
@@ -89,7 +90,7 @@
   cbus.initCanBus(10);  //initiate the transport layer. pin=53, rate=125Kbps,10 tries,200 millis between each try
   //create the servos object
   setUpServos();
-  Serial.println("Setup finished");
+  //Serial.println("Setup finished");
 }

 void loop (){
@@ -98,7 +99,7 @@
   //debug memory
   if (digitalRead(PUSH_BUTTON)==LOW){
     cbus.dumpMemory();
-    Serial.println("alive");
+    //Serial.println("alive");
   }
 }

@@ -120,7 +121,7 @@
   if (mcbus->eventMatch()){
      onEvent=mcbus->isAccOn();
      getServosArray(msg,mcbus);
-     Serial.println("event match");
+    // Serial.println("event match");
      servo_start=mcbus->getEventVar(msg,START_ANGLE_VAR);
      servo_end=mcbus->getEventVar(msg,END_ANGLE_VAR);
      //Serial.println(servo_start);


Turnstile sample completed

Turnstile sample completed

--- examples/cie-Turnstile/cie-Turnstile.ino
+++ examples/cie-Turnstile/cie-Turnstile.ino
@@ -31,6 +31,10 @@
 #define PN532_SS   (4)
 #define PN532_MISO (5)

+#define SERVO      (9)
+#define GREEN_LED  (10)
+#define RED_LED    (11)
+
 // I2C is not supported in this release
 //#define PN532_IRQ   (2)
 //#define PN532_RESET (3)  // Not connected by default on the NFC Shield
@@ -38,6 +42,7 @@

 cie_PN532 cie(PN532_SCK, PN532_MISO, PN532_MOSI, PN532_SS);
 Adafruit_7segment matrix = Adafruit_7segment();
+Servo servo;
 word count;

 void setup(void) {
@@ -49,6 +54,15 @@
   matrix.begin(0x70);
   count = 0;
   clearMatrix();
+
+  pinMode(GREEN_LED, OUTPUT);
+  pinMode(RED_LED, OUTPUT);
+
+  digitalWrite(RED_LED, LOW);
+  digitalWrite(GREEN_LED, LOW);
+
+  servo.attach(SERVO);
+
   Serial.println(F("PN532 initialized, waiting for a CIE card..."));
 }

@@ -67,20 +81,26 @@
   byte buffer[EF_ID_SERVIZI_LENGTH];
   if (!cie.read_EF_ID_Servizi(buffer, &bufferLength)) {
     Serial.print(F("Error reading EF.ID_SERVIZI"));
-    delay(1000);
+    blinkRedLed();
+    delay(100);
     return;
   }
   Serial.print(F("EF.ID_Servizi: "));
   cie.printHex(buffer, bufferLength);

+  turnGreenLedOn();
+  openTurnstile();
   printHi();
   count++;
   delay(1000);
   clearMatrix();
   delay(200);
   printId(buffer);
-  delay(200);
+  delay(2000);
+  turnGreenLedOff();
+  closeTurnstile();
   printCount();
+

   Serial.println();
@@ -183,4 +203,39 @@
    delay(100);
  }
  delay(100);
+}
+
+void blinkRedLed() {
+  digitalWrite(RED_LED, HIGH);
+  delay(200);
+  digitalWrite(RED_LED, LOW);
+  delay(200);
+  digitalWrite(RED_LED, HIGH);
+  delay(200);
+  digitalWrite(RED_LED, LOW);
+}
+
+void turnGreenLedOn() {
+  digitalWrite(GREEN_LED, HIGH);
+}
+
+void turnGreenLedOff() {
+  digitalWrite(GREEN_LED, LOW);
+}
+
+void openTurnstile() {
+  for(byte angle = 90; angle > 0; angle--)
+  {
+    servo.write(angle);
+    delay(5);
+  }
+
+}
+
+void closeTurnstile() {
+  for(byte angle = 0; angle < 90; angle++)
+  {
+    servo.write(angle);
+    delay(5);
+  }
 }


Update AM2321Example.ino

Update AM2321Example.ino

Changed the wait time to 2s after each read from the device.

--- AM2321Example.ino
+++ AM2321Example.ino
@@ -33,7 +33,7 @@
 	unsigned int amID = 0;

 	amID = am2321.readID();
-	delay(500);
+	delay(2000);
 	result = am2321.readAll();
 	humi = result>>16;
 	temp = result&0xFFFF;
@@ -44,6 +44,6 @@
 	Serial.print(temp/10.0);
 	Serial.print(", Humi: ");
 	Serial.println(humi/10.0);
-	delay(500);
+	delay(2000);
 }


Feature: flash red LED if the water moisture reading is super low

--- moisture-sensor.ino
+++ moisture-sensor.ino
@@ -1,11 +1,13 @@
-// Hygrometer
+// Arduino Hygrometer
 // version: 0.1
 // Author: Mika Hassinen

 #define TIME_INTERVAL 1000	// 1000 ms interval
+#define FLASH_TIME_INTERVAL 400	// 400 ms flash interval
 #define ENABLER_PIN 2		// output pin that enables the sensor while reading the value
 #define SENSOR_PIN A1		// input pin for the sensor
+#define LOW_LEVEL_THRESHOLD 200	// minimum threshold for the water level (=desert dry soil)

 int ledPins[] = {3, 4, 5, 6, 7};

@@ -13,7 +15,9 @@

 int ledLevel = 0;

-long timer = 0;
+bool blink = false;
+
+long timer, flashTimer = 0;

 void setup() {

@@ -26,16 +30,16 @@
 	// test leds
 	for (int pin = 0; pin < (sizeof(ledPins)/sizeof(int)); pin++ ) {
 		pinMode(ledPins[pin], OUTPUT);
-		delay(150);
+		delay(150);	// light up each LED in 0.15 second intervals
 		digitalWrite(ledPins[pin], HIGH);
 	}
-	delay(1000);
+	delay(1000);	// show all LEDs on for a second
 	setLedLevel(0);

 	// test sensor
 	digitalWrite(ENABLER_PIN, HIGH);
 	delay(100);
-	sensorValue = analogRead(SENSOR_PIN);
+	sensorValue = readSensor();
 	Serial.print("[DEBUG]: test read value: ");
 	Serial.println(sensorValue);
 	digitalWrite(ENABLER_PIN, LOW);
@@ -44,23 +48,30 @@
 void loop() {

 	unsigned long currentTime = millis();
+	int newLedLevel;
+
 	if ((unsigned long)(currentTime - timer) >= TIME_INTERVAL) {

 		// enable probe
 		digitalWrite(ENABLER_PIN, HIGH);
 		delay(100);
 		// read the value from the sensor:
-		sensorValue = analogRead(SENSOR_PIN);
+		sensorValue = readSensor();
 		// disable probe after reading values
 		digitalWrite(ENABLER_PIN, LOW);

-		// breakpoints for different led levels:
-		if (sensorValue > 550) ledLevel = 5;
-		if (sensorValue < 550) ledLevel = 4;
-		if (sensorValue < 450) ledLevel = 3;
-		if (sensorValue < 350) ledLevel = 2;
-		if (sensorValue < 250) ledLevel = 1;
-		setLedLevel(ledLevel);
+		// thresholds for different LED levels:
+		if (sensorValue >= 550) newLedLevel = 5;
+		if (sensorValue < 550) newLedLevel = 4;
+		if (sensorValue < 450) newLedLevel = 3;
+		if (sensorValue < 350) newLedLevel = 2;
+		if (sensorValue < 250) newLedLevel = 1;
+
+		// update if the value changes
+		if (ledLevel != newLedLevel) {
+			ledLevel = newLedLevel;
+			setLedLevel(ledLevel);
+		}

 		// debug data
 		Serial.print("[DEBUG]: current value: ");
@@ -70,13 +81,31 @@
 		timer = currentTime;
 	}

+	// flash red LED if water level is below threshold
+	if ((unsigned long)(currentTime - flashTimer) >= FLASH_TIME_INTERVAL) {
+
+		if (sensorValue < LOW_LEVEL_THRESHOLD) {
+			if (blink)
+				setLedLevel(1);	// turn on first (red) LED
+			else
+				setLedLevel(0); // turn off all LEDs
+
+			blink = !blink;
+		}
+
+		flashTimer = currentTime;
+	}
+
 }

+/**
+ * Ligts LEDs according to given level where 0 is all LEDs are OFF and 5 is all LEDs are ON
+ * @param Integer level number of leds to light up from 0 to 5
+ */
 void setLedLevel(int level) {
 	int ledArraySize = (sizeof(ledPins)/sizeof(int));
 	if (level < 0) level = 0;
-	if (level > (ledArraySize) )
-		level = ledArraySize;
+	if (level > (ledArraySize) ) level = ledArraySize;

 	for (int pin = 0; pin < ledArraySize; pin++ ) {
 		pinMode(ledPins[pin], OUTPUT);
@@ -86,3 +115,20 @@
 			digitalWrite(ledPins[pin], LOW);
 	}
 }
+
+/**
+ * Read moisture sensor multiple times and return the average
+ * @return Integer
+ */
+int readSensor() {
+	int average;
+	float sensorValue, sum;
+	for (int i = 0; i < 50; i++) {
+		sensorValue = analogRead(SENSOR_PIN);
+		sum += sensorValue;
+		delay(1);
+	}
+	// cast to int
+	average = (int)(sum/50.0);
+	return average;
+}


Remove unused functions

Remove unused functions

--- Receiver_test/Receiver_test.ino
+++ Receiver_test/Receiver_test.ino
@@ -141,76 +141,6 @@

 }

-// Fill the dots one after the other with a color
-void colorWipe(uint32_t c, uint8_t wait) {
-  for(uint16_t i=0; i<strip.numPixels(); i++) {
-      strip.setPixelColor(i, c);
-      strip.show();
-      delay(wait);
-  }
-}
-
-void rainbow(uint8_t wait) {
-  uint16_t i, j;
-
-  for(j=0; j<256; j++) {
-    for(i=0; i<strip.numPixels(); i++) {
-      strip.setPixelColor(i, Wheel((i+j) & 255));
-    }
-    strip.show();
-    delay(wait);
-  }
-}
-
-// Slightly different, this makes the rainbow equally distributed throughout
-void rainbowCycle(uint8_t wait) {
-  uint16_t i, j;
-
-  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
-    for(i=0; i< strip.numPixels(); i++) {
-      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
-    }
-    strip.show();
-    delay(wait);
-  }
-}
-
-//Theatre-style crawling lights.
-void theaterChase(uint32_t c, uint8_t wait) {
-  for (int j=0; j<10; j++) {  //do 10 cycles of chasing
-    for (int q=0; q < 3; q++) {
-      for (int i=0; i < strip.numPixels(); i=i+3) {
-        strip.setPixelColor(i+q, c);    //turn every third pixel on
-      }
-      strip.show();
-
-      delay(wait);
-
-      for (int i=0; i < strip.numPixels(); i=i+3) {
-        strip.setPixelColor(i+q, 0);        //turn every third pixel off
-      }
-    }
-  }
-}
-
-//Theatre-style crawling lights with rainbow effect
-void theaterChaseRainbow(uint8_t wait) {
-  for (int j=0; j < 256; j++) {     // cycle all 256 colors in the wheel
-    for (int q=0; q < 3; q++) {
-        for (int i=0; i < strip.numPixels(); i=i+3) {
-          strip.setPixelColor(i+q, Wheel( (i+j) % 255));    //turn every third pixel on
-        }
-        strip.show();
-
-        delay(wait);
-
-        for (int i=0; i < strip.numPixels(); i=i+3) {
-          strip.setPixelColor(i+q, 0);        //turn every third pixel off
-        }
-    }
-  }
-}
-
 // Input a value 0 to 255 to get a color value.
 // The colours are a transition r - g - b - back to r.
 uint32_t Wheel(byte WheelPos) {


Update Timer_Interrupt_Notes.ino

Update Timer_Interrupt_Notes.ino

--- PulseSensorAmped_Arduino_1dot4/Timer_Interrupt_Notes.ino
+++ PulseSensorAmped_Arduino_1dot4/Timer_Interrupt_Notes.ino
@@ -185,7 +185,7 @@
   'ISR(TIMER2_COMPA_vect)'
   to
   'getPulse()'
-  in order for this to work.
+  and also comment out the entire interruptSetup() function in the interrupts tab in order for this to work.

   Happy Hacking!


Se modifica mensaje de ejemplo rectangulo

--- graficar-lcd-nokia-5110/graficar-lcd-nokia-5110.ino
+++ graficar-lcd-nokia-5110/graficar-lcd-nokia-5110.ino
@@ -36,7 +36,7 @@
   delay(2000);

   display.clearDisplay();
-  setMessage("Linea");
+  setMessage("Rectangulo");
   display.drawRect(0, 10, 84, 32, BLACK);
   display.display();
   delay(2000);


Fixed calculation of UV intensity

Fixed calculation of UV intensity

--- files/template_home_wifi/template_home_wifi.ino
+++ files/template_home_wifi/template_home_wifi.ino
@@ -65,7 +65,7 @@
   sleep(1);
   if (Wire.available()) lsb = Wire.read();
   uvValue = (msb << 8) | lsb;
-  return uvValue * 5;
+  return uvValue * 5.625;
 }

 int printHexToStream(const uint8_t *data, uint8_t length, Print &stream) // prints 8-bit data in hex


Fix tutorial typos

Fix tutorial typos

--- build/shared/examples/08.Strings/StringAdditionOperator/StringAdditionOperator.ino
+++ build/shared/examples/08.Strings/StringAdditionOperator/StringAdditionOperator.ino
@@ -23,7 +23,7 @@
     ; // wait for serial port to connect. Needed for native USB port only
   }

-  stringOne = String("stringThree = ");
+  stringOne = String("You added ");
   stringTwo = String("this string");
   stringThree = String();
   // send an intro:
@@ -34,11 +34,11 @@
 void loop() {
   // adding a constant integer to a string:
   stringThree =  stringOne + 123;
-  Serial.println(stringThree);    // prints "stringThree = 123"
+  Serial.println(stringThree);    // prints "You added 123"

   // adding a constant long interger to a string:
   stringThree = stringOne + 123456789;
-  Serial.println(stringThree);    // prints " You added 123456789"
+  Serial.println(stringThree);    // prints "You added 123456789"

   // adding a constant character to a string:
   stringThree =  stringOne + 'A';


updated button test

updated button test

--- proj/ledvo_lounge_button_test/ledvo_lounge_button_test.ino
+++ proj/ledvo_lounge_button_test/ledvo_lounge_button_test.ino
@@ -91,9 +91,6 @@
 void setup() {
   delay(3000); // Safely power up

-  // Setup serial for debugging
-  Serial.begin(57600);
-
   // Setup Random Number Generator
   random16_set_seed(4832);
   random16_add_entropy(analogRead(5));
@@ -164,7 +161,7 @@
 void loop() {
   // Read in global brightness value
   if (power_on) {
-    gBrightness = map(analogRead(VAL_POT), 0, 687, 0, maxBrightness);
+    gBrightness = map(analogRead(VAL_POT), 0, 687, maxBrightness, 0);

     // Read color from potentiometer input
     gRGB = CHSV(map(analogRead(HUE_POT), 0, 687, 0, 255), 255, gBrightness);


don't need mcp library

don't need mcp library

removing the line for it

--- Arduino/Turnstyle/Turnstyle.ino
+++ Arduino/Turnstyle/Turnstyle.ino
@@ -2,7 +2,6 @@
 #include <MadgwickAHRS.h>
 #include <NewPing.h>
 #include <Wire.h>
-#include <Adafruit_MCP23017.h>
 #include <Adafruit_RGBLCDShield.h>
 #include <CurieBLE.h>


added dimming for connect/disconnect

added dimming for connect/disconnect

mostly implements #28
there is a need for a trailing preamble still to do but it needs a coordinated effort between the windows code and the arduino code. if the trailing preamble (=postamble?) is not used, it is impossible to decide whether the serial connection was lost or the screen is just black!

--- Arduino/adrilight/adrilight.ino
+++ Arduino/adrilight/adrilight.ino
@@ -2,7 +2,6 @@

 #define NUM_LEDS (2*73+2*41)
 #define LED_DATA_PIN 3
-#define NUM_BYTES (NUM_LEDS*3) // 3 colors

 #define BRIGHTNESS 255
 #define UPDATES_PER_SECOND 60
@@ -14,17 +13,16 @@
 #define MODE_BLACK 2
 uint8_t mode = MODE_ANIMATION;

+uint8_t currentBrightness = BRIGHTNESS;
 byte MESSAGE_PREAMBLE[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
 uint8_t PREAMBLE_LENGTH = 10;
 uint8_t current_preamble_position = 0;

 unsigned long last_serial_available = -1L;

-int led_counter = 0;
-int byte_counter = 0;
-
 CRGB leds[NUM_LEDS];
-byte buffer[NUM_BYTES];
+CRGB leds2[NUM_LEDS];
+byte buffer[3];

 // Filler animation attributes
 CRGBPalette16 currentPalette = RainbowColors_p;
@@ -33,118 +31,134 @@

 void setup()
 {
-    Serial.begin(1000000); // 115200
-    FastLED.clear(true);
-    FastLED.addLeds<WS2812B, LED_DATA_PIN, GRB>(leds, NUM_LEDS);
-    FastLED.setBrightness(BRIGHTNESS);
+  Serial.begin(1000000);
+  FastLED.clear(true);
+  FastLED.addLeds<WS2812B, LED_DATA_PIN, GRB>(leds, NUM_LEDS);
+  FastLED.setBrightness(currentBrightness);
+  FastLED.setDither(0);
 }

 void loop()
 {
-    switch (mode) {
-        case MODE_ANIMATION:
-            fillLEDsFromPaletteColors();
-            break;
-
-        case MODE_AMBILIGHT:
-            processIncomingData();
-            break;
+  switch (mode) {
+    case MODE_ANIMATION:
+      fillLEDsFromPaletteColors();
+      break;

-            case MODE_BLACK:
-            showBlack();
-            break;
-    }
-
+    case MODE_AMBILIGHT:
+      processIncomingData();
+      break;
+
+    case MODE_BLACK:
+      showBlack();
+      break;
+  }
 }
-
 void processIncomingData()
 {
-    if (waitForPreamble(TIMEOUT))
+  if (waitForPreamble(TIMEOUT))
+  {
+    for (int ledNum = 0; ledNum < NUM_LEDS; ledNum++)
     {
-        Serial.readBytes((char*)buffer, NUM_BYTES);
+      //we always have to read 3 bytes (RGB!)
+      //if it is less, we ignore this frame and wait for the next preamble
+      if (Serial.readBytes((char*)buffer, 3) < 3) return;

-        while (byte_counter < NUM_BYTES)
-        {
-            byte blue = buffer[byte_counter++];
-            byte green = buffer[byte_counter++];
-            byte red = buffer[byte_counter++];
-
-            leds[led_counter++] = CRGB(red, green, blue);
-        }
+      byte blue = buffer[0];
+      byte green = buffer[1];
+      byte red = buffer[2];

-        FastLED.show();
-
-        // flush the serial buffer to avoid flickering
-        while(Serial.available()) { Serial.read(); }
-
-        byte_counter = 0;
-        led_counter = 0;
+      //there should be a last "invisible color" because black is actually possible!
+      if (ledNum == NUM_LEDS-1 && red == 0 && blue == 0 && green == 0) return;
+
+      //debug: show black as red!
+      //if (red == 0 && blue == 0 && green == 0) red = 255;
+
+      leds2[ledNum] = CRGB(red, green, blue);
     }
-    else
+    for (int ledNum = 0; ledNum < NUM_LEDS; ledNum++)
     {
-        //if we get here, there must have been data before(so the user already knows, it works!)
-        //simply go to black!
-        mode = MODE_BLACK;
+      leds[ledNum]=leds2[ledNum];
     }
+    if (currentBrightness < BRIGHTNESS)
+    {
+      currentBrightness++;
+      FastLED.setBrightness(currentBrightness);
+    }
+
+      //this should only be done, if a trailing preamble (=postamble?) is received.
+      //If it is not received, it is possible, the connection was lost and the LED
+      //buffer should not be used
+
+      //send LED data to actual LEDs
+      FastLED.show();
+  }
+  else
+  {
+    //if we get here, there must have been data before(so the user already knows, it works!)
+    //simply go to black!
+    mode = MODE_BLACK;
+  }
 }

 bool waitForPreamble(int timeout)
 {
-    last_serial_available = millis();
-    current_preamble_position = 0;
-    while (current_preamble_position < PREAMBLE_LENGTH)
+  last_serial_available = millis();
+  current_preamble_position = 0;
+  while (current_preamble_position < PREAMBLE_LENGTH)
+  {
+    if (Serial.available() > 0)
     {
-        if (Serial.available() > 0)
-        {
-            last_serial_available = millis();
+      last_serial_available = millis();

-            if (Serial.read() == MESSAGE_PREAMBLE[current_preamble_position])
-            {
-                current_preamble_position++;
-            }
-            else
-            {
-                current_preamble_position = 0;
-            }
-        }
+      if (Serial.read() == MESSAGE_PREAMBLE[current_preamble_position])
+      {
+        current_preamble_position++;
+      }
+      else
+      {
+        current_preamble_position = 0;
+      }
+    }

-        if (millis() - last_serial_available > timeout)
-        {
-            return false;
-        }
+    if (millis() - last_serial_available > timeout)
+    {
+      return false;
     }
-    return true;
+  }
+  return true;
 }

 void fillLEDsFromPaletteColors()
 {
-    startIndex++;
+  startIndex++;

-    uint8_t colorIndex = startIndex;
-    for( int i = 0; i < NUM_LEDS; i++) {
-            leds[i] = ColorFromPalette(currentPalette, colorIndex, BRIGHTNESS, currentBlending);
-            colorIndex += 3;
-        }
+  uint8_t colorIndex = startIndex;
+  for ( int i = 0; i < NUM_LEDS; i++) {
+    leds[i] = ColorFromPalette(currentPalette, colorIndex, BRIGHTNESS, currentBlending);
+    colorIndex += 3;
+  }

-    FastLED.delay(1000 / UPDATES_PER_SECOND);
+  FastLED.delay(1000 / UPDATES_PER_SECOND);

-    if (Serial.available() > 0)
-    {
-        mode = MODE_AMBILIGHT;
-    }
+  if (Serial.available() > 0)
+  {
+    mode = MODE_AMBILIGHT;
+  }
 }

 void showBlack()
-{
-    for( int i = 0; i < NUM_LEDS; i++)
-    {
-        leds[i] = CRGB(0,0,0);
-    }
-    FastLED.delay(1000 / UPDATES_PER_SECOND);
+{
+  if (currentBrightness > 0)
+  {
+    currentBrightness--;
+    FastLED.setBrightness(currentBrightness);
+  }

-    if (Serial.available() > 0)
-    {
-        mode = MODE_AMBILIGHT;
-    }
+  FastLED.delay(1000 / UPDATES_PER_SECOND);
+
+  if (Serial.available() > 0)
+  {
+    mode = MODE_AMBILIGHT;
+  }
 }
-


Fixed CosaTimeLCD example sketch; ripple of RTC refactoring; diff removed.

--- examples/Time/CosaTimeLCD/CosaTimeLCD.ino
+++ examples/Time/CosaTimeLCD/CosaTimeLCD.ino
@@ -34,9 +34,9 @@
 // HD44780::SR3WSPI port;
 // HD44780::SR4W port;
 // HD44780::ERM1602_5 port;
-// HD44780::MJKDZ port;
+HD44780::MJKDZ port;
 // HD44780::GYIICLCD port;
-HD44780::DFRobot port;
+// HD44780::DFRobot port;
 HD44780 lcd(&port);

 // Bind the lcd to an io-stream
@@ -75,7 +75,7 @@
        << bcd << now.year << '-'
        << bcd << now.month << '-'
        << bcd << now.date << ' '
-       << RTC::diff(clock, epoch);
+       << clock - epoch;

   // Second line with time and battery status
   lcd.set_cursor(0, 1);


Update RS485_UnoR3_Master.ino

Update RS485_UnoR3_Master.ino

--- rs485/RS485_UnoR3_Master.ino
+++ rs485/RS485_UnoR3_Master.ino
@@ -37,6 +37,6 @@
 void loop()
 {
   modbus_update();
-  regs[0] = analogRead(0);
-  analogWrite(LED, regs[0]>>2);
+  regs[0] = analogRead(0)/4;
+  //analogWrite(LED, regs[0]>>2);
 }


Remove unnecessary line.

Remove unnecessary line.

--- arduino_atu.ino
+++ arduino_atu.ino
@@ -67,7 +67,6 @@
     //nobreak;
   case 5:
     t = m + 50000;
-    digitalWrite(ATU_0_PIN, LOW);
     state = 6;
     break;
   }


Numeri mostrati correttamente

Numeri mostrati correttamente

--- WerCA_nightly/WerCA_nightly.ino
+++ WerCA_nightly/WerCA_nightly.ino
@@ -72,15 +72,15 @@
 char ELP_data[20];
 unsigned char ore;
 unsigned char minuti;
-unsigned char num_sms = 0;
-unsigned char num_calls = 0;
-unsigned char num_email = 0;
-unsigned char num_other = 0;
+char num_sms = '0';
+char num_calls = '0';
+char num_email = '0';
+char num_other = '0';
 char incoming_number[15];
 char incoming_name[16];
-unsigned char phone_battery;
-unsigned char werca_battery;
-unsigned char mode;
+char phone_battery;
+char werca_battery;
+char mode;

 /* Define how assert should function in the BLE library */
@@ -409,9 +409,9 @@
             display.setCursor(12, 8);
             display.print("SMS       ");
             display.print(num_sms);
-            display.print("Chiamate  ");
+            display.print("\n  Chiamate  ");
             display.print(num_calls);
-            display.print("Email      ");
+            display.print("\n  Email     ");
             display.print(num_email);
             display.display();


Small update

Small update

Save wear on flash some
Prevent configuration file conflicts with other projects
Increase to maximum filename length for uploads

--- source/ESP_Code/ESP_Code.ino
+++ source/ESP_Code/ESP_Code.ino
@@ -41,7 +41,7 @@
 #include <ESP8266mDNS.h>
 #include <FS.h>
 #include <ArduinoJson.h> // ArduinoJson library 5.11.0 by Benoit Blanchon https://github.com/bblanchon/ArduinoJson
-#include <ESP8266FtpServer.h> // https://github.com/apullin/esp8266FTPServer/tree/feature/bbx10_speedup
+#include <ESP8266FtpServer.h> // https://github.com/exploitagency/esp8266FTPServer/tree/feature/bbx10_speedup
 //#include <SoftwareSerial.h>
 //#include <DoubleResetDetector.h> // Double Reset Detector library VERSION: 1.0.0 by Stephen Denne https://github.com/datacute/DoubleResetDetector

@@ -325,13 +325,13 @@
   json["LivePayloadDelay"] = "3000";
   json["autopwn"] = "0";
   json["autopayload"] = "/payloads/payload.txt";
-  File configFile = SPIFFS.open("/config.json", "w");
+  File configFile = SPIFFS.open("/esploit.json", "w");
   json.printTo(configFile);
   loadConfig();
 }

 bool loadConfig() {
-  File configFile = SPIFFS.open("/config.json", "r");
+  File configFile = SPIFFS.open("/esploit.json", "r");
   if (!configFile) {
     loadDefaults();
   }
@@ -394,18 +394,21 @@
   Serial.println(subnet);
 */

+  WiFi.persistent(false);
+  //ESP.eraseConfig();
 // Determine if set to Access point mode
   if (accesspointmode == 1) {
-    ESP.eraseConfig();
     WiFi.disconnect(true);
     WiFi.mode(WIFI_AP);
+
+//    Serial.print("Starting Access Point ... ");
+//    Serial.println(WiFi.softAP(ssid, password, channel, hidden) ? "Success" : "Failed!");
+    WiFi.softAP(ssid, password, channel, hidden);
+
 //    Serial.print("Setting up Network Configuration ... ");
 //    Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet) ? "Success" : "Failed!");
     WiFi.softAPConfig(local_IP, gateway, subnet);

-//    Serial.print("Starting Access Point ... ");
-//    Serial.println(WiFi.softAP(ssid, password, channel, hidden) ? "Success" : "Failed!");
-    WiFi.softAP(ssid, password, channel, hidden);
 //    WiFi.reconnect();

 //    Serial.print("IP address = ");
@@ -413,7 +416,6 @@
   }
 // or Join existing network
   else if (accesspointmode != 1) {
-    ESP.eraseConfig();
     WiFi.disconnect(true);
     WiFi.mode(WIFI_STA);
 //    Serial.print("Setting up Network Configuration ... ");
@@ -454,7 +456,7 @@
   json["autopwn"] = autopwn;
   json["autopayload"] = autopayload;

-  File configFile = SPIFFS.open("/config.json", "w");
+  File configFile = SPIFFS.open("/esploit.json", "w");
   json.printTo(configFile);
   return true;
 }
@@ -471,7 +473,7 @@
     filename = "/payloads/"+filename;
 //    Serial.print("Uploading file ");
 //    Serial.print(filename+" ... ");
-    String truncatedname = filename.substring(0,20);
+    String truncatedname = filename.substring(0,31);
     fsUploadFile = SPIFFS.open(truncatedname, "w");
     filename = String();
   }
@@ -507,7 +509,7 @@
     File f = dir.openFile("r");
     FileList += " ";
     if(server.uri() == "/listpayloads") FileList += "
"+FileName+"	"+""+f.size()+"	<button>Run Payload</button>	<button>Download File</button>	<button>Delete Payload</button>
";
-    if((server.uri() == "/exfiltrate/list")&&(!FileName.startsWith("/payloads"))&&(!FileName.startsWith("/config.json"))) FileList += "
"+FileName+"	"+""+f.size()+"	<button>Download File</button>	<button>Delete File</button>
";
+    if((server.uri() == "/exfiltrate/list")&&(!FileName.startsWith("/payloads/"))&&(!FileName.startsWith("/esploit.json"))&&(!FileName.startsWith("/esportal.json"))&&(!FileName.startsWith("/config.json"))) FileList += "
"+FileName+"	"+""+f.size()+"	<button>Download File</button>	<button>Delete File</button>
";
   }
   FileList += "
";
   server.send(200, "text/html", FileList);


Receive example changes

Receive example changes


Update EndNode_17_fioV3_Awing.ino

Update EndNode_17_fioV3_Awing.ino

--- Arduino/EndNode_17_fioV3_Awing/EndNode_17_fioV3_Awing.ino
+++ Arduino/EndNode_17_fioV3_Awing/EndNode_17_fioV3_Awing.ino
@@ -1,4 +1,4 @@
- /*
+/*
   CONFIGURATION for ENDNODE PCB
   25/04/2019
   Version 17.0 XX
@@ -352,7 +352,7 @@
       sensors[i][1] = analogRead(sensors[i][0]);
       //Serial.print(sensors[i][0]);
       //Serial.print(" ");
-      //Serial.println(sensors[i][1]);
+      //Serial.println(sensors[i][1]);
     }
   }

@@ -784,7 +784,7 @@
       }
       break;
     case TONE: //Tone
-    Serial.println("tone");
+      Serial.println("tone");
       if (sts == OFF) {
         noTone(pin);
       }
@@ -807,19 +807,26 @@
         case AWNINGUP:
           Serial.println("up");
           //attivo relay di salita
-          tone(8, 4500, 100);
-          digitalWrite(14, HIGH); //relay per impostare up/down up=HIGH down=LOW (2 tende)
-          digitalWrite(10, HIGH); //Attiva il comando (fase)
-          digitalWrite(11, HIGH); //Attiva il comando (neutro)
+          if (sensors[0][1] == 0 || sensors[1][1] == 0) {
+            tone(8, 4500, 100);
+            digitalWrite(14, HIGH); //relay per impostare up/down up=HIGH down=LOW (1 tenda)
+            delay(500);
+            digitalWrite(11, HIGH); //relay per impostare up/down up=HIGH down=LOW (1 tenda)
+            delay(500);
+            digitalWrite(10, HIGH); //Attiva il comando (fase/neutro)
+          }
           break;
         case AWNINGDOWN:
           Serial.println("down");
           //attivo relay di discesa
-          tone(8, 4500, 100);
-          digitalWrite(14, LOW); //relay per impostare up/down up=HIGH down=LOW
-          digitalWrite(10, HIGH); //relay per impostare up/down up=HIGH down=LOW
-          digitalWrite(11, HIGH); //Attiva il comando  (fase)
-          //digitalWrite(11, HIGH); //Attiva il comando (neutro)
+          if (sensors[0][1] == 0 || sensors[1][1] == 0) {
+            tone(8, 4500, 100);
+            digitalWrite(14, LOW); //relay per impostare up/down up=HIGH down=LOW (1 tenda)
+            delay(500);
+            digitalWrite(11, LOW); //relay per impostare up/down up=HIGH down=LOW (1 tenda)
+            delay(500);
+            digitalWrite(10, HIGH); //Attiva il comando (fase/neutro)
+          }
           break;
       }
       awning_started = true;
@@ -1103,12 +1110,24 @@

 void checkAwinig()
 {
-  if (millis() - 15000 > awning_starttime && awning_started == true) {
-    digitalWrite(10, LOW); //Disattiva il comando (fase)
-    digitalWrite(11, LOW); //Disattiva il comando (neutro)
-    awning_started = false;
-    tone(8, 4500, 100);
-    delay(400);
-    tone(8, 4500, 100);
+  if (awning_started == true) {
+    if (millis() - 15000 > awning_starttime) {
+      digitalWrite(10, LOW); //Disattiva il comando (fase/neutro)
+      delay(500);
+      digitalWrite(11, LOW); //disattiva led tenda 1
+      delay(500);
+      digitalWrite(14, LOW); //disattiva led tenda 2
+      awning_started = false;
+      tone(8, 4500, 100);
+      delay(400);
+      tone(8, 4500, 100);
+    }
+  }
+  else if (awning_started == false) {
+    if (sensors[0][1] != 0 || sensors[1][1] != 0) {
+      digitalWrite(10, LOW); //Disattiva il comando (fase/neutro)
+      digitalWrite(11, LOW); //disattiva led tenda 1
+      digitalWrite(14, LOW); //disattiva led tenda 2
+    }
   }
 }


Rotate screen for my prefered orientation

--- Event_Printer/Event_Printer.ino
+++ Event_Printer/Event_Printer.ino
@@ -55,7 +55,7 @@
 void init_display()
 {
   tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab
-  tft.setRotation(1); // rotate 90 degrees
+  tft.setRotation(3); // rotate 90 degrees
   tft.fillScreen(ST7735_BLACK);
 }


Replaces power_twi_disable with power_spi_disable in mcu_reduce_features

--- mcu.ino
+++ mcu.ino
@@ -1,6 +1,6 @@
 void mcu_reduce_features() {
   power_usart1_disable();
-  power_twi_disable();
+  power_spi_disable();
   power_adc_disable();
   power_timer1_disable();
   power_timer2_disable();


Minor mods

Minor mods

--- arduino/libraries/ClockTiM/examples/ClockTiM/ClockTiM.ino
+++ arduino/libraries/ClockTiM/examples/ClockTiM/ClockTiM.ino
@@ -36,7 +36,7 @@

 /************* Settings struct definition *************/
 typedef union Settings {
-	// WARNING: array has to be at least as large as there are elements in the struct
+	// WARNING: array has to be at least as large as the number of elements in the struct
 	uint8_t array[3];
 	struct {
 		uint8_t useGPS;
@@ -67,6 +67,9 @@

 	// Initialise the display
 	disp_init();
+
+	// Load the settings from the EEPROM
+	loadSettings();
 }

@@ -122,7 +125,7 @@
 }

-// This needs to be placed above whereever it's called from as the Arduino compiler seems to have
+// This needs to be placed above where ever it's called from as the Arduino compiler seems to have
 // trouble dealing with function pointers as parameters.
 uint8_t changeSetting(uint8_t origValue, uint8_t min, uint8_t max, void (*dispFunc)(uint8_t)) {
 	KeyStates *keys = NULL;
@@ -134,7 +137,7 @@
 		keys = getKeys(true, 1000);
 		if(keys->justPressed == BUTTON_L_IDX) {
 			break;
-			} else if(keys->justPressed == BUTTON_R_IDX || keys->repeated == BUTTON_R_IDX) {
+		} else if(keys->justPressed == BUTTON_R_IDX || keys->repeated == BUTTON_R_IDX) {
 			value++;
 			if(value > max) {
 				value = min;
@@ -210,6 +213,10 @@
 		}
 	}

+	// TODO: save these new settings to the arduino Time library
+
+	// TODO: load the new time into the RTC
+
 	saveSettings();
 	PRINT_DEBUG("Exiting configuration mode");
 }


Update ADXL362_SimpleRead.ino

Update ADXL362_SimpleRead.ino

--- firmware/examples/ADXL362_SimpleRead/ADXL362_SimpleRead.ino
+++ firmware/examples/ADXL362_SimpleRead/ADXL362_SimpleRead.ino
@@ -20,7 +20,7 @@

 */

-#include "adxl362/spark_internet_button__adxl362.h"
+#include "adxl362/adxl362.h"

 ADXL362 xl;


Get there eventually

Get there eventually

--- src/WiFiSensor/deepsleep.ino
+++ src/WiFiSensor/deepsleep.ino
@@ -60,7 +60,7 @@
 	  } else {
 		  Serial.println("MQTT Successfully Connected");
 		  mqtttimeout = true;
-		  mqttsuccess = true;
+		  mqttconnectsuccess = true;
 	  }

 	  if(mqttfailcount >= 30 ){


Update TrebleBoost_wComp.ino

Update TrebleBoost_wComp.ino

Changing input from on board mic to mic jack

--- examples/01-Basic/TrebleBoost_wComp/TrebleBoost_wComp.ino
+++ examples/01-Basic/TrebleBoost_wComp/TrebleBoost_wComp.ino
@@ -84,8 +84,8 @@
   audioHardware.enable(); // activate AIC

   //Choose the desired input
-  audioHardware.inputSelect(TYMPAN_INPUT_ON_BOARD_MIC); // use the on board microphones
-  // audioHardware.inputSelect(TYMPAN_INPUT_JACK_AS_MIC); // use the microphone jack - defaults to mic bias 2.5V
+  //audioHardware.inputSelect(TYMPAN_INPUT_ON_BOARD_MIC); // use the on board microphones
+  audioHardware.inputSelect(TYMPAN_INPUT_JACK_AS_MIC); // use the microphone jack - defaults to mic bias 2.5V
   // audioHardware.inputSelect(TYMPAN_INPUT_JACK_AS_LINEIN); // use the microphone jack - defaults to mic bias OFF

   //Set the desired volume levels