Difference between revisions of "Hw connected"

From Sim Innovations Wiki
Jump to navigation Jump to search
 
Line 22: Line 22:
 
! # !! Argument !! Type !! Description
 
! # !! 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 ([[Hardware_id_list | Hardware ID list]]).
+
| 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 ([[Hardware_id_list |Hardware ID list]]).
 
|}
 
|}
  

Latest revision as of 16:08, 23 January 2019

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 connected to the hardware.

Return value

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

Arguments

# 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 (Hardware ID list).

Example (Hardware node)

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

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

Example (Hardware id)

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