python - PySerial doesn't work in script -
i have problem script:
#!/usr/bin/env python # -*- coding: utf-8 -*-  import serial import time  ser = serial.serial("com3", 9600, timeout=1) ser.write("test") print "test started\n" time.sleep(1) ans = ser.read(4) print ans   in arduino echo program (everything has been sent arduino has been sent computer). serial monitor works fine.
when i'm running python script stops on ser.read() (it waiting incoming data). when commands script i've written directly python console works without problems.
why code started file didn't work?
my os: windows 8.1 (64 bits) python version: 2.7.9 (64 bits)
try way
import serial import time  ser = serial.serial("com3", 9600, timeout=1) ser.write("test") print "test started - data sent \n" while true:     ans = ser.read(4)     if and:         print ,     time.sleep(1)      
Comments
Post a Comment