Adafruit_Learning_System_Gu.../CircuitPython_Quick_Starts/PWM_Test_Script.py
2018-03-20 23:59:02 -04:00

13 lines
534 B
Python

import board
import pulseio
for pin_name in dir(board):
pin = getattr(board, pin_name)
try:
p = pulseio.PWMOut(pin)
p.deinit()
print("PWM on:", pin_name) # Prints the valid, PWM-capable pins!
except ValueError: # This is the error returned when the pin is invalid.
print("No PWM on:", pin_name) # Prints the invalid pins.
except RuntimeError: # This is the error returned when there is a timer conflict.
print("Timers in use:", pin_name) # Prints the timer conflict pins.