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

Lab 2 - Ashley Mills

Page history last edited by Ashley Mills 7 years, 3 months ago

 

Blinking LEDs:

 

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

digitalWrite(led, HIGH);

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

delay(1000);

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

A resistor

 

Toggle LEDS on and off:

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

const int buttonPin = 2;

const int ledPin = 13;

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

 }

}

 

Fading LEDs on and off:

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

int ledPin = 9;

How would you change the rate of fading?

delay(30);

 

Frankenlight:

What is the minimum resistor size that should be used with these LEDs?

5V - 3.2V = (0.03A)*R

R = 60 ohms

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

Yes, on the circuit board. It is changing the blinking rate of the light everytime the button is depressed.

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

Yes, there is a button. It toggles between off, on, blinking fast, and blinking slow.

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 with 4 1.5V triple A batteries. The power is dissipated through the light bulb as light and heat.

Is information stored in your device? Where? How?

The only information stored is the button setting- keeping track of whether the last setting was off, on, blinking fast, or blinking slow.

 

 

 

 

Comments (0)

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