I'm trying to do the simple hello world
of the pi world. I have been having problems actually turning pin 7
off. I tried moving my rib position in the socket (flipping the white side facing the sd card and away). Ive tried turn it off and on, but it just stays on.
So after some googling I came across a post that suggested checking the pin state. Below is the output of all the pins, to me I see error and think, yes that cant be good. Some calrity on the output below would be appreicated.
Pin State
new: gpio version is: 0.6.2
1 has error
2 has error
Pin 3 is HIGH!
4 has error
Pin 5 is HIGH!
6 has error
Pin 7 is HIGH!
Pin 8 is LOW
9 has error
Pin 10 is LOW
Pin 11 is LOW
Pin 12 is LOW
Pin 13 is HIGH!
14 has error
Pin 15 is LOW
Pin 16 is LOW
17 has error
Pin 18 is HIGH!
Pin 19 is LOW
20 has error
Pin 21 is HIGH!
Pin 22 is LOW
Pin 23 is LOW
Pin 24 is LOW
25 has error
Pin 26 is LOW
27 has error
28 has error
29 has error
30 has error
31 has error
32 has error
33 has error
34 has error
35 has error
36 has error
37 has error
38 has error
39 has error
40 has error
Code Source (https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=93877)
import RPi.GPIO as GPIO
import time
#my b+ gpio pins
GPIO.setmode(GPIO.BOARD)
mypins = range(1, 41)
#GPIO.setmode(GPIO.BCM)
#mypins = [2, 3, 4, 14, 15, 17, 18, 27, 22, 23, 24, 10, 9, 25, 11, 8, 7, 5, 6, 12, 13, 19, 16, 26, 20, 21]
print 'new: gpio version is: ', GPIO.VERSION
for PIR_PIN in mypins:
try:
GPIO.setup(PIR_PIN, GPIO.IN)
read_input = GPIO.input(PIR_PIN)
if read_input:
print 'Pin', PIR_PIN, 'is HIGH!'
else:
print 'Pin', PIR_PIN, 'is LOW'
except:
print PIR_PIN, ' has error'
continue
print 'cleaning up and exiting'
GPIO.cleanup()
System Info
pi@raspberrypi:~ $ sudo cat /proc/cpuinfo
processor : 0
model name : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS : 697.95
Features : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7
Hardware : BCM2708
Revision : 000e
Serial : 00000000******
Configuration
pi@raspberrypi:~ $ lsmod |grep i2c
i2c_bcm2708 5740 0
i2c_dev 6578 0
pi@raspberrypi:~ $ lsmod |grep spi
spi_bcm2835 7424 0
pi@raspberrypi:~ $
Code To Turn Off and On
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.OUT)
for i in range(50):
GPIO.output(7, True)
time.sleep(0.2)
GPIO.output(7, False)
GPIO.cleanup()
GPIO Test
pi@raspberrypi:~ $ ./gpiotest
This program checks the Pi's (user) gpios.
The program reads and writes all the gpios. Make sure NOTHING
is connected to the gpios during this test.
The program uses the pigpio daemon which must be running.
To start the daemon use the command sudo pigpiod.
Press the ENTER key to continue or ctrl-C to abort...
Testing...
Skipped non-user gpios: 0 1 5 6 12 13 16 19 20 21 26
Tested user gpios: 2 3 4 7 8 9 10 11 14 15 17 18 22 23 24 25 27 28 29 30 31
Failed user gpios: None
https://www.adafruit.com/products/1754
. I have a jumper wire attached topin 7
(#4 on the breakout) to an LED to a resistor to agnd pin
.has error
messages are because of two reasons. 1) that pin on the expansion header is connected to 5V, 3V3, or ground so is not a GPIO. 2) you have a 26 pin expansion header so pins 27-40 are not present at all. GPIO4 has an internal pull-up to 3V3 activated at boot. It will stay high until you connect something which pulls it to ground with a stronger force, or you switch it to be an output.