7. Lightware REST API Reference
UCX series – User's Manual
98
Applied firmware package: v1.2.0b9 | LDC software: v2.5.10b1
7.17. GPIO Port Configuration
7.17.1.
Setting the Direction of a GPIO Pin
Request and Response
ɯ
header:
POST·http://
<ip>
/api/V1/MEDIA/GPIO/
<port>
/Direction·HTTP/1.1
ɯ
body:
<dir>
ɮ
header:
200 OK
ɮ
body:
<dir>
Parameters
Parameter
Parameter description
Value
Value description
<dir>
The direction of the GPIO pin.
Input
input
Output
output
Example
ɯ
header:
POST http://192.168.0.50/api/V1/MEDIA/GPIO/P1/Direction HTTP/1.1
ɯ
body: Input
ɮ
header:
200 OK
ɮ
body: Input
7.17.2.
Setting the Output Level of a GPIO Pin
Request and Response
ɯ
header:
POST·http://
<ip>
/api/V1/MEDIA/GPIO/
<port>
/Output·HTTP/1.1
ɯ
body:
<state>
ɮ
header:
200 OK
ɮ
body:
<state>
Parameters
Parameter
Parameter description
Value
Value description
<value>
The output value of the GPIO pin.
High
high level
Low
low level
Example
ɯ
header:
POST http://192.168.0.50/api/V1/MEDIA/GPIO/P1/Output HTTP/1.1
ɯ
body: High
ɮ
header:
200 OK
ɮ
body: High
7.17.3. Setting the Output Level for a Specified Time
Request and Response
ɯ
header:
POST·http://
<ip>
/api/V1/MEDIA/GPIO/
<port>
/interval·HTTP/1.1
ɯ
body:
<value>
;
<time>
ɮ
header:
200 OK
ɮ
body:
<value>
;
<time>
Parameters
Parameter
Parameter description
Value
Value description
<value>
The output value of the GPIO pin.
High
high level
Low
low level
<time>
Duration of the desired value in seconds.
1-120
second
Example
ɯ
header:
POST http://192.168.0.50/api/V1/MEDIA/GPIO/P1/interval HTTP/1.1
ɯ
body:
Low;1
ɮ
header:
200 OK
ɮ
body: OK
7.17.4.
Toggling the Level of a GPIO Pin
The output level can be changed from high to low and low to high by the command below.
Request and Response
ɯ
header:
POST·http://
<ip>
/api/V1/MEDIA/GPIO/
<port>
/toggle·HTTP/1.1
INFO:
The body has to be empty, and the content type should be text/plain.
ɮ
header:
200 OK
ɮ
body: OK
Example
ɯ
header:
POST http://192.168.0.50/api/V1/MEDIA/GPIO/P1/toggle HTTP/1.1
ɮ
header:
200 OK
ɮ
body: OK