Build a “Flying Saucer” Using Arduinoreiser/179-fall2009/studentWork/final...Build a “Flying...

6

Click here to load reader

Transcript of Build a “Flying Saucer” Using Arduinoreiser/179-fall2009/studentWork/final...Build a “Flying...

Page 1: Build a “Flying Saucer” Using Arduinoreiser/179-fall2009/studentWork/final...Build a “Flying Saucer” Using Arduino Created by Alexander Ross Rebecca Arrigo Instructions Manual

Instructions Manual

Build a “Flying Saucer” Using Arduino

Created by

Alexander Ross Rebecca Arrigo

Page 2: Build a “Flying Saucer” Using Arduinoreiser/179-fall2009/studentWork/final...Build a “Flying Saucer” Using Arduino Created by Alexander Ross Rebecca Arrigo Instructions Manual

Instructions Manual Page 2 of 6

“Flying Saucer” Step 1. Wire the Arduino

- - - -

Materials Required 1x Arduino 1x Breadboard 1x Photocell 1x 10k Ω Resistor 8x 100 Ω Resistors 8x LEDs (red) 20x Connectors/Wires *Don’t have a breadboard? You can always use solder to make the connections which eliminates the breadboard.

*Want to be stand-alone? Add an onboard 9V battery or 3 AAA batteries to your setup and eliminate the USB cord.

- - - -

Wire your Arduino according to the schematic below.

Page 3: Build a “Flying Saucer” Using Arduinoreiser/179-fall2009/studentWork/final...Build a “Flying Saucer” Using Arduino Created by Alexander Ross Rebecca Arrigo Instructions Manual

Instructions Manual Page 3 of 6

“Flying Saucer” Step 2. Upload the Arduino Code

- - - - Copy & Paste the Code Below into an Arduino Sketch /* Final Project - Flying Saucer Trail 8 LEDs along the outer edge of a "flying saucer" at a variable rate determined by a mounted photocell resistor. The circuit: * LED connected from digital pins 2-9 to ground. * Photocell connected to analog pin 0 and 5V. Created 8 December 2009 By Alexander Ross and Rebecca Arrigo based on an orginal by H. Barragan for the Wiring i/o board */ int photoCell = 0; // pin of Photocell int ledPin1 = 2; // pin of LED 1 int ledPin2 = 3; // pin of LED 2 int ledPin3 = 4; // pin of LED 3 int ledPin4 = 5; // pin of LED 4 int ledPin5 = 6; // pin of LED 5 int ledPin6 = 7; // pin of LED 6 int ledPin7 = 8; // pin of LED 7 int ledPin8 = 9; // pin of LED 8 int sequence = 4; // LED to start with (0-8) int dlFactor = 1; // delay multiplier /*===========================================================*/ /*= DO NOT MODIFY THE CODE BELOW THIS LINE UNLESS DEBUGGING =*/ /*===========================================================*/ // The setup() method runs once, when the sketch starts void setup() // initialize the digital pin as an output: pinMode(photoCell, INPUT); pinMode(ledPin1, OUTPUT); pinMode(ledPin2, OUTPUT); pinMode(ledPin3, OUTPUT); pinMode(ledPin4, OUTPUT); pinMode(ledPin5, OUTPUT); pinMode(ledPin6, OUTPUT); pinMode(ledPin7, OUTPUT); pinMode(ledPin8, OUTPUT);

Page 4: Build a “Flying Saucer” Using Arduinoreiser/179-fall2009/studentWork/final...Build a “Flying Saucer” Using Arduino Created by Alexander Ross Rebecca Arrigo Instructions Manual

Instructions Manual Page 4 of 6

// the loop() method runs over and over again, // as long as the Arduino has power void loop() delay(analogRead(photoCell)*dlFactor); switch (sequence) case 1: digitalWrite(ledPin2, HIGH); // set LED 2 on digitalWrite(ledPin1, LOW); // set LED 1 off break; case 2: digitalWrite(ledPin3, HIGH); // set LED 3 on digitalWrite(ledPin2, LOW); // set LED 2 off break; case 3: digitalWrite(ledPin4, HIGH); // set LED 4 on digitalWrite(ledPin3, LOW); // set LED 3 off break; case 4: digitalWrite(ledPin5, HIGH); // set LED 5 on digitalWrite(ledPin4, LOW); // set LED 4 off break; case 5: digitalWrite(ledPin6, HIGH); // set LED 6 on digitalWrite(ledPin5, LOW); // set LED 5 off break; case 6: digitalWrite(ledPin7, HIGH); // set LED 7 on digitalWrite(ledPin6, LOW); // set LED 6 off break; case 7: digitalWrite(ledPin8, HIGH); // set LED 8 on digitalWrite(ledPin7, LOW); // set LED 7 off break; case 8: digitalWrite(ledPin1, HIGH); // set LED 1 on digitalWrite(ledPin8, LOW); // set LED 8 off sequence=0; break; default: digitalWrite(ledPin1, HIGH); // set LED 1 off digitalWrite(ledPin2, HIGH); // set LED 2 off digitalWrite(ledPin3, HIGH); // set LED 3 off digitalWrite(ledPin4, HIGH); // set LED 4 off digitalWrite(ledPin5, HIGH); // set LED 5 off digitalWrite(ledPin6, HIGH); // set LED 6 off digitalWrite(ledPin7, HIGH); // set LED 7 off digitalWrite(ledPin8, HIGH); // set LED 8 off sequence = 0; break; sequence+=1; // End of Arduino Code.

Page 5: Build a “Flying Saucer” Using Arduinoreiser/179-fall2009/studentWork/final...Build a “Flying Saucer” Using Arduino Created by Alexander Ross Rebecca Arrigo Instructions Manual

Instructions Manual Page 5 of 6

“Flying Saucer” Step 3. Construct the UFO

- - - -

Materials Used - 4 Clips - 2 Plates - 1 Dixie cup - Paints - Scotch Tape

- - - -

Feel free to get creative on this step. Once you’ve created a UFO case that suits your fancy, insert the

Arduino components, tape them down (as desired), and clip the two plates together to conceal the components.

BE SURE TO KEEP THE PHOTOCELL ON EXTERIOR!

PHOTOCELL

Page 6: Build a “Flying Saucer” Using Arduinoreiser/179-fall2009/studentWork/final...Build a “Flying Saucer” Using Arduino Created by Alexander Ross Rebecca Arrigo Instructions Manual

Instructions Manual Page 6 of 6

“Flying Saucer” Step 4. ENJOY!

- - - -