Mar-04-2019, 08:17 PM
Larz60+ Thank you so much for helping me, I have added the information you requested to the origional post.
The reason why I have written the code like this;
But I have proberbly misunderstood!
Thank you for helping.
regards
Paul
Ps one day when I eventually understand this I will read as many posts as possible (except gamming) and try to help others.
The reason why I have written the code like this;
Quote:This code is wrong:Is, before the code is a query to Pins:
for pin in pins:
GPIO.setup(pin.pin, GPIO.OUT)
GPIO.output(pin.pin, GPIO.LOW)
pin.state = GPIO.input(pin.pin)
db.session.commit()
pins = Pins.query.all() for pin in pins: GPIO.setup(pin.pin, GPIO.OUT) GPIO.output(pin.pin, GPIO.LOW) pin.state = GPIO.input(pin.pin) db.session.commit()each ".pin" is the column "pin" of the database, I understand it as the first pin is "for 'pin' of pins" where "pins" is now = Pins.query.all() this code works, and what I understand is that your second code would relate to a dicionary "pins".
But I have proberbly misunderstood!
Thank you for helping.
regards
Paul
Ps one day when I eventually understand this I will read as many posts as possible (except gamming) and try to help others.