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


lab 4 mario munoz

Page history last edited by Benjamin Tee 8 years, 1 month ago

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


it goes from 0 to 1036

✓ Did it really go above 1024?

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?


the resolution of the atmega32U4 is of 1024 bits or 1 kb

Not quite. 1 bit represents integer value of 2. so to get 1024, you will have 2^10 bits = 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?


mi sensor was a bit weird so it went from 0.6 to 4.2 and as I distanced away from it gradually the voltage would go up lineally but sometimes it would suddenly skip 0.3 volts up or it would suddenly increase or decrease.

Check your wiring or change a known working sensor to check if it is a sensor issue.


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




// these constants describe the pins. They won't change:

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:




void loop()


  // print the sensor values:


  // print a tab between values:



  // print a tab between values:




  // delay before next reading:



a. Turn in a copy of your final state diagram.


Untitled 8.pdf


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



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


1024/4 = 256


Comments (1)

Benjamin Tee said

at 9:23 pm on Aug 15, 2012

- 0.5 for Part 1
- 0.5 missing rotary encoder photo
- 0.5 for missing video

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