TouchIO not working with Feather M0 Express

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
JeffThompson
 
Posts: 42
Joined: Mon Jun 14, 2010 3:05 pm

TouchIO not working with Feather M0 Express

Post by JeffThompson »

I'm following the tutorial on capacitive touch with the Feather M0 Express but am running into an error.

My code (pulled from the tutorial):

Code: Select all

import time
import board
import touchio

touch_pad = board.A2
touch = touchio.TouchIn(touch_pad)

while True:
    if touch.value:
        print("Touched!")
    time.sleep(0.05)
But I get this error:

Code: Select all

Traceback (most recent call last):
  File "code.py", line 6, in <module>
ValueError: No pulldown on pin; 1Mohm recommended
As I understand the tutorial, a resistor isn't needed on these boards, but since it's an error (and not a warning) it stops my code. I tried several other analog pins but get the same result.
  • CircuitPython 7.1.0
  • Mac, running Big Sur
  • Mu editor, connected over USB
Any help would be appreciated!

EDIT: I can verify it does work using a 1M ohm resistor between the pin and ground.

User avatar
danhalbert
 
Posts: 4655
Joined: Tue Aug 08, 2017 12:37 pm

Re: TouchIO not working with Feather M0 Express

Post by danhalbert »

Do you mean a Feather M0 Express, or some other board? Could you confirm the board by looking at the printing on the bottom?

That message is for boards without native touchio support, such as Feather M4 or Feather nRF52840. Those boards do indeed need the 1M resistor. But SAMD21-based boards have native touchio Support.

I just tried a Feather M0 Express with `t = touchio.TouchIn(board.A0)`, and it works without that message.

User avatar
JeffThompson
 
Posts: 42
Joined: Mon Jun 14, 2010 3:05 pm

Re: TouchIO not working with Feather M0 Express

Post by JeffThompson »

Thanks for the quick reply, always appreciated from Adafruit! The board is a Feather M0 Express; the bottom of the board says ATSAMD51J19.

Reading the tutorial again (link didn't seem to work before: https://learn.adafruit.com/adafruit-fea ... -cap-touch) it seems to contradict itself. It says M0 boards don't need the resistor, but that SAMD51 boards do. Maybe the problem is just the tutorial?

User avatar
danhalbert
 
Posts: 4655
Joined: Tue Aug 08, 2017 12:37 pm

Re: TouchIO not working with Feather M0 Express

Post by danhalbert »

A board with an ATSAMD51J19 is a Feather M4 Express. Does it say "M0 Express" somewhere on the board? Could you take a picture that shows that it says Feather M0 Express?

User avatar
JeffThompson
 
Posts: 42
Joined: Mon Jun 14, 2010 3:05 pm

Re: TouchIO not working with Feather M0 Express

Post by JeffThompson »

Ugh I'm so sorry! I have an M4 board, my bad – too many hours staring at a screen. Thanks for you help, feel free to delete this post!

User avatar
danhalbert
 
Posts: 4655
Joined: Tue Aug 08, 2017 12:37 pm

Re: TouchIO not working with Feather M0 Express

Post by danhalbert »

No problem! This is one reason why we ask for photos :) .

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”