code.py
 1  # SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  """
 6  'mib_potentiometer_pwm.py'.
 7  
 8  =================================================
 9  fades a led using a potentiometer
10  """
11  
12  import analogio
13  import board
14  import pwmio
15  
16  led = pwmio.PWMOut(board.D9)
17  pot = analogio.AnalogIn(board.A0)
18  
19  while True:
20      led.duty_cycle = pot.value