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

Labb 4

Page history last edited by Benjamin Tee 11 years, 7 months ago

Part A

 

a)

 

it is between 0 and 1023

b) 10 bits.

I am using 7 bits.

 

Part B

 

 

a)

Voltage to distance plot.

http://www.youtube.com/watch?v=VY2Rk4C1lXs&feature=youtu.be

As we see in the video, when i am making my hand away, the voltages increase, and then decrease again. Like graph says.

 

 

 

2)

a)
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int xpin = A3;             
const int ypin = A2;              
const int zpin = A1;
void setup() {
  lcd.begin(16, 2);
}

void loop() {
  lcd.setCursor(0, 1);
 
  lcd.print(analogRead(xpin));
  lcd.print(" ");
  lcd.print(analogRead(ypin));
  lcd.print(" ");
  lcd.print(analogRead(zpin));
  lcd.print(" ");
  delay(100);
}
http://www.youtube.com/watch?v=l26KuuwFBUw&feature=youtu.be

 

Part C

1)

a)http://www.youtube.com/watch?v=cwYVl7oAPNw&feature=youtu.be

 

 

Part D

2)

a)1024

b)

By arithmetically

For example if there is 3.3Volts

5/2exp8 = 3.3/x

we must find x.

? I think you may have misunderstood the question. The question is how to convert something that is 10 bit to a byte (8 bit). But you got the idea right. Try again.

 

3)

a)

 

 

 

 

 

 

Comments (0)

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