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

• Finally, you can manage your Google Docs, uploads, and email attachments (plus Dropbox and Slack files) in one convenient place. Claim a free account, and in less than 2 minutes, Dokkio (from the makers of PBworks) can automatically organize your content for you.

View

# Abdel-Raouf Buddha Lab 2

last edited by 5 years, 11 months ago

a1.

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

The only line you would need to change is "int led = 13;" and change 13 to whatever pin you prefer. This can also be resolved by plugging in your led into pin 13 instead, which would require no changes in the code.

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

All you would have to do is change the delay time. The smaller the number in the delay time, the quicker the blinking. The longer the number, the slower the blinking.

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

A resistor, because if there is too high of a current going through the circuit it can damage the interior of the board and can burst the LED.

2.

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

The only piece of code you would need to change are the pins so they correspond to where you plug in your LED and button.

b. 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.

Changed line: if (buttonState == HIGH)  to if (buttonState == LOW)

3.

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

Change the 9 in "int ledPin = 9" to what ever pin your LED connects to.

b.  How would you change the rate of fading?

There are two ways to change the speed of the fading. The first is to change the increment of the fadeValue in the for loop. The original code has the increment as +5 after each run, to speed up the fading increase this number. The second way is to change the delay in the loop. The lower the number in the delay method ( which is delay(30) ), the quicker the fading.

c. (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?

Part C

1.

a. 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

R=(Vf-Vd)/I

R=(5V - 3.2V) / 30 mA

R= .06 mili-OHMS

The process is right, but the final answer is 60 Ohms. -0.1

2.

No schematic-0.5

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

Since my device is a 7-port USB hub, there aren't really any computations that it needs to calculate. The only thing it needs to do is to break down the files from the USBs to 0s and 1s and condense that down to one channel and distributes that information to the rest of the computer it is connected to.

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

No there aren't any sensors the only form of input is the information from the USB jacks.

c. 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?

The 7-port USB hub is powered by the computer it is connected to. The voltage comes from the computer through the USB cable to the USB hub.

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

No it does not store any information it just transfers info to the the computer from the USB jacks.

Bellow is my video of my frankenlight: