I would change the digitalWrite(led,HIGH) and digitalWrite(led,Low) and the delay lines.
To blink the light needs to be on delay until it goes off
✓
I would change the delay to a smaller or larger time to change the rate of blinking.
✓
Add a resistor to limit the voltage and current flowing through so it can’t blow up.
✓
Lines:
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.
// 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 off:
digitalWrite(ledPin,LOW);
}
else {
// turn LED on:
digitalWrite(ledPin, HIGH);
}
}
✓
a) Which line(s) of code do you need to modify to correspond with your LED pin?
Change the intledPin = ; to whatever number your LED is connected to.
✓
b) How would you change the rate of fading?
I would change the fadeValue in the “for” functions.
✓
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?
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.)
(5V – 3.2V) = R*(30/1000A)
R= 60 Ω
✓
a. Is there computation in your device? Where is it? What do you think is happening inside the "computer?"
Yes, the Virtex -2 Pro XC2VP30 has a shiny silver computer in the center of the FPGA. Inside there it is controlling and relaying information.
✓
No there are no sensors, only buttons and switches to turn things on and off.
✓
There are internal and external power supplies. That can provide from 5v to 1.5v, they are dispersed through the system by the board and computer with many switches.
✓
Yes there are RAM added and a slot for RAM. These can store information.
✓
Please post a short video of your frankenlight to your lab report page. Include any schematics as well.
- http://www.youtube.com/watch?v=_eEmzfVVCUk&feature=youtu.be
✓