jondallimore
Posts: 176
Joined: Thu Aug 04, 2016 11:02 pm

'saving' GPIO state on reboot

Sun Jan 21, 2018 9:42 pm

Hello.
Is there a way to save the fact that a GPIO pin is on when a pi restarts so that it comes back on after reboot?

Thanks
Jon

User avatar
DougieLawson
Posts: 33805
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: 'saving' GPIO state on reboot

Sun Jan 21, 2018 11:52 pm

No.

You'd have to read all the GPIO status and store that in a file or database, then on reboot read the file or database and restore the status. There's no ready-built way to do that stuff.

The GPIOs tend to start in a predictable state on a cold restart from power off/power on. On a warm restart (possibly done by shorting the RUN header) the status is less predictable.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

jondallimore
Posts: 176
Joined: Thu Aug 04, 2016 11:02 pm

Re: 'saving' GPIO state on reboot

Mon Jan 22, 2018 5:43 am

Well that makes life more interesting... I'm running a load of python on startup anyway so it can read a file. Will just have to wait til I have time to get it done.

Return to “General discussion”

Who is online

Users browsing this forum: aBUGSworstnightmare, Bosse_B and 29 guests