Legal Removal Request This form is for reporting content posted on the AB Electronics UK forums that you believe violates your personal legal rights or applicable local laws for your country. Post: Could you try updating the IO Pi library from GitHub again? It seems that when I rewrote the library a couple of weeks ago to make it compliant with the PEP8 python standards I managed to break every function that wrote to or read from the individual pins. I tried to reduce the number of variables in the library by storing all of the values in an array but it seems that Python doesn't let you do bitwise operations on a bytearray so when it tried to update a single pin it set all of the other pins to 0 at the same time. I have gone through the code and fixed the problems so hopefully, it should work with your code now. Sorry for any inconvenience this has caused. I have made a few changes to your code to reduce the number of I2C calls it has to make to the IO Pi. from time import sleep from IOPi import IOPi import time bus1 = IOPi(0x20) bus2 = IOPi(0x21) # set up ins and outs # 15 outputs on bus1 , 1-10 are leds, 11-15 relays bus1.set_port_direction(0, 0x00) bus1.set_port_direction(1, 0x00) # 10 inputs on bus2 bus2.set_port_direction(0, 0xFF) bus2.set_port_direction(1, 0x03) # which are pulled up bus2.set_port_pullups(0, 0xFF) bus2.set_port_pullups(1, 0x03) # and then inverted so press button to gnd = logic 1 bus2.invert_port(0, 0xFF) bus2.invert_port(1, 0x03) # turn all leds on bus1.write_port(0, 0xFF) bus1.write_port(1, 0x03) sleep(3) # turn all leds and relay outputs off bus1.write_port(0, 0x00) bus1.write_port(1, 0x00) starttime = (time.time()) lastvalue = 0 while (time.time()-starttime) < 100: # counting 100 seconds if bus2.read_pin(1) and lastvalue != 1: # light button 1, open vv1 on 11 print("1") bus1.write_pin(1, 1) bus1.write_pin(2, 0) bus1.write_pin(11, 0) lastvalue = 1 if bus2.read_pin(2) and lastvalue != 2: # light button 2, close vv1 on 11 print("2") bus1.write_pin(1, 0) bus1.write_pin(2, 1) bus1.write_pin(11, 1) lastvalue = 2 if bus2.read_pin(3) and lastvalue != 3: # light button 3 open vv2 on 12 print("3") bus1.write_pin(4, 0) bus1.write_pin(3, 1) bus1.write_pin(12, 0) lastvalue = 3 if bus2.read_pin(4) and lastvalue != 4: # light button 4, close vv2 print("4") bus1.write_pin(3, 0) bus1.write_pin(4, 1) bus1.write_pin(12, 1) lastvalue = 4 if bus2.read_pin(5) and lastvalue != 5: print("5") bus1.write_pin(6, 0) bus1.write_pin(5, 1) bus1.write_pin(13, 0) lastvalue = 5 if bus2.read_pin(6) and lastvalue != 6: print("6") bus1.write_pin(5, 0) bus1.write_pin(6, 1) bus1.write_pin(13, 1) lastvalue = 6 if bus2.read_pin(7) and lastvalue != 7: print("7") bus1.write_pin(8, 0) bus1.write_pin(7, 1) bus1.write_pin(14, 0) lastvalue = 7 if bus2.read_pin(8) and lastvalue != 8: print("8") bus1.write_pin(9, 0) bus1.write_pin(8, 1) bus1.write_pin(14, 1) lastvalue = 8 if bus2.read_pin(9) and lastvalue != 9: print("9") bus1.write_pin(10, 0) bus1.write_pin(9, 1) bus1.write_pin(15, 0) lastvalue = 9 if bus2.read_pin(10) and lastvalue != 10: print("10") bus1.write_pin(9, 0) bus1.write_pin(10, 1) bus1.write_pin(15, 1) lastvalue = 10 I changed the first part with all of the for loops so that instead of setting each pin individually it updates the whole port with one command so all 8 pins are updated together. This means that to update all 16 pins Python only has to send two I2C commands to the IO Pi instead of 16. I also added some extra checking into the read loop so when you press a button it will check to see if that button has already been pressed and only send the write_pin commands if the button is different from the last loop. This stops it from continually writing to the IO Pi and printing to the screen while the button is held down. If you still have any problems with the code or find any other bugs please let me know. Select the country where you are claiming legal rights. Albania Algeria American Samoa Andorra Angola Anguilla Antarctica Antigua and Barbuda Argentina Aruba Australia Austria Bahamas Bahrain Bangladesh Barbados Belarus Belgium Belize Benin Bermuda Bhutan Bolivia Bosnia And Herzegovina Botswana Bouvet Island Brazil British Indian Ocean Territory British Virgin Islands Brunei Bulgaria Burkina Faso Burundi Cambodia Cameroon Canada Canary Islands Cape Verde Cayman Islands Central African Republic Chad Channel Islands Chile Christmas Island Cocos (Keeling) Islands Colombia Comoros Congo Cook Islands Costa Rica Croatia Cuba Cyprus Czech Republic Denmark Djibouti Dominica Dominican Republic East Timor Ecuador Egypt El Salvador Equatorial Guinea Estonia Ethiopia Falkland Islands (Malvinas) Faroe Islands Federated States of Micronesia Fiji Finland France French Guiana French Polynesia French Southern Territories Gabon Gambia Georgia Germany Ghana Gibraltar Greece Greenland Grenada Guadeloupe Guam Guatemala Guyana Haiti Heard Island and McDonald Islands Honduras Hong Kong Hungary Iceland India Indonesia Ireland Israel Italy Jamaica Japan Jordan Kazakhstan Kenya Kiribati Kuwait Kyrgyzstan Laos Latvia Lesotho Liechtenstein Lithuania Luxembourg Macau Macedonia Madagascar Malawi Malaysia Maldives Mali Malta Marshall Islands Martinique Mauritania Mauritius Mayotte Mexico Micronesia, Federated States Of Moldova, Republic Of Monaco Mongolia Montenegro Montserrat Morocco Mozambique Myanmar Namibia Nauru Nepal Netherlands Netherlands Antilles New Caledonia New Zealand Nicaragua Niue Norfolk Island Northern Mariana Islands Norway Oman Palau Panama Papua New Guinea Paraguay Peru Philippines Pitcairn Poland Portugal Puerto Rico Qatar Reunion Romania Russia Rwanda Samoa San Marino Sao Tome and Principe Saudi Arabia Serbia Seychelles Singapore Slovakia Slovenia Solomon Islands South Africa South Georgia and the South Sandwich Islands South Korea Spain Sri Lanka St. Helena St. Kitts and Nevis St. Lucia St. Pierre and Miquelon St. Vincent and the Grenadines Suriname Svalbard and Jan Mayen Islands Swaziland Sweden Switzerland Syria Taiwan Tajikistan Tanzania Thailand Togo Tokelau Tonga Trinidad and Tobago Tunisia Turkey Turkmenistan Turks and Caicos Islands Tuvalu U.S. Virgin Islands Uganda Ukraine United Arab Emirates United Kingdom United States United States Minor Outlying Islands Uruguay Uzbekistan Vanuatu Vatican City Venezuela Vietnam Wallis and Futuna Islands Western Sahara Yemen Yugoslavia Zambia What legal issue or problem do you wish to report? Please select Privacy / Erasure under GDPR Defamation Intellectual Property Hate Speech Other Please enter the following information so we can process your report. Contact Name: Contact Email: Details of complaint: Submit Complaint