Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Python - sending number to the COM port

$
0
0

I want to send a number to the COM port every second.I created a pair of ports (COM3 and COM4) using the com0com program

It then tries to send the number 21 to the COM4 port.

Type "help", "copyright", "credits" or "license" for more information.>>> import serial>>> ser= serial.Serial('COM4', 9600, timeout=1)>>> ser.write(21)

but the operation hangs, does anyone know why this happens?I'm definitely doing something wrong.Maybe someone knows what needs to be done to make it work.


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>