");
- Serial.println("The index of the last list tag in the string " + stringOne + " is " + lastListItem);
-
-
- // lastIndexOf() can also search for a string:
- stringOne = "Lorem ipsum dolor sit amet
Ipsem
Quod
";
- int lastParagraph = stringOne.lastIndexOf(" 0) {
- char inChar = Serial.read();
- txtMsg += inChar;
- }
-
- // print the message and a notice if it's changed:
- if (txtMsg.length() != lastStringLength) {
- Serial.println(txtMsg);
- Serial.println(txtMsg.length());
- // if the String's longer than 140 characters, complain:
- if (txtMsg.length() < 140) {
- Serial.println("That's a perfectly acceptable text message");
- } else {
- Serial.println("That's too long for a text message.");
- }
- // note the length for next time through the loop:
- lastStringLength = txtMsg.length();
- }
-}
diff --git a/build/shared/examples/08.Strings/StringLength/StringLength.txt b/build/shared/examples/08.Strings/StringLength/StringLength.txt
deleted file mode 100644
index 7ffb9c312..000000000
--- a/build/shared/examples/08.Strings/StringLength/StringLength.txt
+++ /dev/null
@@ -1 +0,0 @@
-Examples of how to use length() in a String.
\ No newline at end of file
diff --git a/build/shared/examples/08.Strings/StringLengthTrim/StringLengthTrim.ino b/build/shared/examples/08.Strings/StringLengthTrim/StringLengthTrim.ino
deleted file mode 100644
index d107c8f09..000000000
--- a/build/shared/examples/08.Strings/StringLengthTrim/StringLengthTrim.ino
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- String length() and trim()
-
- Examples of how to use length() and trim() in a String
-
- created 27 Jul 2010
- modified 2 Apr 2012
- by Tom Igoe
-
- This example code is in the public domain.
-
- http://www.arduino.cc/en/Tutorial/StringLengthTrim
-*/
-
-void setup() {
- // Open serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
- // send an intro:
- Serial.println("\n\nString length() and trim():");
- Serial.println();
-}
-
-void loop() {
- // here's a String with empty spaces at the end (called white space):
- String stringOne = "Hello! ";
- Serial.print(stringOne);
- Serial.print("<--- end of string. Length: ");
- Serial.println(stringOne.length());
-
- // trim the white space off the string:
- stringOne.trim();
- Serial.print(stringOne);
- Serial.print("<--- end of trimmed string. Length: ");
- Serial.println(stringOne.length());
-
- // do nothing while true:
- while (true);
-}
diff --git a/build/shared/examples/08.Strings/StringLengthTrim/StringLengthTrim.txt b/build/shared/examples/08.Strings/StringLengthTrim/StringLengthTrim.txt
deleted file mode 100644
index 43dcaa984..000000000
--- a/build/shared/examples/08.Strings/StringLengthTrim/StringLengthTrim.txt
+++ /dev/null
@@ -1 +0,0 @@
-Get and trim the length of a String.
\ No newline at end of file
diff --git a/build/shared/examples/08.Strings/StringReplace/StringReplace.ino b/build/shared/examples/08.Strings/StringReplace/StringReplace.ino
deleted file mode 100644
index 17407f1ec..000000000
--- a/build/shared/examples/08.Strings/StringReplace/StringReplace.ino
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- String replace()
-
- Examples of how to replace characters or substrings of a String
-
- created 27 Jul 2010
- modified 2 Apr 2012
- by Tom Igoe
-
- This example code is in the public domain.
-
- http://www.arduino.cc/en/Tutorial/StringReplace
-*/
-
-void setup() {
- // Open serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
- // send an intro:
- Serial.println("\n\nString replace:\n");
- Serial.println();
-}
-
-void loop() {
- String stringOne = "
";
- Serial.println(stringOne);
- // replace() changes all instances of one substring with another:
- // first, make a copy of the original string:
- String stringTwo = stringOne;
- // then perform the replacements:
- stringTwo.replace("<", "");
- // print the original:
- Serial.println("Original string: " + stringOne);
- // and print the modified string:
- Serial.println("Modified string: " + stringTwo);
-
- // you can also use replace() on single characters:
- String normalString = "bookkeeper";
- Serial.println("normal: " + normalString);
- String leetString = normalString;
- leetString.replace('o', '0');
- leetString.replace('e', '3');
- Serial.println("l33tspeak: " + leetString);
-
- // do nothing while true:
- while (true);
-}
diff --git a/build/shared/examples/08.Strings/StringReplace/StringReplace.txt b/build/shared/examples/08.Strings/StringReplace/StringReplace.txt
deleted file mode 100644
index 75c7ce4c9..000000000
--- a/build/shared/examples/08.Strings/StringReplace/StringReplace.txt
+++ /dev/null
@@ -1 +0,0 @@
-Replace individual characters in a String.
\ No newline at end of file
diff --git a/build/shared/examples/08.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.ino b/build/shared/examples/08.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.ino
deleted file mode 100644
index 6ea6f2cce..000000000
--- a/build/shared/examples/08.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.ino
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- String startWith() and endsWith()
-
- Examples of how to use startsWith() and endsWith() in a String
-
- created 27 Jul 2010
- modified 2 Apr 2012
- by Tom Igoe
-
- This example code is in the public domain.
-
- http://www.arduino.cc/en/Tutorial/StringStartsWithEndsWith
-*/
-
-void setup() {
- // Open serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
- // send an intro:
- Serial.println("\n\nString startsWith() and endsWith():");
- Serial.println();
-}
-
-void loop() {
- // startsWith() checks to see if a String starts with a particular substring:
- String stringOne = "HTTP/1.1 200 OK";
- Serial.println(stringOne);
- if (stringOne.startsWith("HTTP/1.1")) {
- Serial.println("Server's using http version 1.1");
- }
-
- // you can also look for startsWith() at an offset position in the string:
- stringOne = "HTTP/1.1 200 OK";
- if (stringOne.startsWith("200 OK", 9)) {
- Serial.println("Got an OK from the server");
- }
-
- // endsWith() checks to see if a String ends with a particular character:
- String sensorReading = "sensor = ";
- sensorReading += analogRead(A0);
- Serial.print(sensorReading);
- if (sensorReading.endsWith("0")) {
- Serial.println(". This reading is divisible by ten");
- } else {
- Serial.println(". This reading is not divisible by ten");
- }
-
- // do nothing while true:
- while (true);
-}
diff --git a/build/shared/examples/08.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.txt b/build/shared/examples/08.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.txt
deleted file mode 100644
index 80630ce7a..000000000
--- a/build/shared/examples/08.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.txt
+++ /dev/null
@@ -1 +0,0 @@
-Check which characters/substrings a given String starts or ends with.
\ No newline at end of file
diff --git a/build/shared/examples/08.Strings/StringSubstring/StringSubstring.ino b/build/shared/examples/08.Strings/StringSubstring/StringSubstring.ino
deleted file mode 100644
index ccdf2f330..000000000
--- a/build/shared/examples/08.Strings/StringSubstring/StringSubstring.ino
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- String substring()
-
- Examples of how to use substring in a String
-
- created 27 Jul 2010,
- modified 2 Apr 2012
- by Zach Eveland
-
- This example code is in the public domain.
-
- http://www.arduino.cc/en/Tutorial/StringSubstring
-*/
-
-void setup() {
- // Open serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
- // send an intro:
- Serial.println("\n\nString substring():");
- Serial.println();
-}
-
-void loop() {
- // Set up a String:
- String stringOne = "Content-Type: text/html";
- Serial.println(stringOne);
-
- // substring(index) looks for the substring from the index position to the end:
- if (stringOne.substring(19) == "html") {
- Serial.println("It's an html file");
- }
- // you can also look for a substring in the middle of a string:
- if (stringOne.substring(14, 18) == "text") {
- Serial.println("It's a text-based file");
- }
-
- // do nothing while true:
- while (true);
-}
diff --git a/build/shared/examples/08.Strings/StringSubstring/StringSubstring.txt b/build/shared/examples/08.Strings/StringSubstring/StringSubstring.txt
deleted file mode 100644
index ef88bc300..000000000
--- a/build/shared/examples/08.Strings/StringSubstring/StringSubstring.txt
+++ /dev/null
@@ -1 +0,0 @@
-Look for "phrases" within a given String.
\ No newline at end of file
diff --git a/build/shared/examples/08.Strings/StringToInt/StringToInt.ino b/build/shared/examples/08.Strings/StringToInt/StringToInt.ino
deleted file mode 100644
index 59e872aa2..000000000
--- a/build/shared/examples/08.Strings/StringToInt/StringToInt.ino
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- String to Integer conversion
-
- Reads a serial input string until it sees a newline, then converts the string
- to a number if the characters are digits.
-
- The circuit:
- - No external components needed.
-
- created 29 Nov 2010
- by Tom Igoe
-
- This example code is in the public domain.
-
- http://www.arduino.cc/en/Tutorial/StringToInt
-*/
-
-String inString = ""; // string to hold input
-
-void setup() {
- // Open serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for native USB port only
- }
-
- // send an intro:
- Serial.println("\n\nString toInt():");
- Serial.println();
-}
-
-void loop() {
- // Read serial input:
- while (Serial.available() > 0) {
- int inChar = Serial.read();
- if (isDigit(inChar)) {
- // convert the incoming byte to a char and add it to the string:
- inString += (char)inChar;
- }
- // if you get a newline, print the string, then the string's value:
- if (inChar == '\n') {
- Serial.print("Value:");
- Serial.println(inString.toInt());
- Serial.print("String: ");
- Serial.println(inString);
- // clear the string for new input:
- inString = "";
- }
- }
-}
diff --git a/build/shared/examples/09.USB/Keyboard/KeyboardLogout/KeyboardLogout.ino b/build/shared/examples/09.USB/Keyboard/KeyboardLogout/KeyboardLogout.ino
deleted file mode 100644
index f6ea490c2..000000000
--- a/build/shared/examples/09.USB/Keyboard/KeyboardLogout/KeyboardLogout.ino
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- Keyboard logout
-
- This sketch demonstrates the Keyboard library.
-
- When you connect pin 2 to ground, it performs a logout.
- It uses keyboard combinations to do this, as follows:
-
- On Windows, CTRL-ALT-DEL followed by ALT-l
- On Ubuntu, CTRL-ALT-DEL, and ENTER
- On OSX, CMD-SHIFT-q
-
- To wake: Spacebar.
-
- Circuit:
- - Arduino Leonardo or Micro
- - wire to connect D2 to ground
-
- created 6 Mar 2012
- modified 27 Mar 2012
- by Tom Igoe
-
- This example is in the public domain.
-
- http://www.arduino.cc/en/Tutorial/KeyboardLogout
-*/
-
-#define OSX 0
-#define WINDOWS 1
-#define UBUNTU 2
-
-#include "Keyboard.h"
-
-// change this to match your platform:
-int platform = OSX;
-
-void setup() {
- // make pin 2 an input and turn on the pull-up resistor so it goes high unless
- // connected to ground:
- pinMode(2, INPUT_PULLUP);
- Keyboard.begin();
-}
-
-void loop() {
- while (digitalRead(2) == HIGH) {
- // do nothing until pin 2 goes low
- delay(500);
- }
- delay(1000);
-
- switch (platform) {
- case OSX:
- Keyboard.press(KEY_LEFT_GUI);
- // Shift-Q logs out:
- Keyboard.press(KEY_LEFT_SHIFT);
- Keyboard.press('Q');
- delay(100);
- Keyboard.releaseAll();
- // enter:
- Keyboard.write(KEY_RETURN);
- break;
- case WINDOWS:
- // CTRL-ALT-DEL:
- Keyboard.press(KEY_LEFT_CTRL);
- Keyboard.press(KEY_LEFT_ALT);
- Keyboard.press(KEY_DELETE);
- delay(100);
- Keyboard.releaseAll();
- // ALT-l:
- delay(2000);
- Keyboard.press(KEY_LEFT_ALT);
- Keyboard.press('l');
- Keyboard.releaseAll();
- break;
- case UBUNTU:
- // CTRL-ALT-DEL:
- Keyboard.press(KEY_LEFT_CTRL);
- Keyboard.press(KEY_LEFT_ALT);
- Keyboard.press(KEY_DELETE);
- delay(1000);
- Keyboard.releaseAll();
- // Enter to confirm logout:
- Keyboard.write(KEY_RETURN);
- break;
- }
-
- // do nothing:
- while (true);
-}
diff --git a/build/shared/examples/09.USB/Keyboard/KeyboardLogout/KeyboardLogout.txt b/build/shared/examples/09.USB/Keyboard/KeyboardLogout/KeyboardLogout.txt
deleted file mode 100644
index 6d1900b13..000000000
--- a/build/shared/examples/09.USB/Keyboard/KeyboardLogout/KeyboardLogout.txt
+++ /dev/null
@@ -1 +0,0 @@
-Logs out the current user with key commands.
\ No newline at end of file
diff --git a/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino b/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino
deleted file mode 100644
index 32c3b9f81..000000000
--- a/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- Keyboard Message test
-
- For the Arduino Leonardo and Micro.
-
- Sends a text string when a button is pressed.
-
- The circuit:
- - pushbutton attached from pin 4 to +5V
- - 10 kilohm resistor attached from pin 4 to ground
-
- created 24 Oct 2011
- modified 27 Mar 2012
- by Tom Igoe
- modified 11 Nov 2013
- by Scott Fitzgerald
-
- This example code is in the public domain.
-
- http://www.arduino.cc/en/Tutorial/KeyboardMessage
-*/
-
-#include "Keyboard.h"
-
-const int buttonPin = 4; // input pin for pushbutton
-int previousButtonState = HIGH; // for checking the state of a pushButton
-int counter = 0; // button push counter
-
-void setup() {
- // make the pushButton pin an input:
- pinMode(buttonPin, INPUT);
- // initialize control over the keyboard:
- Keyboard.begin();
-}
-
-void loop() {
- // read the pushbutton:
- int buttonState = digitalRead(buttonPin);
- // if the button state has changed,
- if ((buttonState != previousButtonState)
- // and it's currently pressed:
- && (buttonState == HIGH)) {
- // increment the button counter
- counter++;
- // type out a message
- Keyboard.print("You pressed the button ");
- Keyboard.print(counter);
- Keyboard.println(" times.");
- }
- // save the current button state for comparison next time:
- previousButtonState = buttonState;
-}
diff --git a/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.txt b/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.txt
deleted file mode 100644
index 86fc2be23..000000000
--- a/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.txt
+++ /dev/null
@@ -1 +0,0 @@
-Sends a text string when a button is pressed.
\ No newline at end of file
diff --git a/build/shared/examples/09.USB/Keyboard/KeyboardMessage/layout.png b/build/shared/examples/09.USB/Keyboard/KeyboardMessage/layout.png
deleted file mode 100644
index 622a9a5b0..000000000
Binary files a/build/shared/examples/09.USB/Keyboard/KeyboardMessage/layout.png and /dev/null differ
diff --git a/build/shared/examples/09.USB/Keyboard/KeyboardMessage/schematic.png b/build/shared/examples/09.USB/Keyboard/KeyboardMessage/schematic.png
deleted file mode 100644
index ef19b85a6..000000000
Binary files a/build/shared/examples/09.USB/Keyboard/KeyboardMessage/schematic.png and /dev/null differ
diff --git a/build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.ino b/build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.ino
deleted file mode 100644
index 7ec0d6d89..000000000
--- a/build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.ino
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- Arduino Programs Blink
-
- This sketch demonstrates the Keyboard library.
-
- For Leonardo and Due boards only.
-
- When you connect pin 2 to ground, it creates a new window with a key
- combination (CTRL-N), then types in the Blink sketch, then auto-formats the
- text using another key combination (CTRL-T), then uploads the sketch to the
- currently selected Arduino using a final key combination (CTRL-U).
-
- Circuit:
- - Arduino Leonardo, Micro, Due, LilyPad USB, or Yún
- - wire to connect D2 to ground
-
- created 5 Mar 2012
- modified 29 Mar 2012
- by Tom Igoe
- modified 3 May 2014
- by Scott Fitzgerald
-
- This example is in the public domain.
-
- http://www.arduino.cc/en/Tutorial/KeyboardReprogram
-*/
-
-#include "Keyboard.h"
-
-// use this option for OSX.
-// Comment it out if using Windows or Linux:
-char ctrlKey = KEY_LEFT_GUI;
-// use this option for Windows and Linux.
-// leave commented out if using OSX:
-// char ctrlKey = KEY_LEFT_CTRL;
-
-
-void setup() {
- // make pin 2 an input and turn on the pull-up resistor so it goes high unless
- // connected to ground:
- pinMode(2, INPUT_PULLUP);
- // initialize control over the keyboard:
- Keyboard.begin();
-}
-
-void loop() {
- while (digitalRead(2) == HIGH) {
- // do nothing until pin 2 goes low
- delay(500);
- }
- delay(1000);
- // new document:
- Keyboard.press(ctrlKey);
- Keyboard.press('n');
- delay(100);
- Keyboard.releaseAll();
- // wait for new window to open:
- delay(1000);
-
- // versions of the Arduino IDE after 1.5 pre-populate new sketches with
- // setup() and loop() functions let's clear the window before typing anything new
- // select all
- Keyboard.press(ctrlKey);
- Keyboard.press('a');
- delay(500);
- Keyboard.releaseAll();
- // delete the selected text
- Keyboard.write(KEY_BACKSPACE);
- delay(500);
-
- // Type out "blink":
- Keyboard.println("void setup() {");
- Keyboard.println("pinMode(13, OUTPUT);");
- Keyboard.println("}");
- Keyboard.println();
- Keyboard.println("void loop() {");
- Keyboard.println("digitalWrite(13, HIGH);");
- Keyboard.print("delay(3000);");
- // 3000 ms is too long. Delete it:
- for (int keystrokes = 0; keystrokes < 6; keystrokes++) {
- delay(500);
- Keyboard.write(KEY_BACKSPACE);
- }
- // make it 1000 instead:
- Keyboard.println("1000);");
- Keyboard.println("digitalWrite(13, LOW);");
- Keyboard.println("delay(1000);");
- Keyboard.println("}");
- // tidy up:
- Keyboard.press(ctrlKey);
- Keyboard.press('t');
- delay(100);
- Keyboard.releaseAll();
- delay(3000);
- // upload code:
- Keyboard.press(ctrlKey);
- Keyboard.press('u');
- delay(100);
- Keyboard.releaseAll();
-
- // wait for the sweet oblivion of reprogramming:
- while (true);
-}
diff --git a/build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.txt b/build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.txt
deleted file mode 100644
index 0ccbf5fc3..000000000
--- a/build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.txt
+++ /dev/null
@@ -1 +0,0 @@
-Opens a new window in the Arduino IDE and reprograms the Leonardo with a simple blink program.
\ No newline at end of file
diff --git a/build/shared/examples/09.USB/Keyboard/KeyboardSerial/KeyboardSerial.ino b/build/shared/examples/09.USB/Keyboard/KeyboardSerial/KeyboardSerial.ino
deleted file mode 100644
index 72d9dddf5..000000000
--- a/build/shared/examples/09.USB/Keyboard/KeyboardSerial/KeyboardSerial.ino
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- Keyboard test
-
- For the Arduino Leonardo, Micro or Due
-
- Reads a byte from the serial port, sends a keystroke back.
- The sent keystroke is one higher than what's received, e.g. if you send a,
- you get b, send A you get B, and so forth.
-
- The circuit:
- - none
-
- created 21 Oct 2011
- modified 27 Mar 2012
- by Tom Igoe
-
- This example code is in the public domain.
-
- http://www.arduino.cc/en/Tutorial/KeyboardSerial
-*/
-
-#include "Keyboard.h"
-
-void setup() {
- // open the serial port:
- Serial.begin(9600);
- // initialize control over the keyboard:
- Keyboard.begin();
-}
-
-void loop() {
- // check for incoming serial data:
- if (Serial.available() > 0) {
- // read incoming serial data:
- char inChar = Serial.read();
- // Type the next ASCII value from what you received:
- Keyboard.write(inChar + 1);
- }
-}
diff --git a/build/shared/examples/09.USB/Keyboard/KeyboardSerial/KeyboardSerial.txt b/build/shared/examples/09.USB/Keyboard/KeyboardSerial/KeyboardSerial.txt
deleted file mode 100644
index e4e3f91d4..000000000
--- a/build/shared/examples/09.USB/Keyboard/KeyboardSerial/KeyboardSerial.txt
+++ /dev/null
@@ -1 +0,0 @@
-Reads a byte from the serial port, and sends back a keystroke.
\ No newline at end of file
diff --git a/build/shared/examples/09.USB/KeyboardAndMouseControl/KeyboardAndMouseControl.ino b/build/shared/examples/09.USB/KeyboardAndMouseControl/KeyboardAndMouseControl.ino
deleted file mode 100644
index 971354134..000000000
--- a/build/shared/examples/09.USB/KeyboardAndMouseControl/KeyboardAndMouseControl.ino
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- KeyboardAndMouseControl
-
- Controls the mouse from five pushbuttons on an Arduino Leonardo, Micro or Due.
-
- Hardware:
- - five pushbuttons attached to D2, D3, D4, D5, D6
-
- The mouse movement is always relative. This sketch reads four pushbuttons, and
- uses them to set the movement of the mouse.
-
- WARNING: When you use the Mouse.move() command, the Arduino takes over your
- mouse! Make sure you have control before you use the mouse commands.
-
- created 15 Mar 2012
- modified 27 Mar 2012
- by Tom Igoe
-
- This example code is in the public domain.
-
- http://www.arduino.cc/en/Tutorial/KeyboardAndMouseControl
-*/
-
-#include "Keyboard.h"
-#include "Mouse.h"
-
-// set pin numbers for the five buttons:
-const int upButton = 2;
-const int downButton = 3;
-const int leftButton = 4;
-const int rightButton = 5;
-const int mouseButton = 6;
-
-void setup() { // initialize the buttons' inputs:
- pinMode(upButton, INPUT);
- pinMode(downButton, INPUT);
- pinMode(leftButton, INPUT);
- pinMode(rightButton, INPUT);
- pinMode(mouseButton, INPUT);
-
- Serial.begin(9600);
- // initialize mouse control:
- Mouse.begin();
- Keyboard.begin();
-}
-
-void loop() {
- // use serial input to control the mouse:
- if (Serial.available() > 0) {
- char inChar = Serial.read();
-
- switch (inChar) {
- case 'u':
- // move mouse up
- Mouse.move(0, -40);
- break;
- case 'd':
- // move mouse down
- Mouse.move(0, 40);
- break;
- case 'l':
- // move mouse left
- Mouse.move(-40, 0);
- break;
- case 'r':
- // move mouse right
- Mouse.move(40, 0);
- break;
- case 'm':
- // perform mouse left click
- Mouse.click(MOUSE_LEFT);
- break;
- }
- }
-
- // use the pushbuttons to control the keyboard:
- if (digitalRead(upButton) == HIGH) {
- Keyboard.write('u');
- }
- if (digitalRead(downButton) == HIGH) {
- Keyboard.write('d');
- }
- if (digitalRead(leftButton) == HIGH) {
- Keyboard.write('l');
- }
- if (digitalRead(rightButton) == HIGH) {
- Keyboard.write('r');
- }
- if (digitalRead(mouseButton) == HIGH) {
- Keyboard.write('m');
- }
-
-}
diff --git a/build/shared/examples/09.USB/KeyboardAndMouseControl/KeyboardAndMouseControl.txt b/build/shared/examples/09.USB/KeyboardAndMouseControl/KeyboardAndMouseControl.txt
deleted file mode 100644
index 64745d318..000000000
--- a/build/shared/examples/09.USB/KeyboardAndMouseControl/KeyboardAndMouseControl.txt
+++ /dev/null
@@ -1 +0,0 @@
-Demonstrates the Mouse and Keyboard commands in one program.
\ No newline at end of file
diff --git a/build/shared/examples/09.USB/KeyboardAndMouseControl/layout.png b/build/shared/examples/09.USB/KeyboardAndMouseControl/layout.png
deleted file mode 100644
index 45fdc9c07..000000000
Binary files a/build/shared/examples/09.USB/KeyboardAndMouseControl/layout.png and /dev/null differ
diff --git a/build/shared/examples/09.USB/KeyboardAndMouseControl/schematic.png b/build/shared/examples/09.USB/KeyboardAndMouseControl/schematic.png
deleted file mode 100644
index 09998b07b..000000000
Binary files a/build/shared/examples/09.USB/KeyboardAndMouseControl/schematic.png and /dev/null differ
diff --git a/build/shared/examples/09.USB/Mouse/ButtonMouseControl/ButtonMouseControl.ino b/build/shared/examples/09.USB/Mouse/ButtonMouseControl/ButtonMouseControl.ino
deleted file mode 100644
index 9c78eda55..000000000
--- a/build/shared/examples/09.USB/Mouse/ButtonMouseControl/ButtonMouseControl.ino
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- ButtonMouseControl
-
- For Leonardo and Due boards only.
-
- Controls the mouse from five pushbuttons on an Arduino Leonardo, Micro or Due.
-
- Hardware:
- - five pushbuttons attached to D2, D3, D4, D5, D6
-
- The mouse movement is always relative. This sketch reads four pushbuttons,
- and uses them to set the movement of the mouse.
-
- WARNING: When you use the Mouse.move() command, the Arduino takes over your
- mouse! Make sure you have control before you use the mouse commands.
-
- created 15 Mar 2012
- modified 27 Mar 2012
- by Tom Igoe
-
- This example code is in the public domain.
-
- http://www.arduino.cc/en/Tutorial/ButtonMouseControl
-*/
-
-#include "Mouse.h"
-
-// set pin numbers for the five buttons:
-const int upButton = 2;
-const int downButton = 3;
-const int leftButton = 4;
-const int rightButton = 5;
-const int mouseButton = 6;
-
-int range = 5; // output range of X or Y movement; affects movement speed
-int responseDelay = 10; // response delay of the mouse, in ms
-
-
-void setup() {
- // initialize the buttons' inputs:
- pinMode(upButton, INPUT);
- pinMode(downButton, INPUT);
- pinMode(leftButton, INPUT);
- pinMode(rightButton, INPUT);
- pinMode(mouseButton, INPUT);
- // initialize mouse control:
- Mouse.begin();
-}
-
-void loop() {
- // read the buttons:
- int upState = digitalRead(upButton);
- int downState = digitalRead(downButton);
- int rightState = digitalRead(rightButton);
- int leftState = digitalRead(leftButton);
- int clickState = digitalRead(mouseButton);
-
- // calculate the movement distance based on the button states:
- int xDistance = (leftState - rightState) * range;
- int yDistance = (upState - downState) * range;
-
- // if X or Y is non-zero, move:
- if ((xDistance != 0) || (yDistance != 0)) {
- Mouse.move(xDistance, yDistance, 0);
- }
-
- // if the mouse button is pressed:
- if (clickState == HIGH) {
- // if the mouse is not pressed, press it:
- if (!Mouse.isPressed(MOUSE_LEFT)) {
- Mouse.press(MOUSE_LEFT);
- }
- }
- // else the mouse button is not pressed:
- else {
- // if the mouse is pressed, release it:
- if (Mouse.isPressed(MOUSE_LEFT)) {
- Mouse.release(MOUSE_LEFT);
- }
- }
-
- // a delay so the mouse doesn't move too fast:
- delay(responseDelay);
-}
diff --git a/build/shared/examples/09.USB/Mouse/ButtonMouseControl/ButtonMouseControl.txt b/build/shared/examples/09.USB/Mouse/ButtonMouseControl/ButtonMouseControl.txt
deleted file mode 100644
index 20355589b..000000000
--- a/build/shared/examples/09.USB/Mouse/ButtonMouseControl/ButtonMouseControl.txt
+++ /dev/null
@@ -1 +0,0 @@
-Control cursor movement with 5 pushbuttons.
\ No newline at end of file
diff --git a/build/shared/examples/09.USB/Mouse/ButtonMouseControl/layout.png b/build/shared/examples/09.USB/Mouse/ButtonMouseControl/layout.png
deleted file mode 100644
index 45fdc9c07..000000000
Binary files a/build/shared/examples/09.USB/Mouse/ButtonMouseControl/layout.png and /dev/null differ
diff --git a/build/shared/examples/09.USB/Mouse/ButtonMouseControl/schematic.png b/build/shared/examples/09.USB/Mouse/ButtonMouseControl/schematic.png
deleted file mode 100644
index 09998b07b..000000000
Binary files a/build/shared/examples/09.USB/Mouse/ButtonMouseControl/schematic.png and /dev/null differ
diff --git a/build/shared/examples/09.USB/Mouse/JoystickMouseControl/JoystickMouseControl.ino b/build/shared/examples/09.USB/Mouse/JoystickMouseControl/JoystickMouseControl.ino
deleted file mode 100644
index aa608f870..000000000
--- a/build/shared/examples/09.USB/Mouse/JoystickMouseControl/JoystickMouseControl.ino
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- JoystickMouseControl
-
- Controls the mouse from a joystick on an Arduino Leonardo, Micro or Due.
- Uses a pushbutton to turn on and off mouse control, and a second pushbutton
- to click the left mouse button.
-
- Hardware:
- - 2-axis joystick connected to pins A0 and A1
- - pushbuttons connected to pin D2 and D3
-
- The mouse movement is always relative. This sketch reads two analog inputs
- that range from 0 to 1023 (or less on either end) and translates them into
- ranges of -6 to 6.
- The sketch assumes that the joystick resting values are around the middle of
- the range, but that they vary within a threshold.
-
- WARNING: When you use the Mouse.move() command, the Arduino takes over your
- mouse! Make sure you have control before you use the command. This sketch
- includes a pushbutton to toggle the mouse control state, so you can turn on
- and off mouse control.
-
- created 15 Sep 2011
- updated 28 Mar 2012
- by Tom Igoe
-
- This example code is in the public domain.
-
- http://www.arduino.cc/en/Tutorial/JoystickMouseControl
-*/
-
-#include "Mouse.h"
-
-// set pin numbers for switch, joystick axes, and LED:
-const int switchPin = 2; // switch to turn on and off mouse control
-const int mouseButton = 3; // input pin for the mouse pushButton
-const int xAxis = A0; // joystick X axis
-const int yAxis = A1; // joystick Y axis
-const int ledPin = 5; // Mouse control LED
-
-// parameters for reading the joystick:
-int range = 12; // output range of X or Y movement
-int responseDelay = 5; // response delay of the mouse, in ms
-int threshold = range / 4; // resting threshold
-int center = range / 2; // resting position value
-
-bool mouseIsActive = false; // whether or not to control the mouse
-int lastSwitchState = LOW; // previous switch state
-
-void setup() {
- pinMode(switchPin, INPUT); // the switch pin
- pinMode(ledPin, OUTPUT); // the LED pin
- // take control of the mouse:
- Mouse.begin();
-}
-
-void loop() {
- // read the switch:
- int switchState = digitalRead(switchPin);
- // if it's changed and it's high, toggle the mouse state:
- if (switchState != lastSwitchState) {
- if (switchState == HIGH) {
- mouseIsActive = !mouseIsActive;
- // turn on LED to indicate mouse state:
- digitalWrite(ledPin, mouseIsActive);
- }
- }
- // save switch state for next comparison:
- lastSwitchState = switchState;
-
- // read and scale the two axes:
- int xReading = readAxis(A0);
- int yReading = readAxis(A1);
-
- // if the mouse control state is active, move the mouse:
- if (mouseIsActive) {
- Mouse.move(xReading, yReading, 0);
- }
-
- // read the mouse button and click or not click:
- // if the mouse button is pressed:
- if (digitalRead(mouseButton) == HIGH) {
- // if the mouse is not pressed, press it:
- if (!Mouse.isPressed(MOUSE_LEFT)) {
- Mouse.press(MOUSE_LEFT);
- }
- }
- // else the mouse button is not pressed:
- else {
- // if the mouse is pressed, release it:
- if (Mouse.isPressed(MOUSE_LEFT)) {
- Mouse.release(MOUSE_LEFT);
- }
- }
-
- delay(responseDelay);
-}
-
-/*
- reads an axis (0 or 1 for x or y) and scales the analog input range to a range
- from 0 to
-*/
-
-int readAxis(int thisAxis) {
- // read the analog input:
- int reading = analogRead(thisAxis);
-
- // map the reading from the analog input range to the output range:
- reading = map(reading, 0, 1023, 0, range);
-
- // if the output reading is outside from the rest position threshold, use it:
- int distance = reading - center;
-
- if (abs(distance) < threshold) {
- distance = 0;
- }
-
- // return the distance for this axis:
- return distance;
-}
diff --git a/build/shared/examples/09.USB/Mouse/JoystickMouseControl/JoystickMouseControl.txt b/build/shared/examples/09.USB/Mouse/JoystickMouseControl/JoystickMouseControl.txt
deleted file mode 100644
index 55fa2bc4c..000000000
--- a/build/shared/examples/09.USB/Mouse/JoystickMouseControl/JoystickMouseControl.txt
+++ /dev/null
@@ -1 +0,0 @@
-Controls a computer's cursor movement with a Joystick when a button is pressed.
\ No newline at end of file
diff --git a/build/shared/examples/09.USB/Mouse/JoystickMouseControl/layout.png b/build/shared/examples/09.USB/Mouse/JoystickMouseControl/layout.png
deleted file mode 100644
index 95a4e9529..000000000
Binary files a/build/shared/examples/09.USB/Mouse/JoystickMouseControl/layout.png and /dev/null differ
diff --git a/build/shared/examples/09.USB/Mouse/JoystickMouseControl/schematic.png b/build/shared/examples/09.USB/Mouse/JoystickMouseControl/schematic.png
deleted file mode 100644
index ae4ecf122..000000000
Binary files a/build/shared/examples/09.USB/Mouse/JoystickMouseControl/schematic.png and /dev/null differ
diff --git a/build/shared/examples/10.StarterKit_BasicKit/p02_SpaceshipInterface/p02_SpaceshipInterface.ino b/build/shared/examples/10.StarterKit_BasicKit/p02_SpaceshipInterface/p02_SpaceshipInterface.ino
deleted file mode 100644
index 41283dad1..000000000
--- a/build/shared/examples/10.StarterKit_BasicKit/p02_SpaceshipInterface/p02_SpaceshipInterface.ino
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- Arduino Starter Kit example
- Project 2 - Spaceship Interface
-
- This sketch is written to accompany Project 2 in the Arduino Starter Kit
-
- Parts required:
- - one green LED
- - two red LEDs
- - pushbutton
- - 10 kilohm resistor
- - three 220 ohm resistors
-
- created 13 Sep 2012
- by Scott Fitzgerald
-
- http://www.arduino.cc/starterKit
-
- This example code is part of the public domain.
-*/
-
-// Create a global variable to hold the state of the switch. This variable is
-// persistent throughout the program. Whenever you refer to switchState, you’re
-// talking about the number it holds
-int switchstate = 0;
-
-void setup() {
- // declare the LED pins as outputs
- pinMode(3, OUTPUT);
- pinMode(4, OUTPUT);
- pinMode(5, OUTPUT);
-
- // declare the switch pin as an input
- pinMode(2, INPUT);
-}
-
-void loop() {
-
- // read the value of the switch
- // digitalRead() checks to see if there is voltage on the pin or not
- switchstate = digitalRead(2);
-
- // if the button is not pressed turn on the green LED and off the red LEDs
- if (switchstate == LOW) {
- digitalWrite(3, HIGH); // turn the green LED on pin 3 on
- digitalWrite(4, LOW); // turn the red LED on pin 4 off
- digitalWrite(5, LOW); // turn the red LED on pin 5 off
- }
- // this else is part of the above if() statement.
- // if the switch is not LOW (the button is pressed) turn off the green LED and
- // blink alternatively the red LEDs
- else {
- digitalWrite(3, LOW); // turn the green LED on pin 3 off
- digitalWrite(4, LOW); // turn the red LED on pin 4 off
- digitalWrite(5, HIGH); // turn the red LED on pin 5 on
- // wait for a quarter second before changing the light
- delay(250);
- digitalWrite(4, HIGH); // turn the red LED on pin 4 on
- digitalWrite(5, LOW); // turn the red LED on pin 5 off
- // wait for a quarter second before changing the light
- delay(250);
- }
-}
diff --git a/build/shared/examples/10.StarterKit_BasicKit/p03_LoveOMeter/p03_LoveOMeter.ino b/build/shared/examples/10.StarterKit_BasicKit/p03_LoveOMeter/p03_LoveOMeter.ino
deleted file mode 100644
index 2a72f46d7..000000000
--- a/build/shared/examples/10.StarterKit_BasicKit/p03_LoveOMeter/p03_LoveOMeter.ino
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- Arduino Starter Kit example
- Project 3 - Love-O-Meter
-
- This sketch is written to accompany Project 3 in the Arduino Starter Kit
-
- Parts required:
- - one TMP36 temperature sensor
- - three red LEDs
- - three 220 ohm resistors
-
- created 13 Sep 2012
- by Scott Fitzgerald
-
- http://www.arduino.cc/starterKit
-
- This example code is part of the public domain.
-*/
-
-// named constant for the pin the sensor is connected to
-const int sensorPin = A0;
-// room temperature in Celsius
-const float baselineTemp = 20.0;
-
-void setup() {
- // open a serial connection to display values
- Serial.begin(9600);
- // set the LED pins as outputs
- // the for() loop saves some extra coding
- for (int pinNumber = 2; pinNumber < 5; pinNumber++) {
- pinMode(pinNumber, OUTPUT);
- digitalWrite(pinNumber, LOW);
- }
-}
-
-void loop() {
- // read the value on AnalogIn pin 0 and store it in a variable
- int sensorVal = analogRead(sensorPin);
-
- // send the 10-bit sensor value out the serial port
- Serial.print("sensor Value: ");
- Serial.print(sensorVal);
-
- // convert the ADC reading to voltage
- float voltage = (sensorVal / 1024.0) * 5.0;
-
- // Send the voltage level out the Serial port
- Serial.print(", Volts: ");
- Serial.print(voltage);
-
- // convert the voltage to temperature in degrees C
- // the sensor changes 10 mV per degree
- // the datasheet says there's a 500 mV offset
- // ((voltage - 500 mV) times 100)
- Serial.print(", degrees C: ");
- float temperature = (voltage - .5) * 100;
- Serial.println(temperature);
-
- // if the current temperature is lower than the baseline turn off all LEDs
- if (temperature < baselineTemp + 2) {
- digitalWrite(2, LOW);
- digitalWrite(3, LOW);
- digitalWrite(4, LOW);
- } // if the temperature rises 2-4 degrees, turn an LED on
- else if (temperature >= baselineTemp + 2 && temperature < baselineTemp + 4) {
- digitalWrite(2, HIGH);
- digitalWrite(3, LOW);
- digitalWrite(4, LOW);
- } // if the temperature rises 4-6 degrees, turn a second LED on
- else if (temperature >= baselineTemp + 4 && temperature < baselineTemp + 6) {
- digitalWrite(2, HIGH);
- digitalWrite(3, HIGH);
- digitalWrite(4, LOW);
- } // if the temperature rises more than 6 degrees, turn all LEDs on
- else if (temperature >= baselineTemp + 6) {
- digitalWrite(2, HIGH);
- digitalWrite(3, HIGH);
- digitalWrite(4, HIGH);
- }
- delay(1);
-}
diff --git a/build/shared/examples/10.StarterKit_BasicKit/p04_ColorMixingLamp/p04_ColorMixingLamp.ino b/build/shared/examples/10.StarterKit_BasicKit/p04_ColorMixingLamp/p04_ColorMixingLamp.ino
deleted file mode 100644
index 1e15f1cb3..000000000
--- a/build/shared/examples/10.StarterKit_BasicKit/p04_ColorMixingLamp/p04_ColorMixingLamp.ino
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- Arduino Starter Kit example
- Project 4 - Color Mixing Lamp
-
- This sketch is written to accompany Project 3 in the Arduino Starter Kit
-
- Parts required:
- - one RGB LED
- - three 10 kilohm resistors
- - three 220 ohm resistors
- - three photoresistors
- - red green and blue colored gels
-
- created 13 Sep 2012
- modified 14 Nov 2012
- by Scott Fitzgerald
- Thanks to Federico Vanzati for improvements
-
- http://www.arduino.cc/starterKit
-
- This example code is part of the public domain.
-*/
-
-const int greenLEDPin = 9; // LED connected to digital pin 9
-const int redLEDPin = 10; // LED connected to digital pin 10
-const int blueLEDPin = 11; // LED connected to digital pin 11
-
-const int redSensorPin = A0; // pin with the photoresistor with the red gel
-const int greenSensorPin = A1; // pin with the photoresistor with the green gel
-const int blueSensorPin = A2; // pin with the photoresistor with the blue gel
-
-int redValue = 0; // value to write to the red LED
-int greenValue = 0; // value to write to the green LED
-int blueValue = 0; // value to write to the blue LED
-
-int redSensorValue = 0; // variable to hold the value from the red sensor
-int greenSensorValue = 0; // variable to hold the value from the green sensor
-int blueSensorValue = 0; // variable to hold the value from the blue sensor
-
-void setup() {
- // initialize serial communications at 9600 bps:
- Serial.begin(9600);
-
- // set the digital pins as outputs
- pinMode(greenLEDPin, OUTPUT);
- pinMode(redLEDPin, OUTPUT);
- pinMode(blueLEDPin, OUTPUT);
-}
-
-void loop() {
- // Read the sensors first:
-
- // read the value from the red-filtered photoresistor:
- redSensorValue = analogRead(redSensorPin);
- // give the ADC a moment to settle
- delay(5);
- // read the value from the green-filtered photoresistor:
- greenSensorValue = analogRead(greenSensorPin);
- // give the ADC a moment to settle
- delay(5);
- // read the value from the blue-filtered photoresistor:
- blueSensorValue = analogRead(blueSensorPin);
-
- // print out the values to the Serial Monitor
- Serial.print("raw sensor Values \t red: ");
- Serial.print(redSensorValue);
- Serial.print("\t green: ");
- Serial.print(greenSensorValue);
- Serial.print("\t Blue: ");
- Serial.println(blueSensorValue);
-
- /*
- In order to use the values from the sensor for the LED, you need to do some
- math. The ADC provides a 10-bit number, but analogWrite() uses 8 bits.
- You'll want to divide your sensor readings by 4 to keep them in range
- of the output.
- */
- redValue = redSensorValue / 4;
- greenValue = greenSensorValue / 4;
- blueValue = blueSensorValue / 4;
-
- // print out the mapped values
- Serial.print("Mapped sensor Values \t red: ");
- Serial.print(redValue);
- Serial.print("\t green: ");
- Serial.print(greenValue);
- Serial.print("\t Blue: ");
- Serial.println(blueValue);
-
- /*
- Now that you have a usable value, it's time to PWM the LED.
- */
- analogWrite(redLEDPin, redValue);
- analogWrite(greenLEDPin, greenValue);
- analogWrite(blueLEDPin, blueValue);
-}
diff --git a/build/shared/examples/10.StarterKit_BasicKit/p05_ServoMoodIndicator/p05_ServoMoodIndicator.ino b/build/shared/examples/10.StarterKit_BasicKit/p05_ServoMoodIndicator/p05_ServoMoodIndicator.ino
deleted file mode 100644
index b56e860ef..000000000
--- a/build/shared/examples/10.StarterKit_BasicKit/p05_ServoMoodIndicator/p05_ServoMoodIndicator.ino
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- Arduino Starter Kit example
- Project 5 - Servo Mood Indicator
-
- This sketch is written to accompany Project 5 in the Arduino Starter Kit
-
- Parts required:
- - servo motor
- - 10 kilohm potentiometer
- - two 100 uF electrolytic capacitors
-
- created 13 Sep 2012
- by Scott Fitzgerald
-
- http://www.arduino.cc/starterKit
-
- This example code is part of the public domain.
-*/
-
-// include the Servo library
-#include
-
-Servo myServo; // create a servo object
-
-int const potPin = A0; // analog pin used to connect the potentiometer
-int potVal; // variable to read the value from the analog pin
-int angle; // variable to hold the angle for the servo motor
-
-void setup() {
- myServo.attach(9); // attaches the servo on pin 9 to the servo object
- Serial.begin(9600); // open a serial connection to your computer
-}
-
-void loop() {
- potVal = analogRead(potPin); // read the value of the potentiometer
- // print out the value to the Serial Monitor
- Serial.print("potVal: ");
- Serial.print(potVal);
-
- // scale the numbers from the pot
- angle = map(potVal, 0, 1023, 0, 179);
-
- // print out the angle for the servo motor
- Serial.print(", angle: ");
- Serial.println(angle);
-
- // set the servo position
- myServo.write(angle);
-
- // wait for the servo to get there
- delay(15);
-}
diff --git a/build/shared/examples/10.StarterKit_BasicKit/p06_LightTheremin/p06_LightTheremin.ino b/build/shared/examples/10.StarterKit_BasicKit/p06_LightTheremin/p06_LightTheremin.ino
deleted file mode 100644
index 6f6475c24..000000000
--- a/build/shared/examples/10.StarterKit_BasicKit/p06_LightTheremin/p06_LightTheremin.ino
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- Arduino Starter Kit example
- Project 6 - Light Theremin
-
- This sketch is written to accompany Project 6 in the Arduino Starter Kit
-
- Parts required:
- - photoresistor
- - 10 kilohm resistor
- - piezo
-
- created 13 Sep 2012
- by Scott Fitzgerald
-
- http://www.arduino.cc/starterKit
-
- This example code is part of the public domain.
-*/
-
-// variable to hold sensor value
-int sensorValue;
-// variable to calibrate low value
-int sensorLow = 1023;
-// variable to calibrate high value
-int sensorHigh = 0;
-// LED pin
-const int ledPin = 13;
-
-void setup() {
- // Make the LED pin an output and turn it on
- pinMode(ledPin, OUTPUT);
- digitalWrite(ledPin, HIGH);
-
- // calibrate for the first five seconds after program runs
- while (millis() < 5000) {
- // record the maximum sensor value
- sensorValue = analogRead(A0);
- if (sensorValue > sensorHigh) {
- sensorHigh = sensorValue;
- }
- // record the minimum sensor value
- if (sensorValue < sensorLow) {
- sensorLow = sensorValue;
- }
- }
- // turn the LED off, signaling the end of the calibration period
- digitalWrite(ledPin, LOW);
-}
-
-void loop() {
- //read the input from A0 and store it in a variable
- sensorValue = analogRead(A0);
-
- // map the sensor values to a wide range of pitches
- int pitch = map(sensorValue, sensorLow, sensorHigh, 50, 4000);
-
- // play the tone for 20 ms on pin 8
- tone(8, pitch, 20);
-
- // wait for a moment
- delay(10);
-}
diff --git a/build/shared/examples/10.StarterKit_BasicKit/p07_Keyboard/p07_Keyboard.ino b/build/shared/examples/10.StarterKit_BasicKit/p07_Keyboard/p07_Keyboard.ino
deleted file mode 100644
index ad39bd198..000000000
--- a/build/shared/examples/10.StarterKit_BasicKit/p07_Keyboard/p07_Keyboard.ino
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- Arduino Starter Kit example
- Project 7 - Keyboard
-
- This sketch is written to accompany Project 7 in the Arduino Starter Kit
-
- Parts required:
- - two 10 kilohm resistors
- - 1 megohm resistor
- - 220 ohm resistor
- - four pushbuttons
- - piezo
-
- created 13 Sep 2012
- by Scott Fitzgerald
-
- http://www.arduino.cc/starterKit
-
- This example code is part of the public domain.
-*/
-
-// create an array of notes
-// the numbers below correspond to the frequencies of middle C, D, E, and F
-int notes[] = {262, 294, 330, 349};
-
-void setup() {
- //start serial communication
- Serial.begin(9600);
-}
-
-void loop() {
- // create a local variable to hold the input on pin A0
- int keyVal = analogRead(A0);
- // send the value from A0 to the Serial Monitor
- Serial.println(keyVal);
-
- // play the note corresponding to each value on A0
- if (keyVal == 1023) {
- // play the first frequency in the array on pin 8
- tone(8, notes[0]);
- } else if (keyVal >= 990 && keyVal <= 1010) {
- // play the second frequency in the array on pin 8
- tone(8, notes[1]);
- } else if (keyVal >= 505 && keyVal <= 515) {
- // play the third frequency in the array on pin 8
- tone(8, notes[2]);
- } else if (keyVal >= 5 && keyVal <= 10) {
- // play the fourth frequency in the array on pin 8
- tone(8, notes[3]);
- } else {
- // if the value is out of range, play no tone
- noTone(8);
- }
-}
diff --git a/build/shared/examples/10.StarterKit_BasicKit/p08_DigitalHourglass/p08_DigitalHourglass.ino b/build/shared/examples/10.StarterKit_BasicKit/p08_DigitalHourglass/p08_DigitalHourglass.ino
deleted file mode 100644
index 801f8cd41..000000000
--- a/build/shared/examples/10.StarterKit_BasicKit/p08_DigitalHourglass/p08_DigitalHourglass.ino
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- Arduino Starter Kit example
- Project 8 - Digital Hourglass
-
- This sketch is written to accompany Project 8 in the Arduino Starter Kit
-
- Parts required:
- - 10 kilohm resistor
- - six 220 ohm resistors
- - six LEDs
- - tilt switch
-
- created 13 Sep 2012
- by Scott Fitzgerald
-
- http://www.arduino.cc/starterKit
-
- This example code is part of the public domain.
-*/
-
-// named constant for the switch pin
-const int switchPin = 8;
-
-unsigned long previousTime = 0; // store the last time an LED was updated
-int switchState = 0; // the current switch state
-int prevSwitchState = 0; // the previous switch state
-int led = 2; // a variable to refer to the LEDs
-
-// 600000 = 10 minutes in milliseconds
-long interval = 600000; // interval at which to light the next LED
-
-void setup() {
- // set the LED pins as outputs
- for (int x = 2; x < 8; x++) {
- pinMode(x, OUTPUT);
- }
- // set the tilt switch pin as input
- pinMode(switchPin, INPUT);
-}
-
-void loop() {
- // store the time since the Arduino started running in a variable
- unsigned long currentTime = millis();
-
- // compare the current time to the previous time an LED turned on
- // if it is greater than your interval, run the if statement
- if (currentTime - previousTime > interval) {
- // save the current time as the last time you changed an LED
- previousTime = currentTime;
- // Turn the LED on
- digitalWrite(led, HIGH);
- // increment the led variable
- // in 10 minutes the next LED will light up
- led++;
-
- if (led == 7) {
- // the hour is up
- }
- }
-
- // read the switch value
- switchState = digitalRead(switchPin);
-
- // if the switch has changed
- if (switchState != prevSwitchState) {
- // turn all the LEDs low
- for (int x = 2; x < 8; x++) {
- digitalWrite(x, LOW);
- }
-
- // reset the LED variable to the first one
- led = 2;
-
- //reset the timer
- previousTime = currentTime;
- }
- // set the previous switch state to the current state
- prevSwitchState = switchState;
-}
diff --git a/build/shared/examples/10.StarterKit_BasicKit/p09_MotorizedPinwheel/p09_MotorizedPinwheel.ino b/build/shared/examples/10.StarterKit_BasicKit/p09_MotorizedPinwheel/p09_MotorizedPinwheel.ino
deleted file mode 100644
index 23e19b1bc..000000000
--- a/build/shared/examples/10.StarterKit_BasicKit/p09_MotorizedPinwheel/p09_MotorizedPinwheel.ino
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- Arduino Starter Kit example
- Project 9 - Motorized Pinwheel
-
- This sketch is written to accompany Project 9 in the Arduino Starter Kit
-
- Parts required:
- - 10 kilohm resistor
- - pushbutton
- - motor
- - 9V battery
- - IRF520 MOSFET
- - 1N4007 diode
-
- created 13 Sep 2012
- by Scott Fitzgerald
-
- http://www.arduino.cc/starterKit
-
- This example code is part of the public domain.
-*/
-
-// named constants for the switch and motor pins
-const int switchPin = 2; // the number of the switch pin
-const int motorPin = 9; // the number of the motor pin
-
-int switchState = 0; // variable for reading the switch's status
-
-void setup() {
- // initialize the motor pin as an output:
- pinMode(motorPin, OUTPUT);
- // initialize the switch pin as an input:
- pinMode(switchPin, INPUT);
-}
-
-void loop() {
- // read the state of the switch value:
- switchState = digitalRead(switchPin);
-
- // check if the switch is pressed.
- if (switchState == HIGH) {
- // turn motor on:
- digitalWrite(motorPin, HIGH);
- } else {
- // turn motor off:
- digitalWrite(motorPin, LOW);
- }
-}
diff --git a/build/shared/examples/10.StarterKit_BasicKit/p10_Zoetrope/p10_Zoetrope.ino b/build/shared/examples/10.StarterKit_BasicKit/p10_Zoetrope/p10_Zoetrope.ino
deleted file mode 100644
index 4d675ed66..000000000
--- a/build/shared/examples/10.StarterKit_BasicKit/p10_Zoetrope/p10_Zoetrope.ino
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- Arduino Starter Kit example
- Project 10 - Zoetrope
-
- This sketch is written to accompany Project 10 in the Arduino Starter Kit
-
- Parts required:
- - two 10 kilohm resistors
- - two momentary pushbuttons
- - one 10 kilohm potentiometer
- - motor
- - 9V battery
- - H-Bridge
-
- created 13 Sep 2012
- by Scott Fitzgerald
- Thanks to Federico Vanzati for improvements
-
- http://www.arduino.cc/starterKit
-
- This example code is part of the public domain.
-*/
-
-const int controlPin1 = 2; // connected to pin 7 on the H-bridge
-const int controlPin2 = 3; // connected to pin 2 on the H-bridge
-const int enablePin = 9; // connected to pin 1 on the H-bridge
-const int directionSwitchPin = 4; // connected to the switch for direction
-const int onOffSwitchStateSwitchPin = 5; // connected to the switch for turning the motor on and off
-const int potPin = A0; // connected to the potentiometer's output
-
-// create some variables to hold values from your inputs
-int onOffSwitchState = 0; // current state of the on/off switch
-int previousOnOffSwitchState = 0; // previous position of the on/off switch
-int directionSwitchState = 0; // current state of the direction switch
-int previousDirectionSwitchState = 0; // previous state of the direction switch
-
-int motorEnabled = 0; // Turns the motor on/off
-int motorSpeed = 0; // speed of the motor
-int motorDirection = 1; // current direction of the motor
-
-void setup() {
- // initialize the inputs and outputs
- pinMode(directionSwitchPin, INPUT);
- pinMode(onOffSwitchStateSwitchPin, INPUT);
- pinMode(controlPin1, OUTPUT);
- pinMode(controlPin2, OUTPUT);
- pinMode(enablePin, OUTPUT);
-
- // pull the enable pin LOW to start
- digitalWrite(enablePin, LOW);
-}
-
-void loop() {
- // read the value of the on/off switch
- onOffSwitchState = digitalRead(onOffSwitchStateSwitchPin);
- delay(1);
-
- // read the value of the direction switch
- directionSwitchState = digitalRead(directionSwitchPin);
-
- // read the value of the pot and divide by 4 to get a value that can be
- // used for PWM
- motorSpeed = analogRead(potPin) / 4;
-
- // if the on/off button changed state since the last loop()
- if (onOffSwitchState != previousOnOffSwitchState) {
- // change the value of motorEnabled if pressed
- if (onOffSwitchState == HIGH) {
- motorEnabled = !motorEnabled;
- }
- }
-
- // if the direction button changed state since the last loop()
- if (directionSwitchState != previousDirectionSwitchState) {
- // change the value of motorDirection if pressed
- if (directionSwitchState == HIGH) {
- motorDirection = !motorDirection;
- }
- }
-
- // change the direction the motor spins by talking to the control pins
- // on the H-Bridge
- if (motorDirection == 1) {
- digitalWrite(controlPin1, HIGH);
- digitalWrite(controlPin2, LOW);
- } else {
- digitalWrite(controlPin1, LOW);
- digitalWrite(controlPin2, HIGH);
- }
-
- // if the motor is supposed to be on
- if (motorEnabled == 1) {
- // PWM the enable pin to vary the speed
- analogWrite(enablePin, motorSpeed);
- } else { // if the motor is not supposed to be on
- //turn the motor off
- analogWrite(enablePin, 0);
- }
- // save the current on/off switch state as the previous
- previousDirectionSwitchState = directionSwitchState;
- // save the current switch state as the previous
- previousOnOffSwitchState = onOffSwitchState;
-}
diff --git a/build/shared/examples/10.StarterKit_BasicKit/p11_CrystalBall/p11_CrystalBall.ino b/build/shared/examples/10.StarterKit_BasicKit/p11_CrystalBall/p11_CrystalBall.ino
deleted file mode 100644
index 63aefc4c4..000000000
--- a/build/shared/examples/10.StarterKit_BasicKit/p11_CrystalBall/p11_CrystalBall.ino
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- Arduino Starter Kit example
- Project 11 - Crystal Ball
-
- This sketch is written to accompany Project 11 in the Arduino Starter Kit
-
- Parts required:
- - 220 ohm resistor
- - 10 kilohm resistor
- - 10 kilohm potentiometer
- - 16x2 LCD screen
- - tilt switch
-
- created 13 Sep 2012
- by Scott Fitzgerald
-
- http://www.arduino.cc/starterKit
-
- This example code is part of the public domain.
-*/
-
-// include the library code:
-#include
-
-// initialize the library with the numbers of the interface pins
-LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
-
-// set up a constant for the tilt switch pin
-const int switchPin = 6;
-
-// variable to hold the value of the switch pin
-int switchState = 0;
-
-// variable to hold previous value of the switch pin
-int prevSwitchState = 0;
-
-// a variable to choose which reply from the crystal ball
-int reply;
-
-void setup() {
- // set up the number of columns and rows on the LCD
- lcd.begin(16, 2);
-
- // set up the switch pin as an input
- pinMode(switchPin, INPUT);
-
- // Print a message to the LCD.
- lcd.print("Ask the");
- // set the cursor to column 0, line 1
- // line 1 is the second row, since counting begins with 0
- lcd.setCursor(0, 1);
- // print to the second line
- lcd.print("Crystal Ball!");
-}
-
-void loop() {
- // check the status of the switch
- switchState = digitalRead(switchPin);
-
- // compare the switchState to its previous state
- if (switchState != prevSwitchState) {
- // if the state has changed from HIGH to LOW you know that the ball has been
- // tilted from one direction to the other
- if (switchState == LOW) {
- // randomly chose a reply
- reply = random(8);
- // clean up the screen before printing a new reply
- lcd.clear();
- // set the cursor to column 0, line 0
- lcd.setCursor(0, 0);
- // print some text
- lcd.print("the ball says:");
- // move the cursor to the second line
- lcd.setCursor(0, 1);
-
- // choose a saying to print based on the value in reply
- switch (reply) {
- case 0:
- lcd.print("Yes");
- break;
-
- case 1:
- lcd.print("Most likely");
- break;
-
- case 2:
- lcd.print("Certainly");
- break;
-
- case 3:
- lcd.print("Outlook good");
- break;
-
- case 4:
- lcd.print("Unsure");
- break;
-
- case 5:
- lcd.print("Ask again");
- break;
-
- case 6:
- lcd.print("Doubtful");
- break;
-
- case 7:
- lcd.print("No");
- break;
- }
- }
- }
- // save the current switch state as the last state
- prevSwitchState = switchState;
-}
diff --git a/build/shared/examples/10.StarterKit_BasicKit/p12_KnockLock/p12_KnockLock.ino b/build/shared/examples/10.StarterKit_BasicKit/p12_KnockLock/p12_KnockLock.ino
deleted file mode 100644
index 95027ec25..000000000
--- a/build/shared/examples/10.StarterKit_BasicKit/p12_KnockLock/p12_KnockLock.ino
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- Arduino Starter Kit example
- Project 12 - Knock Lock
-
- This sketch is written to accompany Project 12 in the Arduino Starter Kit
-
- Parts required:
- - 1 megohm resistor
- - 10 kilohm resistor
- - three 220 ohm resistors
- - piezo
- - servo motor
- - push button
- - one red LED
- - one yellow LED
- - one green LED
- - 100 uF capacitor
-
- created 18 Sep 2012
- by Scott Fitzgerald
- Thanks to Federico Vanzati for improvements
-
- http://www.arduino.cc/starterKit
-
- This example code is part of the public domain.
-*/
-
-// import the library
-#include
-// create an instance of the Servo library
-Servo myServo;
-
-const int piezo = A0; // pin the piezo is attached to
-const int switchPin = 2; // pin the switch is attached to
-const int yellowLed = 3; // pin the yellow LED is attached to
-const int greenLed = 4; // pin the green LED is attached to
-const int redLed = 5; // pin the red LED is attached to
-
-// variable for the piezo value
-int knockVal;
-// variable for the switch value
-int switchVal;
-
-// variables for the high and low limits of the knock value
-const int quietKnock = 10;
-const int loudKnock = 100;
-
-// variable to indicate if locked or not
-bool locked = false;
-// how many valid knocks you've received
-int numberOfKnocks = 0;
-
-void setup() {
- // attach the servo to pin 9
- myServo.attach(9);
-
- // make the LED pins outputs
- pinMode(yellowLed, OUTPUT);
- pinMode(redLed, OUTPUT);
- pinMode(greenLed, OUTPUT);
-
- // set the switch pin as an input
- pinMode(switchPin, INPUT);
-
- // start serial communication for debugging
- Serial.begin(9600);
-
- // turn the green LED on
- digitalWrite(greenLed, HIGH);
-
- // move the servo to the unlocked position
- myServo.write(0);
-
- // print status to the Serial Monitor
- Serial.println("the box is unlocked!");
-}
-
-void loop() {
-
- // if the box is unlocked
- if (locked == false) {
-
- // read the value of the switch pin
- switchVal = digitalRead(switchPin);
-
- // if the button is pressed, lock the box
- if (switchVal == HIGH) {
- // set the locked variable to "true"
- locked = true;
-
- // change the status LEDs
- digitalWrite(greenLed, LOW);
- digitalWrite(redLed, HIGH);
-
- // move the servo to the locked position
- myServo.write(90);
-
- // print out status
- Serial.println("the box is locked!");
-
- // wait for the servo to move into position
- delay(1000);
- }
- }
-
- // if the box is locked
- if (locked == true) {
-
- // check the value of the piezo
- knockVal = analogRead(piezo);
-
- // if there are not enough valid knocks
- if (numberOfKnocks < 3 && knockVal > 0) {
-
- // check to see if the knock is in range
- if (checkForKnock(knockVal) == true) {
-
- // increment the number of valid knocks
- numberOfKnocks++;
- }
-
- // print status of knocks
- Serial.print(3 - numberOfKnocks);
- Serial.println(" more knocks to go");
- }
-
- // if there are three knocks
- if (numberOfKnocks >= 3) {
- // unlock the box
- locked = false;
-
- // move the servo to the unlocked position
- myServo.write(0);
-
- // wait for it to move
- delay(20);
-
- // change status LEDs
- digitalWrite(greenLed, HIGH);
- digitalWrite(redLed, LOW);
- Serial.println("the box is unlocked!");
-
- numberOfKnocks = 0;
- }
- }
-}
-
-// this function checks to see if a detected knock is within max and min range
-bool checkForKnock(int value) {
- // if the value of the knock is greater than the minimum, and larger
- // than the maximum
- if (value > quietKnock && value < loudKnock) {
- // turn the status LED on
- digitalWrite(yellowLed, HIGH);
- delay(50);
- digitalWrite(yellowLed, LOW);
- // print out the status
- Serial.print("Valid knock of value ");
- Serial.println(value);
- // return true
- return true;
- }
- // if the knock is not within range
- else {
- // print status
- Serial.print("Bad knock value ");
- Serial.println(value);
- // return false
- return false;
- }
-}
diff --git a/build/shared/examples/10.StarterKit_BasicKit/p13_TouchSensorLamp/p13_TouchSensorLamp.ino b/build/shared/examples/10.StarterKit_BasicKit/p13_TouchSensorLamp/p13_TouchSensorLamp.ino
deleted file mode 100644
index 8f7a28a5b..000000000
--- a/build/shared/examples/10.StarterKit_BasicKit/p13_TouchSensorLamp/p13_TouchSensorLamp.ino
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- Arduino Starter Kit example
- Project 13 - Touch Sensor Lamp
-
- This sketch is written to accompany Project 13 in the Arduino Starter Kit
-
- Parts required:
- - 1 megohm resistor
- - metal foil or copper mesh
- - 220 ohm resistor
- - LED
-
- Software required :
- - CapacitiveSensor library by Paul Badger
- http://www.arduino.cc/playground/Main/CapacitiveSensor
-
- created 18 Sep 2012
- by Scott Fitzgerald
-
- http://www.arduino.cc/starterKit
-
- This example code is part of the public domain.
-*/
-
-// import the library (must be located in the Arduino/libraries directory)
-#include
-
-// create an instance of the library
-// pin 4 sends electrical energy
-// pin 2 senses senses a change
-CapacitiveSensor capSensor = CapacitiveSensor(4, 2);
-
-// threshold for turning the lamp on
-int threshold = 1000;
-
-// pin the LED is connected to
-const int ledPin = 12;
-
-
-void setup() {
- // open a serial connection
- Serial.begin(9600);
- // set the LED pin as an output
- pinMode(ledPin, OUTPUT);
-}
-
-void loop() {
- // store the value reported by the sensor in a variable
- long sensorValue = capSensor.capacitiveSensor(30);
-
- // print out the sensor value
- Serial.println(sensorValue);
-
- // if the value is greater than the threshold
- if (sensorValue > threshold) {
- // turn the LED on
- digitalWrite(ledPin, HIGH);
- }
- // if it's lower than the threshold
- else {
- // turn the LED off
- digitalWrite(ledPin, LOW);
- }
-
- delay(10);
-}
diff --git a/build/shared/examples/10.StarterKit_BasicKit/p14_TweakTheArduinoLogo/p14_TweakTheArduinoLogo.ino b/build/shared/examples/10.StarterKit_BasicKit/p14_TweakTheArduinoLogo/p14_TweakTheArduinoLogo.ino
deleted file mode 100644
index e9279e2d6..000000000
--- a/build/shared/examples/10.StarterKit_BasicKit/p14_TweakTheArduinoLogo/p14_TweakTheArduinoLogo.ino
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- Arduino Starter Kit example
- Project 14 - Tweak the Arduino Logo
-
- This sketch is written to accompany Project 14 in the Arduino Starter Kit
-
- Parts required:
- - 10 kilohm potentiometer
-
- Software required:
- - Processing (3.0 or newer) http://processing.org
- - Active Internet connection
-
- created 18 Sep 2012
- by Scott Fitzgerald
-
- http://www.arduino.cc/starterKit
-
- This example code is part of the public domain.
-*/
-
-
-void setup() {
- // initialize serial communication
- Serial.begin(9600);
-}
-
-void loop() {
- // read the value of A0, divide by 4 and send it as a byte over the
- // serial connection
- Serial.write(analogRead(A0) / 4);
- delay(1);
-}
-
-/* Processing code for this example
-
- // Tweak the Arduino Logo
-
- // by Scott Fitzgerald
- // This example code is in the public domain.
-
- // import the serial library
- import processing.serial.*;
-
- // create an instance of the serial library
- Serial myPort;
-
- // create an instance of PImage
- PImage logo;
-
- // a variable to hold the background color
- int bgcolor = 0;
-
- void setup() {
- size(1, 1);
- surface.setResizable(true);
- // set the color mode to Hue/Saturation/Brightness
- colorMode(HSB, 255);
-
- // load the Arduino logo into the PImage instance
- logo = loadImage("http://www.arduino.cc/arduino_logo.png");
-
- // make the window the same size as the image
- surface.setSize(logo.width, logo.height);
-
- // print a list of available serial ports to the Processing status window
- println("Available serial ports:");
- println(Serial.list());
-
- // Tell the serial object the information it needs to communicate with the
- // Arduino. Change Serial.list()[0] to the correct port corresponding to
- // your Arduino board. The last parameter (e.g. 9600) is the speed of the
- // communication. It has to correspond to the value passed to
- // Serial.begin() in your Arduino sketch.
- myPort = new Serial(this, Serial.list()[0], 9600);
-
- // If you know the name of the port used by the Arduino board, you can
- // specify it directly like this.
- // port = new Serial(this, "COM1", 9600);
- }
-
- void draw() {
-
- // if there is information in the serial port
- if ( myPort.available() > 0) {
- // read the value and store it in a variable
- bgcolor = myPort.read();
-
- // print the value to the status window
- println(bgcolor);
- }
-
- // Draw the background. the variable bgcolor contains the Hue, determined by
- // the value from the serial port
- background(bgcolor, 255, 255);
-
- // draw the Arduino logo
- image(logo, 0, 0);
- }
-
-*/
diff --git a/build/shared/examples/10.StarterKit_BasicKit/p15_HackingButtons/p15_HackingButtons.ino b/build/shared/examples/10.StarterKit_BasicKit/p15_HackingButtons/p15_HackingButtons.ino
deleted file mode 100644
index d5d530a2b..000000000
--- a/build/shared/examples/10.StarterKit_BasicKit/p15_HackingButtons/p15_HackingButtons.ino
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- Arduino Starter Kit example
- Project 15 - Hacking Buttons
-
- This sketch is written to accompany Project 15 in the Arduino Starter Kit
-
- Parts required:
- - battery powered component
- - 220 ohm resistor
- - 4N35 optocoupler
-
- created 18 Sep 2012
- by Scott Fitzgerald
-
- http://www.arduino.cc/starterKit
-
- This example code is part of the public domain.
-*/
-
-const int optoPin = 2; // the pin the optocoupler is connected to
-
-void setup() {
- // make the pin with the optocoupler an output
- pinMode(optoPin, OUTPUT);
-}
-
-void loop() {
- digitalWrite(optoPin, HIGH); // pull pin 2 HIGH, activating the optocoupler
-
- delay(15); // give the optocoupler a moment to activate
-
- digitalWrite(optoPin, LOW); // pull pin 2 low until you're ready to activate again
- delay(21000); // wait for 21 seconds
-}
diff --git a/build/shared/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino b/build/shared/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino
deleted file mode 100644
index 8caa58eab..000000000
--- a/build/shared/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino
+++ /dev/null
@@ -1,719 +0,0 @@
-// ArduinoISP
-// Copyright (c) 2008-2011 Randall Bohn
-// If you require a license, see
-// http://www.opensource.org/licenses/bsd-license.php
-//
-// This sketch turns the Arduino into a AVRISP using the following Arduino pins:
-//
-// Pin 10 is used to reset the target microcontroller.
-//
-// By default, the hardware SPI pins MISO, MOSI and SCK are used to communicate
-// with the target. On all Arduinos, these pins can be found
-// on the ICSP/SPI header:
-//
-// MISO °. . 5V (!) Avoid this pin on Due, Zero...
-// SCK . . MOSI
-// . . GND
-//
-// On some Arduinos (Uno,...), pins MOSI, MISO and SCK are the same pins as
-// digital pin 11, 12 and 13, respectively. That is why many tutorials instruct
-// you to hook up the target to these pins. If you find this wiring more
-// practical, have a define USE_OLD_STYLE_WIRING. This will work even when not
-// using an Uno. (On an Uno this is not needed).
-//
-// Alternatively you can use any other digital pin by configuring
-// software ('BitBanged') SPI and having appropriate defines for PIN_MOSI,
-// PIN_MISO and PIN_SCK.
-//
-// IMPORTANT: When using an Arduino that is not 5V tolerant (Due, Zero, ...) as
-// the programmer, make sure to not expose any of the programmer's pins to 5V.
-// A simple way to accomplish this is to power the complete system (programmer
-// and target) at 3V3.
-//
-// Put an LED (with resistor) on the following pins:
-// 9: Heartbeat - shows the programmer is running
-// 8: Error - Lights up if something goes wrong (use red if that makes sense)
-// 7: Programming - In communication with the slave
-//
-
-#include "Arduino.h"
-#undef SERIAL
-
-
-#define PROG_FLICKER true
-
-// Configure SPI clock (in Hz).
-// E.g. for an ATtiny @ 128 kHz: the datasheet states that both the high and low
-// SPI clock pulse must be > 2 CPU cycles, so take 3 cycles i.e. divide target
-// f_cpu by 6:
-// #define SPI_CLOCK (128000/6)
-//
-// A clock slow enough for an ATtiny85 @ 1 MHz, is a reasonable default:
-
-#define SPI_CLOCK (1000000/6)
-
-
-// Select hardware or software SPI, depending on SPI clock.
-// Currently only for AVR, for other architectures (Due, Zero,...), hardware SPI
-// is probably too fast anyway.
-
-#if defined(ARDUINO_ARCH_AVR)
-
-#if SPI_CLOCK > (F_CPU / 128)
-#define USE_HARDWARE_SPI
-#endif
-
-#endif
-
-// Configure which pins to use:
-
-// The standard pin configuration.
-#ifndef ARDUINO_HOODLOADER2
-
-#define RESET 10 // Use pin 10 to reset the target rather than SS
-#define LED_HB 9
-#define LED_ERR 8
-#define LED_PMODE 7
-
-// Uncomment following line to use the old Uno style wiring
-// (using pin 11, 12 and 13 instead of the SPI header) on Leonardo, Due...
-
-// #define USE_OLD_STYLE_WIRING
-
-#ifdef USE_OLD_STYLE_WIRING
-
-#define PIN_MOSI 11
-#define PIN_MISO 12
-#define PIN_SCK 13
-
-#endif
-
-// HOODLOADER2 means running sketches on the ATmega16U2 serial converter chips
-// on Uno or Mega boards. We must use pins that are broken out:
-#else
-
-#define RESET 4
-#define LED_HB 7
-#define LED_ERR 6
-#define LED_PMODE 5
-
-#endif
-
-// By default, use hardware SPI pins:
-#ifndef PIN_MOSI
-#define PIN_MOSI MOSI
-#endif
-
-#ifndef PIN_MISO
-#define PIN_MISO MISO
-#endif
-
-#ifndef PIN_SCK
-#define PIN_SCK SCK
-#endif
-
-// Force bitbanged SPI if not using the hardware SPI pins:
-#if (PIN_MISO != MISO) || (PIN_MOSI != MOSI) || (PIN_SCK != SCK)
-#undef USE_HARDWARE_SPI
-#endif
-
-
-// Configure the serial port to use.
-//
-// Prefer the USB virtual serial port (aka. native USB port), if the Arduino has one:
-// - it does not autoreset (except for the magic baud rate of 1200).
-// - it is more reliable because of USB handshaking.
-//
-// Leonardo and similar have an USB virtual serial port: 'Serial'.
-// Due and Zero have an USB virtual serial port: 'SerialUSB'.
-//
-// On the Due and Zero, 'Serial' can be used too, provided you disable autoreset.
-// To use 'Serial': #define SERIAL Serial
-
-#ifdef SERIAL_PORT_USBVIRTUAL
-#define SERIAL SERIAL_PORT_USBVIRTUAL
-#else
-#define SERIAL Serial
-#endif
-
-
-// Configure the baud rate:
-
-#define BAUDRATE 19200
-// #define BAUDRATE 115200
-// #define BAUDRATE 1000000
-
-
-#define HWVER 2
-#define SWMAJ 1
-#define SWMIN 18
-
-// STK Definitions
-#define STK_OK 0x10
-#define STK_FAILED 0x11
-#define STK_UNKNOWN 0x12
-#define STK_INSYNC 0x14
-#define STK_NOSYNC 0x15
-#define CRC_EOP 0x20 //ok it is a space...
-
-void pulse(int pin, int times);
-
-#ifdef USE_HARDWARE_SPI
-#include "SPI.h"
-#else
-
-#define SPI_MODE0 0x00
-
-class SPISettings {
- public:
- // clock is in Hz
- SPISettings(uint32_t clock, uint8_t bitOrder, uint8_t dataMode) : clock(clock) {
- (void) bitOrder;
- (void) dataMode;
- };
-
- private:
- uint32_t clock;
-
- friend class BitBangedSPI;
-};
-
-class BitBangedSPI {
- public:
- void begin() {
- digitalWrite(PIN_SCK, LOW);
- digitalWrite(PIN_MOSI, LOW);
- pinMode(PIN_SCK, OUTPUT);
- pinMode(PIN_MOSI, OUTPUT);
- pinMode(PIN_MISO, INPUT);
- }
-
- void beginTransaction(SPISettings settings) {
- pulseWidth = (500000 + settings.clock - 1) / settings.clock;
- if (pulseWidth == 0)
- pulseWidth = 1;
- }
-
- void end() {}
-
- uint8_t transfer (uint8_t b) {
- for (unsigned int i = 0; i < 8; ++i) {
- digitalWrite(PIN_MOSI, (b & 0x80) ? HIGH : LOW);
- digitalWrite(PIN_SCK, HIGH);
- delayMicroseconds(pulseWidth);
- b = (b << 1) | digitalRead(PIN_MISO);
- digitalWrite(PIN_SCK, LOW); // slow pulse
- delayMicroseconds(pulseWidth);
- }
- return b;
- }
-
- private:
- unsigned long pulseWidth; // in microseconds
-};
-
-static BitBangedSPI SPI;
-
-#endif
-
-void setup() {
- SERIAL.begin(BAUDRATE);
-
- pinMode(LED_PMODE, OUTPUT);
- pulse(LED_PMODE, 2);
- pinMode(LED_ERR, OUTPUT);
- pulse(LED_ERR, 2);
- pinMode(LED_HB, OUTPUT);
- pulse(LED_HB, 2);
-
-}
-
-int error = 0;
-int pmode = 0;
-// address for reading and writing, set by 'U' command
-unsigned int here;
-uint8_t buff[256]; // global block storage
-
-#define beget16(addr) (*addr * 256 + *(addr+1) )
-typedef struct param {
- uint8_t devicecode;
- uint8_t revision;
- uint8_t progtype;
- uint8_t parmode;
- uint8_t polling;
- uint8_t selftimed;
- uint8_t lockbytes;
- uint8_t fusebytes;
- uint8_t flashpoll;
- uint16_t eeprompoll;
- uint16_t pagesize;
- uint16_t eepromsize;
- uint32_t flashsize;
-}
-parameter;
-
-parameter param;
-
-// this provides a heartbeat on pin 9, so you can tell the software is running.
-uint8_t hbval = 128;
-int8_t hbdelta = 8;
-void heartbeat() {
- static unsigned long last_time = 0;
- unsigned long now = millis();
- if ((now - last_time) < 40)
- return;
- last_time = now;
- if (hbval > 192) hbdelta = -hbdelta;
- if (hbval < 32) hbdelta = -hbdelta;
- hbval += hbdelta;
- analogWrite(LED_HB, hbval);
-}
-
-static bool rst_active_high;
-
-void reset_target(bool reset) {
- digitalWrite(RESET, ((reset && rst_active_high) || (!reset && !rst_active_high)) ? HIGH : LOW);
-}
-
-void loop(void) {
- // is pmode active?
- if (pmode) {
- digitalWrite(LED_PMODE, HIGH);
- } else {
- digitalWrite(LED_PMODE, LOW);
- }
- // is there an error?
- if (error) {
- digitalWrite(LED_ERR, HIGH);
- } else {
- digitalWrite(LED_ERR, LOW);
- }
-
- // light the heartbeat LED
- heartbeat();
- if (SERIAL.available()) {
- avrisp();
- }
-}
-
-uint8_t getch() {
- while (!SERIAL.available());
- return SERIAL.read();
-}
-void fill(int n) {
- for (int x = 0; x < n; x++) {
- buff[x] = getch();
- }
-}
-
-#define PTIME 30
-void pulse(int pin, int times) {
- do {
- digitalWrite(pin, HIGH);
- delay(PTIME);
- digitalWrite(pin, LOW);
- delay(PTIME);
- } while (times--);
-}
-
-void prog_lamp(int state) {
- if (PROG_FLICKER) {
- digitalWrite(LED_PMODE, state);
- }
-}
-
-uint8_t spi_transaction(uint8_t a, uint8_t b, uint8_t c, uint8_t d) {
- SPI.transfer(a);
- SPI.transfer(b);
- SPI.transfer(c);
- return SPI.transfer(d);
-}
-
-void empty_reply() {
- if (CRC_EOP == getch()) {
- SERIAL.print((char)STK_INSYNC);
- SERIAL.print((char)STK_OK);
- } else {
- error++;
- SERIAL.print((char)STK_NOSYNC);
- }
-}
-
-void breply(uint8_t b) {
- if (CRC_EOP == getch()) {
- SERIAL.print((char)STK_INSYNC);
- SERIAL.print((char)b);
- SERIAL.print((char)STK_OK);
- } else {
- error++;
- SERIAL.print((char)STK_NOSYNC);
- }
-}
-
-void get_version(uint8_t c) {
- switch (c) {
- case 0x80:
- breply(HWVER);
- break;
- case 0x81:
- breply(SWMAJ);
- break;
- case 0x82:
- breply(SWMIN);
- break;
- case 0x93:
- breply('S'); // serial programmer
- break;
- default:
- breply(0);
- }
-}
-
-void set_parameters() {
- // call this after reading parameter packet into buff[]
- param.devicecode = buff[0];
- param.revision = buff[1];
- param.progtype = buff[2];
- param.parmode = buff[3];
- param.polling = buff[4];
- param.selftimed = buff[5];
- param.lockbytes = buff[6];
- param.fusebytes = buff[7];
- param.flashpoll = buff[8];
- // ignore buff[9] (= buff[8])
- // following are 16 bits (big endian)
- param.eeprompoll = beget16(&buff[10]);
- param.pagesize = beget16(&buff[12]);
- param.eepromsize = beget16(&buff[14]);
-
- // 32 bits flashsize (big endian)
- param.flashsize = buff[16] * 0x01000000
- + buff[17] * 0x00010000
- + buff[18] * 0x00000100
- + buff[19];
-
- // AVR devices have active low reset, AT89Sx are active high
- rst_active_high = (param.devicecode >= 0xe0);
-}
-
-void start_pmode() {
-
- // Reset target before driving PIN_SCK or PIN_MOSI
-
- // SPI.begin() will configure SS as output, so SPI master mode is selected.
- // We have defined RESET as pin 10, which for many Arduinos is not the SS pin.
- // So we have to configure RESET as output here,
- // (reset_target() first sets the correct level)
- reset_target(true);
- pinMode(RESET, OUTPUT);
- SPI.begin();
- SPI.beginTransaction(SPISettings(SPI_CLOCK, MSBFIRST, SPI_MODE0));
-
- // See AVR datasheets, chapter "SERIAL_PRG Programming Algorithm":
-
- // Pulse RESET after PIN_SCK is low:
- digitalWrite(PIN_SCK, LOW);
- delay(20); // discharge PIN_SCK, value arbitrarily chosen
- reset_target(false);
- // Pulse must be minimum 2 target CPU clock cycles so 100 usec is ok for CPU
- // speeds above 20 KHz
- delayMicroseconds(100);
- reset_target(true);
-
- // Send the enable programming command:
- delay(50); // datasheet: must be > 20 msec
- spi_transaction(0xAC, 0x53, 0x00, 0x00);
- pmode = 1;
-}
-
-void end_pmode() {
- SPI.end();
- // We're about to take the target out of reset so configure SPI pins as input
- pinMode(PIN_MOSI, INPUT);
- pinMode(PIN_SCK, INPUT);
- reset_target(false);
- pinMode(RESET, INPUT);
- pmode = 0;
-}
-
-void universal() {
- uint8_t ch;
-
- fill(4);
- ch = spi_transaction(buff[0], buff[1], buff[2], buff[3]);
- breply(ch);
-}
-
-void flash(uint8_t hilo, unsigned int addr, uint8_t data) {
- spi_transaction(0x40 + 8 * hilo,
- addr >> 8 & 0xFF,
- addr & 0xFF,
- data);
-}
-void commit(unsigned int addr) {
- if (PROG_FLICKER) {
- prog_lamp(LOW);
- }
- spi_transaction(0x4C, (addr >> 8) & 0xFF, addr & 0xFF, 0);
- if (PROG_FLICKER) {
- delay(PTIME);
- prog_lamp(HIGH);
- }
-}
-
-unsigned int current_page() {
- if (param.pagesize == 32) {
- return here & 0xFFFFFFF0;
- }
- if (param.pagesize == 64) {
- return here & 0xFFFFFFE0;
- }
- if (param.pagesize == 128) {
- return here & 0xFFFFFFC0;
- }
- if (param.pagesize == 256) {
- return here & 0xFFFFFF80;
- }
- return here;
-}
-
-
-void write_flash(int length) {
- fill(length);
- if (CRC_EOP == getch()) {
- SERIAL.print((char) STK_INSYNC);
- SERIAL.print((char) write_flash_pages(length));
- } else {
- error++;
- SERIAL.print((char) STK_NOSYNC);
- }
-}
-
-uint8_t write_flash_pages(int length) {
- int x = 0;
- unsigned int page = current_page();
- while (x < length) {
- if (page != current_page()) {
- commit(page);
- page = current_page();
- }
- flash(LOW, here, buff[x++]);
- flash(HIGH, here, buff[x++]);
- here++;
- }
-
- commit(page);
-
- return STK_OK;
-}
-
-#define EECHUNK (32)
-uint8_t write_eeprom(unsigned int length) {
- // here is a word address, get the byte address
- unsigned int start = here * 2;
- unsigned int remaining = length;
- if (length > param.eepromsize) {
- error++;
- return STK_FAILED;
- }
- while (remaining > EECHUNK) {
- write_eeprom_chunk(start, EECHUNK);
- start += EECHUNK;
- remaining -= EECHUNK;
- }
- write_eeprom_chunk(start, remaining);
- return STK_OK;
-}
-// write (length) bytes, (start) is a byte address
-uint8_t write_eeprom_chunk(unsigned int start, unsigned int length) {
- // this writes byte-by-byte, page writing may be faster (4 bytes at a time)
- fill(length);
- prog_lamp(LOW);
- for (unsigned int x = 0; x < length; x++) {
- unsigned int addr = start + x;
- spi_transaction(0xC0, (addr >> 8) & 0xFF, addr & 0xFF, buff[x]);
- delay(45);
- }
- prog_lamp(HIGH);
- return STK_OK;
-}
-
-void program_page() {
- char result = (char) STK_FAILED;
- unsigned int length = 256 * getch();
- length += getch();
- char memtype = getch();
- // flash memory @here, (length) bytes
- if (memtype == 'F') {
- write_flash(length);
- return;
- }
- if (memtype == 'E') {
- result = (char)write_eeprom(length);
- if (CRC_EOP == getch()) {
- SERIAL.print((char) STK_INSYNC);
- SERIAL.print(result);
- } else {
- error++;
- SERIAL.print((char) STK_NOSYNC);
- }
- return;
- }
- SERIAL.print((char)STK_FAILED);
- return;
-}
-
-uint8_t flash_read(uint8_t hilo, unsigned int addr) {
- return spi_transaction(0x20 + hilo * 8,
- (addr >> 8) & 0xFF,
- addr & 0xFF,
- 0);
-}
-
-char flash_read_page(int length) {
- for (int x = 0; x < length; x += 2) {
- uint8_t low = flash_read(LOW, here);
- SERIAL.print((char) low);
- uint8_t high = flash_read(HIGH, here);
- SERIAL.print((char) high);
- here++;
- }
- return STK_OK;
-}
-
-char eeprom_read_page(int length) {
- // here again we have a word address
- int start = here * 2;
- for (int x = 0; x < length; x++) {
- int addr = start + x;
- uint8_t ee = spi_transaction(0xA0, (addr >> 8) & 0xFF, addr & 0xFF, 0xFF);
- SERIAL.print((char) ee);
- }
- return STK_OK;
-}
-
-void read_page() {
- char result = (char)STK_FAILED;
- int length = 256 * getch();
- length += getch();
- char memtype = getch();
- if (CRC_EOP != getch()) {
- error++;
- SERIAL.print((char) STK_NOSYNC);
- return;
- }
- SERIAL.print((char) STK_INSYNC);
- if (memtype == 'F') result = flash_read_page(length);
- if (memtype == 'E') result = eeprom_read_page(length);
- SERIAL.print(result);
-}
-
-void read_signature() {
- if (CRC_EOP != getch()) {
- error++;
- SERIAL.print((char) STK_NOSYNC);
- return;
- }
- SERIAL.print((char) STK_INSYNC);
- uint8_t high = spi_transaction(0x30, 0x00, 0x00, 0x00);
- SERIAL.print((char) high);
- uint8_t middle = spi_transaction(0x30, 0x00, 0x01, 0x00);
- SERIAL.print((char) middle);
- uint8_t low = spi_transaction(0x30, 0x00, 0x02, 0x00);
- SERIAL.print((char) low);
- SERIAL.print((char) STK_OK);
-}
-//////////////////////////////////////////
-//////////////////////////////////////////
-
-
-////////////////////////////////////
-////////////////////////////////////
-void avrisp() {
- uint8_t ch = getch();
- switch (ch) {
- case '0': // signon
- error = 0;
- empty_reply();
- break;
- case '1':
- if (getch() == CRC_EOP) {
- SERIAL.print((char) STK_INSYNC);
- SERIAL.print("AVR ISP");
- SERIAL.print((char) STK_OK);
- }
- else {
- error++;
- SERIAL.print((char) STK_NOSYNC);
- }
- break;
- case 'A':
- get_version(getch());
- break;
- case 'B':
- fill(20);
- set_parameters();
- empty_reply();
- break;
- case 'E': // extended parameters - ignore for now
- fill(5);
- empty_reply();
- break;
- case 'P':
- if (!pmode)
- start_pmode();
- empty_reply();
- break;
- case 'U': // set address (word)
- here = getch();
- here += 256 * getch();
- empty_reply();
- break;
-
- case 0x60: //STK_PROG_FLASH
- getch(); // low addr
- getch(); // high addr
- empty_reply();
- break;
- case 0x61: //STK_PROG_DATA
- getch(); // data
- empty_reply();
- break;
-
- case 0x64: //STK_PROG_PAGE
- program_page();
- break;
-
- case 0x74: //STK_READ_PAGE 't'
- read_page();
- break;
-
- case 'V': //0x56
- universal();
- break;
- case 'Q': //0x51
- error = 0;
- end_pmode();
- empty_reply();
- break;
-
- case 0x75: //STK_READ_SIGN 'u'
- read_signature();
- break;
-
- // expecting a command, not CRC_EOP
- // this is how we can get back in sync
- case CRC_EOP:
- error++;
- SERIAL.print((char) STK_NOSYNC);
- break;
-
- // anything else we will return STK_UNKNOWN
- default:
- error++;
- if (CRC_EOP == getch())
- SERIAL.print((char)STK_UNKNOWN);
- else
- SERIAL.print((char)STK_NOSYNC);
- }
-}
diff --git a/build/shared/examples/README.md b/build/shared/examples/README.md
new file mode 100644
index 000000000..6197c437a
--- /dev/null
+++ b/build/shared/examples/README.md
@@ -0,0 +1,6 @@
+### Built-in examples have been moved
+
+Originally, the main Arduino repository contained the built-in examples in this
+directory. Since then, these have been moved to:
+
+https://github.com/arduino/arduino-examples
diff --git a/build/shared/examples_formatter.conf b/build/shared/examples_formatter.conf
deleted file mode 100644
index e006d1f2f..000000000
--- a/build/shared/examples_formatter.conf
+++ /dev/null
@@ -1,45 +0,0 @@
-# This configuration file contains a selection of the available options provided by the formatting tool "Artistic Style"
-# http://astyle.sourceforge.net/astyle.html
-#
-# If you wish to change them, don't edit this file.
-# Instead, copy it in the same folder of file "preferences.txt" and modify the copy. This way, you won't lose your custom formatter settings when upgrading the IDE
-# If you don't know where file preferences.txt is stored, open the IDE, File -> Preferences and you'll find a link
-
-mode=c
-
-# 2 spaces indentation
-indent=spaces=2
-
-# also indent macros
-indent-preprocessor
-
-# indent classes, switches (and cases), comments starting at column 1
-indent-classes
-indent-switches
-indent-cases
-indent-col1-comments
-
-# put a space around operators
-pad-oper
-
-# put a space after if/for/while
-pad-header
-
-# if you like one-liners, keep them
-keep-one-line-statements
-
-style=java
-attach-namespaces
-attach-classes
-attach-inlines
-attach-extern-c
-indent-modifiers
-indent-namespaces
-indent-labels
-indent-preproc-block
-indent-preproc-define
-indent-preproc-cond
-unpad-paren
-add-brackets
-remove-comment-prefix
-
diff --git a/build/shared/examples_formatter.sh b/build/shared/examples_formatter.sh
deleted file mode 100755
index 01e0fe5b3..000000000
--- a/build/shared/examples_formatter.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-# you need to have astyle installed before running this
-find examples -name '*.ino' -exec astyle --options=examples_formatter.conf {} \;