JishnuDatta_Lab(2)


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

 

     int led = 13;

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

 

     delay(1000);

     This delay, on either side, controls how long the LED is on or off and therefore by changing either delay, you change the rate of blinking.

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

 

I need a resistor to protect the board, so that the current is not extremely high and does not damage the board/ LED through heat.

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

 

void loop(){

  // read the state of the pushbutton value:

  buttonState = digitalRead(buttonPin);

 

  // check if the pushbutton is pressed.

  // if it is, the buttonState is LOW:

  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;    

b) How would you change the rate of fading?

 

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

 

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

 

Frankenlight 

 

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

 

I = 0.03 A

V power supply = 5V

V1 = ?

V2 (Forward voltage of the super bright white light) = 3.2 V

 

V battery = V1 + V2

V1 = 5V - 3.2V

V1 = 1.8V

 

R = V1 / I

R = 1.8 V / 0.03 A

R = 60 Ohms

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

Yes, there is an integrated chip in the mouse which helps recognize the sensed information and transfer these to signals to send 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?

There are two buttons and a mouse ball which rotates. The information from the buttons completes certain circuits which are recognized as button presses on the computer.

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 a PS2 connection to a computer. There is no transformation/ regulation of power. The circuit throughout the mouse runs on 5 Volts.

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

No information is stored in the device as it is used more for its sensors.

Video: