WPC Python driver Logo
3.1.7

API REFERNECE

  • Products Feature
  • Products Usage

EXAMPLE CODES

  • Example Codes - Console (sync)
    • Device finder
      • Find all devices
      • Find network devices and blink
    • Drone
    • STEM
    • EDrive-ST
    • EMotion
    • Ethan-A
    • Ethan-A2
    • Ethan-D
    • Ethan-EX-D
    • Ethan-I
    • Ethan-IA
    • Ethan-L
    • Ethan-O
    • Ethan-P
    • Ethan-T
    • USB-DAQ-F1-AD
    • USB-DAQ-F1-AOD
    • USB-DAQ-F1-CD
    • USB-DAQ-F1-D
    • USB-DAQ-F1-D-SNK
    • USB-DAQ-F1-RD
    • USB-DAQ-F1-TD
    • Wifi-DAQ-E3-A
    • Wifi-DAQ-E3-AH
    • Wifi-DAQ-F4-A
    • Wifi-DAQ-E3-AOD
  • Example Codes - Console (async)
  • Example Codes - GUI (sync)

APPENDICES

  • I/O Port Function Table
  • I/O Channel Function Table
  • AI Max Sampling Rate Table
  • Error Code Table
  • Setting Table
WPC Python driver
  • Example Codes - Console (sync)
  • Find network devices and blink

Find network devices and blink

 1'''
 2Find_devices - find_network_devices_blink.py with synchronous mode.
 3
 4This example demonstrates how to find ethernet devices and blink.
 5
 6For other examples please check:
 7    https://github.com/WPC-Systems-Ltd/WPC_Python_driver_release/tree/main/examples
 8See README.md file to get detailed usage of this example.
 9
10Copyright (c) 2022-2025 WPC Systems Ltd. All rights reserved.
11'''
12
13## WPC
14from wpcsys import pywpc
15
16
17def main():
18    ## Get Python driver version
19    print(f'{pywpc.PKG_FULL_NAME} - Version {pywpc.__version__}')
20
21    ## Create device handle
22    dev = pywpc.DeviceFinder()
23
24    ## Connect to device
25    dev.connect()
26
27    ## Perform network device information
28    print("Find all network devices....")
29    try:
30        dev_2d_list = dev.Bcst_enumerateNetworkDevices()
31        for device_list in dev_2d_list:
32            print(device_list)
33            mac_num = device_list[2]
34
35            ## Check MAC and let LED blink
36            err = dev.Bcst_checkMACAndRing(mac_num)
37            print(f"Bcst_checkMACAndRing, status: {err}")
38
39    except Exception as err:
40        pywpc.printGenericError(err)
41
42    finally:
43        ## Disconnect device
44        dev.disconnect()
45
46        ## Release device handle
47        dev.close()
48
49
50if __name__ == '__main__':
51    main()
Previous Next

© Copyright 2024, WPC Systems Ltd..

Built with Sphinx using a theme provided by Read the Docs.