原本的Cosm的上傳軟體用的是Processing 寫的
但是他實在是有點肥的說....連Delay都妹有(翻桌
剛剛寫完Python 感覺很可以就把他改寫了
--------------------------------------------------------------
import serial
import eeml
import time
API_KEY = ' '
FEED =
API_URL = '/v2/feeds/{feednum}.xml' .format(feednum = FEED)
s=serial.Serial('COM5',9600)
while True:
s.write("a")
voltage = s.readline()
temp= s.readline()
ntemp = s.readline()
hum = s.readline()
dew = s.readline()
voltage = float(voltage) * 0.0048828125
pac = eeml.Pachube(API_URL, API_KEY)
print "-----------Data--------------"
print voltage
print temp
print ntemp
print hum
print dew
print "---------Data end-----------"
pac.update([eeml.Data(0, voltage)])
pac.update([eeml.Data(1, temp)])
pac.update([eeml.Data(2, ntemp)])
pac.update([eeml.Data(3, hum)])
pac.update([eeml.Data(4, dew)])
pac.put()
time.sleep(10)
----------------------------------------------------------------