0% found this document useful (0 votes)
3 views2 pages

MV project code

Uploaded by

Riasat Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

MV project code

Uploaded by

Riasat Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <LiquidCrystal.

h>

const int RS = 12;


const int EN = 11;
const int D5 = 5;
const int D4 = 4;
const int D3 = 3;
const int D2 = 2;
int Xread;
int Xrest;

int Yread;
int Yrest;

int Zread;
int Zrest;

double Gx;
double Gy;
double Gz;

int xpin = A0;


int ypin = A1;
int zpin = A2;

int t1;

LiquidCrystal lcd(RS, EN, D5, D4, D3, D2);

void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
digitalWrite (13, HIGH);
delay(1000);
Xrest = analogRead(xpin);
Serial.print(Xrest);

Yrest = analogRead(ypin);
Serial.print(Yrest);

Zrest = analogRead(zpin);
Serial.print(Zrest);

digitalWrite(13, LOW);
}

void loop() {
Serial.print("Time ");
t1=millis();
Serial.println(t1*0.001);

Xread = analogRead(xpin)-Xrest;
Yread=analogRead(ypin)-Yrest;
Zread=analogRead(zpin)-Zrest;

Gx=Xread/67.584;
Gy=Yread/67.584;
Gz=Zread/67.584;
Serial.print("Acceleration X :");
Serial.print(Gx);
Serial.print("Acceleration Y :");
Serial.print(Gy);
Serial.print("Acceleration Z :");
Serial.print(Gz);
Serial.print("\n");

lcd.setCursor(0, 0);
lcd.print("gx:");
lcd.print(Gx);
lcd.setCursor(8, 0);
lcd.print("gy:");
lcd.print(Gy);
lcd.setCursor(0, 1);
lcd.print("gz:");
lcd.print(Gz);
delay(100);
lcd.clear();
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy