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

Lab 3 - July 10

Page history last edited by Peirol Gomes 6 years, 9 months ago

Lab 3 - 

 

Part B. Writing to the LCD

 

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

You need 5V to power it

 

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

None

 

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

I have to change this line...
  lcd.print("Hello");
and put
  lcd.print("Peirol Gomes");

 

Part C. Fancy Inputs

 

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

int sensorPin = A0;    // select the input pin for the potentiometer

int ledPin = 02;      // 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);

  pinMode(sensorPin, INPUT);  

}

 

void loop() {

  // read the value from the sensor:

  sensorValue = analogRead(sensorPin);    

  // 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?

 

flat ~ 8.1 kOhm

bent ~ 9.1 kOhm

 

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

 

I tested my maximum value with a potentiometer, and my display gave 1023

 

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

 

Considering the fact that the resistance of the sensor is too high, the brightness is 0. 

 

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

 

// include the library code:

#include <LiquidCrystal.h>

 

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

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

int sensorPin = A0;    // select the input pin for the potentiometer

int sensorValue = 0;  // variable to store the value coming from the sensor

 

void setup() {

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

  lcd.begin(16, 2);

}

 

void loop() {

  sensorValue = analogRead(sensorPin);

  lcd.print(sensorValue);

  delay(500);

  lcd.clear();

}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Comments (1)

Vivien Tsao said

at 11:34 pm on Jul 28, 2013

? nothing here

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