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

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

BW_LAB_3

This version was saved 8 years, 9 months ago View current version     Page history
Saved by Benjamin Wang
on July 20, 2015 at 11:24:16 am
 

Part A: Making Sound

 

  1. 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];

 

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

 

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

 

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

  }

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

 

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