Add Trigger/Program relationship to Readme and example
rodzic
b11ff90f0b
commit
117c1232f2
|
@ -3,6 +3,17 @@
|
|||
|
||||
Drive a servo motor by using two PIO statemachines for pulse output.
|
||||
|
||||
Each output needs a statemachine running servo_trigger and one running servo_prog.
|
||||
Due to the IRQ assignments, the statemachines need to be in ordered to have the servo_trigger program first, e.g.:
|
||||
|
||||
```
|
||||
trig = Servo_Trigger(0) # Statemachine 0
|
||||
s = Servo(1, 16) # phys IO on pin 16 # Statemachine 1, since the trigger is on SM0
|
||||
|
||||
trig2 = Servo_Trigger(2) # Statemachine 2
|
||||
s2 = Servo(3, 25) # Builtin LED # Statemachine 3, since the trigger is on SM2
|
||||
```
|
||||
|
||||
== Wiring information
|
||||
|
||||
See <<servo-wiring-diagram>> for wiring instructions.
|
||||
|
|
|
@ -76,11 +76,11 @@ class Servo:
|
|||
self.sm.put(int(self.free_pulse*n))
|
||||
|
||||
# Trigger needs to be the sm before the servo, so the IRQs set by rel(n) match
|
||||
trig = Servo_Trigger(2)
|
||||
s = Servo(3, 16) # phys IO on pin 16
|
||||
trig = Servo_Trigger(0)
|
||||
s = Servo(1, 16) # phys IO on pin 16
|
||||
|
||||
trig2 = Servo_Trigger(0)
|
||||
s2 = Servo(1, 25) # Builtin LED
|
||||
trig2 = Servo_Trigger(2)
|
||||
s2 = Servo(3, 25) # Builtin LED
|
||||
|
||||
for _ in range(2):
|
||||
for p in range(10+1):
|
||||
|
|
Ładowanie…
Reference in New Issue