Part A: Making Sound
- a. How would you change the code to make the song play twice as fast?
Changing the numerator of the noteDuration will change how fast the song plays.
int noteDuration = 500 / noteDurations[thisNote];
- b. What song is playing? ;-)
Star wars song
Part B: Writing to the LCD
a. What voltage level do you need to power your display?
According to the spec sheet, a voltage of 5.0V will power the LCD display.
- c. What was one mistake you made when wiring up the display? How did you fix it?
The 10K potentiometer was not wired correct so the contrast was not correct. I fixed this by grounding the element.
- d. What line of code do you need to change to make it flash your name instead of "Hello World"?
lcd.print("ben!");
Part C. Potentiometer
a. Post a copy of your new code in your lab writeup.
int sensorPin = A0; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int sensorValue = 1; // variable to store the value coming from the sensor
void setup() {
}
void loop() {
sensorValue = analogRead(sensorPin) / 4;
// sets the value (range from 0 to 255):
analogWrite(ledPin, sensorValue);
}
- a. What resistance do you see with a Multimeter when the sensor is flat? When it is bent?
Flat – 9.1 kOhms
Bend – 30 kOhms
- b. What kind of voltages should we expect for the Arduino analog pin based on the sensor resistance?
c. How does the range of the LED's brightness change compared to the potentiometer?
Comments (0)
You don't have permission to comment on this page.