code.py
 1  # SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  """
 6  'squeeze.py'.
 7  
 8  =================================================
 9  force sensitive resistor (fsr) with circuitpython
10  """
11  
12  import analogio
13  import board
14  import pwmio
15  
16  FORCE_SENS_RESISTOR = analogio.AnalogIn(board.A2)
17  LED = pwmio.PWMOut(board.D10)
18  
19  while True:
20      LED.duty_cycle = FORCE_SENS_RESISTOR.value