WhileStatementConditional

WhileStatementConditional - /* Conditionals - while...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/* 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;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/31/2011 for the course CS 302 taught by Professor J.parker during the Spring '08 term at University of Texas at Austin.

Page1 / 2

WhileStatementConditional - /* Conditionals - while...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online