Remap 8bit gyro signal

AndersNyman

New Member
Hi!

I have a picaxe 28x1 and a 3 axis gyro from sparkfun.
I want to remap the signal (-inf to inf) so I can prevent flipping.

The method that appears to me is something like this:

thisFrame = gyroSignal
rotationTable = 0
if thisFrame < 30 and lastFrame > 220:
rotationTable += thisFrame-lastFrame-255​
elif thisFrame > 220 and lastFrame < 30:
rotationTable += thisFrame-lastFrame+255​
else:
rotationTable += thisFrame-lastFrame​
lastFrame = gyroSignal


Is there a nicer way to do this?


/Anders
 

BeanieBots

Moderator
It's not clear (to me) what your want to do.

How does this data come into the PICAXE? (analogue? ASCII?)
What is the range?

Maybe give some numeric examples of what number should map to what other number.
 

boriz

Senior Member
Obviously he wants to "remap the signal (-inf to inf) so I can prevent flipping.".

Why not just add an inverted phase flip signal to the original half-map, providing the -inf does not overload.
 
Last edited:
Top