I'm doing some work with an accelerometer - using an iPhone as a granular sampler, basically - and I'm trying to make a 'zeroer' device, so that I can choose what position of the phone means 'play the sample normally'. My problem seems to stem from the way the accelerometer outputs data - for instance, moving the phone in a circle around one axis gives as x co-ordinates 0 to 1 in the first quadrant, 1 to 0 in the second quadrant, 0 to -1 in the the third quadrant and -1 to 0 in the fourth quadrant. I basically just want to add, say, 0.2 to all the data, but have it stay with in the range and change direction when it's supposed to....
...This has been causing me far more problems than I feel it should... any suggestions?
Thanks
Adam