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



Page history last edited by Vivien Tsao 7 years, 1 month ago

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

digitalWrite(led, HIGH);

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

  delay(1000); //Below each line that turn the led on or off.

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


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? 

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

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

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.

const int buttonPin = 2;

const int ledPin =  13;

int buttonState = 0;

void setup() {

  pinMode(ledPin, OUTPUT);      

  pinMode(buttonPin, INPUT);     


void loop(){

  buttonState = digitalRead(buttonPin);

  if (buttonState == HIGH) {     

    digitalWrite(ledPin, LOW);  


  else {

    digitalWrite(ledPin, HIGH); 



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?

int ledPin = 9;    // LED connected to digital pin 9

b) How would you change the rate of fading?

Changing the fadeValue (-=5, +=5) in both the "for" function.

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?


3. Frankenlight:

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 = R.I

(5V - 3.2V) = R.(30/1000A)

R = 1.8V/0.03A

R =~ 60Ω

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

Yes. In the mouse the computer reads the information of the laser and sends through the usb port to the computer.

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

Yes. The laser inside the mouse. It shows the changes in the surface it's pointing. The information passes to the computer so it can be "read".

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 through the usb port. There is a transformation of the power through the resistor before the switch. 5V are used to power the device.

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



Comments (0)

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