Web API documentation

Set Pin value
pin number: D0-D8, A0-A5, 0-8
value: HIGH, LOW, unsigned byte as string(0,255)

Example:

http://DERVICE_ADDRESS/set?pin=D2&value=HIGH

This will set state of digital pin 2 to HIGH

http://<DERVICE_ADDRESS>/set?pin=<PIN_NUMBER>&value=<VALUE>


Get Pin value
pin number: string D0-D8, A0-A5, 0-8
return: boolean string 0, 1

Example:

http://DERVICE_ADDRESS/get?pin=D2

This will get state of digital pin, in this case HIGH

http://<DERVICE_ADDRESS>/get?pin=<PIN_NUMBER>


Set Pin mode
pin number: D0-D8, A0-A5, 0-8
value: INPUT, OUTPUT, INPUT_PULLUP

Example:

http://DERVICE_ADDRESS/mode_set?pin=D2&value=OUTPUT

This will set mode of digital pin 2 to OUTPUT

http://<DERVICE_ADDRESS>/mode_set?pin=<PIN_NUMBER>&value=<VALUE>


Get Pin mode
pin number: D0-D8, A0-A5, 0-8
return: INPUT, OUTPUT, INPUT_PULLUP, UNKNOWN_PIN

Example:

http://DERVICE_ADDRESS/mode_get?pin=D2

This will get mode of digital pin, in this case OUTPUT

http://<DERVICE_ADDRESS>/mode_get?pin=<PIN_NUMBER>


Set PWM Pin value
pin number: string D3, D5, D8, 3, 5, 8
value: HIGH, LOW, unsigned byte as string (0,255)

http://<DERVICE_ADDRESS>/analog_set?pin=<PIN_NUMBER>&value=<VALUE>


Get Analog Pin value
pin number: string A0-A5
return: unsigned integer as string (0-1023)

http://<DERVICE_ADDRESS>/analog_get?pin=<PIN_NUMBER>


Begin I2C Transmission

http://<DERVICE_ADDRESS>/twin_begin?address=<I2C_ADDRESS>


End I2C Transmission

http://<DERVICE_ADDRESS>/twin_end


Write to I2C device

Example:
/twin_write?address=24&byte=16&reg=1&value=0
This will write to device on address 24 (0x18), value 0 as unsigned integer 16bit number to registry 1 (0x1)

http://<DERVICE_ADDRESS>/twin_write?address=<I2C_ADDRESS>&reg=<REGISTRY_NUMBER>&value=<VALUE_TO_WRITE>&byte=<MODE>&buffer=<BUFFER>


Read from I2C device

Example:
/twin_read?address=24&byte=16&reg=5
This will read from device on address 24 (0x18), value as unsigned integer 16bit number from registry 5 (0x5) and send number as string

http://<DERVICE_ADDRESS>/twin_read?address=<I2C_ADDRESS>&reg=<REGISTRY_NUMBER>&count=<DATA_LENGTH>&byte=<MODE>


Write to UART device
DATA - data to send to UART device as TTL transmition, RAW data URL encoded
COMMIT - send end of line at the end (\r\n)

http://<DERVICE_ADDRESS>/uart_write?buffer=<DATA>&commit=<COMMIT>


Read from UART device
RAW data from UART input buffer, will be sent as result of this request

http://<DERVICE_ADDRESS>/uart_read