Title
Message
Create new category
What is the title of your new category?
Edit page index title
What is the title of the page index?
Edit category
What is the new title of your category?
Edit link
What is the new title and URL of your link?
Barionet 500 IO
Copy Markdown
Open in ChatGPT
Open in Claude
Callback and direct access functions for the digital inputs and outputs of the Barionet 500
Library
barionet-io.lua
Functions
Initialisation
dio = require "barionet-io.lua"
Set Output
dio.setio(function, value)
function: IO pin (1,2,3,4 for the relays)
value: 0 or 1 for off/on
Get Input Value
x = dio.iostate(function)
function: IO pin (201,202,203,204 for the digital inputs)
return value: 0 (off) or 1 (on)
Start monitoring (for callback)
dio.start(tim,iocallback)
tim: poll time for the io (in ms)
iocallback: function to be called when an input changes its value
Callback Function
This function is called from the background when an input has changed
iocallback(function,val) -- this is the function you have to give to the start monitoring call
function: is the input address which changes
val: is the new value of the input pin
Example program
Lua
x
local uv = require 'luv'local dio = require 'barionet-io'function iocallback(adr,val) print(string.format("io callback adr %u val %u",adr,val)) dio.setio(adr-200,val)enddio.start(100,iocallback)uv.run();Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
Last updated on
Next to read:
Flexa: Install linuquick packageDiscard Changes
Do you want to discard your current changes and overwrite with the template?
Archive Synced Block
Message
Create new Template
What is this template's title?
Delete Template
Message