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

Akshay Trikha Lab 3

Page history last edited by zahraa@... 8 years, 8 months ago

Part (A)

 

1)

 

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

 

The line of code you would need to change is “int noteDuration = 500”. By halving the note duration, the song would play twice as fast.

✔ 

 

b. What song is playing? ;-)

 

It’s the “Main Title” of Star Wars, written by John Williams and performed by the London Symphony Orchestra!!!!

✔ 

 

Part (B)

 

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

 

5 Volts.

✔ 

 

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

 

Hahahaha, this one’s funny.

 

While getting confused with the overwhelming amount of wires on my breadboard, I accidentally reversed the complete order of 1-16 on the LCD. This resulted in weird symbols and many progressive flickers on the screen and it took me an entire 20 mins to figure out what my blunder was!

✔ 

 

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

 

The line of code you would need to change is “ lcd.print("Akshay Trikha"); “

✔ 

 

Part (C)

 

1)

 

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

 

#include <LiquidCrystal.h>

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

 

int sensorPin = A0;    

int ledPin = 13;      

int senseValue = 0;

int ledBrightness = 0;

 

void setup() {

 pinMode(ledPin, OUTPUT);

 lcd.begin(16,2);

}

 

void loop() {

senseValue = analogRead (sensorPin);

byte ledBrightness = map (senseValue, 0, 1023, 0, 255);

analogWrite (ledPin, ledBrightness);

lcd.print(analogRead(sensorPin));

}

✔ 

 

2)

 

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

 

When it is flat I see around 10k Ohms resistance. When it is bent I see around 50k Ohms resistance.

✔ 

 

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

 

R1 = 10k or 50k Ohms

 

R2 = 27k Ohms

 

  • Voltage Output = [R2/(R1+R2)] * Voltage Input = 27/37 + 3.3 = 2.41V

  • Voltage Output = [R2/(R1+R2)] * Voltage Input = 27/77 + 3.3 = 1.16V

✔ 

 

So the voltage range to expect would be 1.16 to 2.41V. (Depending on whether the flex sensor is bent or not)

 

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

 

The potentiometer goes from 0 -5V which means that it goes from completely dim to very very bright.

However when connected to the flex sensor, the LED is supplied with much less voltage and so is not as bright as when it is connected to the potentiometer.

✔ 

 

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

 

int sensorPin = A0;    

int ledPin = 13;      

int senseValue = 0;

int ledBrightness = 0;

void setup() {

 pinMode(ledPin, OUTPUT);

}

 

void loop() {

senseValue = analogRead (sensorPin);

byte ledBrightness = map (senseValue, 0, 1023, 0, 255);

analogWrite (ledPin, ledBrightness);

lcd.print(analogRead(sensorPin));

}

 

✔ 

3)

 

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

 

I see 0 Ohms when there is no force sensed, and a maxiumum of 1k Ohms when maximum force is detected by the sensor.

Resistance should be very high (infinite or M Ohms) when the FSR is not pressed. Resistance should lower to a few hundred Ohms, or low K Ohms, when pressed hard. -0.5

 

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

 

This relationship is one that is logarithmic, as it can be seen in the data sheet as a logarithmic curve.

 

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

 

int forceSensorOne = 0;

int forceSensorTwo = 0;

int ledOne = 9;

int ledTwo = 10;

 

void setup() {

 

pinMode(led, OUTPUT);

}

 

void loop() {

 

switch(win) {

 case 1: {

 (analogRead(forceSensorOne) > analogRead(forceSensorTwo))

  pinMode(ledOne, HIGH);

  break;

 }

 case 2: {

 (analogRead(forceSensorTwo) > analogRead(forceSensorOne))

 pinMode(ledTwo, HIGH);

 break;

 }

}

 

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

 

Comments (1)

zahraa@... said

at 5:32 pm on Aug 10, 2015

good job

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