This library can be used to communicate between and an Electric imp device and a Sigfox RC1692HP via UART. This includes accessing the self information of the RC1692HP.
To add this library to your model, add the following lines to the top of your agent code:
#require "RC1692HP.lib.nut"
Configures internal variables and configures UART settings
Parameter | Type | Description |
---|---|---|
uart | meta | a configured UART hardware pin |
params | table | See params |
where params
can include
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
baudRate | integer | No | 19200 | Rate at which information is transmitted |
wordSize | integer | No | 8 | Word size in bits (7 or 8) |
parity | integer | No | 0 | Parity bit: 0 means no parity bit, 1 includes an even parity bit and 2 includes an odd parity bit |
stopBit | integer | No | 1 | Stop bits (1 or 2) |
flags | integer | No | 4 | See : here. Default is to disable flow control |
timeout | float | No | 1.0 | Time to wait for a response before timing out |
delay | float | No | 2.0 | Time to wait between performing actions in a queue |
shouldLog | boolean | No | false | Displays logs of transmitted and received data |
local uart = hardware.uart12;
local sigFox = RC1692HP(uart);
configures parameters stored in non-volatile memory. See here for a list of memory address and parameter values.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
address | Integer | Yes | N/A | memory address of parameter you want to configure |
value | Integer | Yes | N/A | new value for the the parameter that you want to configure |
const UART_BAUD_RATE = 0x30;
const BAUD_RATE_9600 = 0x03;
sigFox.configure(UART_BAUD_RATE, BAUD_RATE_9600);
Switches the RC1692HP Sigfox mode of operation.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
mode | integer | Yes | N/A | The mode of operation you want Sigfox to operate in. Valid values include: RC1692HP_MODE.CONFIG and RC1692HP_MODE.NORMAL |
sigFox.switchMode(RC1692HP_MODE.CONFIG);
Sends a message to RC1692HP Sigfox
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
message | String or Blob | Yes | N/A | The message to be sent |
sigFox.sendMessage("MysticPants");
Reads the device ID and the PAC number
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
callback | function | No | null | Callback executed when response from Sigfox is received. Callback receives 1 input parameter a table. |
where Callback params
includes
Parameter | Type | Description |
---|---|---|
ID | String | device Id |
PAC | String | device PAC number |
sigFox.readID(function(res) {
server.log("The ID is: " + res.ID);
server.log("The PAC number is: " + res.pAC );
});
Reads the signal Strength of a detected signal or valid packet
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
callback | function | No | null | Callback executed when response from Sigfox is received. Callback receives 1 input parameter a table. |
where Callback params
includes
Parameter | Type | Description |
---|---|---|
RSSI | Integer | Signal Strength |
sigFox.readRSSI(function(res) {
server.log("The RSSI is: " + res.RSSI);
});
Reads the temperature of the RC1692HP Sigfox
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
callback | function | No | null | Callback executed when response from Sigfox is received. Callback receives 1 input parameter a table. |
where Callback params
includes
Parameter | Type | Description |
---|---|---|
temperature | Integer | Temperature read from RC1692HP Sigfox |
sigFox.readTemperature(function(res) {
server.log("The temperature is: " + res.temperature);
});
Reads the battery voltage of the RC1692HP Sigfox
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
callback | function | No | null | Callback executed when response from Sigfox is received. Callback receives 1 input parameter a table. |
where Callback params
includes
Parameter | Type | Description |
---|---|---|
battery | Float | The battery voltage of the RC1692HP Sigfox |
sigFox.readBattery(function(res) {
server.log("The battery voltage is: " + res.battery);
});
Reads the parameters values stored in non-volatile memory of the RC1692HP Sigfox
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
address | Integer | Yes | N/A | memory address of parameter you want to read from |
callback | Function | No | null | Callback executed when response from Sigfox is received. Callback receives 1 input parameter a table. |
where Callback params
includes
Parameter | Type | Description |
---|---|---|
value | Integer | The value of the read parameter. |
const UART_BAUD_RATE = 0x30;
sigFox.readConfigurationAt(UART_BAUD_RATE, function(res) {
server.log("The device's currently configured Baud Rate is: " + res.value);
});
The RC1692HP library is licensed under the MIT License.