Lab4


Part A.  Writing to the Serial Monitor

 

Lab3 report of Cansu Paksoy was check+ .

 

a. Based on the readings from the serial monitor, what is the range of the analog values being read?

The range is 0-1023.

b. How many bits of resolution does the analog to digital converter (ADC) on the Atmega32U4 have (hint: where might you look to find this sort of thing)? How many are you using with the range of values you're seeing?

10.

Part B. Voltage Varying Sensors 

 

1. IR Distance Sensor

 

a. Describe the voltage change over the sensing range of the sensor. A sketch of voltage vs. distance would work also. Does it match up with what you expect from the datasheet?

It increased and decreased.

 

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

 

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

2. Accelerometer

The code is;

#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=4dDy_dDVC8E&feature=youtu.be

Part C. Count/Time-Based Sensors

 

1. Rotary Encoder

 

a. Upload a picture of your rotary encoder in action!

 

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