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

Kresten
  • 810
  • 13
  • 36

2 Answers2

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.

Benoît Latinier
  • 2,062
  • 2
  • 24
  • 36
  • So my approach is fine. What would I gain from using a formated file rather than just any text file? – Kresten Dec 15 '14 at 23:52
  • 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. – Benoît Latinier Dec 16 '14 at 07:08
0

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

Community
  • 1
  • 1
sax
  • 3,708
  • 19
  • 22