I wanted to start serial on my RasperyPi Model B but i notice that it get stuck on Serial.Write("ETC")
The python module I am Using is PySerial
This is the code I have tried:
import serial
import time
test=serial.Serial("/dev/ttyAMA0",9600)
time.sleep(1)
print('1')
test.write("SomeStuff".encode("ascii"))
print('2')
It stuck on write() and wont show '2'
I am also getting the same issue in these snippets:
test.open() : #Its already open
test.write(bytes('Em','ascii')) #Not working / Same
test.write('hi?'.encode()) #Same !
-
test=serial.Serial()
test.baudrate=9600
test.timeout=0
test.port="/dev/ttyAMA0"
test.open()
test.write('hi?'.encode())
-
test=serial.Serial("/dev/ttyAMA0",115200) #Even more baudrates..
Why does this code get stuck on write and how can I fix this issue? Thanks in advance!
I think using test=serial.Serial("/dev/ttyS0",115200) #Even more baudrates..
will be better ! it works fine now