Beispiel #1
0
#!/usr/bin/python

from urllib2 import urlopen
from simulator import DEFAULT_FILENAME
from number import print_number
from subprocess import Popen, PIPE
from os import path
import json

prices = json.load(urlopen("https://api.bitcoinaverage.com/ticker/EUR"))
eur24 = 2 / float(prices["24h_avg"])
rpi = Popen([path.join(path.dirname(__file__), 'rpi')],
        stdin=PIPE, stdout=PIPE, stderr=PIPE)
print_number(str(eur24 * 1000)[:4], rpi.stdin.write)
print ''.join(rpi.communicate(''))
Beispiel #2
0
#!/usr/bin/python

from urllib2 import urlopen
from simulator import DEFAULT_FILENAME
from number import print_number
from serial import Serial
import json

prices = json.load(urlopen("https://api.bitcoinaverage.com/ticker/EUR"))
eur24 = 2 / float(prices["24h_avg"])
port = Serial('/dev/ttyUSB0', 1200)
print_number(str(eur24 * 1000)[:4], port.write)
Beispiel #3
0
#!/usr/bin/python

from urllib2 import urlopen
from simulator import DEFAULT_FILENAME
from number import print_number
from subprocess import call
from StringIO import StringIO
from os import path
from binascii import hexlify
import json

prices = json.load(urlopen("https://api.bitcoinaverage.com/ticker/EUR"))
eur24 = 2 / float(prices["24h_avg"])
sio = StringIO()
print_number(str(eur24 * 1000)[:4], sio.write)
call(['spark', 'call', 'YOUR DEVID COMES HERE', 'txserial', hexlify(sio.getvalue())])