• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Get control of your email attachments. Connect all your Gmail accounts and in less than 2 minutes, Dokkio will automatically organize your file attachments. You can also connect Dokkio to Drive, Dropbox, and Slack. Sign up for free.


Lab2 - Aziz Sayigh

Page history last edited by Aziz Sayigh 7 years, 2 months ago



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


This code needs to be changed to make an external LED.

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;


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


The delay lines change the rate of blinking


void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(3000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(3000);               // wait for a second


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


Some sort of automatic shutoff after a while would protect the LED from staying on forever...




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


change the ledPin integer:


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


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.


just swap the booleans in the if statement, as below


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 == LOW) {    
    // 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?

int ledPin = 9; 


b) How would you change the rate of fading?


Change 'fadeValue += 5' to a different value


  // fade in from min to max in increments of 5 points:
  for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {


Part C 


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

0.03A * R = (5V - 3.2V) --> R = 60 ohms


actual V=3.8A .03A*r = 3.8-3.2




a.  Yes there is a lot of computation inside the device.  It's hard to get at it all without ruining the power, but labeled what we could (see photo attached).  But the main microprocessor, the baseband processor, the touch screen processing capability remain hidden underneath another layer.

2.  Sensors- Aceleromator, light sensor with the flash.  Obviously the touch screen is a big sensor.

3.  A micro-USB port charges the Lithium Ion battery, which in turn charges the phone.  

     There appears to be some regulation: when the battery is not touching the charge nodes the USB delivers only 3V of Power (which is not enough to light the Frankenlight).  The battery itself delivers 3.8 ohms, which is (barely) enough to power the Frankenlight.

4.  yes, can't see the internal memory, but there is the slot for SD card


3.  We are in a Catch 22- when the battery is removed, the USB only delivers 3.0 V to the system, and at no point in the system is the Voltage higher than that (confirmed using the Multimeter).  However, when we put the battery back in, it blocks our access to other parts of the system that could deliver current for us!  The only option is to use the battery, which delivers 3.8V of power:

3.8V from the battery --> 0.03A*R = 3.8-3.2 --> R = 20 ohms




Comments (0)

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