diff --git a/examples/UltrasonicSerial/UltrasonicSerial.ino b/examples/UltrasonicSerial/UltrasonicSerial.ino
deleted file mode 100644
index bf9ddae..0000000
--- a/examples/UltrasonicSerial/UltrasonicSerial.ino
+++ /dev/null
@@ -1,97 +0,0 @@
-// Bricktronics Example: UltrasonicSerial
-// http://www.wayneandlayne.com/bricktronics
-// This example uses a LEGO NXT Ultrasonic Sensor.
-//
-// Ultrasonic readings are taken every 100 milliseconds, and
-// printed out over the serial console. Be sure to set your serial
-// console to 115200 baud. The ultrasonic sensor reports the distance
-// to an obstruction in front of the sensor (in centimeters). It has
-// a range of 2.5 meters, a resolution of 1 cm, and reported accuracy
-// of +/- 3 cm. 255 is sometimes reported as an error state.
-//
-// This example uses an Ultrasonic Sensor, so it needs more voltage
-// than a USB port usually gives. Use an external power supply that
-// provides between 7.2 and 9 volts DC. Two options that work really
-// well are a 9V wall adapter or a 6xAA battery pack (2.1mm plug).
-//
-// Written in 2015 by Matthew Beckler and Adam Wolf for Wayne and Layne, LLC
-// To the extent possible under law, the author(s) have dedicated all
-// copyright and related and neighboring rights to this software to the
-// public domain worldwide. This software is distributed without any warranty.
-// You should have received a copy of the CC0 Public Domain Dedication along
-// with this software. If not, see .
-
-
-// Include the BricktronicsUltrasonic library
-#include
-
-
-// This example can be run in three different ways. Pick one, and un-comment
-// the code lines corresponding to your chosen method. Comment-out the lines
-// for the other methods that you aren't using.
-
-// 1. With a Bricktronics Shield - Include these lines and be sure to
-// call BricktronicsShield::begin() in the setup() function below.
-// You also need to install the Adafruit MCP23017 library:
-// https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library
-// Select the sensor port for the sensor (SENSOR_3 and SENSOR_4) below.
-// Use the jumpers to connect pins 1-2 and 4-5 for the ultrasonic sensor.
-//
-// Config 1 - CFG_WNL_BS
-//#include
-//#include
-//#include
-//BricktronicsUltrasonic u(BricktronicsShield::SENSOR_4);
-// Config end
-
-// 2. With a Bricktronics Megashield - Include these lines but do not
-// call BricktronicsShield::begin() in the setup() function below.
-// Select the sensor port for the sensor (SENSOR_1 through SENSOR_4) below.
-// Use the jumpers to connect pins 1-2 and 4-5 for the ultrasonic sensor.
-//
-// Config 2 - CFG_WNL_BMS
-//#include
-//BricktronicsUltrasonic u(BricktronicsMegashield::SENSOR_4);
-// Config end
-
-// 3. With a Bricktronics Breakout board - No additional includes needed, just
-// update the pin assignments in the Ultrasonic constructor below.
-//
-// Connect these pins on the Bricktronics Breakout board:
-// Pin 1 - Connect to an external power supply between 7.2 and 9 volts DC
-// Pin 2 - Connect to Ground
-// Pin 3 - Connect to Ground
-// Pin 4 - Connect to 5V
-// Pin 5 - Connect to any digital pin (sclPin)
-// Pin 6 - Connect to any digital pin (sdaPin)
-//
-// The BricktronicsUltrasonic() arguments are:
-// sclPin (pin 5), sdaPin (pin 6)
-//
-// Config 3 - CFG_WNL_NS
-//BricktronicsUltrasonic u(8, 12);
-// Config end
-
-
-void setup()
-{
- // Be sure to set your serial console to 115200 baud
- Serial.begin(115200);
-
- // Only call this if you are using a Bricktronics Shield,
- // otherwise leave it commented-out.
- // Config 1 - CFG_WNL_BS
- //BricktronicsShield::begin();
- // Config end
-
- // Initialize the ultrasonic sensor connections
- u.begin();
-}
-
-
-void loop()
-{
- Serial.println(u.getDistance());
- delay(100);
-}
-
diff --git a/examples/UltrasonicSerial/UltrasonicSerialBricktronicsBreakoutBoard/UltrasonicSerialBricktronicsBreakoutBoard.ino b/examples/UltrasonicSerial/UltrasonicSerialBricktronicsBreakoutBoard/UltrasonicSerialBricktronicsBreakoutBoard.ino
new file mode 100644
index 0000000..80a82cb
--- /dev/null
+++ b/examples/UltrasonicSerial/UltrasonicSerialBricktronicsBreakoutBoard/UltrasonicSerialBricktronicsBreakoutBoard.ino
@@ -0,0 +1,67 @@
+// Bricktronics Example: UltrasonicSerialBricktronicsBreakoutBoard
+// http://www.wayneandlayne.com/bricktronics
+//
+// This example uses a LEGO NXT Ultrasonic Sensor. Ultrasonic readings
+// are taken every 100 milliseconds, and printed out over the serial console.
+// Be sure to set your serial console to 115200 baud. The ultrasonic sensor
+// reports the distance to an obstruction in front of the sensor
+// (in centimeters). It has a range of 2.5 meters, a resolution of 1 cm, and
+// reported accuracy of +/- 3 cm. 255 is sometimes reported as an error state.
+//
+// This example uses an Ultrasonic Sensor, so it needs more voltage
+// than a USB port usually gives. Use an external power supply that
+// provides between 7.2 and 9 volts DC. Two options that work really
+// well are a 9V wall adapter or a 6xAA battery pack (2.1mm plug).
+//
+// Hardware used:
+// * Wayne and Layne Bricktronics Breakout Board
+// https://store.wayneandlayne.com/products/bricktronics-breakout-board.html
+// * LEGO NXT Ultrasonic sensor
+//
+// Software libraries used:
+// * Wayne and Layne BricktronicsUltrasonic library
+// https://github.com/wayneandlayne/BricktronicsUltrasonic
+//
+// Written in 2016 by Matthew Beckler and Adam Wolf for Wayne and Layne, LLC
+// To the extent possible under law, the author(s) have dedicated all
+// copyright and related and neighboring rights to this software to the
+// public domain worldwide. This software is distributed without any warranty.
+// You should have received a copy of the CC0 Public Domain Dedication along
+// with this software. If not, see .
+
+
+// Include the Bricktronics libraries
+#include
+
+
+// Connect these pins on the Bricktronics Breakout board:
+// Pin 1 - Connect to an external power supply between 7.2 and 9 volts DC
+// Pin 2 - Connect to Ground
+// Pin 3 - Connect to Ground
+// Pin 4 - Connect to 5V
+// Pin 5 - Connect to any digital pin (sclPin)
+// Pin 6 - Connect to any digital pin (sdaPin)
+//
+// The BricktronicsUltrasonic() arguments are:
+// sclPin (pin 5), sdaPin (pin 6)
+//
+BricktronicsUltrasonic u(8, 12);
+
+
+
+void setup()
+{
+ // Be sure to set your serial console to 115200 baud
+ Serial.begin(115200);
+
+ // Initialize the ultrasonic sensor connections
+ u.begin();
+}
+
+
+void loop()
+{
+ Serial.println(u.getDistance());
+ delay(100);
+}
+
diff --git a/examples/UltrasonicSerial/UltrasonicSerialBricktronicsMegashield/UltrasonicSerialBricktronicsMegashield.ino b/examples/UltrasonicSerial/UltrasonicSerialBricktronicsMegashield/UltrasonicSerialBricktronicsMegashield.ino
new file mode 100644
index 0000000..4285ccf
--- /dev/null
+++ b/examples/UltrasonicSerial/UltrasonicSerialBricktronicsMegashield/UltrasonicSerialBricktronicsMegashield.ino
@@ -0,0 +1,60 @@
+// Bricktronics Example: UltrasonicSerialBricktronicsMegashield
+// http://www.wayneandlayne.com/bricktronics
+//
+// This example uses a LEGO NXT Ultrasonic Sensor. Ultrasonic readings
+// are taken every 100 milliseconds, and printed out over the serial console.
+// Be sure to set your serial console to 115200 baud. The ultrasonic sensor
+// reports the distance to an obstruction in front of the sensor
+// (in centimeters). It has a range of 2.5 meters, a resolution of 1 cm, and
+// reported accuracy of +/- 3 cm. 255 is sometimes reported as an error state.
+//
+// This example uses an Ultrasonic Sensor, so it needs more voltage
+// than a USB port usually gives. Use an external power supply that
+// provides between 7.2 and 9 volts DC. Two options that work really
+// well are a 9V wall adapter or a 6xAA battery pack (2.1mm plug).
+//
+// Hardware used:
+// * Wayne and Layne Bricktronics Megashield
+// https://store.wayneandlayne.com/products/bricktronics-megashield-kit.html
+// * LEGO NXT Ultrasonic sensor
+//
+// Software libraries used:
+// * Wayne and Layne BricktronicsUltrasonic library
+// https://github.com/wayneandlayne/BricktronicsUltrasonic
+// * Wayne and Layne BricktronicsMegashield library
+// https://github.com/wayneandlayne/BricktronicsMegashield
+//
+// Written in 2016 by Matthew Beckler and Adam Wolf for Wayne and Layne, LLC
+// To the extent possible under law, the author(s) have dedicated all
+// copyright and related and neighboring rights to this software to the
+// public domain worldwide. This software is distributed without any warranty.
+// You should have received a copy of the CC0 Public Domain Dedication along
+// with this software. If not, see .
+
+
+// Include the Bricktronics libraries
+#include
+#include
+
+
+// Select the sensor port for the sensor (SENSOR_1 through SENSOR_4) below.
+// Use the jumpers to connect pins 1-2 and 4-5 for the ultrasonic sensor.
+BricktronicsUltrasonic u(BricktronicsMegashield::SENSOR_4);
+
+
+void setup()
+{
+ // Be sure to set your serial console to 115200 baud
+ Serial.begin(115200);
+
+ // Initialize the ultrasonic sensor connections
+ u.begin();
+}
+
+
+void loop()
+{
+ Serial.println(u.getDistance());
+ delay(100);
+}
+
diff --git a/examples/UltrasonicSerial/UltrasonicSerialBricktronicsShield/UltrasonicSerialBricktronicsShield.ino b/examples/UltrasonicSerial/UltrasonicSerialBricktronicsShield/UltrasonicSerialBricktronicsShield.ino
new file mode 100644
index 0000000..00af833
--- /dev/null
+++ b/examples/UltrasonicSerial/UltrasonicSerialBricktronicsShield/UltrasonicSerialBricktronicsShield.ino
@@ -0,0 +1,63 @@
+// Bricktronics Example: UltrasonicSerialBricktronicsShield
+// http://www.wayneandlayne.com/bricktronics
+//
+// This example uses a LEGO NXT Ultrasonic Sensor. Ultrasonic readings
+// are taken every 100 milliseconds, and printed out over the serial console.
+// Be sure to set your serial console to 115200 baud. The ultrasonic sensor
+// reports the distance to an obstruction in front of the sensor
+// (in centimeters). It has a range of 2.5 meters, a resolution of 1 cm, and
+// reported accuracy of +/- 3 cm. 255 is sometimes reported as an error state.
+//
+// This example uses an Ultrasonic Sensor, so it needs more voltage
+// than a USB port usually gives. Use an external power supply that
+// provides between 7.2 and 9 volts DC. Two options that work really
+// well are a 9V wall adapter or a 6xAA battery pack (2.1mm plug).
+//
+// Hardware used:
+// * Wayne and Layne Bricktronics Shield
+// https://store.wayneandlayne.com/products/bricktronics-shield-kit.html
+// * LEGO NXT Ultrasonic sensor
+//
+// Software libraries used:
+// * Wayne and Layne BricktronicsUltrasonic library
+// https://github.com/wayneandlayne/BricktronicsUltrasonic
+// * Wayne and Layne BricktronicsShield library
+// https://github.com/wayneandlayne/BricktronicsShield
+//
+// Written in 2016 by Matthew Beckler and Adam Wolf for Wayne and Layne, LLC
+// To the extent possible under law, the author(s) have dedicated all
+// copyright and related and neighboring rights to this software to the
+// public domain worldwide. This software is distributed without any warranty.
+// You should have received a copy of the CC0 Public Domain Dedication along
+// with this software. If not, see .
+
+
+// Include the Bricktronics libraries
+#include
+#include
+
+
+// Select the sensor port for the sensor (SENSOR_3 or SENSOR_4) below.
+// Use the jumpers to connect pins 1-2 and 4-5 for the ultrasonic sensor.
+BricktronicsUltrasonic u(BricktronicsShield::SENSOR_4);
+
+
+void setup()
+{
+ // Be sure to set your serial console to 115200 baud
+ Serial.begin(115200);
+
+ // Initialize the Bricktronics Shield
+ BricktronicsShield::begin();
+
+ // Initialize the ultrasonic sensor connections
+ u.begin();
+}
+
+
+void loop()
+{
+ Serial.println(u.getDistance());
+ delay(100);
+}
+
diff --git a/examples/test_compile.sh b/examples/test_compile.sh
new file mode 100755
index 0000000..0250e1a
--- /dev/null
+++ b/examples/test_compile.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+if [ -z "$ARDUINO" ]; then
+ echo "Need to set ARDUINO envvar to your arduino binary"
+ echo "You can use something like this:"
+ echo " ARDUINO=/path/to/arduino $0"
+ exit 1
+fi
+
+PLATFORMS="arduino:avr:uno arduino:avr:mega:cpu=atmega2560"
+
+for ino in `find $1 | grep '\.ino$'`; do
+ echo "--------------------------------------------------------------------------------"
+ for platform in $PLATFORMS; do
+ echo "$ino - $platform"
+ echo ""
+ $ARDUINO --verify --board $platform $ino || exit $?
+ done
+done
+
+echo "--------------------------------------------------------------------------------"
+echo "All examples compiled for all platforms, great work."
+