from machine import Pin, TouchPad
from time import sleep
# Define the GPIO pin connected to the touch sensor
touch_pin = 4
# Create a TouchPad object
touch = TouchPad(Pin(touch_pin))
while True:
# Read the touch value
touch_value = touch.read()
# Print the touch value to the shell
print("Touch Value:", touch_value)
# Wait for half a second before reading again
sleep(0.5)