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

  • Social distancing? Try a better way to work remotely on your online files. Dokkio, a new product from PBworks, can help your team find, organize, and collaborate on your Drive, Gmail, Dropbox, Box, and Slack files. Sign up for free.

View
 

KristofferBorgen_Lab3

Page history last edited by dodgerdogkris@... 6 years, 10 months ago

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

 

I would change the note duration to play faster i doubled all the notes

 

b. What song is playing? ;-)

 

Star Wars theme song!!!!!!!!!!!

 

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

 

4.5 Volts is the recommended input

 

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

 

I am not sure what my wiring mistake was. When i was trying to trouble shoot it  i felt that all the wires were connected so i ripped them all out and rewired the LCD again and it worked.

 

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

 

The line where it prints out "Hello World" i changed it so that it said my name "Kristoffer Borgen"

 

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

 

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int sensorPin = A0;  
int ledPin = 9;  
int sensorValue = 0;  

void setup()

{
  pinMode(ledPin, OUTPUT);
  lcd.begin(16, 2);    
}

void loop()

{
  sensorValue = analogRead(sensorPin);   
  lcd.clear();
  lcd.print(sensorValue);
  analogWrite(ledPin, sensorValue); 
  delay(500);

}

 

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

 

Straight: Roughly 10.5K Ohms 

Bent: One way 35K Ohms. Other way 9K ohms

 

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

 

Anywhere from 0.9V to 0.675V using the 3.3V out

 

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

 

When the flex sensor is straight and bent one way it matches the potentiometer but if its bent the other way then it is considerably higher resistance.

 

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

 

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int sensorPin = A0; 
int ledPin = 9; 
int sensorValue = 0; 

void setup()

{
  pinMode(ledPin, OUTPUT);
  lcd.begin(16, 2);    
}

void loop() {
  sensorValue = analogRead(sensorPin);   
  lcd.clear();
  lcd.print(sensorValue);
  analogWrite(ledPin, sensorValue); 
  delay(500);                       
}

 

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

 

Infinity and beyond! to 400 Ohms 

 

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

 

The datasheet shows an exponential so force^2

 

c. 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 force1 = A0;  

int force2 = A1;
int forceValue1 = 0;
int forceValue2 = 0;

void setup()

{
  lcd.begin(16, 2);    
}

void loop()

{
  forceValue1 = analogRead(force1);   
  forceValue2 = analogRead(force2);   
  lcd.clear();
  if(forceValue1 < forceValue2)
    lcd.print("force1 is winning!");
  else 
    lcd.print("force2 is winning!");
  delay(30);                       
}

 

 

Comments (1)

Vivien Tsao said

at 12:00 am on Jul 29, 2013

Good job. :] 10/10

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