Created
June 20, 2015 02:58
-
-
Save ganmedia/c96cff28a1df530535e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding=utf-8 | |
from pyfirmata import Arduino, util | |
from firebase import firebase | |
import time | |
board = Arduino('com3') | |
firebase = firebase.FirebaseApplication('https://<<MY ARDUINO PROJECT>>.firebaseio.com', None) | |
it = util.Iterator(board) | |
it.start() | |
analog_0 = board.get_pin('a:0:i') | |
analog_5 = board.get_pin('a:5:i') | |
digital_13 = board.get_pin('d:13:o') | |
while True: | |
firebase.patch('/potenciometer', {'energy':analog_0.read()}) | |
firebase.patch('/photocell', {'brightness':analog_5.read()}) | |
result = firebase.get('/led/status', None) | |
if result == 1: | |
digital_13.write(1) | |
print digital_13.read() | |
elif result == 0: | |
digital_13.write(0) | |
print digital_13.read() | |
print analog_0.read() | |
print analog_5.read() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment