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

View
 

Guiher Ally Lab 2

Page history last edited by zahraa@... 5 years, 1 month ago

Part B. Arduino micro LED!

 

1. Blinking LEDs with Arduino Micro

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

     The critical line of code that makes the LED blink is:

          digitalWrite(13, HIGH);        // turn the LED on (HIGH is the voltage level)

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

     The lines of code that change the rate of blinking are:

          delay(1000);              // wait for a second

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

     The circuit element that I would want to add to protect the board and LED would be a resistor, which would limit the amount of current being fed into the LED and board and would prevent them from being damaged.

2. Toggle LEDs on and off using Arduino Micro

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

The lines that change the button and LED pin numbers are:

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

     const int ledPin =  13;      // the number of the LED pin

The second line (const int ledPin = 13;) is the only one that needs to be modified with the current pin set-up.

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.

     

 if (buttonState == LOW) {

    // turn LED on:

    digitalWrite(ledPin, HIGH);

  }

  else {

    // turn LED off:

    digitalWrite(ledPin, LOW);

  }

3. Fading LEDs on and off using Arduino Micro 

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

     You need to modify the following line:

          int ledPin = 9;


b) How would you change the rate of fading?

     You would need to change the fadeValue in the for loops.

           for (int fadeValue = 255 ; fadeValue >= 0; fadeValue += 5) {

           for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5) {

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

 

1. Super bright LEDs

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

     (5V- 3.2V)/ .030A= 60 Ohms

2. Take apart your electronic device, and draw a schematic of what is inside.

Schematic:

 

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

     Yes, there is a microcontroller chip on board on the backside of the circuit board. It is checking the values of the pins that correspond to the buttons that are mapped to letters. When a value changes, the information is processed and translated into data that is sent to the computer which then displays the typed character.

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

     There are no sensors. Buttons convey the condition of letter presses to the computer via the microcontroller's pin values.

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 device is powered by the USB cable. The power is not transformed, but current is regulated by 3 resistors and voltage is regulated by 7 different capacitors. The input is the standard USB power supply of 5 Volts. The power supplies 3 different LEDs and the microcontroller.

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

     No information is stored in the device, it all travels to the computer that the keyboard is connected to.

Video:


Comments (1)

zahraa@... said

at 1:41 pm on Jul 15, 2015

good job

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