Skip to content

Commit

Permalink
Added XBee packet grapher, serial version
Browse files Browse the repository at this point in the history
  • Loading branch information
tigoe committed Aug 18, 2013
1 parent 2d40831 commit 30e6035
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions AccelerometerADXL335/AccelerometerADXL335.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
ADXL335 Accelerometer
This example reads an ADXL335 accelerometer (Adafruit breakout board model)
and prints either the analogRead value from each axis.
Circuit:
* ADXL335 attached to pins A0 - A5 as follows:
** Vin: A0
** GND: A2
** X axis: A5
** Y Axis: A4
** z Axis: A3
created 18 Aug 2013
by Tom Igoe
*/

void setup() {
pinMode(A0, OUTPUT); // Vin for accelerometer
pinMode(A2, OUTPUT); // ground for accelerometer
digitalWrite(A0, HIGH); // make A0 a voltage supply for the accelerometer
digitalWrite(A2, LOW); // make A2 ground for the accelerometer
Serial.begin(9600);
}

void loop() {
int xAxis = analogRead(A5); // Xout pin of accelerometer
Serial.print("x: ");
Serial.print(xAxis);

int yAxis = analogRead(A4); // Yout pin of accelerometer
Serial.print("\ty: ");
Serial.print(yAxis);

int zAxis = analogRead(A3); // Zout pin of accelerometer
Serial.print("\tz: ");
Serial.println(zAxis);
}



0 comments on commit 30e6035

Please sign in to comment.