Hi,
Can someone let me know how to do the following please? I'm using PIC BASIC and programming an 18F2431 PIC.

I am trying to move an arm around a 360 circle. For example if it is at 1degree and it needs to move to 2 degrees, then it should move cwise 1 degree. I want it always to take the shortest route. Example if the arm is at 1 degree and needs to move to 359 then how do I make it go ccwise? Because the motor moves if depending on whether ax is > or < than bx, but in this case 359 is > than 0 so it will go right round. Here is an example something like how I think it will work, but there isn't an OR in PICBASIC for this purpose.

If ax < bx Or
If bx - ax >= 180 Then
Gosub cwise
Endif
Endif

Help will be appreciated,

Camerart.