Created
July 9, 2014 17:13
-
-
Save Technicus/d4b5102fbc90cbf49934 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
import smbus | |
import time | |
# for RPI version 1, use "bus = smbus.SMBus(0)" | |
bus = smbus.SMBus(1) | |
# This is the address we setup in the Arduino Program | |
address = 0x04 | |
def writeData(value): | |
#bus.write_byte(address,88) | |
bus.write_byte(address, value) | |
# bus.write_byte_data(address, 0, value) | |
return 0 | |
def readNumber(): | |
number = bus.read_byte(address) | |
# number = bus.read_byte_data(address, 1) | |
return number | |
while True: | |
axis = input("Axis 88 or 89: ") | |
parameter = input("parameter: ") | |
if not parameter: | |
continue | |
writeData(axis) | |
writeData(parameter) | |
#print "RPI: Hi Arduino, I sent you ", axis, parameter | |
# sleep one second | |
time.sleep(1) | |
# number = readNumber() | |
# print "Arduino: Hey RPI, I received a digit ", number | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment