| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Get control of your email attachments. Connect all your Gmail accounts and in less than 2 minutes, Dokkio will automatically organize your file attachments. You can also connect Dokkio to Drive, Dropbox, and Slack. Sign up for free.

View
 

Nathan Hall-Snyder - Lab 2

Page history last edited by Nathan Hall-Snyder 10 years, 2 months ago

Lab 2!

By: Nathan Hall-Snyder

 

Part A: 2. Simple LED

a. What resistance do you need to limit current to 20 mA?

the minimum resistance, since there's a roughly 2V voltage drop across the LED, required to limit the current to 20 mA is 3V/.020 = 150 ohms

 

b. Is 220 ohms a maximum or minimum resistance?

This is a minimum resistance...with less, the current would increase, towards 20 mA

 

c. What is the resistance range of the potentiometer?

The pot I used has a resistance range from 2 ohms to 10 K ohms.

 

Part A: 3. LED with button

a. Does it matter what order the components of your circuit are arranged between power and ground? Why or why not?

In this particular circuit, it doesn't matter what the order is...the resistor will limit anywhere in the circuit, current will only flow if the circuit is connected...and the led, as long as it's in the correct direction, also doesn't care.

 

Part A: 4. LED with battery

a. What is the minimum resistance required for use with the battery?

a. Minimum resistance = (9-7)/.020 A = 350 ohms

 

 

Part B: 1.

a. What line of code do you need to change to light the Teensy LED?

In order to get the LED to blink, you just change the ledPin variable from 13 to 11.

 

b. What lines of code do you need to change to change the rate of blinking?

In order to change the time, you change the "1000" in the loop.

 

 

Part B: 2

 

a. Which lines do you need to modify to correspond with your button and LED pins?

You only have to change the LED pin to pin 9 and kept the same button pin

 

b. Modify the code so that the LED lights only while the button is depressed. Include your code in your lab write-up.

Change "HIGH" to "LOW" on the if statement

 

// set pin numbers:

const int buttonPin = 2;     // the number of the pushbutton pin

const int ledPin =  9;      // 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 == LOW) {     

    // turn LED on:    

    digitalWrite(ledPin, HIGH);  

  }

  else {

    // turn LED off:

    digitalWrite(ledPin, LOW);

  }

}

 

Fading

 

a. You have to add lines from the button program:

int buttonState = 0;

const int buttonPin = 2;

pinMode(buttonPin, INPUT);

 

-and-

 

buttonState = digitalRead(buttonPin);

if(buttonState == LOW){etc}

 

Part B 3.

 

a) Which lines do you need to modify to correspond with your button and LED pins?

I changed the LED pin to pin 9 and used my button code from part 2, so the button remained on pin 2.

 

 

b) How would you change the rate of fading?

You should change the "5" number in the += or -= 5 in order to change the rate of fade.

 

Part C: 1. Superbright LED

a. What is the minimum resistor size that should be used with these LEDs?

Minimum resistance: (5-3.4V)/.020 = 80 ohms

 

Part C: 2. Sketch time!

 

That concludes the sketching...now for part 3:

 

Part C: 3 Paper Prototypes:

 

LED Light Key Fob

AA Battery with charge level LED

 

 

Laptop with glowing base to indicate charge (with iphone color effects!)

 

"I'm Hot" Lighted Toaster

 

 

 

Temperature Indicator Faucet

 

Persistence of Vision Rotary Display

 

Longboard HeadLight

 

Under-door LED status indicator (sleeping, working, etc)

 

Fluorescent Light Replacement

 

LED Wallpaper

 

Part C: 3 LED Project: Longboard Cylon Lights

 

Video:

http://www.youtube.com/watch?v=acRIBeQfCDw

 

 

 

 

 

Comments (1)

Megan Wachs said

at 7:21 pm on Apr 21, 2010

I love the (computer added?) effects on your prototypes. Also really like the battery indicator and light-up power cords idea!

You don't have permission to comment on this page.