Another way to measure the amount the wheel rotated is to use a signed angle difference. It’s like the anglediff(a,b) expression but is negative if counter clockwise.
angle(0,0,cos(b-a),sin(b-a))
Will work as long as the rotation is less than 180 in a frame. You could also just use anglediff in this case I suppose since the wheel is rotating only one way.
TotalRotation=0
PrevAngle=0
Every tick
— add angle(0,0,cos(wheel.angle-prevAngle),sin(wheel.angle-prevAngle)) to totalRotation
— set prevAngle to wheel.angle