atmodule supports sending AT commands and handling the responses. This module is useful for the devices controlled by AT command such as Wi-Fi, GSM, Bluetooth modules. Use
require('at')to access this module.
<UART>UART object where a device is connected which controlled by AT command.
<boolean>Print all data received from UART if
Note that data received from
uartis converted to an ASCII string (1 byte to 1 char) for easy manipulation.
<string|Uint8Array>AT command (or data) to send. If
Uint8Arraytype is given, it send as data.
<function(result:string)>Callback called when expected response is arrived.
<string>Result status. One of array items of
<number|Array<string>>Indicates what is expected response of the AT command. If a number of given, waits for the given time in milliseconds. Default:
['OK', 'ERROR', 'FAIL']
<number>Timeout for waiting response. Default:
10000(10 sec). When timeout, callback is called with
'TIMEOUT'for the second parameter.
cmdis sent as data without appending
'\r\n'in the end. Default:
cmd, it sends AT command and then process the next command in the queue without waiting for expected response.
matchparameters. If a number is given for
callbackis called with the response just after waiting response for the given number of time (milliseconds).
callbackis called with the response and the matched item in the
matchparameter when there is a line matched with the
matchparameter in the response buffer.
<string>A match string.
<string>The matched line.
<string>The response buffer.
matchparameter in the response buffer, the handler function will be called. The data from start to the matched line are removed from the response buffer. If you want to keep the response buffer without any changes, then just return