Bu devre ile 2 adet servo motoru kontrol edebilirsiniz.
Pic programı:
'Manual control of two servomotors using 2 SPDT switches
'Use B1 to hold pulsewidth variable for servo 1
'Use B2 to hold pulsewidth variable for servo 2
'Initialize Variables
B1 = 150
B2 = 150
'start servo 1 at center position
'start servo 2 at center position
start:
IF pin1 = 0 Then left1
IF pin2 = 0 Then right1
IF pin4 = 0 Then left2
IF pin5 = 0 Then right2
PulsOut 0, B1
PulsOut 3, B2
Pause 18
GoTo start
'check for switch closures
'is sw1 left active?
'is sw1 right active?
'is sw2 left active?
'is sw2 right active?
'send current servo 1 position out
'send current servo 2 position out
'Routines for Servomotor 1
left1:
B1 = B1 + 1
PulsOut 0, B1
PulsOut 3, B2
Pause 18
IF B1 > 225 Then max1
GoTo start
right1:
B1 = B1 - 1
PulsOut 0, B1
PulsOut 3, B2
Pause 18
IF B1 225 Then max2
GoTo start
right2:
B2 = B2 - 1
PulsOut 0, B1
PulsOut 3, B2
Pause 18
IF B2