センサー値を読み取るPythonスクリプト(以下に抜粋)があります。残念ながら、一度に5〜60分間しか実行されず、その後突然停止します。これを永遠に効率的に実行する方法はありますか?このようなPythonスクリプトをRaspberryPiで永久に実行できなかった理由はありますか、それともPythonはスクリプトの期間を自動的に制限しますか?
while True:
current_reading = readadc(current_sensor, SPICLK, SPIMOSI, SPIMISO, SPICS)
current_sensed = (1000.0 * (0.0252 * (current_reading - 492.0))) - correction_factor
values.append(current_sensed)
if len(values) > 40:
values.pop(0)
if reading_number > 500:
reading_number = 0
reading_number = reading_number + 1
if ( reading_number == 500 ):
actual_current = round((sum(values)/len(values)), 1)
# open up a cosm feed
pac = eeml.datastream.Cosm(API_URL, API_KEY)
#send data
pac.update([eeml.Data(0, actual_current)])
# send data to cosm
pac.put()