IOPi Pin Write, Keep Pin State
The IO Pi Plus is a 32 channel MCP23017 GPIO expander for the Raspberry Pi
10/07/2015
Posted by:
D_Az35
I was wandering what would be the correct approach, in Python, to keep an IOPi Output Pin, with the value 1 (high), even after the script dies, only returning to its original 0 (low) state, if the RPi is rebooted or if you change it back. Can this be done without extra hardware?
Thks to all
D.az
10/07/2015
Posted by:
andrew
I have just tried running the following python script which sets pin 1 on bus 1 to high and it remained at the high state after the script finished and also stayed high when I rebooted the raspberry pi.
#!/usr/bin/python
from ABE_helpers import ABEHelpers
from ABE_IoPi import IoPi
i2c_helper = ABEHelpers()
newbus = i2c_helper.get_smbus()
bus1 = IoPi(newbus, 0x20)
bus1.set_port_direction(0, 0x00)
bus1.write_pin(1, 1)
19/11/2015
Posted by:
wieserdk
I used script you put above, but I have a problem.
I tried to read pin states using demo-iopiread2.py and it returns only:
Pin 1: 0
Pin 2: 0
Pin 3: 0
Pin 4: 0
Pin 5: 0
Pin 6: 0
Pin 7: 0
Pin 8: 0
Any sugestions?
20/11/2015
Posted by:
andrew
20/11/2015
Posted by:
wieserdk
21/11/2015
Posted by:
andrew
28/11/2015
Posted by:
wieserdk
28/11/2015
Posted by:
wieserdk
i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
30: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
70: 70 71 72 73 74 75 76 77
Any ideas?
29/11/2015
Posted by:
andrew
Can you try disconnecting the IO Pi and see if you get the same response? If it all goes to 00 then it may be a fault with the IO Pi, in which case I will send you a new one to try.
If it still shows all of the addresses then it is probably a problem with the i2c configuration in Linux. Try going through our i2c tutorial and checking that everything is set up correctly. Otherwise, you may need to try a fresh install of Raspbian Linux and see if that solves the problem.
Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.