This service provides an ability to manage GPIO on devices remotely.
It is possible to call this service programmatically via serial, HTTP/RESTful,
Websocket, MQTT or other transports
(see RPC section) or use mos
tool.
Below is a list of exported RPC methods and arguments:
Set given pin in INPUT mode, read GPIO pin, return its value. Arguments:
{
"pin": 15 // Required. Pin number.
}
Example usage:
mos call GPIO.Read '{"pin": 0}'
{
"value": 1
}
Set given pin in OUTPUT mode, read GPIO pin, return its value. Arguments:
{
"pin": 15 // Required. Pin number.
}
Example usage:
mos call GPIO.ReadOut '{"pin": 1}'
{
"value": 0
}
Set given pin in OUTPUT mode, set GPIO pin. Arguments:
{
"pin": 15, // Required. Pin number.
"value": 0 // Required. Voltage level. Either 0 (low) or 1 (high).
}
Example usage:
mos call GPIO.Write '{"pin": 2, "value": 0}'
Set given pin in OUTPUT mode, toggle voltage level and return that level. Arguments:
{
"pin: 15 // Required. Pin number.
}
Example usage:
mos call GPIO.Toggle '{"pin": 2}'
{
"value": 1
}