Lab 3 - Ashley Mills



Making Sounds:

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

int pauseBetweenNotes = (noteDuration*1.3)/2

What song is playing?

Star Wars Theme


Writing to the LCD:

What voltage level do you need to power your display?

5 V

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

I did not sodder the pins to the display properly, so while the backlight turned on, nothing showed up on the LCD screen. Once I soddered every pin carefully, it worked perfectly.

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

lcd.print("hello, world!");


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

int sensorPin = A0;

int ledPin = 13;  

int sensorValue = 0;  

void setup() {

 pinMode(ledPin, OUTPUT);


void loop() {

 sensorValue = analogRead(sensorPin);

 analogWrite(ledPin, sensorValue);              



Flex Sensor:

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






What kind of voltages should we expect for the Arduino analog pin based on the sensor resistance?






How does the range of the LED's brightness change compared to the potentiometer?






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


 sensorValue = analogRead(sensorPin);

 int R = map(sensorValue, 512, 1023, 24, 65);

 int V = 5*(24/(R+24));

 lcd.print("Resistance = ");


 lcd.setCursor(0, 1);

 lcd.print("Voltage = ");



Force Sensitive Sensor:

What resistance values do you see from your force sensor?






What kind of relationship does the resistance have as a function of force applied?






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

#include <LiquidCrystal.h>


LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int sensorPin1 = A0;

int sensorPin2 = A1;

int sensorVal1, sensorVal2, winner;


void setup() {

 lcd.begin(16, 2);



void loop() {



sensorVal1 = analogRead(sensorPin1);

 sensorVal2 = analogRead(sensorPin2);


 if (sensorVal1 > sensorVal2)  winner = 1;

 else winner = 2;


 if (sensorVal1==0||sensorVal2==0)   lcd.print("Ready?");


lcd.print("Player ");


lcd.print(" is winning!");