شکل مدار

برنامه با بسکام :
Dim Testin As Integer , Wa As Integer
Config Portb = Output
Config Portd = Input
Wa = 5 ; delay between steps
Lus:
If Pind.0 = 0 Then Gosub Cw
If Pind.1 = 0 Then Gosub Ccw
Goto Lus
Ccw:
Portb = 9 ' turn on Q1
Waitms Wa ' wait 2wa ms
Portb = 0 ' turn off Q1
Portb = 3 ' turn on Q2
Waitms Wa ' wait 2wa ms
Portb = 0
Portb = 6 ' turn on Q3
Waitms Wa ' wait 2wa ms
Portb = 0 ' turn off Q3
Portb = 12 ' turn on Q4
Waitms Wa 'wait wams
Portb = 0 'turn off Q4
Return
Cw:
Portb = 12 ' turn on Q1
Waitms Wa ' wait 2wa ms
Portb = 0 ' turn off Q1
Portb = 6 ' turn on Q2
Waitms Wa ' wait 2wa ms
Portb = 0
Portb = 3 ' turn on Q3
Waitms Wa ' wait 2wa ms
Portb = 0 ' turn off Q3
Portb = 9 ' turn on Q4
Waitms Wa 'wait wams
Portb = 0 'turn off Q4
Return