thivtulz
Posts: 56
Joined: Tue Dec 18, 2012 10:05 am

UART problems

Mon Mar 25, 2013 9:39 am

Here the python code ,,

Code: Select all

import serial
usbport = '/dev/ttyAMA0'
ser = serial.Serial(usbport, 9600, timeout=1)
ser.write("Raspberry pi\r\n")
x = ""
while chr(3) not in x:
   x = ser.readline()
   print x

ser.close()

the errors after i ran the python source code..

Code: Select all

File"hello.world.py", line 9, in <module>
while chr(3) not in x:
TypeError: argument of type 'builtin_function_or_method'  is not iterable
in python it doesn't works.Now my objective is once i run the python code in RPi i must send a text to the PC and must received the text which is type in the PC and display on RPi.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: UART problems

Mon Mar 25, 2013 9:46 am

Please don't duplicate threads unnecessarily.

Return to “Python”