Browse Source

Updated readme for config file

master
Ben Savage 4 years ago
parent
commit
1d3bdfa52b
  1. 66
      README.md

66
README.md

@ -31,6 +31,71 @@ Notes:
1. I couldn't set the address to listen on in the GUI, but it binds to 0.0.0.0 so it's listening on every local address anyway.
2. I've set this to 100ms for testing. If this is too long a latency it can be dropped, but the python components are set with thresholds between .5% and 1% of brightness and colour respectively before changing the LEDs so that grandients aren't crazily chatty.
# Update the config file
The file is config.json, following json formatting. This file describes the elements connected via GPIO and how they interact with osc_server.
It also sets the initial state of outputs when osc_server starts, or when the restart function is called.
The base version is a reasonable starting point. There are 3 main sections.
Note that JSON doesn't support comments (#) so these will need to be removed if these examples are used.
## Inputs/buttons
This section is for any element that is read. At this point, we only deal with buttons.
```
# Inputs section
"inputs":{
# Button elements, a dict, so each name correlates to one element
"buttons":{
# Button named "restart"
"restart":{
# Connected to pin 2
"pin": 2,
# When the button is pressed, run the restart function
# The function needs to exist in osc_server as btn_<name>
"when_pressed": "restart"
}
}
}
```
## Outputs
### LEDs
Section for outputs. At the moment, only LEDs are supported.
```
# Outputs section
"outputs":{
# LEDs, an array of dicts
"leds":[
{
"name":"1", # A descriptive name, for logs
"pin": 21, # The pin it's connected to
"target": 3 # The OSC target. In this case, this is the number of the fx_param. In theory multiple LEDs could share a target to be controlled by one OSC message
"defaults": # Optional: defaults to set on startup
{
"state": 0 # Whether it's on or off, 1=on 0=off
"brightness": 1.0 # Brightness as a float, 0.0 to 1.0
}
},
# JSON allows us to condense the formatting, in this case one per line
{ "name":"2", "pin":20, "target":"4", "defaults": { "state":0,"brightness":1.0}},
{ "name":"3", "pin":16, "target":"5"},
{ "name":"4", "pin":12, "target":"6"},
{ "name":"5", "pin":5, "target":"7"}
]
}
```
### Defaults
This section sets the defaults for outputs/LEDs where the elements themselves do not have defaults set.
```
# Defaults section
"defaults":{
# LEDs
"led":{
# Values as above.
"brightness": 1.0,
"colour": 1.0 ,
"state": 0
}
}
```
# Start osc_server
1. Open lxterminal
2. Run the following:
@ -58,3 +123,4 @@ cd ~/git/osc_led

Loading…
Cancel
Save