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: Found a bit of time to tinker and I have found an interesting problem... everything is set up OK and working - but with a strange bug. the following is really simple code, but it doesn't work under IOPi, the "earlier" leds (lower numbered pins) don't remember their state and turn off when a button further up the range is pressed... If it's of any help, using exactly the same code but with calls to the "wiringPi" library works fine! What is [i]meant[/i] to happen : buttons 1 and 2 (bus2, pins 1&2) light up with the appropriate leds (bus1, pins 1&2) and toggle a relay (bus1, pin15) repeat for 10 buttons and 5 relays button 1&2 correctly toggle relay 1 on pin15, but when button 3 (or >) is pressed, pin15 goes back to low. Each "pair" works, but they interfere with each other. Here's the relevant bit of code, including the setting up etc. The main loop begins at "starttime =" I think there are enough comments to make sense from time import sleep from IOPi import IOPi import time bus1 = IOPi(0x20) bus2 = IOPi(0x21) # set up ins and outs for pin in range(1,16): bus1.set_pin_direction(pin,0) # 15 outputs on bus1 , 1-10 are leds, 11-15 relays for pin in range(1,11): bus2.set_pin_direction(pin,1) # 10 inputs on bus2 bus2.set_pin_pullup(pin,1) # which are pulled up bus2.invert_pin(pin,1) # and then inverted so press button to gnd = logic 1 for pin in range (1,11): bus1.write_pin(pin,1) # turn all leds on print (pin) sleep(3) for pin in range(1,11): bus1.write_pin(pin,0) # turn all leds off for pin in range(11,16): bus1.write_pin(pin,0) # check off all relay outputs starttime = (time.time()) while ((time.time()-starttime) <100): # counting 100 seconds if bus2.read_pin(1)==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) if bus2.read_pin(2)==1: # light button 2, close vv1 on 11 print"2" bus1.write_pin(1,0) bus1.write_pin(2,1) bus1.write_pin(11,1) if bus2.read_pin(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) if bus2.read_pin(4): # light button 4, close vv2 print"4" bus1.write_pin(3,0) bus1.write_pin(4,1) bus1.write_pin(12,1) if bus2.read_pin(5): print"5" bus1.write_pin(6,0) bus1.write_pin(5,1) bus1.write_pin(13,0) if bus2.read_pin(6): print"6" bus1.write_pin(5,0) bus1.write_pin(6,1) bus1.write_pin(13,1) if bus2.read_pin(7): print"7" bus1.write_pin(8,0) bus1.write_pin(7,1) bus1.write_pin(14,0) if bus2.read_pin(8): print"8" bus1.write_pin(9,0) bus1.write_pin(8,1) bus1.write_pin(14,1) if bus2.read_pin(9): print"9" bus1.write_pin(10,0) bus1.write_pin(9,1) bus1.write_pin(15,0) if bus2.read_pin(10): print"10" bus1.write_pin(9,0) bus1.write_pin(10,1) bus1.write_pin(15,1) 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