Help with ADXL345 accelerometer and IDG 500 gyroscope

Hello everybody. Im new to this arduino stuff. I've tried running some of the tutorials for the ADXL345 accelerometer and the IDG500 gyroscope; I can successfully say that they are not working for me. I am working on a project which involves creating an interactive game controller for the PC using both an accelerometer and gyroscope to play games like battlefield 3 and what not.

I have a feeling that the first suggestion might be about the wiring. I did some research and found many wiring methods for both sensors. This is wiring schematic I used for the ADXL345:

This is the one I used for the IDG500:

Any and all help would be greatly appreciated.

Are the both not working? If so, you are asking two questions.

Can you add links to the sensor boards (just copy the url in your message).
Is this your breakout board for the accelerometer ? http://www.sparkfun.com/products/9156
Is this your breakout board for the gyro ? Gyro Breakout Board - IDG500 Dual 500°/s - SEN-09094 - SparkFun Electronics

I suggest to start with the gyro.
It has an onboard voltage regulator, so use 5V, and connect the analog outputs to analog inputs of the Arduino.
The picture for the gyro is good.

Get the gyro running, before trying to communicate with the accelerator breakout board.
The accelerator breakout board needs the "Wire" library for I2C. The voltage must be 3.3V (from the Arduino board). It also needs 2 pull-up resistors of 4k7 to the 3.3V for the I2C bus, and the CS line has to be connected to the 3.3V to select I2C.
So before trying to communicate with the accelerator breakout board, you should try a few sketches to get to know the Arduino. Try the example for the blinking led first.

Yea those are the boards I am using. I will look into trying that out thanks.

Here is tutorial for ADxl345 and ITG 3200.. not IDG 500
http://www.electrodragon.com/?p=3683

OK, so I ran the blinking LED code and I got it to work.

I also, ran an example code for the gyroscope:

/*
Sample code for the gyroscope
*/

// analog Pin 0 has the x output on the gyroscope connected to it
// analog Pin 1 has the y output on the gyroscope connected to it
// Name it:

int x, y;

void setup()
{
  Serial.begin(9600); // sets the serial port to 9600
}

void loop()
{
  x = analogRead(0); // read analog input pin 0
  y = analogRead(1); // read analog input pin 1
  Serial.print("rotational rates are x, y: ");
  Serial.print(" "); // prints a space between the label and the first number
  Serial.print(x, DEC); // print the rotational rate in the X axis
  Serial.print(" "); // prints a space between the numbes
  Serial.print(y,DEC); // print the rotational rate in the Y axis
  Serial.print('\n'); // prints on the next line
  delay(500);
}

This is what I got:
rotational rates are x, y: 270 272
rotational rates are x, y: 270 272
rotational rates are x, y: 269 267
rotational rates are x, y: 272 272
rotational rates are x, y: 275 275
rotational rates are x, y: 251 273
rotational rates are x, y: 257 273
rotational rates are x, y: 255 271
rotational rates are x, y: 267 270
rotational rates are x, y: 304 271
rotational rates are x, y: 270 282
rotational rates are x, y: 270 285
rotational rates are x, y: 270 279
rotational rates are x, y: 272 267
rotational rates are x, y: 274 254
rotational rates are x, y: 268 253
rotational rates are x, y: 271 286
rotational rates are x, y: 265 274
rotational rates are x, y: 253 273
rotational rates are x, y: 271 273
rotational rates are x, y: 272 272
rotational rates are x, y: 282 274
rotational rates are x, y: 270 272
rotational rates are x, y: 269 271
rotational rates are x, y: 264 271
rotational rates are x, y: 254 265
rotational rates are x, y: 277 278
rotational rates are x, y: 267 269
rotational rates are x, y: 270 270
rotational rates are x, y: 270 272
rotational rates are x, y: 309 275
rotational rates are x, y: 284 276
rotational rates are x, y: 285 270
rotational rates are x, y: 295 269
rotational rates are x, y: 260 275
rotational rates are x, y: 279 273
rotational rates are x, y: 297 274
rotational rates are x, y: 269 271
rotational rates are x, y: 225 276
rotational rates are x, y: 269 272
rotational rates are x, y: 270 272
rotational rates are x, y: 279 273
rotational rates are x, y: 301 276
rotational rates are x, y: 267 271
rotational rates are x, y: 270 273
rotational rates are x, y: 275 272
rotational rates are x, y: 280 262
rotational rates are x, y: 274 271
rotational rates are x, y: 270 272
rotational rates are x, y: 274 266
rotational rates are x, y: 272 270
rotational rates are x, y: 268 273
rotational rates are x, y: 267 272
rotational rates are x, y: 269 271
rotational rates are x, y: 227 268
rotational rates are x, y: 255 273
rotational rates are x, y: 271 270
rotational rates are x, y: 270 273
rotational rates are x, y: 225 274
rotational rates are x, y: 271 273
rotational rates are x, y: 272 279
rotational rates are x, y: 271 269
rotational rates are x, y: 264 297
rotational rates are x, y: 270 272
rotational rates are x, y: 271 271
rotational rates are x, y: 250 208
rotational rates are x, y: 260 237
rotational rates are x, y: 268 278
rotational rates are x, y: 261 265
rotational rates are x, y: 265 285
rotational rates are x, y: 268 258
rotational rates are x, y: 296 294
rotational rates are x, y: 213 277
rotational rates are x, y: 305 266
rotational rates are x, y: 216 281
rotational rates are x, y: 314 352
rotational rates are x, y: 272 260
rotational rates are x, y: 304 288
rotational rates are x, y: 251 272
rotational rates are x, y: 269 250
rotational rates are x, y: 320 277
rotational rates are x, y: 262 249
rotational rates are x, y: 250 273
rotational rates are x, y: 304 303
rotational rates are x, y: 235 217
rotational rates are x, y: 274 278
rotational rates are x, y: 256 253
rotational rates are x, y: 347 306
rotational rates are x, y: 220 291
rotational rates are x, y: 240 239
rotational rates are x, y: 289 267
rotational rates are x, y: 265 274
rotational rates are x, y: 272 278
rotational rates are x, y: 286 262
rotational rates are x, y: 259 263
rotational rates are x, y: 273 267
rotational rates are x, y: 267 277
rotational rates are x, y: 257 237
rotational rates are x, y: 253 285
rotational rates are x, y: 367 253
rotational rates are x, y: 257 276
rotational rates are x, y: 222 280
rotational rates are x, y: 271 273
rotational rates are x, y: 270 271
rotational rates are x, y: 263 299
rotational rates are x, y: 271 271
rotational rates are x, y: 270 272
rotational rates are x, y: 266 264
rotational rates are x, y: 269 272
rotational rates are x, y: 275 263
rotational rates are x, y: 270 271
rotational rates are x, y: 271 272
rotational rates are x, y: 267 279
rotational rates are x, y: 275 256
rotational rates are x, y: 270 272
rotational rates are x, y: 271 271
rotational rates are x, y: 315 375

Is this whats supposed to be happening or is something wrong with the code?

For the accelerometer, I was looking and that schematic is right. Thats the schematic for it if I wanted to use it in SPI mode. After doing some research , I found out that SPI is faster than I2C. Which do you think would be better to use in this case?

The sensor values look okay.
Do they change if you tilt the sensor in all directions ?

I always recommend I2C, since it is a well defined protocol. Only if you must have a higher speed, you can use SPI.

Yes, the values do change. Sometimes they stay the same, but thats probably because I moved it back to the starting position before the reading was taken.

I think for what I am going to be using it for, I might need the SPI. Thats only if the I2C is much slower than I need the mouse to move.

I think that even for a "fast" gaming mouse, the I2C is still 100 times faster than what you need.

Alright, which ever is easier to code. So I m going to give that a try either later tonight or tomorrow and will post the results. Thanks for the help man.

Edit: also, the two resistors for the accelerometer have to be 4007 ohms? or could it be more like 2 x 10k resistors?

So I tried to get the accelerometer to work, but it wasn't cooperating. The main errors were with the code. I had got them from two places: (1) http://codeyoung.blogspot.com.es/2009/11/adxl345-accelerometer-breakout-board.html, (2)https://www.loveelectronics.co.uk/Tutorials/12/adxl345-accelerometer-arduino-tutorial (note: the second one supplied a library which I think does all the initializing and what not).

I had success with neither example. I would get errors like this:
sketch_aug12a:5: error: 'ADXL345' does not name a type
sketch_aug12a.cpp: In function 'void setup()':
sketch_aug12a:17: error: 'accel' was not declared in this scope
sketch_aug12a:17: error: 'ADXL345' was not declared in this scope
with the example from the second source. The first source I got to work, but some of the functions were outdated and I didn't quite know how to implement them now since the board I am using is a Leonardo (Arduino). I would get outputs with the example from the first looking like this:
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0

Anyone have some suggestions?

Edit: I got the code to compile but now it won't give me any outputs in the serial monitor. I had to modify the Loveelectronics ADXL 345 library to work with arduino 1.0.1.

moderator, delete this thread. no longer relevant; problem solved

That's no reason to delete this thread.
I you write how you solved it, and what code you used, it might be helpful for others.