[vc_row][vc_column][vc_column_text]
ADXL335 is a small, low-power three-axis accelerometer. It can monitor the impact of moving objects or dynamic acceleration resulting from vibration. pcDuino has hardware headers interface compatible with Arduino. ADXL335 on pcduino can be well used.
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column width=”1/1″][vc_tour][vc_tab title=”Parts list” tab_id=”1394011864-1-98″][vc_column_text]
Pcduino v2 × 1
ADXL335 module × 1
Several lines of DuPont
[/vc_column_text][/vc_tab][vc_tab title=”Wiring diagram” tab_id=”1394011864-2-3″][vc_column_text]ADXL335 GND -> pcDuino GND
ADXL335 Vcc -> pcDuino +3V
ADXL335 X -> pcDuino A4
ADXL335 Y -> pcDuino A3
ADXL335 Z -> pcDuino A2[/vc_column_text][/vc_tab][vc_tab title=”Software code” tab_id=”1394012592354-2-5″][vc_column_text]#include <core.h>
int RPotPin2 = 2;
int RPotPin1 = 1;
int RPotPin0 = 0;
int x = 0;
int y = 0;
int z = 0;
void setup (){
}
void loop (){
x = analogRead (RPotPin2);
y = analogRead (RPotPin1);
z = analogRead (RPotPin0);
printf (“x is %d,”, x);
printf (“ y is %d,”, y);
printf (“ z is %d\n”, z);
delay (1000);
}[/vc_column_text][/vc_tab][vc_tab title=”Run and results” tab_id=”1394012593264-3-1″][vc_column_text]Open the Arduino IDE on pcDuino, copy the last step code in it, then compile and run.
You can see the termial window pop up and display
The analog of x, y, z axis will always be printed on the screen. But it will produce an acceleration of the corresponding analog value changes produced three directions[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.