Created
October 15, 2024 22:37
Revisions
-
todbot created this gist
Oct 15, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ # touchio_debug_code.py -- debug raw touchio values # 15 Oct 2024 - @todbot / Tod Kurt # This sketch shows the raw_value and threshold value for each # touchio TouchIn input, as well as the normal ".value" boolean # Hopefully this will help to debug touchio circuits. import time import board import touchio # these pins are for the first 8 picotouch midi board pads, # your board will likely use different pins touch_pins = ( board.GP0, board.GP1, board.GP2, board.GP3, board.GP4, board.GP5, board.GP6, board.GP7, ) touch_ins = [] # holder of all the touchio objects for pin in touch_pins: print("creating TouchIn for pin", pin) touch_in = touchio.TouchIn(pin) touch_ins.append(touch_in) while True: # print out threshold and raw value for each pin for i, touch_in in enumerate(touch_ins): raw_value = touch_in.raw_value threshold = touch_in.threshold touched = touch_in.value # same as "if raw_value > threshold" touched_str = "*" if touched else " " print("%4d/%4d%s " % (raw_value, threshold, touched_str), end='') print() time.sleep(0.1)