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

View

# Derrenbacher Michael Lab 2

last edited by 5 years, 1 month ago

1a. What line(s) of code do you need to change to make the LED blink (like, at all)?

pinMode(13, OUTPUT);

It should be blink though, it doesn't have to be changed

1b. What line(s) of code do you need to change to change the rate of blinking?

digitalWrite(13, HIGH);

delay(1000);

digitalWrite(13, LOW);

delay(1000);

Change delay

1c. What circuit element would you want to add to protect the board and LED?

Resistor

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

const int buttonPin = 2;

const int ledPin =  13;

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

if (buttonState == LOW)

{

// turn LED on:

digitalWrite(ledPin, HIGH);

}

else

{

// turn LED off:

digitalWrite(ledPin, LOW);

}

3a) Which line(s) of code do you need to modify to correspond with your LED pin?

int ledPin = 9;

Already hooked up to port 9 though

3b) How would you change the rate of fading?

3c) (Extra) Since the human eye doesn't see increases in brightness linearly and the diode brightness is also nonlinear with voltage, how could you change the code to make the light appear to fade linearly?

According to this, make the brightness change to match this graph (log)

You didn't say how to change the code.   +0.25

3a. What is the minimum resistor size that should be used with these LEDs? (Hint: think about your voltage supply and what the diode voltage drop means.)

V = IR

2.8V = .03A * R

1.8V / .03A =  60Ω

R = 60Ω

4a. Is there computation in your device? Where is it? What do you think is happening inside the "computer?"

Yes, each different button relates to a different signal to send to the T.V.

4b. Are there sensors on your device? How do they work? How is the sensed information conveyed to other portions of the device?

There are a multitude of buttons to record and send input

4c. How is the device powered? Is there any transformation or regulation of the power? How is that done? What voltages are used throughout the system?

Batteries (2 AA)

4d. Is information stored in your device? Where? How?

Yes, each button has a memory of different signals to send to the IR LED

___V___     V is LED

I  .     . I

I  ....... I     . are buttons

L__EE__L    EE is chip

I   . . .  I

I          I

Power  Ground

#### Michael Derrenbacher said

at 5:24 pm on Jul 10, 2015

Finished

#### Michael Derrenbacher said

at 5:24 pm on Jul 10, 2015

Finished

#### zahraa@... said

at 2:48 pm on Jul 14, 2015

good job