Trouble
Can not import RPi.GPIO
11
11398
View: 11398|Reply: 11
|
[Trouble]
Can not import RPi.GPIO
[Copy link]
|
|
I have been trying this for days now, been through all the forums and tried different things but I still get the same error. I have the latest version of Rasbian. When I bring up the python shell and type the command "import RPi.GPIO as GPIO" I am getting an import error: No module named GPIO.
I am only a noob, I have had my banana pi for a few weeks now and have been trying to learn as much as I can.
any help will be appreciated
Thanks |
|
|
|
|
|
|
|
I seen this article but it isn't really any help.
I managed to get past the no module error by editing the py_gpio.c in source dir (suggested in another thread)
if (revision == -1 )
changed to
if (revision == -10 )
What I get now when I run my simple led flash code
sudo python ledflash.py (lx terminal)
BAPI: Banana Pi!!
BAPI: Banana Pi!!
BAPI: Banana Pi!!
BAPI: Banana Pi!!
BAPI: revision(3)
Is this a correct response ? The Led does not flash. So im am sort of stuck about what to do at the moment
Script:
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT)
while True:
GPIO.output(11, True)
sleep (2)
GPIO.output(11,False)
sleep (2) |
|
|
|
|
|
|
|
Just before anyone pics up on the code being wrong for the gpio.setup and outputs. 4,11,11 They are all 5,5,5 |
|
|
|
|
|
|
|
Just an update:
I was unsure how I got rid of the No Module error. I reverted the py_gpio.c file back to original and received the same " BAPI: Banana Pi!!" messages
The fault was in my code. |
|
|
|
|
|
|
|
GPIO.setup(4, GPIO.OUT) here you use 4;
But GPIO.output(11, True) here you use 11;
The both should use the same number. |
|
|
|
|
|
|
|
Hi All,
I am also getting the same messages when trying to use the RPi.GPIO program.
" BAPI: Banana Pi!!"
" BAPI: Banana Pi!!"
" BAPI: Banana Pi!!"
" BAPI: Banana Pi!!"
" BAPI: Revision (3)
I even tried to perform a reinstall and saw additional updates:
bananapi@lemaker ~ $ sudo apt-get install RPi.GPIO
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'python3-rpi.gpio' for regex 'RPi.GPIO'
Note, selecting 'python-rpi.gpio' for regex 'RPi.GPIO'
The following NEW packages will be installed:
python-rpi.gpio python3-rpi.gpio
0 upgraded, 2 newly installed, 0 to remove and 13 not upgraded.
Need to get 64.2 kB of archives.
After this operation, 259 kB of additional disk space will be used.
Get:1 http://archive.raspberrypi.org/debian/ wheezy/main python-rpi.gpio armhf 0.5.7-1 [40.3 kB]
Get:2 http://archive.raspberrypi.org/debian/ wheezy/main python3-rpi.gpio armhf 0.5.7-1 [23.9 kB]
Fetched 64.2 kB in 0s (64.6 kB/s)
Selecting previously unselected package python-rpi.gpio.
(Reading database ... 81002 files and directories currently installed.)
Unpacking python-rpi.gpio (from .../python-rpi.gpio_0.5.7-1_armhf.deb) ...
Selecting previously unselected package python3-rpi.gpio.
Unpacking python3-rpi.gpio (from .../python3-rpi.gpio_0.5.7-1_armhf.deb) ...
Setting up python-rpi.gpio (0.5.7-1) ...
Setting up python3-rpi.gpio (0.5.7-1) ...
but still I received same errors
I also tried the program from the suggested link:
http://hardware-libre.fr/2014/07/banana-pi-gpio-now-supported/
my python program works on a Raspberry Pi. I have latest Raspian and updates |
|
|
|
|
|
|
|
jemartel replied at 2014-10-23 16:06 
Hi All,
I am also getting the same messages when trying to use the RPi.GPIO program.
" BAPI: Banana ...
You can not use the command to install the library: sudo apt-get install RPi.GPIO
You need download it from https://github.com/LeMaker/RPi.GPIO_BP .
These messages:
BAPI: Banana Pi!!
BAPI: Banana Pi!!
BAPI: Banana Pi!!
BAPI: Banana Pi!!
BAPI: revision(3)
are right. |
|
|
|
|
|
|
|
Hi Tony,
Thanks again. I have tried that link to the RPi.GPIO_BP download as well as from RPi.GPIO.0.5.0? library found on the Raspian V3.0 and V3.1 SD images. Am I understanding you correctly that :
These messages:
BAPI: Banana Pi!!
BAPI: Banana Pi!!
BAPI: Banana Pi!!
BAPI: Banana Pi!!
BAPI: revision(3)
Will be displayed each time the Python code is running correctly? What do they mean? I am curious.
I thought they were an error because nothing was happening |
|
|
|
|
|
|
|
These messages:
BAPI: Banana Pi!!
BAPI: Banana Pi!!
BAPI: Banana Pi!!
BAPI: Banana Pi!!
BAPI: revision(3)
means, my python code is working now. I need to revise 'key_press' input for manual control argument error and figure out why sonic sensor is not printing distance on screen. PROGRESS |
|
|
|
|
|
|