| 
  • 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 3 - Ashley Mills

Page history last edited by Ashley Mills 10 years, 11 months ago

 

 

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!");

Potentiometer:

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?

 

 


  • 4.8 mohms; 6.5 mohms

 

 

 

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

 

 

  • 5V

 

 

 

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

 

 

  • It is a more limited range than that of the potentiometer

 

 

 

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

 lcd.clear();

 sensorValue = analogRead(sensorPin);

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

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

 lcd.print("Resistance = ");

 lcd.print(R);

 lcd.setCursor(0, 1);

 lcd.print("Voltage = ");

 lcd.print(V);

 

Force Sensitive Sensor:

What resistance values do you see from your force sensor?

 

 

  • 10 ohms when left alone, 0 when pressed

 

 

 

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

 

 

  • inverse linear

 

 

 

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() {

 lcd.clear();

 

sensorVal1 = analogRead(sensorPin1);

 sensorVal2 = analogRead(sensorPin2);

 

 if (sensorVal1 > sensorVal2)  winner = 1;

 else winner = 2;

 

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

 else{

lcd.print("Player ");

lcd.print(winner);

lcd.print(" is winning!");

 }

}

 

Timer:

       

 

 

Comments (0)

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