I have two Parallax H48C 3-axis accelerometer and I am using the example code found on the playground (http://playground.arduino.cc/Main/ParallaxH48C
). The example code only supports one accelerometer but I wish to use two on the same arduino. After reading the data sheet it said I could use the same arduino I/O pins but I would have to run the CS pin to different arduino pins. My solution is to run them alternately by running the example once then increase a variable by one. If the number is even then CS = accelerometer1 but if the number is odd then CS = accelerometer2. I have tried this for several hours but I can’t get my code to use the new CS pin number at every start.
Let me simplify this I DO have a way to change the number and I can see it change when I print it on serial but the code will not use the new number as the new CS pin number.
If someone can explain what’s happening or if you can modify the example to incorporate two accelerometers running alternately that would be great