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

View

# QuinnMatheis_LabReport3 (1)

last edited by 7 years, 2 months ago

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

By changing this:

int noteDurations[] = {

4, 8, 8, 4,4,4,4,4 };

to this:

int noteDurations[] = {

8, 16, 16, 8,8,8,8,8 };

b. What song is playing? ;-)

STAR WARS

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

I need at least 4.7 Volts to power the LCD.

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

I did not wire the POT to ground as well.

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

Change : lcd.print("hello, world!") to lcd.print(“Quinn Matheis”).

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 = 0; // variable to store the value coming from the sensor

void setup() {

// declare the ledPin as an OUTPUT:

pinMode(ledPin, OUTPUT);

}

void loop() {

// read the value from the sensor:

// turn the ledPin on

analogWrite(ledPin, sensorValue);

}

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

When flat: 10.2K Ohms.

When bent: 19.4K Ohms.

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

VMax=10K Ohm/(10 K Ohm+10.2 K Ohm*5V=2.47 K Ohms.

VMin=10K Ohm/(10 K Ohm+19.4 K Ohm*5V=1.70 K Ohms.

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

A bit smaller.

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

Quinn Matheis : Lowly Multimeter.

//Include Library code.

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins

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

int analogPin = A0; //input pin for flex sensor.

int sensorValue = 0; //variable for the output from the flex sensor.

void setup() {

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

}

void loop() {

//Print message to LCD.

lcd.print(sensorValue);

delay(500);

lcd.clear();

}

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

0.2 K Ohms to an unreadably massive number (infinity?).

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

Perhaps there is a set of resistor circuits inside the sensor that connect…well more (for lack of a better word), with the greater amount of pressure you apply. Maybe it recognizes greater force on it and increases the resistance along the bottom somehow.

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

Quinn Matheis : Thumb Wrestling

//Determines the greater amount of force in a competitive game of thumb war

//include library code.

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins

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

int playerOne = A0 //Player 1's FSR

int playerTwo = A1 //Player 2's FSR

int sensorOne = 0; //variables for detecting force

int sensorTwo = 0; //from the players.

void setup() {

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

}

void loop() {

//Print result to LCD

lcd.print(sensorOne);

lcd.setCursor(5,0);

lcd.print(sensorTwo);

if (sensorOne > sensorTwo) {

lcd.setCursor(0,2);

lcd.print("Player 1 won :)");

}

else if (sensorOne = sensorTwo) {

lcd.setCursor(0,2);

lcd.print("It's a draw! :O");

}

else if (sensorOne < sensorTwo) {

lcd.setCursor(0,2);

lcd.print("Player 2 won :)");

}

delay(2000);

lcd.clear();

}

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

Fliqz has shut down their service. To access this video, email support with this video id: d990f399fdff411da6615d2c73033777