| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

KristofferBorgen_Lab4

Page history last edited by Vivien Tsao 7 years ago

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

 

 

 

 

 

 

 

 

 

Comments (1)

Vivien Tsao said

at 5:02 pm on Aug 10, 2013

Good job! :)

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