| 
  • 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 Write-Up Beck

Page history last edited by Benjamin Tee 8 years ago

1

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

     int led = 13

     change to int led = 11;

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

     delay(1000);

     change to delay("desired blink rate");

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

     A resistor in series, to prevent shorting the circuit.

 

2

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

     int buttonPin = 13;

     change to int buttonPin = 9;

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. 

          const int buttonPin = 2;     

          const int ledPin =  9;     

          int buttonState = 0;    

 

          void setup() { 

               pinMode(ledPin, OUTPUT);      

               pinMode(buttonPin, INPUT);     

          }

 

          void loop(){ 

               buttonState = digitalRead(buttonPin);

               if (buttonState == LOW) {      

                    digitalWrite(ledPin, HIGH);  

               } else {

                    digitalWrite(ledPin, LOW); 

               }

          }

3

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

     N/A - no change necessary.

b) How would you change the rate of fading?

     change the value of delay

     alternatively one could increase or decrease the increments at which the fading animates.

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?

     Increase the increments of increase and decrease exponentially rather than linearly.

C

1. 

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

          R = (Vin - Vlight)/I

             = (5.0V - 3.2V)/.03Amps

             = 1.8V/.03A

             = 60 Ohms

D

1. Frankenlight Guitar

(RockBand wireless guitar controller used)

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

     The only computing device in the controller is its microcontroller.  All other computation is done by the actual gaming console (be      it XBox, PlayStation, et al.).  The microcontroller does nothing other than relay all of the information gathered from the devices      many sensors to the game console.

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

     The guitar is chock full of sensors.  There are 10 buttons along the frets, a strumming switch, a potentiometer (in the form of a      "whammy bar", another potentiometer (in the form of a pickup switch), an accelerometer, and a few more buttons on the body      that facilitate connection with the game console.  All of these devices are channeled through the microcontroller.

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 consistently supplied with power by 3 1.5V batteries. 

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

     No information is stored on the device.  Sensory data is immediately transferred to the game console.

4. Build your light!

      Please post a short video of your frankenlight to your lab report page. Include any schematics as well.

     http://www.youtube.com/playlist?list=PL2602840AC8C56602

 

Comments (1)

Benjamin Tee said

at 2:26 am on Jul 22, 2012

I like your vids! Awesome!~ Nice interview format! Great job hacking the frankenlight out of the rockband guitar.

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