Listing 9.1: Cut and paste this program into the code window of the OOPic Multi-language Compiler

'A motor control program using the Pololu
'micro dual serial motor controller and
'the oSerialx object.

Dim S As New oSerialx
Dim R As New oDio1

Sub Main()
R.IOLine = 31
S.Baud = cv4800
S.IOlineS = 30
S.Operate = cvTrue
R.Direction = cvoutput
OOPic.Delay = 50

Do
R.Invert 'Invert reset pin

'Motor 1
S.Value = 128 'Start byte
S.Value = 0 'Device type (motor)
S.Value = 0 'Motor and direction
S.Value = 127 'Motor speed (between 0 - 127)

'Motor 2
S.Value =128 'Start byte
S.Value = 0 'Device type (motor)
S.Value = 3 'Motor and direction
S.Value = 127 'Motor speed (between 0 - 127)
OOPic.Delay = 500
Loop

End Sub