Difference between revisions of "Device add"

From Sim Innovations Wiki
Jump to navigation Jump to search
 
Line 33: Line 33:


-- Add RealSimGear G5 device
-- Add RealSimGear G5 device
my_device = device_add("REALSIMGEAR_G5")
my_device = device_add("REAL_SIM_GEAR_G5")


-- Set the position of the first needle to the middle
-- Print when the power button is released
device_prop_set(my_device, "NEEDLE_POS_1", 0.5)
device_command_subscribe("PWR_RELEASED", function()
    print"pwr released"
end)


</source >
</source >

Latest revision as of 12:19, 2 June 2023

Description

device_id = device_add(type, offset)

device_add is used to add a device. Note that the device needs to me added within the Air Manager or Air Player before you can access it here.

See Device list for available devices.

Return value

Argument Type Description
device_id String This value can be used for further reference.

Arguments

# Argument Type Description
1 type String Device type. See Device list for available devices.
2 offset Number (Optional) When you have multiple devices of the same type, you can provide an offset.

Example

-- Add RealSimGear G5 device
my_device = device_add("REAL_SIM_GEAR_G5")

-- Print when the power button is released
device_command_subscribe("PWR_RELEASED", function()
    print"pwr released"
end)