Globe Motor

We have a globe motor set to a speed controller on the RC and we have two digital switches on the OI to control it. What do we set the PWM to in the Serout command?

Here’s my suggestion:

globe_motor VAR byte              ' put this in the "declare variables" section

' Main Loop:

globe_motor = 127 + (127*switch_one) - (127*switch_two)

You gotta put the globe_motor in your serout, in whatever PWM output you want.

With this code, the motor will turn CW if switch_one is pressed, and CCW if switch_two is on. If both are pressed, nothing happens.

Hope I helped, feel free to ask any question. :slight_smile:

Just a quick question -

Is PBASIC operand supportive? For example, would it work mathematically left to right, do exponents before subtraction, etc?

It works from left to right, period.
For example:
In normal math, you would multiply 2 by 6 and then add 3, for a total of 15. In PBasic, you sum 2 to 3 and then multiply by 6, resulting in 30. You have to use parentheses if you want to give any operation priority over another.

Hope I was clear. :slight_smile: