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

Lab Report 3 - Flavio Castro

Page history last edited by castro.flaviojr@... 10 years, 8 months ago

a) For changing the speed of the song we can either decrease the size of the pauses(PausesBetweenNotes) in the delay function and decrease the note duration(noteDuration). 

So if you want it to be twice as fast you have to cut both in half. HOWEVER if you decrease the noteDuration value in half, that will also decrease the pauses because they proportional do the note duration.

 

b) StarWars

Part B

a) we need 5V to power our LCD

b) I didn't make any mistake.

c) the line with the print("hello World') function.

Part C

that's my code:

sensorValue = analogRead(sensorPin);    
sensorValue= sensorValue/2;
  analogWrite(ledPin, sensorValue);
  delay(50); 

a) When the sensor is flat the resistance is 9.7 K Ohms, when is bent it reaches 24k Ohms

b) Voltages smaller than half of the initial voltage of 5v

c) It changes a little bit less than the potentiometer

d) This is the code used to display the sensor value on the LCD:  

sensorValue = analogRead(sensorPin);
  lcd.clear();
  lcd.print(sensorValue);
  delay(200);

Force sensor

     0 from 400 Ohms to infinite

     the resistance is inversely proportional to the force applied
Code: that's my code for the game:
sensorValue = analogRead(sensorPin);
  sensorValue2 = analogRead(sensorPin2);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Player 1 ");
  lcd.print(sensorValue);
  if (sensorValue > sensorValue2) {
  lcd.print(" Win!");}else if (sensorValue == sensorValue2){lcd.print(" Draw");}
  lcd.setCursor(0, 1);
  lcd.print("Player 2 ");
  lcd.print(sensorValue2);
  if (sensorValue2 > sensorValue) {
  lcd.print(" Win!");}else if (sensorValue == sensorValue2){lcd.print(" Draw");}
  delay(200);   

http://www.youtube.com/watch?v=Ha9wRb48KKo

 

Comments (1)

Vivien Tsao said

at 12:10 am on Jul 29, 2013

-2 for unfinished report... good job overall!

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