Controlling Relays and Dry Contacts
The AT1000 provides 8 dry contact relays per device, which can be controlled individually or all at once. Each relay is addressed by its number (0-7).
Closing and Opening Relays​
the code snippets below demonstrate how to control the relays using the AT1000 API. The tester.relay() function is used to select a relay. The close() and open() methods are used to activate and deactivate the relay, respectively.
- NodeJS
- Python
import AT1000 from '@ikalogic/at1000';
let testers = await AT1000.findDevices(500); // Find the device with serial number 12345
let tester = testers[0]; // Pick the first detected device
let relay4 = tester.relays.relay(4); // Select relay number 4
await relay4.close(); // Close relay 4 (activate)
await relay4.open(); // Open relay 4 (deactivate)
from ikalogic_at1000 import AT1000
testers = AT1000.find_devices(500) # Find the device with serial number 12345
tester = testers[0] # Pick the first detected device
relay4 = tester.relays.relay(4) # Select relay number 4
await relay4.close() # Close relay 4 (activate)
await relay4.open() # Open relay 4 (deactivate)
Reading Relay Status
To check whether a relay is open or closed, use the read() function in a similar manner. This function returns 1 if the relay is closed and 0 if it is open.
- NodeJS
- Python
let relay_status = await relay4.read(); // Read the status of relay 4
console.log("Relay 4 status:" + relay_status );
relay_status = await relay4.read() # Read the status of relay 4
print("Relay 4 status:" + str(relay_status) )
Relays / Dry contacts are not synchronized
Please note that relays operation are always sequential, and cannot be synchronized using the hold and release mechanisms described here.