minute read

Devices

You are reading our Automation1 API documentation for the .NET programming language.

In the .NET API, Devices lets you see the electrical devices on your Automation1 controller.

The Basics

Electrical devices include the electrical HyperWire devices that connect to mechanical devices and the HyperWire PCIe card required by PC-based controllers.

How to Use

In the .NET API, Devices is part of the Controller.Runtime property. For all the APIs that operate under this property, the Automation1 controller must be running before you can see the electrical devices on your controller. For more information about this property, see the Controller page.

The Controller.Runtime.Devices property gives you access to see the attached electrical HyperWire devices. The Controller.Runtime.Devices.HyperWireDevices property is an enumerable collection of the electrical HyperWire devices on the Automation1 controller. You can iterate over this collection or index into it. The index for this collection is the device index, not the axis index. The main use of this collection is to determine what type of devices you have with the HyperWireDeviceType enum and to determine which physical axes are controlled by each device. Refer to the example that follows.

Copy
controller.Runtime.Devices.HyperWireDevices[int deviceIndex].DeviceType

The combination of an electrical HyperWire device and a connected mechanical device makes a physical axis on your Automation1 controller. See the Axes page. The Axes property is an enumerable collection of the physical axes controlled by the device. The index for this collection is a simple array-like collection that always starts at 0. It is not the axis index. Refer to the example that follows.

Copy
controller.Runtime.Devices.HyperWireDevices[int deviceIndex].Axes[int index]

The Controller.Runtime.Devices property also gives you access to see the installed HyperWire PCIe card with the Controller.Runtime.Device.HyperWireCard property. This property will be null if there is no HyperWire PCIe card. PC-based controllers might not have a HyperWire PCIe card if they are running virtually. Drive-based controllers never have a HyperWire PCIe card. Refer to the example that follows.

Copy
controller.Runtime.Devices.HyperWireCard

Example Code

Copy
bool hasHyperWireCard = controller.Runtime.Devices.HyperWireCard != null;
Console.WriteLine(controller.Runtime.Devices.HyperWireDevices.FirstOrDefault()?.DeviceType);

Thread Safety

All the methods and properties that operate under the Controller.Runtime.Devices property are thread safe. You can call them from two or more threads without interference.

Full Reference

For more information about the properties that are available for Devices, refer to the lists that follow.

Controller.Runtime.Devices.HyperWireCard Properties

Controller.Runtime.Devices.HyperWireDevices Properties