Connecting to AT1000 devices
This section describes how to find and connect to AT1000 devices on the network.
Discovering AT1000 Devices​
Before a test sequence can be launched (controlling outputs and measuring inputs), and device needs to be found on the network.
The following code will list all devices found on the network and print their serial numbers in the console:
- NodeJS
- Python
const at1000 = require("at1000");
let devices = at1000.find_devices(5); // Find devices with a 5s timeout
// Loop through devices and print their serial numbers
devices.forEach((device, index) => {
console.log(`Device ${index + 1}: Serial Number - ${device.get_capabilities().serialnumber}`);
});
import at1000
devices = at1000.find_devices(5) # Find devices with a 5s timeout
# Loop through devices and print their serial numbers
for index, device in enumerate(devices):
print(f"Device {index + 1}: Serial Number - {device.get_capabilities().serialnumber}")
The following code will pick the first device in the list and create a tester
variable that can be used to control the device. It'll also reset the device to its default state, which is useful if you want to start from a known state.:
- NodeJS
- Python
const at1000 = require("at1000");
let devices = at1000.find_devices(5); // Find devices with a 5s timeout
let tester = devices[0]; // Pick the first detected device
tester.reset(); // Reset the device to its default state
import at1000
devices = at1000.find_devices(5) # Find devices with a 5s timeout
tester = devices[0] # pick the first detected device
tester.reset() # Reset the device to its default state
Connecting to a specific AT1000 Device​
If you know the serial number of the device you want to connect to, you can use the find_device
function to directly connect to it. The following code will find a device with a specific serial number and create a tester
variable that can be used to control the device. It will also reset the device to its default state.
- NodeJS
- Python
const at1000 = require("at1000");
let tester = at1000.find_device("12345"); // Find the device with serial number 12345
tester.reset(); // Reset the device to its default state
import at1000
tester = at1000.find_device("12345") # Find the device with serial number 12345
tester.reset() # Reset the device to its default state
Some code examples in the next sections of this documentation will assume that a tester
variable representing an AT1000 device is already created. The code to find an AT1000 device and create tester
variable may not repeated in all example for simplicity and readability.