You now have code that will change the read/write status of the drive depending on a pin state, log the temperature once a second a provide three different status indicators. But there could be more to do, if you’d like.

Maybe you want to add better error reporting (the OSError error code for a read only device is 30). Or log differently, or log to a different file. This was only a starting point, so make it your own!

Acknowledgements

The code from this guide is based on code from @jerryneedell and @edgecollective.

This guide was first published on Sep 27, 2017. It was last updated on Sep 27, 2017.

This page (Keep going) was last updated on Aug 29, 2021.

Text editor powered by tinymce.