Arduino on Raspberry Pi


3 posts
by HizMama » Thu Jan 17, 2013 5:50 pm
Hey guys,

I've been trying to use arduino in Raspberry Pi but I am fatally stuck and I have no clue what to do. This is the closest I've gotten but I cannot download pySerial on the Raspberry Pi (just not letting me). There is a Python library for serial communications called 'pySerial' which has history with Arduino. The site says that once I download this software I type in code to access the serial port. Any help would be appreciated! :geek:
Posts: 11
Joined: Mon Jan 14, 2013 6:51 pm
by kghunt » Thu Jan 17, 2013 8:23 pm
pyserial is included with python usually. Create a .py file and call the serial library. read serial input to a variable then print it.

import time
import serial

# configure the serial connections (the parameters differs on the device you are connecting to)
ser = serial.Serial(
port='/dev/ttyUSB1',
baudrate=9600,
parity=serial.PARITY_ODD,
stopbits=serial.STOPBITS_TWO,
bytesize=serial.SEVENBITS
)


while True:
data = ser.read(50)
time.sleep(0.5)
Print data
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by HizMama » Fri Jan 18, 2013 3:04 am
Thanks! Will try it out! :D
Posts: 11
Joined: Mon Jan 14, 2013 6:51 pm