ibitfit/arduino_blink_test.py
Cocktail Frank 61ddaae91a Initialize dispenser only when GPIO libraries are available
When not running on a Pi, the dispenser will be an empty object and no
calls will be made with it.

Update Arduino blink test
2026-06-20 00:14:30 -04:00

22 lines
461 B
Python

"""
Blink an LED on digital pin 13 in 1 second intervals
"""
from Arduino import Arduino # type: ignore [import-untyped]
import time
# Arduino plugged in via USB, serial com at rate 115200
board = Arduino()
board.pinMode(3, "OUTPUT")
# Set a pin to simulate ground
board.pinMode(4, "OUTPUT")
board.digitalWrite(4, "LOW")
while True:
# Blink LED
board.digitalWrite(3, "LOW")
time.sleep(5.0)
board.digitalWrite(3, "HIGH")
time.sleep(0.4)