• 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 Martin Sanner 7 years, 2 months ago Saved with comment

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

"int led=9 => int led=13)"

✓ did you need to change any lines in this case?
b. What line(s) of code do you need to change to change the rate of blinking?

the last change in the forloop


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

A fitting resistor

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

"int ledPin=x" -> change x.

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

"int ledPin=y"

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.

"int ButtonPin=x"

 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.

// 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 =  13;      // 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);

b) How would you change the rate of fading?

by changing the actualisation in the forloop

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

U=RI |/I

U/I=R     |T

2.8v/0.03A=93.33 Ohm

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

There is a small "computer", which calculates the outputs and displays them on the screen. This happens via bitswitches, that resemble the current states,  Calculations, numbers, places etc.

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

There is an array of Pushbuttons on the front, as well as a photosensor

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 System uses approx. 2.5-2.8 Volts, which are given through a photosensor and/or a battery.

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

Information is stored in the Cache of the Calculator

Note: The Photosensor broke, so i need to reimplement the light for the video :(. i will post it in lab if possible.

✓ please do so..


Comments (1)

Vivien Tsao said

at 12:53 am on Jul 15, 2013

Good job.

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