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

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.


Koe Josephine Lab 2

Page history last edited by zahraa@... 5 years, 2 months ago

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


You need to change the lines "digitalWrite(13, HIGH);" and "digitalWrite(13, LOW);" to make the LED blink.

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


You need to change the 2 lines of "delay(1000);" to change the rate of blinking.

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


You would want to add a resistor to protect the board and LED.

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


You need to modify the line "const int ledPin =  13;" to correspond with the button and LED pins.

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


Koe Josephine Lab 2 Code

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


You need to modify the line "int ledPin = 9;" to correspond with the LED pin.

B3b) How would you change the rate of fading?


You could either modify the 2 lines of "delay(30);" to change the time between the increments and decrements or modify the segments of "fadeValue += 5" and "fadeValue -= 5" to change the amount the frequency of the voltage is incremented or decremented by.

B3c) (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?


You could change the code so the "fadeValue" is not incremented and decremented at a constant rate. Instead of the frequency of the voltage being a linear function of time, it could be an exponential, logarithmic, or sinusoidal function.

C1a. 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.) 


The battery has a voltage of 3.7 V, and since the LEDs have a forward drop of 3.2, the resistor will have a voltage of 0.5 V and a current of 30 mA will run through the circuit. 


R = V/I = 0.5/0.03 = 16.67 Ω

It is partially correct, but the complete correct answer is :

R = (Vcc - Vf) / If = (5V – 3.2V) / 20mA = 90 Ohms. (-0.3)


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

I think there is computation in my device in the integrated circuit (IC). It probably controls the motors based on the input from the remote control.



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

There is a sensor on the helicopter in the back. It gets a signal from the remote control and sends the information to the IC, which does the computation and controls the motors accordingly by changing the voltage.



C2c. 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 helicopter is powered by a battery which has a voltage of 3.7 V. I don't think there is any transformation of the power, but it is probably regulated by the IC so the motors can turn at different speeds, for example, when the user wants it to change direction. The 3.7 V of the battery is probably used throughout the system, but it is turned off and on really fast at different frequencies to control speed.



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

There is probably information stored in the IC. It is the information that tells the computer part what to do when a certain signal is received, like turning the motor faster when the user wants it to go up, and then the computer part executes it.



Comments (1)

zahraa@... said

at 2:02 pm on Jul 15, 2015


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