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!
Arduino on Raspberry Pi
3 posts
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!
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!
- Posts: 11
- Joined: Mon Jan 14, 2013 6:51 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
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: 234
- Joined: Sun Mar 04, 2012 9:28 am
Thanks! Will try it out! 
- Posts: 11
- Joined: Mon Jan 14, 2013 6:51 pm