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

Yarnes Nathan Lab 4

Page history last edited by zahraa@... 5 years, 1 month ago

Part A

     a.

          In the serial monitor I read values from 0 to 1023.

 

     b.

          Because the maximum value is 1023, the ADC has 10bits of resolution.

 

Part B

     1.

          I read values between ≈160 and ≈500. The change in voltage is ≈ 2V.

 

     2.

          This is the code i used to display the X, Y, and Z orientation of the accelerometer:

 

 

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)

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()

{

  // initialize the serial communications:

  Serial.begin(9600);

  lcd.begin(16, 2);

}

 

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:

  lcd.setCursor(0, 0);

  lcd.print(analogRead(A3));

  lcd.setCursor(6, 0);

  lcd.print(analogRead(A2));

  lcd.setCursor(12, 0);

  lcd.print(analogRead(A1));

  delay(100);

}

 

Part C

     1.

          

NO State diagram -.5

Part D

     1. 

     2.

          a.

               Because the Arduino has 1KB of internal EEPROM the Atmega 32U4 can store 1,000 byte sized samples.

          b.

               For the information to b byte sized you divide the 10 bit analog values by 4 to equal 8 bits.

               1024/4= 256

 

No video -2

 

Comments (1)

xyyue@... said

at 2:34 pm on Aug 11, 2015

Well done.

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