Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3862

Beginners • Best way to run a Python Program

$
0
0
Goal: To have a python program run (or stay running), take the temperature reading, turn on or turn off a 5v relay, print temp reading to file. In 30 minutes do it again.

What is the best way to go about this? Do I have a while loop that is running forever? Should it be a scheduled task of some sort that makes the program run (no infinite While loop).
I have been able to get this to sort of work with Crontab. It takes the readings, triggers the relay, but the state of the relay does not stay as it is after the program ends.

In general, should a relay Keep it's state after the triggering python program runs and closes?

Beginner at Python and linux.

Statistics: Posted by BlueBarryCat — Tue Jul 16, 2024 4:09 pm



Viewing all articles
Browse latest Browse all 3862

Trending Articles