From ca651419c53cafea0e5f2a9d183660e70699473e Mon Sep 17 00:00:00 2001 From: Tom Igoe Date: Wed, 17 Jun 2009 21:24:05 +0000 Subject: [PATCH] New examples for basic control structures --- .../ForLoopIteration/ForLoopIteration.pde | 51 ++++++ .../IfStatementConditional.pde | 53 ++++++ .../dist/examples/Control/Loop/Loop.pde | 37 +++++ .../WhileStatementConditional.pde | 75 +++++++++ .../applet/WhileStatementConditional.cpp | 86 ++++++++++ .../applet/WhileStatementConditional.eep | 1 + .../applet/WhileStatementConditional.elf | Bin 0 -> 54388 bytes .../applet/WhileStatementConditional.hex | 155 ++++++++++++++++++ .../applet/WhileStatementConditional.pde | 70 ++++++++ 9 files changed, 528 insertions(+) create mode 100644 build/shared/dist/examples/Control/ForLoopIteration/ForLoopIteration.pde create mode 100644 build/shared/dist/examples/Control/IfStatementConditional/IfStatementConditional.pde create mode 100644 build/shared/dist/examples/Control/Loop/Loop.pde create mode 100644 build/shared/dist/examples/Control/WhileStatementConditional/WhileStatementConditional.pde create mode 100644 build/shared/dist/examples/Control/WhileStatementConditional/applet/WhileStatementConditional.cpp create mode 100644 build/shared/dist/examples/Control/WhileStatementConditional/applet/WhileStatementConditional.eep create mode 100755 build/shared/dist/examples/Control/WhileStatementConditional/applet/WhileStatementConditional.elf create mode 100644 build/shared/dist/examples/Control/WhileStatementConditional/applet/WhileStatementConditional.hex create mode 100644 build/shared/dist/examples/Control/WhileStatementConditional/applet/WhileStatementConditional.pde diff --git a/build/shared/dist/examples/Control/ForLoopIteration/ForLoopIteration.pde b/build/shared/dist/examples/Control/ForLoopIteration/ForLoopIteration.pde new file mode 100644 index 000000000..4fcc4e22c --- /dev/null +++ b/build/shared/dist/examples/Control/ForLoopIteration/ForLoopIteration.pde @@ -0,0 +1,51 @@ +/* + For Loop Iteration + + Demonstrates the use of a for() loop and arrays. + 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 17 Jan 2009 + by Tom Igoe + + http://www.arduino.cc/en/Tutorial/Loop + */ + +int timer = 100; // The higher the number, the slower the timing. +int ledPins[] = { + 2, 3, 4, 5, 6, 7 }; // 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 < thisPin; thisPin++) { + pinMode(ledPins[thisPin], OUTPUT); + } +} + +void loop() { + // loop from the lowest pin to the highest: + for (int thisPin = 0; i < 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 (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/dist/examples/Control/IfStatementConditional/IfStatementConditional.pde b/build/shared/dist/examples/Control/IfStatementConditional/IfStatementConditional.pde new file mode 100644 index 000000000..068b4fe69 --- /dev/null +++ b/build/shared/dist/examples/Control/IfStatementConditional/IfStatementConditional.pde @@ -0,0 +1,53 @@ +/* + 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 + by Tom Igoe + + http://arduino.cc/en/Tutorial/ + + */ + +// These constants won't change: +const int analogPin = 0; // 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(LED, 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/dist/examples/Control/Loop/Loop.pde b/build/shared/dist/examples/Control/Loop/Loop.pde new file mode 100644 index 000000000..5ea723127 --- /dev/null +++ b/build/shared/dist/examples/Control/Loop/Loop.pde @@ -0,0 +1,37 @@ +/* + * Loop + * by David A. Mellis + * + * Lights multiple LEDs in sequence, then in reverse. Demonstrates + * the use of a for() loop and arrays. + * + * http://www.arduino.cc/en/Tutorial/Loop + */ + +int timer = 100; // The higher the number, the slower the timing. +int pins[] = { 2, 3, 4, 5, 6, 7 }; // an array of pin numbers +int num_pins = 6; // the number of pins (i.e. the length of the array) + +void setup() +{ + int i; + + for (i = 0; i < num_pins; i++) // the array elements are numbered from 0 to num_pins - 1 + pinMode(pins[i], OUTPUT); // set each pin as an output +} + +void loop() +{ + int i; + + for (i = 0; i < num_pins; i++) { // loop through each pin... + digitalWrite(pins[i], HIGH); // turning it on, + delay(timer); // pausing, + digitalWrite(pins[i], LOW); // and turning it off. + } + for (i = num_pins - 1; i >= 0; i--) { + digitalWrite(pins[i], HIGH); + delay(timer); + digitalWrite(pins[i], LOW); + } +} diff --git a/build/shared/dist/examples/Control/WhileStatementConditional/WhileStatementConditional.pde b/build/shared/dist/examples/Control/WhileStatementConditional/WhileStatementConditional.pde new file mode 100644 index 000000000..23ba3da23 --- /dev/null +++ b/build/shared/dist/examples/Control/WhileStatementConditional/WhileStatementConditional.pde @@ -0,0 +1,75 @@ +/* + Conditionals - while statement + + This example demonstrates the use of while() statements. + + It reads the state of a potentiometer (an analog input) and blinks an LED + while the LED remains above a certain threshold level. It prints the analog value + only if it's below the threshold. + + This example uses principles explained in the BlinkWithoutDelay example as well. + + 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 + by Tom Igoe + + */ + +// These constants won't change: +const int analogPin = 0; // 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 +const int blinkDelay = 500; // how long to hold between changes of the LED + +// these variables will change: +int ledState = LOW; // the state of the LED +int lastBlinkTime = 0; // last time the LED changed +int analogValue; // variable to hold the value 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: + analogValue = analogRead(analogPin); + + // if the analog value is high enough, turn on the LED: + while (analogValue > threshold) { + // if enough time has passed since the last change of the LED, + // then change it. Note you're using the technique from BlinkWithoutDelay + // here so that the while loop doesn't delay the rest of the program: + + if (millis() - lastBlinkTime > blinkDelay) { + // if the ledState is high, this makes it low, and vice versa: + ledState = !ledState; + digitalWrite(ledPin, ledState); + + // save the last time the LED changed in a variable: + lastBlinkTime = millis(); + } + // while you're in the while loop, you have to read the + // input again: + analogValue = analogRead(analogPin); + } + + // if you're below the threshold, print the analog value: + Serial.println(analogValue, DEC); + // turn the LED off: + digitalWrite(ledPin, LOW); + +} + + diff --git a/build/shared/dist/examples/Control/WhileStatementConditional/applet/WhileStatementConditional.cpp b/build/shared/dist/examples/Control/WhileStatementConditional/applet/WhileStatementConditional.cpp new file mode 100644 index 000000000..fd7fb7a0e --- /dev/null +++ b/build/shared/dist/examples/Control/WhileStatementConditional/applet/WhileStatementConditional.cpp @@ -0,0 +1,86 @@ +/* + Conditionals - while statement + + This example demonstrates the use of while() statements. + + It reads the state of a potentiometer (an analog input) and blinks an LED + while the LED remains above a certain threshold level. It prints the analog value + only if it's below the threshold. + + This example uses principles explained in the BlinkWithoutDelay example as well. + + 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 + by Tom Igoe + + */ + +#define ledPin 13 // the pin for the LED +#define analogPin 0 // the analog pin that the potentiometer is attached to + +#include "WProgram.h" +void setup(); +void loop(); +int threshold = 400; // an arbitrary threshold level that's in the range of the analog input +int ledState = LOW; // the state of the LED +int lastBlinkTime = 0; // last time the LED changed +int blinkDelay = 500; // how long to hold between changes of the LED + int analogValue; // variable to hold the value 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: + analogValue = analogRead(analogPin); + + // if the analog value is high enough, turn on the LED: + while (analogValue > threshold) { + // if enough time has passed since the last change of the LED, + // then change it. Note you're using the technique from BlinkWithoutDelay + // here so that the while loop doesn't delay the rest of the program: + + if (millis() - lastBlinkTime > blinkDelay) { + // if the ledState is high, this makes it low, and vice versa: + ledState = !ledState; + digitalWrite(ledPin, ledState); + + // save the last time the LED changed in a variable: + lastBlinkTime = millis(); + } + // while you're in the while loop, you have to read the + // input again: + analogValue = analogRead(analogPin); + } + + // if you're below the threshold, print the analog value: + Serial.println(analogValue, DEC); + // turn the LED off: + digitalWrite(ledPin, LOW); + +} + + +int main(void) +{ + init(); + + setup(); + + for (;;) + loop(); + + return 0; +} + diff --git a/build/shared/dist/examples/Control/WhileStatementConditional/applet/WhileStatementConditional.eep b/build/shared/dist/examples/Control/WhileStatementConditional/applet/WhileStatementConditional.eep new file mode 100644 index 000000000..1996e8fde --- /dev/null +++ b/build/shared/dist/examples/Control/WhileStatementConditional/applet/WhileStatementConditional.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/build/shared/dist/examples/Control/WhileStatementConditional/applet/WhileStatementConditional.elf b/build/shared/dist/examples/Control/WhileStatementConditional/applet/WhileStatementConditional.elf new file mode 100755 index 0000000000000000000000000000000000000000..cefe0de60f228cba5963c8d711f7fadba420906f GIT binary patch literal 54388 zcmdsg31C&l+4ju6*&rbcI|3492g$;shzmi2fC7miptxLak{c4qW)?QB1jV(e2{&=C zqPA+St!V4gS}V4G{nc8RE_U;)(Jr60R>4xWi{*cwIcM&9?@2BOLB7BLfpg}0-+AYq z?VaV!oio`ofAMKrYh|y1TCOZL1I$aFQtAr0GgPh$sEMk-$};}VHUQjf`#5(pFvIfx zH+V|78ovy{Cvc~bg*&684EO7SjE=wKz83gk@4-PQ%!daIi>TCCH9<`#P~(vLDF%&E z*20<-u`=6V0Us`za0-2Je>Ngk8-*m1Xu4Kx#Rv5A5MMqqwKC{-+iSkY4!<*8#rFW+1 zwg67@Dj zv%tyJt>C;AY>VdT)@ZiQZO?{Q;C6-ZT3u*(Wj&DNB2jI+JC6J+IQ$Z?NR-*);F$sy8&^XlXN@M)PXd0 z>WM>6NIhZCdl&q>r0DX3XjJD$cj*1?@3%kQ{!sg!?KiY!k$=z=FaM){Z|nZ8TT5Fnf9HySUXiz8uf5=&SI&S6_kWeW-1g z>~@ssU)ulGuG{u(?V4KK)u;29g1)fpIo+p|xk>BH-!W%L$&S#D`W;(#+_2-$9sW9c z1GV(y$AA0y&YQ9x`?%w`PiKAa$4`&Y7wU`k+(Bn1hm$W#UbIifwdQwyI?vjD_1Ig+ zo~2LCTQRnB?1r(rE4wQrYvic3e#1uoAN`oVNAEyA)+BwbQ92!4N3@T)YsAANqz`Mj zMt?y+Gw{`$iX8nynWWWba#ZzTRDZ-m4<#&miAv9dD-XO{*KYC27$|J8$%I^>X_g-D>#G zwj0{EwAHtT+Dh8ywB@75rR~0JYncb;6_jGi1yg6d;2t6`q zBZZxl3ks8m?aS=w46yZn606nBj_(GZ zgPuQXr}n(I%=XK++uD9VTIg5N>rC3y1-u8iPbb^vooJU{TkI+10|@ywH{=5d`L$08 znIG#lTH7B)*str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it. Note you're using the technique from BlinkWithoutDelay + // here so that the while loop doesn't delay the rest of the program: + + if (millis() - lastBlinkTime > blinkDelay) { + // if the ledState is high, this makes it low, and vice versa: + ledState = !ledState; + digitalWrite(ledPin, ledState); + + // save the last time the LED changed in a variable: + lastBlinkTime = millis(); + } + // while you're in the while loop, you have to read the + // input again: + analogValue = analogRead(analogPin); + } + + // if you're below the threshold, print the analog value: + Serial.println(analogValue, DEC); + // turn the LED off: + digitalWrite(ledPin, LOW); + +} +