Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Grove_Generic_UART

Jack Shao edited this page Jan 17, 2017 · 2 revisions

The Grove Generic UART module can forward short messages between internet and Wio's UART port.

Send messages from internet to Wio's UART port

POST /v1/node/GroveUARTUART0/string/[str]

Send plain text to Wio's UART port.

POST /v1/node/GroveUARTUART0/base64_string/[b64_str]

To send messages with characters like \r \n, you need call this API.

Receive messages from Wio's UART port via Websocket

The generic UART module driver will check the UART RX buffer every 1 second. Multiple transmissions into the UART port within 1 second will be combined into one event.

Example:

<script>
var ws = new WebSocket('wss://cn.wio.seeed.io/v1/node/event');
ws.onopen = function() {
    ws.send("the token of your wio device");
};
ws.onmessage = function (evt) {
    alert(evt.data);
};
</script>

You will receive event messages like {"msg": {"uart_rx": "hello!"}}

Configure the baud rate

POST /v1/node/GroveUARTUART0/baudrate/[index]

This API can let users change the baud rate of UART from 9600 (default) to other values. The parameter index should be one of 0,1,2,3,4. And the mapping of index and baud rate is,

  • 0:9600
  • 1:19200
  • 2:38400
  • 3:57600
  • 4:115200