code.py
1 # SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries 2 # 3 # SPDX-License-Identifier: MIT 4 5 import board 6 import pwmio 7 8 for pin_name in dir(board): 9 pin = getattr(board, pin_name) 10 try: 11 p = pwmio.PWMOut(pin) 12 p.deinit() 13 print("PWM on:", pin_name) # Prints the valid, PWM-capable pins! 14 except ValueError: # This is the error returned when the pin is invalid. 15 print("No PWM on:", pin_name) # Prints the invalid pins. 16 except RuntimeError: # Timer conflict error. 17 print("Timers in use:", pin_name) # Prints the timer conflict pins.