I'm hacking my way through Python;
Right now I'm trying to get the heading of a robot using a magnetometer using Python. The problem is I want to be able to set "North" by mapping the degree based values onto my own set. If I were programming the Arduino I'd use the map() function. Is there anything similar in Python?
// how many degrees are we off
int diff = compassValue-direc;
// modify degress
if(diff > 180)
diff = -360+diff;
else if(diff < -180)
diff = 360+diff;
// Make the robot turn to its proper orientation
diff = map(diff, -180, 180, -255, 255);