mardi 28 mars 2017

Timestamp test every 10 minutes

I have a RaspberryPI with temparature sensors, i made a Python code, that measure the temperature and send this into my database when executed. (EasyPHP). I want to do a simple test procedure with timestamp, a test for sending measures every 10 minutes. So, that's my code:

    #!/usr/bin/python

import Adafruit_CharLCD as LCD
import math
import os
import RPi.GPIO as GPIO
import spidev
import string
import time
import urllib2,urllib3,urllib

....

timestamp = int(time.time())
print timestamp     

<Temperature measures here>

And then i have to do something like this?

if ($timestamp < (time() - 600)) - if test ok, send measures.

url = 'database adress'

    user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
    param = {'Timestamp' : timestamp ,
              'Te1' : temperatures[1],
               Te2
               Te3...

That's how can i make a test procedure?

Thank's you!

Aucun commentaire:

Enregistrer un commentaire