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

View
 

Sarah's Lab 3: Digital Timer

Page history last edited by sgonzaga@stanford.edu 7 years, 2 months ago

Part A. Making Sounds:

a. How would you change the code to make the song play twice as fast?

double the duration values in the array

// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
  4, 8, 8, 4,4,4,4,4 };

 

OR half this:

int noteDuration = 1000/noteDurations[thisNote];

becomes

int noteDuration = 500/noteDurations[thisNote];

 

b. What song is playing? ;-)

Star Wars theme

 

Part B. Writing to the LCD

a. What voltage level do you need to power your display?

 

 

b. What was one mistake you made when wiring up the display? How did you fix it?

I wired the potentiometer incorrectly/didn't understand the diagram at first. Pin 3 is attached to the middle pin on the pot.

 

c. What line of code do you need to change to make it flash your name instead of "Hello World"?

  // Print a message to the LCD.
  lcd.print("hello, world!"); 

REPLACE with
  lcd.print("sarah!");

 

 

Part C. Fancy Inputs

1. Potentiometer

a. Post a copy of your new code in your lab writeup.

 

2. Flex Sensor

a. What resistance do you see with a Multimeter when the sensor is flat? When it is bent?

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?

 

d. Include a copy of your Lowly Multimeter code in your lab write-up.

 

3. Force Sensor

a. What resistance values do you see from your force sensor?

b. What kind of relationship does the resistance have as a function of force applied? (e.g., linear?)

c. Include a copy of your FSR thumb wrestling code in your lab write-up.

 

 

Part D. Timer

a. Make a short video showing how your timer works, and what happens when time is up!

b. Post a link to the Lab 3 Timers Hall of Fame.

 

Comments (0)

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