The SH01 xChip is a multiple channel capacitive touch sensor controller. It is based on the CAP1296 manufactured by Microchip. Each sensor input is calibrated to compensate for system parasitic capacitance and automatically recalibrated to compensate for gradual environmental changes. In addition, the CAP1296 can be configured to detect proximity on one or more channels with an optional signal guard to reduce noise sensitivity. The CAP1296 includes Multiple Pattern Touch recognition that allows the user to select a specific set of buttons to be touched simultaneously. If this pattern is detected, a status bit is set and an interrupt is generated.
Download Mu-editor
- Use XinaBoxUploader and flash MicroPython to the CW01/CW02.
- Download Python packages from the REPL with the following code:
import network import upip sta_if = network.WLAN(network.STA_IF) sta_if.active(True) sta_if.connect("ssid", "password") upip.install("xinabox-SH01")
- Download the .UF2 file for CC03/CS11/CW03 CircuitPython and flash it to the board.
- TO DO
- TO DO
Requires Python 3
pip3 install xinabox-SH01
from xCore import xCore
from xSH01 import xSH01
# SH01 instance
SH01 = xSH01()
# configure SH01
SH01.init()
while True:
button = SH01.touched() # return which button is pressed
if button == 'square': # square touched
print('SQUARE TOUCHED')
elif button == 'triangle': # triangle touched
print('TRIANGLE TOUCHED')
elif button == 'circle': # circle touched
print('CIRCLE TOUCHED')
elif button == 'cross': # cross touched
print('CROSS TOUCHED')
xCore.sleep(100)