From b21b43c591ef5b7bfdc5294d89482b7cccdc2b1a Mon Sep 17 00:00:00 2001 From: Tom Igoe Date: Tue, 30 Aug 2011 17:02:55 -0400 Subject: [PATCH] deleted .pde examples --- .../AnalogReadSerial/AnalogReadSerial.pde | 15 -- .../DigitalReadSerial/DigitalReadSerial.pde | 19 -- .../examples/2.Digital/Button/Button.pde | 56 ----- .../examples/2.Digital/Debounce/Debounce.pde | 75 ------- .../StateChangeDetection.pde | 92 -------- .../2.Digital/toneKeyboard/toneKeyboard.pde | 45 ---- .../2.Digital/toneMelody/toneMelody.pde | 49 ---- .../tonePitchFollower/tonePitchFollower.pde | 46 ---- .../AnalogInOutSerial/AnalogInOutSerial.pde | 53 ----- .../3.Analog/AnalogInput/AnalogInput.pde | 50 ----- .../3.Analog/Calibration/Calibration.pde | 75 ------- .../examples/3.Analog/Fading/Fading.pde | 45 ---- .../examples/3.Analog/Smoothing/Smoothing.pde | 66 ------ .../4.Communication/ASCIITable/ASCIITable.pde | 76 ------- .../4.Communication/Dimmer/Dimmer.pde | 112 ---------- .../examples/4.Communication/Graph/Graph.pde | 149 ------------- .../examples/4.Communication/MIDI/Midi.pde | 49 ---- .../PhysicalPixel/PhysicalPixel.pde | 170 -------------- .../SerialCallResponse/SerialCallResponse.pde | 211 ------------------ .../SerialCallResponseASCII.pde | 211 ------------------ .../VirtualColorMixer/VirtualColorMixer.pde | 130 ----------- .../examples/5.Control/Arrays/Arrays.pde | 57 ----- .../ForLoopIteration/ForLoopIteration.pde | 47 ---- .../IfStatementConditional.pde | 56 ----- .../WhileStatementConditional.pde | 88 -------- .../5.Control/switchCase/switchCase.pde | 62 ----- .../examples/6.Sensors/ADXL3xx/ADXL3xx.pde | 64 ------ .../shared/examples/6.Sensors/Knock/Knock.pde | 55 ----- .../6.Sensors/Memsic2125/Memsic2125.pde | 63 ------ build/shared/examples/6.Sensors/Ping/Ping.pde | 84 ------- .../RowColumnScanning/RowColumnScanning.pde | 114 ---------- .../StringAdditionOperator.pde | 61 ----- .../StringAppendOperator.pde | 64 ------ .../StringComparisonOperators.pde | 124 ---------- .../StringConstructors/StringConstructors.pde | 64 ------ .../StringStartsWithEndsWith.pde | 49 ---- 36 files changed, 2846 deletions(-) delete mode 100644 build/shared/examples/1.Basics/AnalogReadSerial/AnalogReadSerial.pde delete mode 100644 build/shared/examples/1.Basics/DigitalReadSerial/DigitalReadSerial.pde delete mode 100644 build/shared/examples/2.Digital/Button/Button.pde delete mode 100644 build/shared/examples/2.Digital/Debounce/Debounce.pde delete mode 100644 build/shared/examples/2.Digital/StateChangeDetection/StateChangeDetection.pde delete mode 100644 build/shared/examples/2.Digital/toneKeyboard/toneKeyboard.pde delete mode 100644 build/shared/examples/2.Digital/toneMelody/toneMelody.pde delete mode 100644 build/shared/examples/2.Digital/tonePitchFollower/tonePitchFollower.pde delete mode 100644 build/shared/examples/3.Analog/AnalogInOutSerial/AnalogInOutSerial.pde delete mode 100644 build/shared/examples/3.Analog/AnalogInput/AnalogInput.pde delete mode 100644 build/shared/examples/3.Analog/Calibration/Calibration.pde delete mode 100644 build/shared/examples/3.Analog/Fading/Fading.pde delete mode 100644 build/shared/examples/3.Analog/Smoothing/Smoothing.pde delete mode 100644 build/shared/examples/4.Communication/ASCIITable/ASCIITable.pde delete mode 100644 build/shared/examples/4.Communication/Dimmer/Dimmer.pde delete mode 100644 build/shared/examples/4.Communication/Graph/Graph.pde delete mode 100644 build/shared/examples/4.Communication/MIDI/Midi.pde delete mode 100644 build/shared/examples/4.Communication/PhysicalPixel/PhysicalPixel.pde delete mode 100644 build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde delete mode 100644 build/shared/examples/4.Communication/SerialCallResponseASCII/SerialCallResponseASCII.pde delete mode 100644 build/shared/examples/4.Communication/VirtualColorMixer/VirtualColorMixer.pde delete mode 100644 build/shared/examples/5.Control/Arrays/Arrays.pde delete mode 100644 build/shared/examples/5.Control/ForLoopIteration/ForLoopIteration.pde delete mode 100644 build/shared/examples/5.Control/IfStatementConditional/IfStatementConditional.pde delete mode 100644 build/shared/examples/5.Control/WhileStatementConditional/WhileStatementConditional.pde delete mode 100644 build/shared/examples/5.Control/switchCase/switchCase.pde delete mode 100644 build/shared/examples/6.Sensors/ADXL3xx/ADXL3xx.pde delete mode 100644 build/shared/examples/6.Sensors/Knock/Knock.pde delete mode 100644 build/shared/examples/6.Sensors/Memsic2125/Memsic2125.pde delete mode 100644 build/shared/examples/6.Sensors/Ping/Ping.pde delete mode 100644 build/shared/examples/7.Display/RowColumnScanning/RowColumnScanning.pde delete mode 100644 build/shared/examples/8.Strings/StringAdditionOperator/StringAdditionOperator.pde delete mode 100644 build/shared/examples/8.Strings/StringAppendOperator/StringAppendOperator.pde delete mode 100644 build/shared/examples/8.Strings/StringComparisonOperators/StringComparisonOperators.pde delete mode 100644 build/shared/examples/8.Strings/StringConstructors/StringConstructors.pde delete mode 100644 build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde diff --git a/build/shared/examples/1.Basics/AnalogReadSerial/AnalogReadSerial.pde b/build/shared/examples/1.Basics/AnalogReadSerial/AnalogReadSerial.pde deleted file mode 100644 index 97243f325..000000000 --- a/build/shared/examples/1.Basics/AnalogReadSerial/AnalogReadSerial.pde +++ /dev/null @@ -1,15 +0,0 @@ -/* - AnalogReadSerial - Reads an analog input on pin 0, prints the result to the serial monitor - - This example code is in the public domain. - */ - -void setup() { - Serial.begin(9600); -} - -void loop() { - int sensorValue = analogRead(A0); - Serial.println(sensorValue, DEC); -} diff --git a/build/shared/examples/1.Basics/DigitalReadSerial/DigitalReadSerial.pde b/build/shared/examples/1.Basics/DigitalReadSerial/DigitalReadSerial.pde deleted file mode 100644 index 7651a8fae..000000000 --- a/build/shared/examples/1.Basics/DigitalReadSerial/DigitalReadSerial.pde +++ /dev/null @@ -1,19 +0,0 @@ -/* - DigitalReadSerial - Reads a digital input on pin 2, prints the result to the serial monitor - - This example code is in the public domain. - */ - -void setup() { - Serial.begin(9600); - pinMode(2, INPUT); -} - -void loop() { - int sensorValue = digitalRead(2); - Serial.println(sensorValue, DEC); -} - - - diff --git a/build/shared/examples/2.Digital/Button/Button.pde b/build/shared/examples/2.Digital/Button/Button.pde deleted file mode 100644 index a56ea14eb..000000000 --- a/build/shared/examples/2.Digital/Button/Button.pde +++ /dev/null @@ -1,56 +0,0 @@ -/* - Button - - Turns on and off a light emitting diode(LED) connected to digital - pin 13, when pressing a pushbutton attached to pin 2. - - - The circuit: - * LED attached from pin 13 to ground - * pushbutton attached to pin 2 from +5V - * 10K resistor attached to pin 2 from ground - - * Note: on most Arduinos there is already an LED on the board - attached to pin 13. - - - created 2005 - by DojoDave - modified 28 Oct 2010 - by Tom Igoe - - This example code is in the public domain. - - http://www.arduino.cc/en/Tutorial/Button - */ - -// constants won't change. They're used here to -// set pin numbers: -const int buttonPin = 2; // the number of the pushbutton pin -const int ledPin = 13; // the number of the LED pin - -// variables will change: -int buttonState = 0; // variable for reading the pushbutton status - -void setup() { - // initialize the LED pin as an output: - pinMode(ledPin, OUTPUT); - // initialize the pushbutton pin as an input: - pinMode(buttonPin, INPUT); -} - -void loop(){ - // read the state of the pushbutton value: - buttonState = digitalRead(buttonPin); - - // check if the pushbutton is pressed. - // if it is, the buttonState is HIGH: - if (buttonState == HIGH) { - // turn LED on: - digitalWrite(ledPin, HIGH); - } - else { - // turn LED off: - digitalWrite(ledPin, LOW); - } -} \ No newline at end of file diff --git a/build/shared/examples/2.Digital/Debounce/Debounce.pde b/build/shared/examples/2.Digital/Debounce/Debounce.pde deleted file mode 100644 index 6f184eccc..000000000 --- a/build/shared/examples/2.Digital/Debounce/Debounce.pde +++ /dev/null @@ -1,75 +0,0 @@ -/* - Debounce - - Each time the input pin goes from LOW to HIGH (e.g. because of a push-button - press), the output pin is toggled from LOW to HIGH or HIGH to LOW. There's - a minimum delay between toggles to debounce the circuit (i.e. to ignore - noise). - - The circuit: - * LED attached from pin 13 to ground - * pushbutton attached from pin 2 to +5V - * 10K resistor attached from pin 2 to ground - - * Note: On most Arduino boards, there is already an LED on the board - connected to pin 13, so you don't need any extra components for this example. - - - created 21 November 2006 - by David A. Mellis - modified 3 Jul 2009 - by Limor Fried - -This example code is in the public domain. - - http://www.arduino.cc/en/Tutorial/Debounce - */ - -// constants won't change. They're used here to -// set pin numbers: -const int buttonPin = 2; // the number of the pushbutton pin -const int ledPin = 13; // the number of the LED pin - -// Variables will change: -int ledState = HIGH; // the current state of the output pin -int buttonState; // the current reading from the input pin -int lastButtonState = LOW; // the previous reading from the input pin - -// the following variables are long's because the time, measured in miliseconds, -// will quickly become a bigger number than can be stored in an int. -long lastDebounceTime = 0; // the last time the output pin was toggled -long debounceDelay = 50; // the debounce time; increase if the output flickers - -void setup() { - pinMode(buttonPin, INPUT); - pinMode(ledPin, OUTPUT); -} - -void loop() { - // read the state of the switch into a local variable: - int reading = digitalRead(buttonPin); - - // check to see if you just pressed the button - // (i.e. the input went from LOW to HIGH), and you've waited - // long enough since the last press to ignore any noise: - - // If the switch changed, due to noise or pressing: - if (reading != lastButtonState) { - // reset the debouncing timer - lastDebounceTime = millis(); - } - - if ((millis() - lastDebounceTime) > debounceDelay) { - // whatever the reading is at, it's been there for longer - // than the debounce delay, so take it as the actual current state: - buttonState = reading; - } - - // set the LED using the state of the button: - digitalWrite(ledPin, buttonState); - - // save the reading. Next time through the loop, - // it'll be the lastButtonState: - lastButtonState = reading; -} - diff --git a/build/shared/examples/2.Digital/StateChangeDetection/StateChangeDetection.pde b/build/shared/examples/2.Digital/StateChangeDetection/StateChangeDetection.pde deleted file mode 100644 index 33f997c6b..000000000 --- a/build/shared/examples/2.Digital/StateChangeDetection/StateChangeDetection.pde +++ /dev/null @@ -1,92 +0,0 @@ -/* - State change detection (edge detection) - - Often, you don't need to know the state of a digital input all the time, - but you just need to know when the input changes from one state to another. - For example, you want to know when a button goes from OFF to ON. This is called - state change detection, or edge detection. - - This example shows how to detect when a button or button changes from off to on - and on to off. - - The circuit: - * pushbutton attached to pin 2 from +5V - * 10K resistor attached to pin 2 from ground - * LED attached from pin 13 to ground (or use the built-in LED on - most Arduino boards) - - created 27 Sep 2005 - modified 14 Oct 2010 - by Tom Igoe - -This example code is in the public domain. - - http://arduino.cc/en/Tutorial/ButtonStateChange - - */ - -// this constant won't change: -const int buttonPin = 2; // the pin that the pushbutton is attached to -const int ledPin = 13; // the pin that the LED is attached to - -// Variables will change: -int buttonPushCounter = 0; // counter for the number of button presses -int buttonState = 0; // current state of the button -int lastButtonState = 0; // previous state of the button - -void setup() { - // initialize the button pin as a input: - pinMode(buttonPin, INPUT); - // initialize the LED as an output: - pinMode(ledPin, OUTPUT); - // initialize serial communication: - Serial.begin(9600); -} - - -void loop() { - // read the pushbutton input pin: - buttonState = digitalRead(buttonPin); - - // compare the buttonState to its previous state - if (buttonState != lastButtonState) { - // if the state has changed, increment the counter - if (buttonState == HIGH) { - // if the current state is HIGH then the button - // wend from off to on: - buttonPushCounter++; - Serial.println("on"); - Serial.print("number of button pushes: "); - Serial.println(buttonPushCounter, DEC); - } - else { - // if the current state is LOW then the button - // wend from on to off: - Serial.println("off"); - } - } - // save the current state as the last state, - //for next time through the loop - lastButtonState = buttonState; - - - // turns on the LED every four button pushes by - // checking the modulo of the button push counter. - // the modulo function gives you the remainder of - // the division of two numbers: - if (buttonPushCounter % 4 == 0) { - digitalWrite(ledPin, HIGH); - } else { - digitalWrite(ledPin, LOW); - } - -} - - - - - - - - - diff --git a/build/shared/examples/2.Digital/toneKeyboard/toneKeyboard.pde b/build/shared/examples/2.Digital/toneKeyboard/toneKeyboard.pde deleted file mode 100644 index b1a5364a7..000000000 --- a/build/shared/examples/2.Digital/toneKeyboard/toneKeyboard.pde +++ /dev/null @@ -1,45 +0,0 @@ -/* - keyboard - - Plays a pitch that changes based on a changing analog input - - circuit: - * 3 force-sensing resistors from +5V to analog in 0 through 5 - * 3 10K resistors from analog in 0 through 5 to ground - * 8-ohm speaker on digital pin 8 - - created 21 Jan 2010 - Modified 4 Sep 2010 - by Tom Igoe - -This example code is in the public domain. - - http://arduino.cc/en/Tutorial/Tone3 - - */ - -#include "pitches.h" - -const int threshold = 10; // minimum reading of the sensors that generates a note - -// notes to play, corresponding to the 3 sensors: -int notes[] = { - NOTE_A4, NOTE_B4,NOTE_C3 }; - -void setup() { - -} - -void loop() { - for (int thisSensor = 0; thisSensor < 3; thisSensor++) { - // get a sensor reading: - int sensorReading = analogRead(thisSensor); - - // if the sensor is pressed hard enough: - if (sensorReading > threshold) { - // play the note corresponding to this sensor: - tone(8, notes[thisSensor], 20); - } - } - Serial.println(); -} diff --git a/build/shared/examples/2.Digital/toneMelody/toneMelody.pde b/build/shared/examples/2.Digital/toneMelody/toneMelody.pde deleted file mode 100644 index debcebd6b..000000000 --- a/build/shared/examples/2.Digital/toneMelody/toneMelody.pde +++ /dev/null @@ -1,49 +0,0 @@ -/* - Melody - - Plays a melody - - circuit: - * 8-ohm speaker on digital pin 8 - - created 21 Jan 2010 - modified 14 Oct 2010 - by Tom Igoe - -This example code is in the public domain. - - http://arduino.cc/en/Tutorial/Tone - - */ - #include "pitches.h" - -// notes in the melody: -int melody[] = { - NOTE_C4, NOTE_G3,NOTE_G3, NOTE_A3, NOTE_G3,0, NOTE_B3, NOTE_C4}; - -// note durations: 4 = quarter note, 8 = eighth note, etc.: -int noteDurations[] = { - 4, 8, 8, 4,4,4,4,4 }; - -void setup() { - // iterate over the notes of the melody: - for (int thisNote = 0; thisNote < 8; thisNote++) { - - // to calculate the note duration, take one second - // divided by the note type. - //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc. - int noteDuration = 1000/noteDurations[thisNote]; - tone(8, melody[thisNote],noteDuration); - - // to distinguish the notes, set a minimum time between them. - // the note's duration + 30% seems to work well: - int pauseBetweenNotes = noteDuration * 1.30; - delay(pauseBetweenNotes); - // stop the tone playing: - noTone(8); - } -} - -void loop() { - // no need to repeat the melody. -} diff --git a/build/shared/examples/2.Digital/tonePitchFollower/tonePitchFollower.pde b/build/shared/examples/2.Digital/tonePitchFollower/tonePitchFollower.pde deleted file mode 100644 index bcc4b6327..000000000 --- a/build/shared/examples/2.Digital/tonePitchFollower/tonePitchFollower.pde +++ /dev/null @@ -1,46 +0,0 @@ -/* - Pitch follower - - Plays a pitch that changes based on a changing analog input - - circuit: - * 8-ohm speaker on digital pin 8 - * photoresistor on analog 0 to 5V - * 4.7K resistor on analog 0 to ground - - created 21 Jan 2010 - Modified 4 Sep 2010 - by Tom Igoe - -This example code is in the public domain. - - http://arduino.cc/en/Tutorial/Tone2 - - */ - - -void setup() { - // initialize serial communications (for debugging only): - Serial.begin(9600); -} - -void loop() { - // read the sensor: - int sensorReading = analogRead(A0); - // print the sensor reading so you know its range - Serial.println(sensorReading); - // map the pitch to the range of the analog input. - // change the minimum and maximum input numbers below - // depending on the range your sensor's giving: - int thisPitch = map(sensorReading, 400, 1000, 100, 1000); - - // play the pitch: - tone(9, thisPitch, 10); - -} - - - - - - diff --git a/build/shared/examples/3.Analog/AnalogInOutSerial/AnalogInOutSerial.pde b/build/shared/examples/3.Analog/AnalogInOutSerial/AnalogInOutSerial.pde deleted file mode 100644 index 57c14219d..000000000 --- a/build/shared/examples/3.Analog/AnalogInOutSerial/AnalogInOutSerial.pde +++ /dev/null @@ -1,53 +0,0 @@ -/* - Analog input, analog output, serial output - - Reads an analog input pin, maps the result to a range from 0 to 255 - and uses the result to set the pulsewidth modulation (PWM) of an output pin. - Also prints the results to the serial monitor. - - The circuit: - * potentiometer connected to analog pin 0. - Center pin of the potentiometer goes to the analog pin. - side pins of the potentiometer go to +5V and ground - * LED connected from digital pin 9 to ground - - created 29 Dec. 2008 - Modified 4 Sep 2010 - by Tom Igoe - - This example code is in the public domain. - - */ - -// These constants won't change. They're used to give names -// to the pins used: -const int analogInPin = A0; // Analog input pin that the potentiometer is attached to -const int analogOutPin = 9; // Analog output pin that the LED is attached to - -int sensorValue = 0; // value read from the pot -int outputValue = 0; // value output to the PWM (analog out) - -void setup() { - // initialize serial communications at 9600 bps: - Serial.begin(9600); -} - -void loop() { - // read the analog in value: - sensorValue = analogRead(analogInPin); - // map it to the range of the analog out: - outputValue = map(sensorValue, 0, 1023, 0, 255); - // change the analog out value: - analogWrite(analogOutPin, outputValue); - - // print the results to the serial monitor: - Serial.print("sensor = " ); - Serial.print(sensorValue); - Serial.print("\t output = "); - Serial.println(outputValue); - - // wait 10 milliseconds before the next loop - // for the analog-to-digital converter to settle - // after the last reading: - delay(10); -} diff --git a/build/shared/examples/3.Analog/AnalogInput/AnalogInput.pde b/build/shared/examples/3.Analog/AnalogInput/AnalogInput.pde deleted file mode 100644 index 18a005524..000000000 --- a/build/shared/examples/3.Analog/AnalogInput/AnalogInput.pde +++ /dev/null @@ -1,50 +0,0 @@ -/* - Analog Input - Demonstrates analog input by reading an analog sensor on analog pin 0 and - turning on and off a light emitting diode(LED) connected to digital pin 13. - The amount of time the LED will be on and off depends on - the value obtained by analogRead(). - - The circuit: - * Potentiometer attached to analog input 0 - * center pin of the potentiometer to the analog pin - * one side pin (either one) to ground - * the other side pin to +5V - * LED anode (long leg) attached to digital output 13 - * LED cathode (short leg) attached to ground - - * Note: because most Arduinos have a built-in LED attached - to pin 13 on the board, the LED is optional. - - - Created by David Cuartielles - Modified 4 Sep 2010 - By Tom Igoe - - This example code is in the public domain. - - http://arduino.cc/en/Tutorial/AnalogInput - - */ - -int sensorPin = A0; // select the input pin for the potentiometer -int ledPin = 13; // select the pin for the LED -int sensorValue = 0; // variable to store the value coming from the sensor - -void setup() { - // declare the ledPin as an OUTPUT: - pinMode(ledPin, OUTPUT); -} - -void loop() { - // read the value from the sensor: - sensorValue = analogRead(sensorPin); - // turn the ledPin on - digitalWrite(ledPin, HIGH); - // stop the program for milliseconds: - delay(sensorValue); - // turn the ledPin off: - digitalWrite(ledPin, LOW); - // stop the program for for milliseconds: - delay(sensorValue); -} \ No newline at end of file diff --git a/build/shared/examples/3.Analog/Calibration/Calibration.pde b/build/shared/examples/3.Analog/Calibration/Calibration.pde deleted file mode 100644 index c5734df4e..000000000 --- a/build/shared/examples/3.Analog/Calibration/Calibration.pde +++ /dev/null @@ -1,75 +0,0 @@ -/* - Calibration - - Demonstrates one technique for calibrating sensor input. The - sensor readings during the first five seconds of the sketch - execution define the minimum and maximum of expected values - attached to the sensor pin. - - The sensor minimum and maximum initial values may seem backwards. - Initially, you set the minimum high and listen for anything - lower, saving it as the new minimum. Likewise, you set the - maximum low and listen for anything higher as the new maximum. - - The circuit: - * Analog sensor (potentiometer will do) attached to analog input 0 - * LED attached from digital pin 9 to ground - - created 29 Oct 2008 - By David A Mellis - Modified 4 Sep 2010 - By Tom Igoe - - http://arduino.cc/en/Tutorial/Calibration - - This example code is in the public domain. - - */ - -// These constants won't change: -const int sensorPin = A0; // pin that the sensor is attached to -const int ledPin = 9; // pin that the LED is attached to - -// variables: -int sensorValue = 0; // the sensor value -int sensorMin = 1023; // minimum sensor value -int sensorMax = 0; // maximum sensor value - - -void setup() { - // turn on LED to signal the start of the calibration period: - pinMode(13, OUTPUT); - digitalWrite(13, HIGH); - - // calibrate during the first five seconds - while (millis() < 5000) { - sensorValue = analogRead(sensorPin); - - // record the maximum sensor value - if (sensorValue > sensorMax) { - sensorMax = sensorValue; - } - - // record the minimum sensor value - if (sensorValue < sensorMin) { - sensorMin = sensorValue; - } - } - - // signal the end of the calibration period - digitalWrite(13, LOW); -} - -void loop() { - // read the sensor: - sensorValue = analogRead(sensorPin); - - // apply the calibration to the sensor reading - sensorValue = map(sensorValue, sensorMin, sensorMax, 0, 255); - - // in case the sensor value is outside the range seen during calibration - sensorValue = constrain(sensorValue, 0, 255); - - // fade the LED using the calibrated value: - analogWrite(ledPin, sensorValue); -} diff --git a/build/shared/examples/3.Analog/Fading/Fading.pde b/build/shared/examples/3.Analog/Fading/Fading.pde deleted file mode 100644 index 46959ad26..000000000 --- a/build/shared/examples/3.Analog/Fading/Fading.pde +++ /dev/null @@ -1,45 +0,0 @@ -/* - Fading - - This example shows how to fade an LED using the analogWrite() function. - - The circuit: - * LED attached from digital pin 9 to ground. - - Created 1 Nov 2008 - By David A. Mellis - Modified 17 June 2009 - By Tom Igoe - - http://arduino.cc/en/Tutorial/Fading - - This example code is in the public domain. - - */ - - -int ledPin = 9; // LED connected to digital pin 9 - -void setup() { - // nothing happens in setup -} - -void loop() { - // fade in from min to max in increments of 5 points: - for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { - // sets the value (range from 0 to 255): - analogWrite(ledPin, fadeValue); - // wait for 30 milliseconds to see the dimming effect - delay(30); - } - - // fade out from max to min in increments of 5 points: - for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { - // sets the value (range from 0 to 255): - analogWrite(ledPin, fadeValue); - // wait for 30 milliseconds to see the dimming effect - delay(30); - } -} - - diff --git a/build/shared/examples/3.Analog/Smoothing/Smoothing.pde b/build/shared/examples/3.Analog/Smoothing/Smoothing.pde deleted file mode 100644 index 5de30e8d7..000000000 --- a/build/shared/examples/3.Analog/Smoothing/Smoothing.pde +++ /dev/null @@ -1,66 +0,0 @@ -/* - - Smoothing - - Reads repeatedly from an analog input, calculating a running average - and printing it to the computer. Keeps ten readings in an array and - continually averages them. - - The circuit: - * Analog sensor (potentiometer will do) attached to analog input 0 - - Created 22 April 2007 - By David A. Mellis - - http://www.arduino.cc/en/Tutorial/Smoothing - - This example code is in the public domain. - - -*/ - - -// Define the number of samples to keep track of. The higher the number, -// the more the readings will be smoothed, but the slower the output will -// respond to the input. Using a constant rather than a normal variable lets -// use this value to determine the size of the readings array. -const int numReadings = 10; - -int readings[numReadings]; // the readings from the analog input -int index = 0; // the index of the current reading -int total = 0; // the running total -int average = 0; // the average - -int inputPin = A0; - -void setup() -{ - // initialize serial communication with computer: - Serial.begin(9600); - // initialize all the readings to 0: - for (int thisReading = 0; thisReading < numReadings; thisReading++) - readings[thisReading] = 0; -} - -void loop() { - // subtract the last reading: - total= total - readings[index]; - // read from the sensor: - readings[index] = analogRead(inputPin); - // add the reading to the total: - total= total + readings[index]; - // advance to the next position in the array: - index = index + 1; - - // if we're at the end of the array... - if (index >= numReadings) - // ...wrap around to the beginning: - index = 0; - - // calculate the average: - average = total / numReadings; - // send it to the computer (as ASCII digits) - Serial.println(average, DEC); -} - - diff --git a/build/shared/examples/4.Communication/ASCIITable/ASCIITable.pde b/build/shared/examples/4.Communication/ASCIITable/ASCIITable.pde deleted file mode 100644 index c92b0d023..000000000 --- a/build/shared/examples/4.Communication/ASCIITable/ASCIITable.pde +++ /dev/null @@ -1,76 +0,0 @@ -/* - ASCII table - - Prints out byte values in all possible formats: - * as raw binary values - * as ASCII-encoded decimal, hex, octal, and binary values - - For more on ASCII, see http://www.asciitable.com and http://en.wikipedia.org/wiki/ASCII - - The circuit: No external hardware needed. - - created 2006 - by Nicholas Zambetti - modified 18 Jan 2009 - by Tom Igoe - - This example code is in the public domain. - - - - */ -void setup() -{ - Serial.begin(9600); - - // prints title with ending line break - Serial.println("ASCII Table ~ Character Map"); -} - -// first visible ASCIIcharacter '!' is number 33: -int thisByte = 33; -// you can also write ASCII characters in single quotes. -// for example. '!' is the same as 33, so you could also use this: -//int thisByte = '!'; - -void loop() -{ - // prints value unaltered, i.e. the raw binary version of the - // byte. The serial monitor interprets all bytes as - // ASCII, so 33, the first number, will show up as '!' - Serial.write(thisByte); - - Serial.print(", dec: "); - // prints value as string as an ASCII-encoded decimal (base 10). - // Decimal is the default format for Serial.print() and Serial.println(), - // so no modifier is needed: - Serial.print(thisByte); - // But you can declare the modifier for decimal if you want to. - //this also works if you uncomment it: - - // Serial.print(thisByte, DEC); - - - Serial.print(", hex: "); - // prints value as string in hexadecimal (base 16): - Serial.print(thisByte, HEX); - - Serial.print(", oct: "); - // prints value as string in octal (base 8); - Serial.print(thisByte, OCT); - - Serial.print(", bin: "); - // prints value as string in binary (base 2) - // also prints ending line break: - Serial.println(thisByte, BIN); - - // if printed last visible character '~' or 126, stop: - if(thisByte == 126) { // you could also use if (thisByte == '~') { - // This loop loops forever and does nothing - while(true) { - continue; - } - } - // go on to the next character - thisByte++; -} diff --git a/build/shared/examples/4.Communication/Dimmer/Dimmer.pde b/build/shared/examples/4.Communication/Dimmer/Dimmer.pde deleted file mode 100644 index 2985ddaee..000000000 --- a/build/shared/examples/4.Communication/Dimmer/Dimmer.pde +++ /dev/null @@ -1,112 +0,0 @@ -/* - Dimmer - - Demonstrates the sending data from the computer to the Arduino board, - in this case to control the brightness of an LED. The data is sent - in individual bytes, each of which ranges from 0 to 255. Arduino - reads these bytes and uses them to set the brightness of the LED. - - The circuit: - LED attached from digital pin 9 to ground. - Serial connection to Processing, Max/MSP, or another serial application - - created 2006 - by David A. Mellis - modified 14 Apr 2009 - by Tom Igoe and Scott Fitzgerald - - This example code is in the public domain. - - http://www.arduino.cc/en/Tutorial/Dimmer - - */ - -const int ledPin = 9; // the pin that the LED is attached to - -void setup() -{ - // initialize the serial communication: - Serial.begin(9600); - // initialize the ledPin as an output: - pinMode(ledPin, OUTPUT); -} - -void loop() { - byte brightness; - - // check if data has been sent from the computer: - if (Serial.available()) { - // read the most recent byte (which will be from 0 to 255): - brightness = Serial.read(); - // set the brightness of the LED: - analogWrite(ledPin, brightness); - } -} - -/* Processing code for this example - // Dimmer - sends bytes over a serial port - // by David A. Mellis - //This example code is in the public domain. - - import processing.serial.*; - Serial port; - - void setup() { - size(256, 150); - - println("Available serial ports:"); - println(Serial.list()); - - // Uses the first port in this list (number 0). Change this to - // select the 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. - port = 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() { - // draw a gradient from black to white - for (int i = 0; i < 256; i++) { - stroke(i); - line(i, 0, i, 150); - } - - // write the current X-position of the mouse to the serial port as - // a single byte - port.write(mouseX); - } - */ - -/* Max/MSP v5 patch for this example - -----------begin_max5_patcher---------- -1008.3ocuXszaiaCD9r8uhA5rqAeHIa0aAMaAV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8qHc -cxmfxVihWz6a3yqY9NazzUYkua9UnynadOtogW.JfsVGRVNEbWF8I+eHtcwJ -+wLXqZeSdWLo+FQF6731Tva0BISKTx.cLwmgJsUTTvkg1YsnXmxDge.CDR7x -D6YmX6fMznaF7kdczmJXwm.XSOOrdoHhNA7GMiZYLZZR.+4lconMaJP6JOZ8 -ftCs1YWHZI3o.sIXezX5ihMSuXzZtk3ai1mXRSczoCS32hAydeyXNEu5SHyS -xqZqbd3ZLdera1iPqYxOm++v7SUSz ------------end_max5_patcher----------- - */ diff --git a/build/shared/examples/4.Communication/Graph/Graph.pde b/build/shared/examples/4.Communication/Graph/Graph.pde deleted file mode 100644 index 03e868b9b..000000000 --- a/build/shared/examples/4.Communication/Graph/Graph.pde +++ /dev/null @@ -1,149 +0,0 @@ -/* - Graph - - A simple example of communication from the Arduino board to the computer: - the value of analog input 0 is sent out the serial port. We call this "serial" - communication because the connection appears to both the Arduino and the - computer as a serial port, even though it may actually use - a USB cable. Bytes are sent one after another (serially) from the Arduino - to the computer. - - You can use the Arduino serial monitor to view the sent data, or it can - be read by Processing, PD, Max/MSP, or any other program capable of reading - data from a serial port. The Processing code below graphs the data received - so you can see the value of the analog input changing over time. - - The circuit: - Any analog input sensor is attached to analog in pin 0. - - created 2006 - by David A. Mellis - modified 14 Apr 2009 - by Tom Igoe and Scott Fitzgerald - - This example code is in the public domain. - - http://www.arduino.cc/en/Tutorial/Graph - */ - -void setup() { - // initialize the serial communication: - Serial.begin(9600); -} - -void loop() { - // send the value of analog input 0: - Serial.println(analogRead(A0)); - // wait a bit for the analog-to-digital converter - // to stabilize after the last reading: - delay(10); -} - -/* Processing code for this example - - // Graphing sketch - - - // This program takes ASCII-encoded strings - // from the serial port at 9600 baud and graphs them. It expects values in the - // range 0 to 1023, followed by a newline, or newline and carriage return - - // Created 20 Apr 2005 - // Updated 18 Jan 2008 - // by Tom Igoe - // This example code is in the public domain. - - import processing.serial.*; - - Serial myPort; // The serial port - int xPos = 1; // horizontal position of the graph - - void setup () { - // set the window size: - size(400, 300); - - // List all the available serial ports - println(Serial.list()); - // I know that the first port in the serial list on my mac - // is always my Arduino, so I open Serial.list()[0]. - // Open whatever port is the one you're using. - myPort = new Serial(this, Serial.list()[0], 9600); - // don't generate a serialEvent() unless you get a newline character: - myPort.bufferUntil('\n'); - // set inital background: - background(0); - } - void draw () { - // everything happens in the serialEvent() - } - - void serialEvent (Serial myPort) { - // get the ASCII string: - String inString = myPort.readStringUntil('\n'); - - if (inString != null) { - // trim off any whitespace: - inString = trim(inString); - // convert to an int and map to the screen height: - float inByte = float(inString); - inByte = map(inByte, 0, 1023, 0, height); - - // draw the line: - stroke(127,34,255); - line(xPos, height, xPos, height - inByte); - - // at the edge of the screen, go back to the beginning: - if (xPos >= width) { - xPos = 0; - background(0); - } - else { - // increment the horizontal position: - xPos++; - } - } - } - - */ - -/* Max/MSP v5 patch for this example - ----------begin_max5_patcher---------- -1591.3oc0YszbaaCD9r7uBL5RalQUAO3CvdyS5zVenWZxs5NcfHgjPCIfJIT -RTxj+6AOHkoTDooroUs0AQPR73a+1cwtK3WtZxzEpOwqlB9YveAlL4KWMYh6 -Q1GLo99ISKXeJMmU451zTUQAWpmNy+NM+SZ2y+sR1l02JuU9t0hJvFlNcMPy -dOuBv.U5Rgb0LPpRpYBooM3529latArTUVvzZdFPtsXAuDrrTU.f.sBffXxL -vGE50lIHkUVJXq3fRtdaoDvjYfbgjujaFJSCzq4.tLaN.bi1tJefWpqbO0uz -1IjIABoluxrJ1guxh2JfPO2B5zRNyBCLDFcqbwNvuv9fHCb8bvevyyEU2JKT -YhkBSWPAfq2TZ6YhqmuMUo0feUn+rYpY4YtY+cFw3lUJdCMYAapZqzwUHX8S -crjAd+SIOU6UBAwIygy.Q1+HAA1KH6EveWOFQlitUK92ehfal9kFhUxJ3tWc -sgpxadigWExbt1o7Ps5dk3yttivyg20W0VcSmg1G90qtx92rAZbH4ez.ruy1 -nhmaDPidE07J+5n2sg6E6oKXxUSmc20o6E3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 -tboIkatIA7c1cTKD1u.honLYV04VkluHsXe0szv9pQCE9Ro3jaVB1o15pz2X -zYoBvO5KXCAe0LCYJybE8ZODf4fV8t9qW0zYxq.YJfTosj1bv0xc.SaC0+AV -9V9L.KKyV3SyTcRtmzi6rO.O16USvts4B5xe9EymDvebK0eMfW6+NIsNlE2m -eqRyJ0utRq13+RjmqYKN1e.4d61jjdsauXe3.2p6jgi9hsNIv97CoyJ01xzl -c3ZhUCtSHx3UZgjoEJYqNY+hYs5zZQVFW19L3JDYaTlMLqAAt1G2yXlnFg9a -53L1FJVcv.cOX0dh7mCVGCLce7GFcQwDdH5Ta3nyAS0pQbHxegr+tGIZORgM -RnMj5vGl1Fs16drnk7Tf1XOLgv1n0d2iEsCxR.eQsNOZ4FGF7whofgfI3kES -1kCeOX5L2rifbdu0A9ae2X.V33B1Z+.Bj1FrP5iFrCYCG5EUWSG.hhunHJd. -HJ5hhnng3h9HPj4lud02.1bxGw. ------------end_max5_patcher----------- - - */ diff --git a/build/shared/examples/4.Communication/MIDI/Midi.pde b/build/shared/examples/4.Communication/MIDI/Midi.pde deleted file mode 100644 index cdeaeea11..000000000 --- a/build/shared/examples/4.Communication/MIDI/Midi.pde +++ /dev/null @@ -1,49 +0,0 @@ -/* - MIDI note player - - This sketch shows how to use the serial transmit pin (pin 1) to send MIDI note data. - If this circuit is connected to a MIDI synth, it will play - the notes F#-0 (0x1E) to F#-5 (0x5A) in sequence. - - - The circuit: - * digital in 1 connected to MIDI jack pin 5 - * MIDI jack pin 2 connected to ground - * MIDI jack pin 4 connected to +5V through 220-ohm resistor - Attach a MIDI cable to the jack, then to a MIDI synth, and play music. - - created 13 Jun 2006 - modified 2 Jul 2009 - by Tom Igoe - - This example code is in the public domain. - - http://www.arduino.cc/en/Tutorial/MIDI - - */ - -void setup() { - // Set MIDI baud rate: - Serial.begin(31250); -} - -void loop() { - // play notes from F#-0 (0x1E) to F#-5 (0x5A): - for (int note = 0x1E; note < 0x5A; note ++) { - //Note on channel 1 (0x90), some note value (note), middle velocity (0x45): - noteOn(0x90, note, 0x45); - delay(100); - //Note on channel 1 (0x90), some note value (note), silent velocity (0x00): - noteOn(0x90, note, 0x00); - delay(100); - } -} - -// plays a MIDI note. Doesn't check to see that -// cmd is greater than 127, or that data values are less than 127: -void noteOn(int cmd, int pitch, int velocity) { - Serial.write(cmd); - Serial.write(pitch); - Serial.write(velocity); -} - diff --git a/build/shared/examples/4.Communication/PhysicalPixel/PhysicalPixel.pde b/build/shared/examples/4.Communication/PhysicalPixel/PhysicalPixel.pde deleted file mode 100644 index 8c1f780d3..000000000 --- a/build/shared/examples/4.Communication/PhysicalPixel/PhysicalPixel.pde +++ /dev/null @@ -1,170 +0,0 @@ -/* - Physical Pixel - - An example of using the Arduino board to receive data from the - computer. In this case, the Arduino boards turns on an LED when - it receives the character 'H', and turns off the LED when it - receives the character 'L'. - - The data can be sent from the Arduino serial monitor, or another - program like Processing (see code below), Flash (via a serial-net - proxy), PD, or Max/MSP. - - The circuit: - * LED connected from digital pin 13 to ground - - created 2006 - by David A. Mellis - modified 14 Apr 2009 - by Tom Igoe and Scott Fitzgerald - - This example code is in the public domain. - - http://www.arduino.cc/en/Tutorial/PhysicalPixel - */ - -const int ledPin = 13; // the pin that the LED is attached to -int incomingByte; // a variable to read incoming serial data into - -void setup() { - // initialize serial communication: - Serial.begin(9600); - // initialize the LED pin as an output: - pinMode(ledPin, OUTPUT); -} - -void loop() { - // see if there's incoming serial data: - if (Serial.available() > 0) { - // read the oldest byte in the serial buffer: - incomingByte = Serial.read(); - // if it's a capital H (ASCII 72), turn on the LED: - if (incomingByte == 'H') { - digitalWrite(ledPin, HIGH); - } - // if it's an L (ASCII 76) turn off the LED: - if (incomingByte == 'L') { - digitalWrite(ledPin, LOW); - } - } -} - -/* Processing code for this example - - // mouseover serial - - // Demonstrates how to send data to the Arduino I/O board, in order to - // turn ON a light if the mouse is over a square and turn it off - // if the mouse is not. - - // created 2003-4 - // based on examples by Casey Reas and Hernando Barragan - // modified 18 Jan 2009 - // by Tom Igoe - // This example code is in the public domain. - - - - import processing.serial.*; - - float boxX; - float boxY; - int boxSize = 20; - boolean mouseOverBox = false; - - Serial port; - - void setup() { - size(200, 200); - boxX = width/2.0; - boxY = height/2.0; - rectMode(RADIUS); - - // List all the available serial ports in the output pane. - // You will need to choose the port that the Arduino board is - // connected to from this list. The first port in the list is - // port #0 and the third port in the list is port #2. - println(Serial.list()); - - // Open the port that the Arduino board is connected to (in this case #0) - // Make sure to open the port at the same speed Arduino is using (9600bps) - port = new Serial(this, Serial.list()[0], 9600); - - } - - void draw() - { - background(0); - - // Test if the cursor is over the box - if (mouseX > boxX-boxSize && mouseX < boxX+boxSize && - mouseY > boxY-boxSize && mouseY < boxY+boxSize) { - mouseOverBox = true; - // draw a line around the box and change its color: - stroke(255); - fill(153); - // send an 'H' to indicate mouse is over square: - port.write('H'); - } - else { - // return the box to it's inactive state: - stroke(153); - fill(153); - // send an 'L' to turn the LED off: - port.write('L'); - mouseOverBox = false; - } - - // Draw the box - rect(boxX, boxY, boxSize, boxSize); - } - - - */ - -/* -Max/MSP version 5 patch to run with this example: - -----------begin_max5_patcher---------- -1672.3oc2ZszaaiCD9ryuBBebQVCQRYao8xhf1cQCPVfBzh8RRQ.sDsM2HSZ -HQmlzh9eu7gjsjsEk7y0oWjiHoHm4aluYHGlueUmtiDuPy5B9Cv8fNc99Uc5 -XZR2Pm726zcF4knDRlYXciDylQ4xtWa6SReQZZ+iSeMiEQR.ej8BM4A9C7OO -kkAlSjQSAYTdbFfvA27o2c6sfO.Doqd6NfXgDHmRUCKkolg4hT06BfbQJGH3 -5Qd2e8d.QJIQSow5tzebZ7BFW.FIHow8.2JAQpVIIYByxo9KIMkSjL9D0BRT -sbGHZJIkDoZOSMuQT.8YZ5qpgGI3locF4IpQRzq2nDF+odZMIJkRjpEF44M3 -A9nWAum7LKFbSOv+PSRXYOvmIhYiYpg.8A2LOUOxPyH+TjPJA+MS9sIzTRRr -QP9rXF31IBZA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ynYYjIzMvjOTKf -3DLvnvRLDLpWeEOYXMfAZqfQ0.qsnlUdmA33t8CNJ7MZEb.u7fiZHLYzDkJp -R7CqEVLGN75U+1JXxFUY.xEEBcRCqhOEkz2bENEWnh4pbh0wY25EefbD6EmW -UA6Ip8wFLyuFXx+Wrp8m6iff1B86W7bqJO9+mx8er4E3.abCLrYdA16sBuHx -vKT6BlpIGQIhL55W7oicf3ayv3ixQCm4aQuY1HZUPQWY+cASx2WZ3f1fICuz -vj5R5ZbM1y8gXYN4dIXaYGq4NhQvS5MmcDADy+S.j8CQ78vk7Q7gtPDX3kFh -3NGaAsYBUAO.8N1U4WKycxbQdrWxJdXd10gNIO+hkUMmm.CZwknu7JbNUYUq -0sOsTsI1QudDtjw0t+xZ85wWZd80tMCiiMADNX4UzrcSeK23su87IANqmA7j -tiRzoXi2YRh67ldAk79gPmTe3YKuoY0qdEDV3X8xylCJMTN45JIakB7uY8XW -uVr3PO8wWwEoTW8lsfraX7ZqzZDDXCRqNkztHsGCYpIDDAOqxDpMVUMKcOrp -942acPvx2NPocMC1wQZ8glRn3myTykVaEUNLoEeJjVaAevA4EAZnsNgkeyO+ -3rEZB7f0DTazDcQTNmdt8aACGi1QOWnMmd+.6YjMHH19OB5gKsMF877x8wsJ -hN97JSnSfLUXGUoj6ujWXd6Pk1SAC+Pkogm.tZ.1lX1qL.pe6PE11DPeMMZ2 -.P0K+3peBt3NskC ------------end_max5_patcher----------- - - - */ diff --git a/build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde b/build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde deleted file mode 100644 index 3a6e01300..000000000 --- a/build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde +++ /dev/null @@ -1,211 +0,0 @@ -/* - Serial Call and Response - Language: Wiring/Arduino - - This program sends an ASCII A (byte of value 65) on startup - and repeats that until it gets some data in. - Then it waits for a byte in the serial port, and - sends three sensor values whenever it gets a byte in. - - Thanks to Greg Shakar and Scott Fitzgerald for the improvements - - The circuit: - * potentiometers attached to analog inputs 0 and 1 - * pushbutton attached to digital I/O 2 - - Created 26 Sept. 2005 - by Tom Igoe - Modified 4 Sep 2010 - by Tom Igoe and Scott Fitzgerald - - This example code is in the public domain. - - http://www.arduino.cc/en/Tutorial/SerialCallResponse - - */ - -int firstSensor = 0; // first analog sensor -int secondSensor = 0; // second analog sensor -int thirdSensor = 0; // digital sensor -int inByte = 0; // incoming serial byte - -void setup() -{ - // start serial port at 9600 bps: - Serial.begin(9600); - pinMode(2, INPUT); // digital sensor is on digital pin 2 - establishContact(); // send a byte to establish contact until receiver responds -} - -void loop() -{ - // if we get a valid byte, read analog ins: - if (Serial.available() > 0) { - // get incoming byte: - inByte = Serial.read(); - // read first analog input, divide by 4 to make the range 0-255: - firstSensor = analogRead(A0)/4; - // delay 10ms to let the ADC recover: - delay(10); - // read second analog input, divide by 4 to make the range 0-255: - secondSensor = analogRead(1)/4; - // read switch, map it to 0 or 255L - thirdSensor = map(digitalRead(2), 0, 1, 0, 255); - // send sensor values: - Serial.write(firstSensor); - Serial.write(secondSensor); - Serial.write(thirdSensor); - } -} - -void establishContact() { - while (Serial.available() <= 0) { - Serial.print('A'); // send a capital A - delay(300); - } -} - -/* -Processing sketch to run with this example: - -// This example code is in the public domain. - -import processing.serial.*; - -int bgcolor; // Background color -int fgcolor; // Fill color -Serial myPort; // The serial port -int[] serialInArray = new int[3]; // Where we'll put what we receive -int serialCount = 0; // A count of how many bytes we receive -int xpos, ypos; // Starting position of the ball -boolean firstContact = false; // Whether we've heard from the microcontroller - -void setup() { - size(256, 256); // Stage size - noStroke(); // No border on the next thing drawn - - // Set the starting position of the ball (middle of the stage) - xpos = width/2; - ypos = height/2; - - // Print a list of the serial ports, for debugging purposes: - println(Serial.list()); - - // I know that the first port in the serial list on my mac - // is always my FTDI adaptor, so I open Serial.list()[0]. - // On Windows machines, this generally opens COM1. - // Open whatever port is the one you're using. - String portName = Serial.list()[0]; - myPort = new Serial(this, portName, 9600); -} - -void draw() { - background(bgcolor); - fill(fgcolor); - // Draw the shape - ellipse(xpos, ypos, 20, 20); -} - -void serialEvent(Serial myPort) { - // read a byte from the serial port: - int inByte = myPort.read(); - // if this is the first byte received, and it's an A, - // clear the serial buffer and note that you've - // had first contact from the microcontroller. - // Otherwise, add the incoming byte to the array: - if (firstContact == false) { - if (inByte == 'A') { - myPort.clear(); // clear the serial port buffer - firstContact = true; // you've had first contact from the microcontroller - myPort.write('A'); // ask for more - } - } - else { - // Add the latest byte from the serial port to array: - serialInArray[serialCount] = inByte; - serialCount++; - - // If we have 3 bytes: - if (serialCount > 2 ) { - xpos = serialInArray[0]; - ypos = serialInArray[1]; - fgcolor = serialInArray[2]; - - // print the values (for debugging purposes only): - println(xpos + "\t" + ypos + "\t" + fgcolor); - - // Send a capital A to request new sensor readings: - myPort.write('A'); - // Reset serialCount: - serialCount = 0; - } - } -} -*/ - -/* -Max/MSP version 5 patch to run with this example: - -----------begin_max5_patcher---------- -2569.3oc2as0jiZqD9YO+Jzw09PRc75BIAX671TaUop8gy4gLoNmG1YqsjAY -rxhAGPLW1T4+dZIAd.aCFeiEuYqXFABQqu9qa0Rp0ec2fgyiegmND8KnOgFL -3utav.8sT2XPd4ACWwdwKjkpq1vU7zTV.e3Hyyj7Wj5665Tbq3LYHWJecM2z -tCGh9b9iVyjdKEQAeIg6IMOkRmM1ZDx10UcgRF6LBgmN1Zy6H70se77+38yJ -9DKhijQrU5Ovv6SDrvhmDksRDAedsvRJU8Tw2zUGSfuyl5ZjUckwpa922cm5 -mQsDLh3OCx0NXQJODgqENlyhBFNpkvBchFVzfCwZ+vh60DVHm.r3EuZEORtC -t7.WISnOvBCe+uwSWGGkxQnGidL5AdjeJhgl+pjifuNRtjiRMUecbhbDhE4i -R3LnVTcsRQhnwHzCfXhVDmvChyfZ3EGFmLB8x53Tyq7J7Wn3EPS6IR7B4nrT -.n0M+SrvLnYR3xrjHtOZQR7ps+tiMh2+MVx+EzuuTjhz5JDzSy.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I2xwvRn6jfnU.Dbea550AH5SYF6TONl1k3H13lPDbu67XVmYyG -pX1DvA3Aolut5joTx1Isov5yWzJCIgXMoQim9lsyYtvcDhwzHOPNRwu6kUf+ -9rvc+4JtLI9sjcrlAUaQ2rXfTmlTwXxMi6.8Yr3z7FjuBlFRuYY7q0a.8lY4 -L0F7LzLWKqyZ0sx4KTrloLswU6EeUOHeWx02323L+Buhhn0YRz7rEKTmm4m3 -IuBFXnUhPv6I2KNxO8nO8iTy4IKeo.sZ5vOhuYNwnlAXTGna0gztokIwrj.X -WCLfabXDbmECl9qWMO8Lvw16+cNnry9dWIsNpYKuUl.kpzNa2892p6czPsUj -bnsPlbONQhByHUkxwTr5B0d5lRmov51BYcVmBeTbKDIpS2JSUxFwZjIxrtWl -tzTehEUwrbLqlH1rP5UKkmgyDplCpKctFLSZQOYKqpCawfmYRR+7oXYuoz4h -6VsQZmzstbZCWvw9z74XN+h1NlSrdkRTmxnqtTW37zoas9IsxgNoakIRakIb -24QpshDoyDI21.Szt0w8V1g0jNmS6TYBa2VGHGAcpXHByvG1jYaJ0INIrNM2 -cj7kmjtozYJsaoJuLCuctHXaFDaqHw5GbPqN0klNltCF3WG65uMy4gP6dYhb -H9T2RmZ07HNRmD4tzv4KbOAuozkHpxCQzvc7LLZiSBR25jffuBy5IWORw5KE -CagO+YWiuFKOA0VOzDY5zRRqtz4Jszqgz5ZjVWqxRqpTWXei6VWyXx0d4nfB -+8c+C81VE7B ------------end_max5_patcher----------- - - -*/ diff --git a/build/shared/examples/4.Communication/SerialCallResponseASCII/SerialCallResponseASCII.pde b/build/shared/examples/4.Communication/SerialCallResponseASCII/SerialCallResponseASCII.pde deleted file mode 100644 index 76a6ffe2b..000000000 --- a/build/shared/examples/4.Communication/SerialCallResponseASCII/SerialCallResponseASCII.pde +++ /dev/null @@ -1,211 +0,0 @@ -/* - Serial Call and Response in ASCII - Language: Wiring/Arduino - - This program sends an ASCII A (byte of value 65) on startup - and repeats that until it gets some data in. - Then it waits for a byte in the serial port, and - sends three ASCII-encoded, comma-separated sensor values, - truncated by a linefeed and carriage return, - whenever it gets a byte in. - - Thanks to Greg Shakar and Scott Fitzgerald for the improvements - - The circuit: - * potentiometers attached to analog inputs 0 and 1 - * pushbutton attached to digital I/O 2 - - - - Created 26 Sept. 2005 - by Tom Igoe - Modified 4 Sep 2010 - by Tom Igoe and Scott Fitzgerald - - This example code is in the public domain. - - http://www.arduino.cc/en/Tutorial/SerialCallResponseASCII - - */ - -int firstSensor = 0; // first analog sensor -int secondSensor = 0; // second analog sensor -int thirdSensor = 0; // digital sensor -int inByte = 0; // incoming serial byte - -void setup() -{ - // start serial port at 9600 bps: - Serial.begin(9600); - pinMode(2, INPUT); // digital sensor is on digital pin 2 - establishContact(); // send a byte to establish contact until receiver responds -} - -void loop() -{ - // if we get a valid byte, read analog ins: - if (Serial.available() > 0) { - // get incoming byte: - inByte = Serial.read(); - // read first analog input, divide by 4 to make the range 0-255: - firstSensor = analogRead(A0)/4; - // delay 10ms to let the ADC recover: - delay(10); - // read second analog input, divide by 4 to make the range 0-255: - secondSensor = analogRead(1)/4; - // read switch, map it to 0 or 255L - thirdSensor = map(digitalRead(2), 0, 1, 0, 255); - // send sensor values: - Serial.print(firstSensor, DEC); - Serial.print(","); - Serial.print(secondSensor, DEC); - Serial.print(","); - Serial.println(thirdSensor, DEC); - } -} - -void establishContact() { - while (Serial.available() <= 0) { - Serial.println("0,0,0"); // send an initial string - delay(300); - } -} - - -/* -Processing code to run with this example: - -// This example code is in the public domain. - -import processing.serial.*; // import the Processing serial library -Serial myPort; // The serial port - -float bgcolor; // Background color -float fgcolor; // Fill color -float xpos, ypos; // Starting position of the ball - -void setup() { - size(640,480); - - // List all the available serial ports - println(Serial.list()); - - // I know that the first port in the serial list on my mac - // is always my Arduino module, so I open Serial.list()[0]. - // Change the 0 to the appropriate number of the serial port - // that your microcontroller is attached to. - myPort = new Serial(this, Serial.list()[0], 9600); - - // read bytes into a buffer until you get a linefeed (ASCII 10): - myPort.bufferUntil('\n'); - - // draw with smooth edges: - smooth(); -} - -void draw() { - background(bgcolor); - fill(fgcolor); - // Draw the shape - ellipse(xpos, ypos, 20, 20); -} - -// serialEvent method is run automatically by the Processing applet -// whenever the buffer reaches the byte value set in the bufferUntil() -// method in the setup(): - -void serialEvent(Serial myPort) { - // read the serial buffer: - String myString = myPort.readStringUntil('\n'); - // if you got any bytes other than the linefeed: - myString = trim(myString); - - // split the string at the commas - // and convert the sections into integers: - int sensors[] = int(split(myString, ',')); - - // print out the values you got: - for (int sensorNum = 0; sensorNum < sensors.length; sensorNum++) { - print("Sensor " + sensorNum + ": " + sensors[sensorNum] + "\t"); - } - // add a linefeed after all the sensor values are printed: - println(); - if (sensors.length > 1) { - xpos = map(sensors[0], 0,1023,0,width); - ypos = map(sensors[1], 0,1023,0,height); - fgcolor = sensors[2]; - } - // send a byte to ask for more data: - myPort.write("A"); - } - -*/ - -/* - -Max/MSP version 5 patch to run with this example: - -----------begin_max5_patcher---------- -2726.3oc2bkziaiiE9bU+J3XjCciwo.WzZeqPCL.4vLG5zXlCIAAzRz1bhrj -aI5pRkF8+89QRIWR1VxxqQNoPrL0B0G+dK7QxG8ed+cilj8UQwHzuf9.5t69 -y6u6Nyozm3txx2MZA+qQI7BysMJU7b1j++nw1KoDeUYN8z7rEEurXRVR0kxV -oRDJ0KKE1pezHzmJuzRtJZtLc1myEQJ6UodtOfGibCLG7czeRwOfW+LxXy6A -d2u0u5ULMKUkxWXdAidLWxW+xixRxxs0LQWU3GBBwjPO82vkeiTq1SWsPlBv -0zFI0p9B42LUOgBUy56011r2r9j+082q+X7owgRUFuU1Slp5EA5oAJxwqKBL -3BSfruSD32RPyxyVsrcUvw8TMjEZOzEK5reVrAqPODVgd9XkBQBz9PDLhvZk -YlvSmoYmpicyRXK8fMpF9tcwRD7ARSGj0G6HnoEhhB9LwV7jm6w45h4Z7V4D -XXCF8AWvzHX2rQ3kTmgbV0YPj8przKZw03Ph0oCIugloTT1hEBvi6l7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ZX.Z62ROhqRqmpGH793oVOzCtyKDWKALak7Burjm6YeqXg6wdqoe6wFZoSFW -aHFcERIavsQrZMSpSjfF1bQtIcoiRxJDatIR5vKbYRDxvk63nN23QTualzKu -Aony+zCfSJG5AsLap1Cm3Oz3j11wdFUiibS6YsbJ0RXakWjMHDxPaTpsQHl8 -WE+HYDmvZ5HNjtXDxfaeL1lYyu1vrYlPY1EcEJ8dxnlsSQmQyVeeRPw9cZ7L -zrcNw4qh53X2gZVNfV84N0JHeelup+XgPkms24moGMypNR6dGMSuYbGX1ZAG -m2fxXtrJ81cuaqdCX2LyhmwfmiB8v3SaRcr5KLlwrHnyI4jbQ2Bamyg0+aBd -bkWQY5xUJzjUSmp2IuOIxeQ+KHvBYB38TDkkFWbn66uxrxpz+IA2019ibyrW -Iscvn2Jy5smbWyNfusKUe61ZgzY2HjqVLXl2dyzSyRGatrukjxVK2qd3WutZ -+srTuzF47v1Ky6tWh2sDQGDlb1ClXWUHwZjEBsQSgWeZBuOLcc4IWbOvDAeU -wjeOfDy8vfD02QuVvdjx.OBVW5DAaPO.q+Uk9b5AhBtpHhzGkLmCTfZEgtzP -yZ7aEulRmCvROyfsDdkKGUsRmJXo8w7045JsI8ASW2dnHrK.Ow7Cr5dtlCtr -0kNUzFdIPqqAsLLqFZMkN0t0HWBzBiARiOpWczpKcpAFzGeQazjt3Aqf6QvJ -jvgmUL6.CLnxFobZ.sxXSoSEs8oSO2lz7EOzJVewzAvfNXS+cN1ILrrSPSoq -BC5bXLXkcqcIJcbbVW5DQqWe52iccsX5i31fa50aDGz9hoqmYAs27DdfYp5d -cwjaeMHOB2G1ewWc7Br4NX8RL6OpBk2ooz0nKW2q6fjb6yfLcYGZPKFGbNj5 -Lnoz4X1LN2gXUMHX2xYa1lC.MJwpRWPqabh6o63tGMjvgmsu2Q1KsMHVO15R -mHXCGdC2yI3BXIcpxz9DLiyoLIHPg+59+Fv1JXFJ ------------end_max5_patcher----------- -*/ diff --git a/build/shared/examples/4.Communication/VirtualColorMixer/VirtualColorMixer.pde b/build/shared/examples/4.Communication/VirtualColorMixer/VirtualColorMixer.pde deleted file mode 100644 index e931262a9..000000000 --- a/build/shared/examples/4.Communication/VirtualColorMixer/VirtualColorMixer.pde +++ /dev/null @@ -1,130 +0,0 @@ -/* - This example reads three analog sensors (potentiometers are easiest) - and sends their values serially. The Processing and Max/MSP programs at the bottom - take those three values and use them to change the background color of the screen. - - The circuit: - * potentiometers attached to analog inputs 0, 1, and 2 - - http://www.arduino.cc/en/Tutorial/VirtualColorMixer - - created 2 Dec 2006 - by David A. Mellis - modified 4 Sep 2010 - by Tom Igoe and Scott Fitzgerald - - This example code is in the public domain. - */ - -const int redPin = A0; // sensor to control red color -const int greenPin = A1; // sensor to control green color -const int bluePin = A2; // sensor to control blue color - -void setup() -{ - Serial.begin(9600); -} - -void loop() -{ - Serial.print(analogRead(redPin)); - Serial.print(","); - Serial.print(analogRead(greenPin)); - Serial.print(","); - Serial.println(analogRead(bluePin)); -} - -/* Processing code for this example - -// This example code is in the public domain. - - import processing.serial.*; - - float redValue = 0; // red value - float greenValue = 0; // green value - float blueValue = 0; // blue value - - Serial myPort; - - void setup() { - size(200, 200); - - // List all the available serial ports - println(Serial.list()); - // I know that the first port in the serial list on my mac - // is always my Arduino, so I open Serial.list()[0]. - // Open whatever port is the one you're using. - myPort = new Serial(this, Serial.list()[0], 9600); - // don't generate a serialEvent() unless you get a newline character: - myPort.bufferUntil('\n'); - } - - void draw() { - // set the background color with the color values: - background(redValue, greenValue, blueValue); - } - - void serialEvent(Serial myPort) { - // get the ASCII string: - String inString = myPort.readStringUntil('\n'); - - if (inString != null) { - // trim off any whitespace: - inString = trim(inString); - // split the string on the commas and convert the - // resulting substrings into an integer array: - float[] colors = float(split(inString, ",")); - // if the array has at least three elements, you know - // you got the whole thing. Put the numbers in the - // color variables: - if (colors.length >=3) { - // map them to the range 0-255: - redValue = map(colors[0], 0, 1023, 0, 255); - greenValue = map(colors[1], 0, 1023, 0, 255); - blueValue = map(colors[2], 0, 1023, 0, 255); - } - } - } - */ - -/* Max/MSP patch for this example - - ----------begin_max5_patcher---------- -1512.3oc4Z00aaaCE8YmeED9ktB35xOjrj1aAsXX4g8xZQeYoXfVh1gqRjdT -TsIsn+2K+PJUovVVJ1VMdCAvxThV7bO7b48dIyWtXxzkxaYkSA+J3u.Sl7kK -lLwcK6MlT2dxzB5so4zRW2lJXeRt7elNy+HM6Vs61uDDzbOYkNmo02sg4euS -4BSede8S2P0o2vEq+aEKU66PPP7b3LPHDauPvyCmAvv4v6+M7L2XXF2WfCaF -lURgVPKbCxzKUbZdySDUEbgABN.ia08R9mccGYGn66qGutNir27qWbg8iY+7 -HDRx.Hjf+OPHCQgPdpQHoxhBlwB+QF4cbkthlCRk4REnfeKScs3ZwaugWBbj -.PS+.qDPAkZkgPlY5oPS4By2A5aTLFv9pounjsgpnZVF3x27pqtBrRpJnZaa -C3WxTkfUJYA.BzR.BhIy.ehquw7dSoJCsrlATLckR.nhLPNWvVwL+Vp1LHL. -SjMG.tRaG7OxT5R2c8Hx9B8.wLCxVaGI6qnpj45Ug84kL+6YIM8CqUxJyycF -7bqsBRULGvwfWyRMyovElat7NvqoejaLm4f+fkmyKuVTHy3q3ldhB.WtQY6Z -x0BSOeSpTqA+FW+Yy3SyybH3sFy8p0RVCmaMpTyX6HdDZ2JsPbfSogbBMueH -JLd6RMBdfRMzPjZvimuWIK2XgFA.ZmtfKoh0Sm88qc6OF4bDQ3P6kEtF6xej -.OkjD4H5OllyS+.3FlhY0so4xRlWqyrXErQpt+2rsnXgQNZHZgmMVzEofW7T -S4zORQtgIdDbRHrObRzSMNofUVZVcbKbhQZrSOo934TqRHIN2ncr7BF8TKR1 -tHDqL.PejLRRPKMR.pKFAkbtDa+UOvsYsIFH0DYsTCjqZ66T1CmGeDILLpSm -myk0SdkOKh5LUr4GbWwRYdW7fm.BvDmzHnSdH3biGpSbxxDNJoGDAD1ChH7L -I0DaloOTBLvkO7zPs5HJnKNoGAXbol5eytUhfyiSfnjE1uAq+Fp0a+wygGwR -q3ZI8.psJpkpJnyPzwmXBj7Sh.+bNvVZxlcKAm0OYHIxcIjzEKdRChgO5UMf -LkMPNN0MfiS7Ev6TYQct.F5IWcCZ4504rGsiVswGWWSYyma01QcZgmL+f+sf -oU18Hn6o6dXkMkFF14TL9rIAWE+6wvGV.p.TPqz3HK5L+VxYxl4UmBKEjr.B -6zinuKI3C+D2Y7azIM6N7QL6t+jQyZxymK1ToAKqVsxjlGyjz2c1kTK3180h -kJEYkacWpv6lyp2VJTjWK47wHA6fyBOWxH9pUf6jUtZkLpNKW.9EeUBH3ymY -XSQlaqGrkQMGzp20adYSmIOGjIABo1xZyAWJtCX9tg6+HMuhMCPyx76ao+Us -UxmzUE79H8d2ZB1m1ztbnOa1mGeAq0awyK8a9UqBUc6pZolpzurTK232e5gp -aInVw8QIIcpaiNSJfY4Z+92Cs+Mc+mgg2cEsvGlLY6V+1kMuioxnB5VM+fsY -9vSu4WI1PMBGXye6KXvNuzmZTh7U9h5j6vvASdngPdgOFxycNL6ia1axUMmT -JIzebXcQCn3SKMf+4QCMmOZung+6xBCPLfwO8ngcEI52YJ1y7mx3CN9xKUYU -bg7Y1yXjlKW6SrZnguQdsSfOSSDItqv2jwJFjavc1vO7OigyBr2+gDYorRk1 -HXZpVFfu2FxXkZtfp4RQqNkX5y2sya3YYL2iavWAOaizH+pw.Ibg8f1I9h3Z -2B79sNeOHvBOtfEalWsvyu0KMf015.AaROvZ7vv5AhnndfHLbTgjcCK1KlHv -gOk5B26OqrXjcJ005.QqCHn8fVTxnxfj93SfQiJlv8YV0VT9fVUwOOhSV3uD -eeqCUClbBPa.j3vWDoMZssNTzRNEnE6gYPXazZaMF921syaLWyAeBXvCESA8 -ASi6Zyw8.RQi65J8ZsNx3ho93OhGWENtWpowepae4YhCFeLErOLENtXJrOSc -iadi39rf4hwc8xdhHz3gn3dBI7iDRlFe8huAfIZhq ------------end_max5_patcher----------- - - - */ diff --git a/build/shared/examples/5.Control/Arrays/Arrays.pde b/build/shared/examples/5.Control/Arrays/Arrays.pde deleted file mode 100644 index cf83ccfb2..000000000 --- a/build/shared/examples/5.Control/Arrays/Arrays.pde +++ /dev/null @@ -1,57 +0,0 @@ -/* - Arrays - - Demonstrates the use of an array to hold pin numbers - in order to iterate over the pins in a sequence. - Lights multiple LEDs in sequence, then in reverse. - - Unlike the For Loop tutorial, where the pins have to be - contiguous, here the pins can be in any random order. - - The circuit: - * LEDs from pins 2 through 7 to ground - - created 2006 - by David A. Mellis - modified 5 Jul 2009 - by Tom Igoe - -This example code is in the public domain. - - http://www.arduino.cc/en/Tutorial/Array - */ - -int timer = 100; // The higher the number, the slower the timing. -int ledPins[] = { - 2, 7, 4, 6, 5, 3 }; // an array of pin numbers to which LEDs are attached -int pinCount = 6; // the number of pins (i.e. the length of the array) - -void setup() { - int thisPin; - // the array elements are numbered from 0 to (pinCount - 1). - // use a for loop to initialize each pin as an output: - for (int thisPin = 0; thisPin < pinCount; thisPin++) { - pinMode(ledPins[thisPin], OUTPUT); - } -} - -void loop() { - // loop from the lowest pin to the highest: - for (int thisPin = 0; thisPin < pinCount; thisPin++) { - // turn the pin on: - digitalWrite(ledPins[thisPin], HIGH); - delay(timer); - // turn the pin off: - digitalWrite(ledPins[thisPin], LOW); - - } - - // loop from the highest pin to the lowest: - for (int thisPin = pinCount - 1; thisPin >= 0; thisPin--) { - // turn the pin on: - digitalWrite(ledPins[thisPin], HIGH); - delay(timer); - // turn the pin off: - digitalWrite(ledPins[thisPin], LOW); - } -} diff --git a/build/shared/examples/5.Control/ForLoopIteration/ForLoopIteration.pde b/build/shared/examples/5.Control/ForLoopIteration/ForLoopIteration.pde deleted file mode 100644 index ec60ec9a0..000000000 --- a/build/shared/examples/5.Control/ForLoopIteration/ForLoopIteration.pde +++ /dev/null @@ -1,47 +0,0 @@ -/* - For Loop Iteration - - Demonstrates the use of a for() loop. - Lights multiple LEDs in sequence, then in reverse. - - The circuit: - * LEDs from pins 2 through 7 to ground - - created 2006 - by David A. Mellis - modified 5 Jul 2009 - by Tom Igoe - -This example code is in the public domain. - - http://www.arduino.cc/en/Tutorial/ForLoop - */ - -int timer = 100; // The higher the number, the slower the timing. - -void setup() { - // use a for loop to initialize each pin as an output: - for (int thisPin = 2; thisPin < 8; thisPin++) { - pinMode(thisPin, OUTPUT); - } -} - -void loop() { - // loop from the lowest pin to the highest: - for (int thisPin = 2; thisPin < 8; thisPin++) { - // turn the pin on: - digitalWrite(thisPin, HIGH); - delay(timer); - // turn the pin off: - digitalWrite(thisPin, LOW); - } - - // loop from the highest pin to the lowest: - for (int thisPin = 7; thisPin >= 2; thisPin--) { - // turn the pin on: - digitalWrite(thisPin, HIGH); - delay(timer); - // turn the pin off: - digitalWrite(thisPin, LOW); - } -} diff --git a/build/shared/examples/5.Control/IfStatementConditional/IfStatementConditional.pde b/build/shared/examples/5.Control/IfStatementConditional/IfStatementConditional.pde deleted file mode 100644 index 5bc0dff3b..000000000 --- a/build/shared/examples/5.Control/IfStatementConditional/IfStatementConditional.pde +++ /dev/null @@ -1,56 +0,0 @@ -/* - Conditionals - If statement - - This example demonstrates the use of if() statements. - It reads the state of a potentiometer (an analog input) and turns on an LED - only if the LED goes above a certain threshold level. It prints the analog value - regardless of the level. - - The circuit: - * potentiometer connected to analog pin 0. - Center pin of the potentiometer goes to the analog pin. - side pins of the potentiometer go to +5V and ground - * LED connected from digital pin 13 to ground - - * Note: On most Arduino boards, there is already an LED on the board - connected to pin 13, so you don't need any extra components for this example. - - created 17 Jan 2009 - modified 4 Sep 2010 - by Tom Igoe - -This example code is in the public domain. - -http://arduino.cc/en/Tutorial/IfStatement - - */ - -// These constants won't change: -const int analogPin = A0; // pin that the sensor is attached to -const int ledPin = 13; // pin that the LED is attached to -const int threshold = 400; // an arbitrary threshold level that's in the range of the analog input - -void setup() { - // initialize the LED pin as an output: - pinMode(ledPin, OUTPUT); - // initialize serial communications: - Serial.begin(9600); -} - -void loop() { - // read the value of the potentiometer: - int analogValue = analogRead(analogPin); - - // if the analog value is high enough, turn on the LED: - if (analogValue > threshold) { - digitalWrite(ledPin, HIGH); - } - else { - digitalWrite(ledPin,LOW); - } - - // print the analog value: - Serial.println(analogValue, DEC); - -} - diff --git a/build/shared/examples/5.Control/WhileStatementConditional/WhileStatementConditional.pde b/build/shared/examples/5.Control/WhileStatementConditional/WhileStatementConditional.pde deleted file mode 100644 index 69c6fc83b..000000000 --- a/build/shared/examples/5.Control/WhileStatementConditional/WhileStatementConditional.pde +++ /dev/null @@ -1,88 +0,0 @@ -/* - Conditionals - while statement - - This example demonstrates the use of while() statements. - - While the pushbutton is pressed, the sketch runs the calibration routine. - The sensor readings during the while loop define the minimum and maximum - of expected values from the photo resistor. - - This is a variation on the calibrate example. - - The circuit: - * photo resistor connected from +5V to analog in pin 0 - * 10K resistor connected from ground to analog in pin 0 - * LED connected from digital pin 9 to ground through 220 ohm resistor - * pushbutton attached from pin 2 to +5V - * 10K resistor attached from pin 2 to ground - - created 17 Jan 2009 - modified 4 Sep 2010 - by Tom Igoe - - This example code is in the public domain. - - http://arduino.cc/en/Tutorial/WhileLoop - - */ - - -// These constants won't change: -const int sensorPin = A2; // pin that the sensor is attached to -const int ledPin = 9; // pin that the LED is attached to -const int indicatorLedPin = 13; // pin that the built-in LED is attached to -const int buttonPin = 2; // pin that the button is attached to - - -// These variables will change: -int sensorMin = 1023; // minimum sensor value -int sensorMax = 0; // maximum sensor value -int sensorValue = 0; // the sensor value - - -void setup() { - // set the LED pins as outputs and the switch pin as input: - pinMode(indicatorLedPin, OUTPUT); - pinMode (ledPin, OUTPUT); - pinMode (buttonPin, INPUT); -} - -void loop() { - // while the button is pressed, take calibration readings: - while (digitalRead(buttonPin) == HIGH) { - calibrate(); - } - // signal the end of the calibration period - digitalWrite(indicatorLedPin, LOW); - - // read the sensor: - sensorValue = analogRead(sensorPin); - - // apply the calibration to the sensor reading - sensorValue = map(sensorValue, sensorMin, sensorMax, 0, 255); - - // in case the sensor value is outside the range seen during calibration - sensorValue = constrain(sensorValue, 0, 255); - - // fade the LED using the calibrated value: - analogWrite(ledPin, sensorValue); -} - -void calibrate() { - // turn on the indicator LED to indicate that calibration is happening: - digitalWrite(indicatorLedPin, HIGH); - // read the sensor: - sensorValue = analogRead(sensorPin); - - // record the maximum sensor value - if (sensorValue > sensorMax) { - sensorMax = sensorValue; - } - - // record the minimum sensor value - if (sensorValue < sensorMin) { - sensorMin = sensorValue; - } -} - - diff --git a/build/shared/examples/5.Control/switchCase/switchCase.pde b/build/shared/examples/5.Control/switchCase/switchCase.pde deleted file mode 100644 index 1b76e5fb6..000000000 --- a/build/shared/examples/5.Control/switchCase/switchCase.pde +++ /dev/null @@ -1,62 +0,0 @@ -/* - Switch statement - - Demonstrates the use of a switch statement. The switch - statement allows you to choose from among a set of discrete values - of a variable. It's like a series of if statements. - - To see this sketch in action, but the board and sensor in a well-lit - room, open the serial monitor, and and move your hand gradually - down over the sensor. - - The circuit: - * photoresistor from analog in 0 to +5V - * 10K resistor from analog in 0 to ground - - created 1 Jul 2009 - modified 4 Sep 2010 - by Tom Igoe - - This example code is in the public domain. - - http://www.arduino.cc/en/Tutorial/SwitchCase - */ - -// these constants won't change: -const int sensorMin = 0; // sensor minimum, discovered through experiment -const int sensorMax = 600; // sensor maximum, discovered through experiment - -void setup() { - // initialize serial communication: - Serial.begin(9600); -} - -void loop() { - // read the sensor: - int sensorReading = analogRead(A0); - // map the sensor range to a range of four options: - int range = map(sensorReading, sensorMin, sensorMax, 0, 3); - - // do something different depending on the - // range value: - switch (range) { - case 0: // your hand is on the sensor - Serial.println("dark"); - break; - case 1: // your hand is close to the sensor - Serial.println("dim"); - break; - case 2: // your hand is a few inches from the sensor - Serial.println("medium"); - break; - case 3: // your hand is nowhere near the sensor - Serial.println("bright"); - break; - } - -} - - - - - diff --git a/build/shared/examples/6.Sensors/ADXL3xx/ADXL3xx.pde b/build/shared/examples/6.Sensors/ADXL3xx/ADXL3xx.pde deleted file mode 100644 index 58ea129d2..000000000 --- a/build/shared/examples/6.Sensors/ADXL3xx/ADXL3xx.pde +++ /dev/null @@ -1,64 +0,0 @@ - -/* - ADXL3xx - - Reads an Analog Devices ADXL3xx accelerometer and communicates the - acceleration to the computer. The pins used are designed to be easily - compatible with the breakout boards from Sparkfun, available from: - http://www.sparkfun.com/commerce/categories.php?c=80 - - http://www.arduino.cc/en/Tutorial/ADXL3xx - - The circuit: - analog 0: accelerometer self test - analog 1: z-axis - analog 2: y-axis - analog 3: x-axis - analog 4: ground - analog 5: vcc - - created 2 Jul 2008 - by David A. Mellis - modified 4 Sep 2010 - by Tom Igoe - - This example code is in the public domain. - -*/ - -// these constants describe the pins. They won't change: -const int groundpin = 18; // analog input pin 4 -- ground -const int powerpin = 19; // analog input pin 5 -- voltage -const int xpin = A3; // x-axis of the accelerometer -const int ypin = A2; // y-axis -const int zpin = A1; // z-axis (only on 3-axis models) - -void setup() -{ - // initialize the serial communications: - Serial.begin(9600); - - // Provide ground and power by using the analog inputs as normal - // digital pins. This makes it possible to directly connect the - // breakout board to the Arduino. If you use the normal 5V and - // GND pins on the Arduino, you can remove these lines. - pinMode(groundpin, OUTPUT); - pinMode(powerpin, OUTPUT); - digitalWrite(groundpin, LOW); - digitalWrite(powerpin, HIGH); -} - -void loop() -{ - // print the sensor values: - Serial.print(analogRead(xpin)); - // print a tab between values: - Serial.print("\t"); - Serial.print(analogRead(ypin)); - // print a tab between values: - Serial.print("\t"); - Serial.print(analogRead(zpin)); - Serial.println(); - // delay before next reading: - delay(100); -} diff --git a/build/shared/examples/6.Sensors/Knock/Knock.pde b/build/shared/examples/6.Sensors/Knock/Knock.pde deleted file mode 100644 index 985f032b9..000000000 --- a/build/shared/examples/6.Sensors/Knock/Knock.pde +++ /dev/null @@ -1,55 +0,0 @@ -/* Knock Sensor - - This sketch reads a piezo element to detect a knocking sound. - It reads an analog pin and compares the result to a set threshold. - If the result is greater than the threshold, it writes - "knock" to the serial port, and toggles the LED on pin 13. - - The circuit: - * + connection of the piezo attached to analog in 0 - * - connection of the piezo attached to ground - * 1-megohm resistor attached from analog in 0 to ground - - http://www.arduino.cc/en/Tutorial/Knock - - created 25 Mar 2007 - by David Cuartielles - modified 4 Sep 2010 - by Tom Igoe - - This example code is in the public domain. - - */ - - -// these constants won't change: -const int ledPin = 13; // led connected to digital pin 13 -const int knockSensor = A0; // the piezo is connected to analog pin 0 -const int threshold = 100; // threshold value to decide when the detected sound is a knock or not - - -// these variables will change: -int sensorReading = 0; // variable to store the value read from the sensor pin -int ledState = LOW; // variable used to store the last LED status, to toggle the light - -void setup() { - pinMode(ledPin, OUTPUT); // declare the ledPin as as OUTPUT - Serial.begin(9600); // use the serial port -} - -void loop() { - // read the sensor and store it in the variable sensorReading: - sensorReading = analogRead(knockSensor); - - // if the sensor reading is greater than the threshold: - if (sensorReading >= threshold) { - // toggle the status of the ledPin: - ledState = !ledState; - // update the LED pin itself: - digitalWrite(ledPin, ledState); - // send the string "Knock!" back to the computer, followed by newline - Serial.println("Knock!"); - } - delay(100); // delay to avoid overloading the serial port buffer -} - diff --git a/build/shared/examples/6.Sensors/Memsic2125/Memsic2125.pde b/build/shared/examples/6.Sensors/Memsic2125/Memsic2125.pde deleted file mode 100644 index cf5e81c33..000000000 --- a/build/shared/examples/6.Sensors/Memsic2125/Memsic2125.pde +++ /dev/null @@ -1,63 +0,0 @@ -/* - Memsic2125 - - Read the Memsic 2125 two-axis accelerometer. Converts the - pulses output by the 2125 into milli-g's (1/1000 of earth's - gravity) and prints them over the serial connection to the - computer. - - The circuit: - * X output of accelerometer to digital pin 2 - * Y output of accelerometer to digital pin 3 - * +V of accelerometer to +5V - * GND of accelerometer to ground - - http://www.arduino.cc/en/Tutorial/Memsic2125 - - created 6 Nov 2008 - by David A. Mellis - modified 30 Jun 2009 - by Tom Igoe - - This example code is in the public domain. - - */ - -// these constants won't change: -const int xPin = 2; // X output of the accelerometer -const int yPin = 3; // Y output of the accelerometer - -void setup() { - // initialize serial communications: - Serial.begin(9600); - // initialize the pins connected to the accelerometer - // as inputs: - pinMode(xPin, INPUT); - pinMode(yPin, INPUT); -} - -void loop() { - // variables to read the pulse widths: - int pulseX, pulseY; - // variables to contain the resulting accelerations - int accelerationX, accelerationY; - - // read pulse from x- and y-axes: - pulseX = pulseIn(xPin,HIGH); - pulseY = pulseIn(yPin,HIGH); - - // convert the pulse width into acceleration - // accelerationX and accelerationY are in milli-g's: - // earth's gravity is 1000 milli-g's, or 1g. - accelerationX = ((pulseX / 10) - 500) * 8; - accelerationY = ((pulseY / 10) - 500) * 8; - - // print the acceleration - Serial.print(accelerationX); - // print a tab character: - Serial.print("\t"); - Serial.print(accelerationY); - Serial.println(); - - delay(100); -} diff --git a/build/shared/examples/6.Sensors/Ping/Ping.pde b/build/shared/examples/6.Sensors/Ping/Ping.pde deleted file mode 100644 index 70bab93a7..000000000 --- a/build/shared/examples/6.Sensors/Ping/Ping.pde +++ /dev/null @@ -1,84 +0,0 @@ -/* Ping))) Sensor - - This sketch reads a PING))) ultrasonic rangefinder and returns the - distance to the closest object in range. To do this, it sends a pulse - to the sensor to initiate a reading, then listens for a pulse - to return. The length of the returning pulse is proportional to - the distance of the object from the sensor. - - The circuit: - * +V connection of the PING))) attached to +5V - * GND connection of the PING))) attached to ground - * SIG connection of the PING))) attached to digital pin 7 - - http://www.arduino.cc/en/Tutorial/Ping - - created 3 Nov 2008 - by David A. Mellis - modified 30 Jun 2009 - by Tom Igoe - - This example code is in the public domain. - - */ - -// this constant won't change. It's the pin number -// of the sensor's output: -const int pingPin = 7; - -void setup() { - // initialize serial communication: - Serial.begin(9600); -} - -void loop() -{ - // establish variables for duration of the ping, - // and the distance result in inches and centimeters: - long duration, inches, cm; - - // The PING))) is triggered by a HIGH pulse of 2 or more microseconds. - // Give a short LOW pulse beforehand to ensure a clean HIGH pulse: - pinMode(pingPin, OUTPUT); - digitalWrite(pingPin, LOW); - delayMicroseconds(2); - digitalWrite(pingPin, HIGH); - delayMicroseconds(5); - digitalWrite(pingPin, LOW); - - // The same pin is used to read the signal from the PING))): a HIGH - // pulse whose duration is the time (in microseconds) from the sending - // of the ping to the reception of its echo off of an object. - pinMode(pingPin, INPUT); - duration = pulseIn(pingPin, HIGH); - - // convert the time into a distance - inches = microsecondsToInches(duration); - cm = microsecondsToCentimeters(duration); - - Serial.print(inches); - Serial.print("in, "); - Serial.print(cm); - Serial.print("cm"); - Serial.println(); - - delay(100); -} - -long microsecondsToInches(long microseconds) -{ - // According to Parallax's datasheet for the PING))), there are - // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per - // second). This gives the distance travelled by the ping, outbound - // and return, so we divide by 2 to get the distance of the obstacle. - // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf - return microseconds / 74 / 2; -} - -long microsecondsToCentimeters(long microseconds) -{ - // The speed of sound is 340 m/s or 29 microseconds per centimeter. - // The ping travels out and back, so to find the distance of the - // object we take half of the distance travelled. - return microseconds / 29 / 2; -} diff --git a/build/shared/examples/7.Display/RowColumnScanning/RowColumnScanning.pde b/build/shared/examples/7.Display/RowColumnScanning/RowColumnScanning.pde deleted file mode 100644 index bcda4c78d..000000000 --- a/build/shared/examples/7.Display/RowColumnScanning/RowColumnScanning.pde +++ /dev/null @@ -1,114 +0,0 @@ -/* - Row-Column Scanning an 8x8 LED matrix with X-Y input - - This example controls an 8x8 LED matrix using two analog inputs - - created 27 May 2009 - modified 4 Sep 2010 - by Tom Igoe - - This example works for the Lumex LDM-24488NI Matrix. See - http://sigma.octopart.com/140413/datasheet/Lumex-LDM-24488NI.pdf - for the pin connections - - For other LED cathode column matrixes, you should only need to change - the pin numbers in the row[] and column[] arrays - - rows are the anodes - cols are the cathodes - --------- - - Pin numbers: - Matrix: - * Digital pins 2 through 13, - * analog pins 2 through 5 used as digital 16 through 19 - Potentiometers: - * center pins are attached to analog pins 0 and 1, respectively - * side pins attached to +5V and ground, respectively. - - This example code is in the public domain. - - http://www.arduino.cc/en/Tutorial/RowColumnScanning - - see also http://www.tigoe.net/pcomp/code/category/arduinowiring/514 for more - */ - - -// 2-dimensional array of row pin numbers: -const int row[8] = { - 2,7,19,5,13,18,12,16 }; - -// 2-dimensional array of column pin numbers: -const int col[8] = { - 6,11,10,3,17,4,8,9 }; - -// 2-dimensional array of pixels: -int pixels[8][8]; - -// cursor position: -int x = 5; -int y = 5; - -void setup() { - Serial.begin(9600); - // initialize the I/O pins as outputs: - - // iterate over the pins: - for (int thisPin = 0; thisPin < 8; thisPin++) { - // initialize the output pins: - pinMode(col[thisPin], OUTPUT); - pinMode(row[thisPin], OUTPUT); - // take the col pins (i.e. the cathodes) high to ensure that - // the LEDS are off: - digitalWrite(col[thisPin], HIGH); - } - - // initialize the pixel matrix: - for (int x = 0; x < 8; x++) { - for (int y = 0; y < 8; y++) { - pixels[x][y] = HIGH; - } - } -} - -void loop() { - // read input: - readSensors(); - - // draw the screen: - refreshScreen(); -} - -void readSensors() { - // turn off the last position: - pixels[x][y] = HIGH; - // read the sensors for X and Y values: - x = 7 - map(analogRead(A0), 0, 1023, 0, 7); - y = map(analogRead(A1), 0, 1023, 0, 7); - // set the new pixel position low so that the LED will turn on - // in the next screen refresh: - pixels[x][y] = LOW; - -} - -void refreshScreen() { - // iterate over the rows (anodes): - for (int thisRow = 0; thisRow < 8; thisRow++) { - // take the row pin (anode) high: - digitalWrite(row[thisRow], HIGH); - // iterate over the cols (cathodes): - for (int thisCol = 0; thisCol < 8; thisCol++) { - // get the state of the current pixel; - int thisPixel = pixels[thisRow][thisCol]; - // when the row is HIGH and the col is LOW, - // the LED where they meet turns on: - digitalWrite(col[thisCol], thisPixel); - // turn the pixel off: - if (thisPixel == LOW) { - digitalWrite(col[thisCol], HIGH); - } - } - // take the row pin low to turn off the whole row: - digitalWrite(row[thisRow], LOW); - } -} diff --git a/build/shared/examples/8.Strings/StringAdditionOperator/StringAdditionOperator.pde b/build/shared/examples/8.Strings/StringAdditionOperator/StringAdditionOperator.pde deleted file mode 100644 index fe631b9c7..000000000 --- a/build/shared/examples/8.Strings/StringAdditionOperator/StringAdditionOperator.pde +++ /dev/null @@ -1,61 +0,0 @@ -/* - Adding Strings together - - Examples of how to add strings together - You can also add several different data types to string, as shown here: - - created 27 July 2010 - modified 4 Sep 2010 - by Tom Igoe - - http://arduino.cc/en/Tutorial/StringAdditionOperator - - This example code is in the public domain. - */ - -// declare three strings: -String stringOne, stringTwo, stringThree; - -void setup() { - Serial.begin(9600); - stringOne = String("stringThree = "); - stringTwo = String("this string"); - stringThree = String (); - Serial.println("\n\nAdding strings together (concatenation):"); -} - -void loop() { - // adding a constant integer to a string: - stringThree = stringOne + 123; - Serial.println(stringThree); // prints "stringThree = 123" - - // adding a constant long interger to a string: - stringThree = stringOne + 123456789; - Serial.println(stringThree); // prints " You added 123456789" - - // adding a constant character to a string: - stringThree = stringOne + 'A'; - Serial.println(stringThree); // prints "You added A" - - // adding a constant string to a string: - stringThree = stringOne + "abc"; - Serial.println(stringThree); // prints "You added abc" - - stringThree = stringOne + stringTwo; - Serial.println(stringThree); // prints "You added this string" - - // adding a variable integer to a string: - int sensorValue = analogRead(A0); - stringOne = "Sensor value: "; - stringThree = stringOne + sensorValue; - Serial.println(stringThree); // prints "Sensor Value: 401" or whatever value analogRead(A0) has - - // adding a variable long integer to a string: - long currentTime = millis(); - stringOne="millis() value: "; - stringThree = stringOne + millis(); - Serial.println(stringThree); // prints "The millis: 345345" or whatever value currentTime has - - // do nothing while true: - while(true); -} \ No newline at end of file diff --git a/build/shared/examples/8.Strings/StringAppendOperator/StringAppendOperator.pde b/build/shared/examples/8.Strings/StringAppendOperator/StringAppendOperator.pde deleted file mode 100644 index 680738142..000000000 --- a/build/shared/examples/8.Strings/StringAppendOperator/StringAppendOperator.pde +++ /dev/null @@ -1,64 +0,0 @@ -/* - Appending to Strings using the += operator and concat() - - Examples of how to append different data types to strings - - created 27 July 2010 - modified 4 Sep 2010 - by Tom Igoe - - http://arduino.cc/en/Tutorial/StringAppendOperator - - This example code is in the public domain. - */ -String stringOne, stringTwo; - -void setup() { - Serial.begin(9600); - stringOne = String("Sensor "); - stringTwo = String("value"); - Serial.println("\n\nAppending to a string:"); -} - -void loop() { - Serial.println(stringOne); // prints "Sensor " - - // adding a string to a string: - stringOne += stringTwo; - Serial.println(stringOne); // prints "Sensor value" - - // adding a constant string to a string: - stringOne += " for input "; - Serial.println(stringOne); // prints "Sensor value for input" - - // adding a constant character to a string: - stringOne += 'A'; - Serial.println(stringOne); // prints "Sensor value for input A" - - // adding a constant integer to a string: - stringOne += 0; - Serial.println(stringOne); // prints "Sensor value for input A0" - - // adding a constant string to a string: - stringOne += ": "; - Serial.println(stringOne); // prints "Sensor value for input" - - // adding a variable integer to a string: - stringOne += analogRead(A0); - Serial.println(stringOne); // prints "Sensor value for input A0: 456" or whatever analogRead(A0) is - - Serial.println("\n\nchanging the Strings' values"); - stringOne = "A long integer: "; - stringTwo = "The millis(): "; - - // adding a constant long integer to a string: - stringOne += 123456789; - Serial.println(stringOne); // prints "A long integer: 123456789" - - // using concat() to add a long variable to a string: - stringTwo.concat(millis()); - Serial.println(stringTwo); // prints "The millis(): 43534" or whatever the value of the millis() is - - // do nothing while true: - while(true); -} \ No newline at end of file diff --git a/build/shared/examples/8.Strings/StringComparisonOperators/StringComparisonOperators.pde b/build/shared/examples/8.Strings/StringComparisonOperators/StringComparisonOperators.pde deleted file mode 100644 index 3122b0bee..000000000 --- a/build/shared/examples/8.Strings/StringComparisonOperators/StringComparisonOperators.pde +++ /dev/null @@ -1,124 +0,0 @@ -/* - Comparing Strings - - Examples of how to compare strings using the comparison operators - - created 27 July 2010 - modified 4 Sep 2010 - by Tom Igoe - - http://arduino.cc/en/Tutorial/StringComparisonOperators - - This example code is in the public domain. - */ - -String stringOne, stringTwo; - -void setup() { - Serial.begin(9600); - stringOne = String("this"); - stringTwo = String("that"); - Serial.println("\n\nComparing Strings:"); - -} - -void loop() { - // two strings equal: - if (stringOne == "this") { - Serial.println("StringOne == \"this\""); - } - // two strings not equal: - if (stringOne != stringTwo) { - Serial.println(stringOne + " =! " + stringTwo); - } - - // two strings not equal (case sensitivity matters): - stringOne = "This"; - stringTwo = "this"; - if (stringOne != stringTwo) { - Serial.println(stringOne + " =! " + stringTwo); - } - // you can also use equals() to see if two strings are the same: - if (stringOne.equals(stringTwo)) { - Serial.println(stringOne + " equals " + stringTwo); - } - else { - Serial.println(stringOne + " does not equal " + stringTwo); - } - - // or perhaps you want to ignore case: - if (stringOne.equalsIgnoreCase(stringTwo)) { - Serial.println(stringOne + " equals (ignoring case) " + stringTwo); - } - else { - Serial.println(stringOne + " does not equal (ignoring case) " + stringTwo); - } - - // a numeric string compared to the number it represents: - stringOne = "1"; - int numberOne = 1; - if (stringOne == numberOne) { - Serial.println(stringOne + " = " + numberOne); - } - - - - // two numeric strings compared: - stringOne = "2"; - stringTwo = "1"; - if (stringOne >= stringTwo) { - Serial.println(stringOne + " >= " + stringTwo); - } - - // comparison operators can be used to compare strings for alphabetic sorting too: - stringOne = String("Brown"); - if (stringOne < "Charles") { - Serial.println(stringOne + " < Charles"); - } - - if (stringOne > "Adams") { - Serial.println(stringOne + " > Adams"); - } - - if (stringOne <= "Browne") { - Serial.println(stringOne + " <= Browne"); - } - - - if (stringOne >= "Brow") { - Serial.println(stringOne + " >= Brow"); - } - - // the compareTo() operator also allows you to compare strings - // it evaluates on the first character that's different. - // if the first character of the string you're comparing to - // comes first in alphanumeric order, then compareTo() is greater than 0: - stringOne = "Cucumber"; - stringTwo = "Cucuracha"; - if (stringOne.compareTo(stringTwo) < 0 ) { - Serial.println(stringOne + " comes before " + stringTwo); - } - else { - Serial.println(stringOne + " comes after " + stringTwo); - } - - delay(10000); // because the next part is a loop: - - // compareTo() is handy when you've got strings with numbers in them too: - - while (true) { - stringOne = "Sensor: "; - stringTwo= "Sensor: "; - - stringOne += analogRead(A0); - stringTwo += analogRead(A5); - - if (stringOne.compareTo(stringTwo) < 0 ) { - Serial.println(stringOne + " comes before " + stringTwo); - } - else { - Serial.println(stringOne + " comes after " + stringTwo); - - } - } -} \ No newline at end of file diff --git a/build/shared/examples/8.Strings/StringConstructors/StringConstructors.pde b/build/shared/examples/8.Strings/StringConstructors/StringConstructors.pde deleted file mode 100644 index 94ae2dc7a..000000000 --- a/build/shared/examples/8.Strings/StringConstructors/StringConstructors.pde +++ /dev/null @@ -1,64 +0,0 @@ -/* - String constructors - - Examples of how to create strings from other data types - - created 27 July 2010 - modified 4 Sep 2010 - by Tom Igoe - - http://arduino.cc/en/Tutorial/StringConstructors - - This example code is in the public domain. - */ - -void setup() { - Serial.begin(9600); -} - -void loop() { - // using a constant String: - String stringOne = "Hello String"; - Serial.println(stringOne); // prints "Hello String" - - // converting a constant char into a String: - stringOne = String('a'); - Serial.println(stringOne); // prints "a" - - // converting a constant string into a String object: - String stringTwo = String("This is a string"); - Serial.println(stringTwo); // prints "This is a string" - - // concatenating two strings: - stringOne = String(stringTwo + " with more"); - // prints "This is a string with more": - Serial.println(stringOne); - - // using a constant integer: - stringOne = String(13); - Serial.println(stringOne); // prints "13" - - // using an int and a base: - stringOne = String(analogRead(A0), DEC); - // prints "453" or whatever the value of analogRead(A0) is - Serial.println(stringOne); - - // using an int and a base (hexadecimal): - stringOne = String(45, HEX); - // prints "2d", which is the hexadecimal version of decimal 45: - Serial.println(stringOne); - - // using an int and a base (binary) - stringOne = String(255, BIN); - // prints "11111111" which is the binary value of 255 - Serial.println(stringOne); - - // using a long and a base: - stringOne = String(millis(), DEC); - // prints "123456" or whatever the value of millis() is: - Serial.println(stringOne); - - // do nothing while true: - while(true); - -} \ No newline at end of file diff --git a/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde b/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde deleted file mode 100644 index b18b67684..000000000 --- a/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde +++ /dev/null @@ -1,49 +0,0 @@ -/* - String startWith() and endsWith() - - Examples of how to use startsWith() and endsWith() in a String - - created 27 July 2010 - modified 4 Sep 2010 - by Tom Igoe - - http://arduino.cc/en/Tutorial/StringStartsWithEndsWith - - This example code is in the public domain. - */ - -void setup() { - Serial.begin(9600); - Serial.println("\n\nString startsWith() and endsWith():"); - -} - -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); -} \ No newline at end of file