oldieman
Posts: 7
Joined: Mon Nov 18, 2013 4:51 pm

RPI.GPIO - no module

Tue Aug 26, 2014 9:43 am

Hello,
I'm trying to use the 4 buttons on a Adafruit 2.8" PiTFT capacitive touchscreen. The left button to use as powerswitch is not the problem - is working. To use the other 3 buttons in a Python program I get the problem that the RPI.GPIO module is not found.
I installed the python-dev and python-rpi.gpio modules etc. written in http://learn.adafruit.com/adafruits-ras ... gpio-setup . But when using import RPI.GPIO as GPIO in my python program I get this import error: No module named RPI.GPIO.

Thanks for help
Oldieman

User avatar
joan
Posts: 14887
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: RPI.GPIO - no module

Tue Aug 26, 2014 9:49 am

Linux is case sensitive.

oldieman
Posts: 7
Joined: Mon Nov 18, 2013 4:51 pm

Re: RPI.GPIO - no module

Tue Aug 26, 2014 1:24 pm

Thanks - you were right. I read this RPi as RPI. This is working now but I still get no response from the tactile buttons on the touchscreen. The input is always False on all 3 buttons. The difference between #23 (use as power button) and the others is, that the voltage on the buttons is always low the pin #23 is high. But there are no pullup restistance available on the board.
How is it possible to get a high output on a GPIO pin and use the same as input?

Thanks.
Oldieman

User avatar
joan
Posts: 14887
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: RPI.GPIO - no module

Tue Aug 26, 2014 1:32 pm

I'm not familiar with your set up.

I'd connect a switch as follows.

Connect one end of the switch to ground (optionally through a current limiting resistor of 20Kohm or less). Connect the other end to a gpio. Set the gpio as an input. ENABLE the gpios internal pull-up resistor to 3.3V. All the gpio libraries allow you to set the internal pull-ups.

The switch will read 1 when open and 0 when closed.

oldieman
Posts: 7
Joined: Mon Nov 18, 2013 4:51 pm

Re: RPI.GPIO - no module

Tue Aug 26, 2014 1:59 pm

Thanks that's what I want. How to enable the internal pullups?


DirkS
Posts: 10347
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: RPI.GPIO - no module

Tue Aug 26, 2014 2:06 pm

joan wrote:I'm not familiar with your set up.

I'd connect a switch as follows.

Connect one end of the switch to ground (optionally through a current limiting resistor of 20Kohm or less). Connect the other end to a gpio. Set the gpio as an input. ENABLE the gpios internal pull-up resistor to 3.3V. All the gpio libraries allow you to set the internal pull-ups.

The switch will read 1 when open and 0 when closed.
FYI: On the PiTFT the switches are normally directly soldered on the board (see https://www.adafruit.com/products/1601) and are directly led to the GPIO connector. So you should probably start at 'Set the gpio as input....'.

oldieman
Posts: 7
Joined: Mon Nov 18, 2013 4:51 pm

Re: RPI.GPIO - no module

Tue Aug 26, 2014 2:33 pm

Thanks AndrewS, that's the information I was looking for. Now the program is working.
Thanks a lot. :D

Return to “Python”