Add Trigger/Program relationship to Readme and example

pull/29/head
Thomas A 2021-04-08 15:00:34 +02:00
rodzic b11ff90f0b
commit 117c1232f2
2 zmienionych plików z 15 dodań i 4 usunięć

Wyświetl plik

@ -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.

Wyświetl plik

@ -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):