KristofferBorgen_Lab4


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

 

0-10,000

 

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 bits (2^10 = 1024)

 

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?

 

When an object was far away the voltage would drop down to almost 0 but as i brought the object or sensor closer it increased the voltage to about 3V

 

a. Include your accelerometer read-out code in your write-up.

 

const int xpin = A3;                  // x-axis of the accelerometer

const int ypin = A2;                  // y-axis

const int zpin = A1;                  // z-axis (only on 3-axis models)

 

void setup()

{

  // initialize the serial communications:

  Serial.begin(9600);

}

 

void loop()

{

  // print the sensor values:

  Serial.print(analogRead(xpin));

  // print a tab between values:

  Serial.print("\t");

  Serial.print(analogRead(ypin));

  // print a tab between values:

  Serial.print("\t");

  Serial.print(analogRead(zpin));

  Serial.println();

  // delay before next reading:

  delay(100);

} 

 

a. How many byte-sized data samples can you store on the Atmega32U4?

 

1,024

 

b. How would you get your analog data from the ADC to be byte-sized?

 

ADC is a 10 bit sample 

✓ What does this mean? -0.5