Skip to content

Commit 9b1df93

Browse files
authored
Create Basic.ino
1 parent de51d85 commit 9b1df93

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

examples/Basic/Basic.ino

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <7semi_ADXL335.h>
2+
3+
// Connect ADXL335 X/Y/Z outputs to A0, A1, A2
4+
ADXL335_7semi accel;
5+
6+
void setup() {
7+
Serial.begin(115200);
8+
accel.begin();
9+
Serial.println(" ADXL335 Accelerometer Reading");
10+
Serial.println("===========================================");
11+
}
12+
13+
void loop() {
14+
float x, y, z;
15+
accel.readG(x, y, z);
16+
17+
Serial.print("X: "); Serial.print(x, 2);
18+
Serial.print("g\tY: "); Serial.print(y, 2);
19+
Serial.print("g\tZ: "); Serial.print(z, 2);
20+
Serial.println("g");
21+
22+
delay(500);
23+
}

0 commit comments

Comments
 (0)