You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-3Lines changed: 27 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,11 @@ pip install Pi-Pin-Manager
9
9
10
10
### Configure It
11
11
12
-
A config file, written in [YAML](http://en.wikipedia.org/wiki/YAML), is used to define the initial pin setup. If a pin is not defined here it will not be available to the `PinManager`. The following snippet shows an example configuration file:
12
+
When creating an instance of `pi_pin_manager.PinManager`, there are two ways you can supply pin configuration information: A config file, written in [YAML](http://en.wikipedia.org/wiki/YAML) or a dictionary. If a pin is not defined at this step it will not be available to the `PinManager`.
13
+
14
+
#### Configure with file
15
+
16
+
The following snippet shows an example configuration file:
13
17
14
18
```yaml
15
19
18:
@@ -25,6 +29,28 @@ A config file, written in [YAML](http://en.wikipedia.org/wiki/YAML), is used to
25
29
bounce: 200
26
30
```
27
31
32
+
#### Configure with dictionary
33
+
34
+
This snippet shows the same configuration example above as a dictionary:
35
+
36
+
```python
37
+
config = {
38
+
18:
39
+
'mode': 'OUT'
40
+
initial: 'HIGH'
41
+
23:
42
+
'mode': 'OUT'
43
+
initial: 'LOW'
44
+
24:
45
+
'mode': 'IN'
46
+
'event': 'RISING'
47
+
'handler': 'do_something'
48
+
'bounce': 200
49
+
}
50
+
```
51
+
52
+
#### Notes
53
+
28
54
* Add a numbered element for each pin to enable
29
55
*`mode` - This controls whether the pin will be used for input or output. Accepted values are: `IN`, `OUT`. (Required)
30
56
*`initial` - This controls the starting value of the pin. Accepted values are: `LOW`, `HIGH`. (Optional - defaults to `LOW`)
@@ -33,8 +59,6 @@ A config file, written in [YAML](http://en.wikipedia.org/wiki/YAML), is used to
33
59
*`handler` - This is used in combination with an `event` to designate a function to call when an `event` happens. This value should correspond to a method defined in your handler class.
34
60
*`bounce` - This can be used when an `event` is defined to prevent multiple `handler` calls being fired accidentally. The value is the number of milliseconds to wait before detecting another `event`.
35
61
36
-
**Note:**
37
-
38
62
For full documentation about available GPIO input pin configurations see the [documentation](http://sourceforge.net/p/raspberry-gpio-python/wiki/Examples/).
0 commit comments