Page 1 of 1

button interfacing

Posted: Thu Jul 21, 2016 6:35 am
by syed-anwar
hi
i am going to interface the button with raspi model b the code is
import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)

but it give me the following error
attribute error: module object has no attribute setmode
what the problem is and how to solve it please?

Re: button interfacing

Posted: Thu Jul 21, 2016 7:29 am
by MarkHaysHarris777
Make sure that none of your own modules are called RPi.GPIO

... otherwise, that name will get imported instead of the PI version...

There is nothing wrong with your syntax... so the problem has to be a naming problem.

marcus

Re: button interfacing

Posted: Thu Jul 21, 2016 9:03 am
by syed-anwar
ok thanks

Re: button interfacing

Posted: Thu Jul 21, 2016 9:07 am
by B.Goode
MarkHaysHarris777 wrote: There is nothing wrong with your syntax... so the problem has to be a naming problem.
Or a VERY old version of the RPi.GPIO library that goes back several years before the developer implemented the setmode function.