0

I have a python script on my raspberry-pi continuously (every 5 seconds) running a loop to control the temperature of a pot with some electronics through GPIO.

I monitor temperature on a web page by having the python script write the temperature to a text file witch I request from java script and HTTP on a web page.

I would like to pass a parameter to the python script to make changes to the controlling, like change the target temperature.

What would be the better way to do this?

I'm working on a solution, where the python script is looking for parameters in a text file and then have a second python script write changes to this file. This second python script would be run by a http request from the web page.

Is this a way to go? Or am I missing a more direct way to do this.

This must be done many time before and described on the web, but I find nothing. Maybe I don't have the right terms to describe the problem.

Any hints is appreciated. Best regards Kresten

2 Answers 2

1

You have to write somewhere your configuration for looping script. So file or database are possible choices but I would say that a formatted file (ini, yaml, …) is the way to go if you have a little number of parameters.

Sign up to request clarification or add additional context in comments.

2 Comments

So my approach is fine. What would I gain from using a formated file rather than just any text file?
Some modules to parse and work with your config. Standard format that anyone know, better for review and bug finding plus you won't fail at parsing it. Finally, evolutivity.
0

not sure about raspberry-pi but I see these solutions:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.