EdgePi-Cloud / edgepi-python-sdk

Python SDK to control EdgePi, an industrial PC/PLC/IoT device powered by Raspberry Pi CM4
MIT License
6 stars 3 forks source link

Slow LED method calls #354

Open iaj2 opened 1 year ago

iaj2 commented 1 year ago

Test:

edgepi_led = EdgePiLED()
total_time_ns = 0
RANGE = 10**3
for _ in range(RANGE):
    s = time.perf_counter_ns()
    edgepi_led.toggle_led(LEDPins.LED1)
    total_time_ns += time.perf_counter_ns() - s

avg_time_ms = ((total_time_ns/10**6)/RANGE)
print(f'average latency: {avg_time_ms}ms')

Output: average latency: 2.183056713ms

Note: Using an on-then-off pattern had same results

Sorry Steven ;(