Button Issues with Tri-Color eInk Featherwing

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
User avatar
jferguson75
 
Posts: 8
Joined: Wed Nov 13, 2013 5:15 pm

Button Issues with Tri-Color eInk Featherwing

Post by jferguson75 »

I'm doing a project using the Tri-Color eInk feather wing(https://www.adafruit.com/product/4778) display and the ESP32 v2 Feather (https://www.adafruit.com/product/5400). I've had to jump over some hurdles but I'm getting to where I want to be.

As part of the project I want to be able to scroll through some screens. I intended to use the built-in 3 buttons on the featherwing. For some reason, I can't for the life of me get them to read high. If I jump the pins manually to the USB pin, they read just fine, it's just the buttons on the featherwing that don't register.

Has anyone come across this before? Is there something I'm supposed to activate to get it to work? What am I missing?

Thanks for the help!

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Button Issues with Tri-Color eInk Featherwing

Post by dastels »

Alas, I don't see a schematic for that exact product, but I suspect the buttons are connected between the pin and ground. When you set up the buttons pins, are you setting them to have a pullup? When your code checks for a button push it would look for a LOW/False/0 on the pin.

Dave

User avatar
jferguson75
 
Posts: 8
Joined: Wed Nov 13, 2013 5:15 pm

Re: Button Issues with Tri-Color eInk Featherwing

Post by jferguson75 »

I'm doing it like this in my C code:

#define BUTTON_A 27
pinMode(BUTTON_A, INPUT);
int buttonStateA = digitalRead(BUTTON_A);

Whether I have the button pushed or not, buttonStateA is always 0. I'm not sure how to set the pin up as a pull up. My microcontroller skills are pretty rudimentary.

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Button Issues with Tri-Color eInk Featherwing

Post by dastels »

Use a pin mode of INPUT_PULLUP

Dave

User avatar
jferguson75
 
Posts: 8
Joined: Wed Nov 13, 2013 5:15 pm

Re: Button Issues with Tri-Color eInk Featherwing

Post by jferguson75 »

That did it! Thanks!

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”