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

Koe Josephine Lab 4 Code

Page history last edited by Josephine 5 years, 2 months ago

#include <LiquidCrystal.h>

 

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()

{

  lcd.begin(16, 2); 

}

 

void loop()

{

  // print the sensor values:

  lcd.print("X");

  lcd.print(analogRead(xpin));

  // print a tab between values:

  lcd.print("  Y");

  lcd.print(analogRead(ypin));

  // print a tab between values:

  lcd.print("  Z");

  lcd.print(analogRead(zpin));

  // delay before next reading:

  delay(500);

  lcd.clear();

}

 

Comments (0)

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