Hw output add

From Sim Innovations Wiki
Revision as of 19:29, 11 October 2018 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Description

hw_output_id = hw_output_add(name, initial_state) (from AM/AP 3.5)
hw_output_id = hw_output_add(hw_id, initial_state)

hw_output_add is used to add a hardware output to your instrument.

Named

Info Available from AM/AP 3.5.

Give your hardware objects a name (.e.g. 'Power button' or 'Strobe LED').
Air Manager will present the user with a view where the assignment of pins can be done.

Arguments

hw_output_id = hw_output_add(name, initial_state)

# Argument Type Description
1 name String A functional name to define the output.
2 initial_state Boolean The initial state of the output. When true, the pin will be driven high, otherwise low.

Return value

Argument Type Description
hw_output_id ID This value can be used for further reference. Functions such as hw_output_set can use this hw_output_id. Its good practice to store this hw_output_id in your logic code.

Example

-- Create a new output
outp_id = hw_output_add("My output", true)

-- Nah, rather have the output low
hw_output_set(outp_id, false)

Hardware Id's

Info Hardware Id's are not preferred, try to use named hardware instead.

Define the used pin(s) right away. This is not preferred, since changing of pin assignment can only be done by changing the instrument/panel lua script.


Arguments

hw_output_id = hw_output_add(hw_id, initial_state)

# Argument Type Description
1 hw_id String The is the reference to the output. You can choose to bind to an existing Hardware ID (Hardware_id_list).
2 initial_state Boolean The initial state of the output. When true, the pin will be driven high, otherwise low.

Return value

Argument Type Description
hw_output_id ID This value can be used for further reference. Functions such as hw_output_set can use this hw_output_id. Its good practice to store this hw_output_id in your logic code.

Example

-- Bind to Raspberry Pi 2, Header P1, Pin 38, and drive the output high
outp_id = hw_output_add("RPI_V2_P1_38", true)

-- Nah, rather have the output low
hw_output_set(outp_id, false)