Hw connected

From Sim Innovations Wiki
Revision as of 16:07, 23 January 2019 by Admin (talk | contribs) (Created page with "== Description == '''value = hw_connected(hw_node_id)''' '''value = hw_connected(hw_id)''' '''hw_connected''' is used to check if the given hardware node or hardware id is...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


value = hw_connected(hw_node_id)
value = hw_connected(hw_id)

hw_connected is used to check if the given hardware node or hardware id is connected to the hardware.

Return value

Argument Type Description
connected Boolean True is connected to the hardware, otherwise false.


# Argument Type Description
1 hw_node_id / hw_id Hardware node / String Can be a hw_node_id, which is a reference to a certain hardware node. It is received from the hw_button_add, hw_switch_add, hw_dial_add etc. functions. Alternatively, it can also be a hardware id.

Example (Hardware node)

id = hw_button_add("My button", function()
  -- Button is pressed

if hw_connected(id) then
  print("The button is connected to the hardware")

Example (Hardware id)

if hw_connected("ARDUINO_NANO_A_D11") then
  print("Pin D11 on Arduino Nano on channel A is connected")