Custom Screw Terminal
This component allows you to connect your own sensors to it.
You can use it as an component by connecting a variable resistor between the terminals: A thermistor will turn it into a temperature sensor, a photoresistor into a light sensor. But you can also connect something like conductive rubber band to turn it onto a stretch sensor.
You can also use it as a component by building a custom switch: Use any two conductive objects and connect one to either screw terminal. As soon as they touch each other or are bridged by a third conductive object, you can read that like a closed switch!
Basic photo resistor example
# --- Imports
import time
import board
import analogio
# --- Variables
# Initialize analog input connected to photo resistor
photo_resistor = analogio.AnalogIn(board.A1)
# --- Functions
# --- Setup
# --- Main loop
while True:
val = photo_resistor.value # Read the photo resistor value
print(val) # Output the value in the serial monitor
time.sleep(0.05) # Make the loop run a little bit slower