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



Page history last edited by Martin Sanner 7 years ago

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

2^10-1(10 bits, including the 0, so 1023 different possible Values).

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?

According to the Arduino.cc website, it has 20 bits. As stated in a., i'm only using 10.


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?

The Voltage decreases with increasing length of view. That turns out to be what i expected, since i imagined it to work as an electronic echolot.



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

31    33    0
16    14    0
6    0    43
35    33    0
0    0    0
33    0    0
27    17    19
15    0    0
31    0    31
0    0    0
0    0    0
9    0    15
25    40    0
41    21    43
37    6    0
2    6    0





 Reads an Analog Devices ADXL3xx accelerometer and communicates the

 acceleration to the computer.  The pins used are designed to be easily

 compatible with the breakout boards from Sparkfun, available from:





 The circuit:

 analog 0: accelerometer self test

 analog 1: z-axis

 analog 2: y-axis

 analog 3: x-axis


 created 2 Jul 2008

 by David A. Mellis

 modified 4 Sep 2010

 by Tom Igoe


 This example code is in the public domain.



 #include <string>
 // include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// 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:
  lcd.begin(16, 2);



void loop()


  // print the sensor values:

  // print a tab between values:

  lcd.print ("");
  // print a tab between values:


  // delay before next reading:



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



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

Will do so :)

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

Since the Arduino micro has got 1kbyte of EEPROM, we can store 1000 Samples.

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

We have to divide the data by 10, since the analogreadfunction returns a 10 byte-value.

Comments (1)

Vivien Tsao said

at 5:19 pm on Aug 10, 2013

Good job!! ... are you sure about 2b though? -0.5

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