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

Aubuchon Joseph Lab 2

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

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

The code only has to have the 13 in the pin selected for voltage output be changed to pin 9 to light the led


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

The number used in the delay needs to be shrunk or enlarged to change the rate of blinking, 500 makes it 2x quicker than 1000


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

A Resistor is a part needed to lower the current to a usable amount to keep the led from burning out


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

Change the number next to Pinmode from 13 to 9 as well as next to digitalwrite 

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.

/*

  Button

 

 Turns on and off a light emitting diode(LED) connected to digital

 pin 13, when pressing a pushbutton attached to pin 2.

 

 

 The circuit:

 * LED attached from pin 13 to ground

 * pushbutton attached to pin 2 from +5V

 * 10K resistor attached to pin 2 from ground

 

 * Note: on most Arduinos there is already an LED on the board

 attached to pin 13.

 

 

 created 2005

 by DojoDave <http://www.0j0.org>

 modified 30 Aug 2011

 by Tom Igoe

 

 This example code is in the public domain.

 

 http://www.arduino.cc/en/Tutorial/Button

 */

 

// constants won't change. They're used here to

// set pin numbers:

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

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

 

// variables will change:

int buttonState = 0;         // variable for reading the pushbutton status

 

void setup() {

  // initialize the LED pin as an output:

  pinMode(ledPin, OUTPUT);

  // initialize the pushbutton pin as an input:

  pinMode(buttonPin, INPUT);

}

 

void loop() {

  // read the state of the pushbutton value:

  buttonState = digitalRead(buttonPin);

 

  // check if the pushbutton is pressed.

  // if it is, the buttonState is HIGH:

  if (buttonState == HIGH) {

    // turn LED on:

    digitalWrite(ledPin, HIGH);

  }

  else {

    // turn LED off:

    digitalWrite(ledPin, LOW);

  }

}

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

just the ones refering to pin 13 to pin 9 


b) How would you change the rate of fading? 

change the fade value increment to change the rate of fade


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? 

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

60 ohms.


a. Is there computation in your device? Where is it? What do you think is happening inside the "computer?" yes there is a computation device, it sends out a certain voltage to tell the computer what button was depressed on the keyboard, it is under the number pad, it sends out specific voltages to tell the computer what buttons have been depressed

No schematics -0.5

 

 

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

Yes, they are pressure sensors that detect when a button has been pushed, through specific voltage values.

✔ great answer

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?

through USB, there is not, it is designed to run on 5 volts


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

No. 

 

 

 

Comments (1)

zahraa@... said

at 5:30 pm on Jul 11, 2015

good job

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