Announcement

Collapse
No announcement yet.

Accessing GPIOs via WebAPI

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing GPIOs via WebAPI

    WebAPI gives you a way to access a lot of the xPico Wi-Fi features via standard HTTP requests. That can be done using Javascript on a page that is stored on the xPico Wi-Fi itself, or from another device using curl or a REST API client.

    Anyway, this is how you access the GPIOs themselves.

    Change the GPIOs:
    HTTP POST to URL: /action/status

    Send Content-Type x-www-form-urlencoded the following:
    group=CPM CPs
    optionalItem=CP
    optionalItemInstance=1 (or whatever the CP number)
    action=<action>

    Available <actions>:
    Usage Output
    Usage Input
    Assert Low
    Assert High
    Mode Push-Pull
    Mode Weak Pullup
    Value 0
    Value 1

    So you could write Javascript that sets a CP as an output, then toggle it with by sending Value 0 and Value 1 to the WebAPI.

    See the example below with the Postman REST API tester:

    Attached Files
Working...
X