adxl 335 code

I'm trying to connect a adxl 335 to my arduino uno. I followed the directions on this site

and used the code listed there, but my serial monitor isn't giving me numbers, only a bunch of gibberish.

anyone know what's wrong?


You've got the wrong bit rate set? You've got a TTL to RS232 conversion issue?

I got a different code, and now it is working. Thanks

And what was the problem (so that others may learn from your experience) ?

I'm not sure what the problem was!!! However, here is how i hooked it up as well as my code:adxl 335-arduino uno st-A0 z-A1 y-A2 x-A3 gnd-A4 vcc-A5

My code is:

 This example code is in the public domain.


// these constants describe the pins. They won't change:
const int groundpin = 18;             // analog input pin 4 -- ground
const int powerpin = 19;              // analog input pin 5 -- voltage
const int xpin = A3;                  // x-axis of the accelerometer
const int ypin = A2;                  // y-axis
const int zpin = A1;                  // z-axis (only on 3-axis models)

void setup()
  // initialize the serial communications:
  // Provide ground and power by using the analog inputs as normal
  // digital pins.  This makes it possible to directly connect the
  // breakout board to the Arduino.  If you use the normal 5V and
  // GND pins on the Arduino, you can remove these lines.
  pinMode(groundpin, OUTPUT);
  pinMode(powerpin, OUTPUT);
  digitalWrite(groundpin, LOW); 
  digitalWrite(powerpin, HIGH);

void loop()
  // print the sensor values:
  // print a tab between values:
  // print a tab between values:
  // delay before next reading:

Thank you so much!!!