I have a graphics display and accelerometer connected to my arduino that shows a ball the middle of the screen when level. When on a angle the ball moves to the right when it should lean towards the left. An easy fix would be to rotate the accelerometer 180 degrees but I was wondering if it can somehow be done in code. At 0 the ball is in the middle, -10 is to right when it should be on the left and 10 is to the left when it should be on the right. Somehow all the negative numbers have to be positive and the positive have to be negative.
Right now this is what I have.
float tempAccel = readAccel();
int abc=acc_data[0];
display.print((float) abc, 0 );