نمونه کد :
کد:
int x, Y, Z;
void Setup ().
{
Serial . BEGIN (9600);
}
void loop ()
{
x = AnalogRead (A0); // read from analog pin A0
Y = AnalogRead (A1); // read from analog pin A1
Z = AnalogRead (A2); // read from analog pin. A2 Serial . Print ( "accelerations are x, Y, Z:" );
Serial . Print (x, DEC ); // show the X-axis acceleration is number 10 Serial . Print ( "" );
Serial . Print (Y. , DEC ); // display the Y-axis acceleration is number 10 Serial . Print ( "" );
Serial . println (Z, DEC ); // display the number 10 is the Z-axis acceleration Delay (100); //. delay 100 milliseconds
}