Is it a coding error?
Maybe. Does your code really look like that? Use the # icon above the row of smiley faces
// to get a nice code box
You can make the servo move the other way by doing something like:
pos=map(flexsum, 160, 238, 90, 0);
instead.
Or, leave the map alone, and use:
hip.write(180 - pos);
Noticethespacesthatmakethingseasiertoread.