This shows you the differences between two versions of the page.
— |
kits:gpio:api:gpio [2021/11/01 12:48] (current) James Sentman created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | =====XTension GPIO Kit API: Controlling GPIO outputs===== | ||
+ | GPIO Endpoints setup as outputs can be controlled with a simple GET request to the /api/gpio url: http://xtgpio.local/api/gpio | ||
+ | To turn on gpio 3: | ||
+ | http://xtgpio.local/api/gpio?index=3&command=on | ||
+ | |||
+ | To turn off gpio 1: | ||
+ | http://xtgpio.local/api/gpio?index=1&command=off | ||
+ | |||
+ | Both index and command are required elements. Leaving any of them off will return an error instead. If you attempt to control a GPIO Endpoint that is lower than 0 or above the number of available GPIO endpoints an error is returned. If you try to control a GPIO channel that is not configured as an output an error will be returned. | ||
+ | |||
+ | Upon success the same json data as returned from the /api/data request is returned showing the new values if any that were changed by your command. | ||
+ | |||
+ | (BETA: Eventually the setvalue command will also be supported for endpoints like the servo and DAC outputs. This is not implemented yet in the current beta) |