Questions tagged [pyserial]

pySerial is a Python module that encapsulates the access for the serial port. It provides backends for different platforms and Python implementations.

pySerial encapsulates the access for the serial port. It provides backends for Python running on Windows, Linux, BSD (possibly any POSIX compliant system), Jython and IronPython (.NET and Mono). The module named serial automatically selects the appropriate backend.

This is an example extracted from the introduction of the documentation:

>>> import serial
>>> ser = serial.Serial(0)  # open first serial port
>>> print(ser.portstr)      # check which port was really used
>>> ser.write("hello")      # write a string
>>> ser.close()             # close port

References:

2268 questions
0
votes
0 answers

`python -m app` fails to open serial port but `flask run` works

I've written a microserver in Flask that monitors a serial port. When I launch flask via > flask run it launches the server, which in turn opens the serial port. But I'd prefer to use the python -m app version so I can add command line…
fearless_fool
  • 33,645
  • 23
  • 135
  • 217
0
votes
0 answers

Does python serial has a problem on macOS?

I am trying to program esp32 with esp idf. I installed it on my mac os machine. When I try to compile code with "make" command, I have got that error: Pyserial is not installed for /usr/local/opt/python@2/bin/python2.7. Check the README for…
fxday
  • 1
0
votes
1 answer

AttributeError: 'module' object has no attribute 'Serial' with connection for pi and arduino

I'm trying to connect Raspberry pi and Arduino UNO with just a simple code. For Arduino, void setup(){ Serial.begin(9600); } void loop(){ Serial.println("Hello Pi"); delay(1000); } For pi, import serial ser =…
0
votes
1 answer

My script has the answe :TypeError: 'module' object is not callable. How I solve it?

I am trying to use serial port but I have no sucess with the simple program below. Somebody can help me? I run the script the result is: TypeError: 'module' object is not callable I change de serial to Serial and I put the b => ser.write(b,'A) I…
0
votes
1 answer

Serial Communication PySerial i get weird Characters (Probably ASCII?) I'm not able to decode it

Im try to communicate serial data between an Arduino and Python. I get this list of Character but im not able to convert them into integers. I didnt got it running through decoding: It works when im sending values from 0 - 255 aka single…
0
votes
0 answers

how to write float numbers to serial port

I want to send a float number to serial port. I wrote this code: import serial import time import struct my_float = 125.568 my_data = struct.pack('f',my_float) n=ser.write(my_data) # print(ser.write() + " Bytes successfully…
shina
  • 1
0
votes
1 answer

Can't write to a serial port twice using Pyserial without closing and reopening the port in between writing data

If I open a port with Pyserial then try to write GCode to a printer controller board twice, the second command does not execute. If I close the port after the first time data is written, then reopen it and write again, it works fine. I have found…
0
votes
1 answer

Using Pyserial, why would a delay be required between the time that a Serial class is instantiated and the Serial object being used to write data?

Solved: It seems that after instantiating the class which opens the port, it takes approximately 1 second for the board to boot up before data can be wrote. I'm uncertain if there is any way around this though. Original Question: I have a basic…
0
votes
1 answer

Need help listing the devices on COMM Ports in Python

I would like to automatically read all of the devices connected to the computer, so that I can communicate with all of the Keyspans, and none of the other devices. I am using Python, with the PySerial module. The closest I have gotten is through…
Liam Plybon
  • 58
  • 10
0
votes
1 answer

How to return SerialException error message, Object Serial?

How to return Error message that output by SerialException? In here i try to open port in port that already open. I want to get error that occurs. In the case SerialException will return Access is denied could not open port 'COM38':…
IOSBET
  • 61
  • 1
  • 1
  • 6
0
votes
1 answer

how do you open FTDI serial ports ttyUSBx such that we can run 2 applications on it?

I am writing a python pyserial app and need to debug it. It is not getting anything on its rx beyond the prompt. I would like to open up a parallel minicom on same tty and be able to see the port rx. Is this possible without hardware logging ? Can I…
preetam
  • 1,451
  • 1
  • 17
  • 43
0
votes
1 answer

How to solve AttributeError: module 'serial' has no attribute 'Serial' in pyserial?

I have a Windows 10 with Python 3.7.4 and I use Jupyter Notebook. I'm trying to use pySerial to connect to my Arduino by Serial attribute. I tried installing pySerial simply by pip install pyserial and eventually I tried conda install -c conda-forge…
0
votes
1 answer

How to send int or string from Python over pySerial and turn in to int or String in C

I am sending a String 1 and a String 0 encoded with ASCII from Python to a C program on my Arduino UNO over a serial port. I am able to receive the encoded data in C which is 0x31 for 1 and 0x30 for 2, this is what I expected as it is ASCII hex for…
Hoxlegion
  • 277
  • 1
  • 3
  • 14
0
votes
1 answer

How to know if an SMS sending is failed or successful?

I' creating a SMS gateway from GSM Modem port. I need to verify if an SMS sending is failed or successful. So I think the ways to check failed or success is to check the message storage called outbox if success and failed to draft.But, if I try to…
yui amanda
  • 37
  • 5
0
votes
2 answers

Reading realtime data from serial port from Arduino into a python script

Im trying to read the data from Arduino through Pyserial lib. Im encountering the issue where it denies access to the COM port to read the data. The python script is an OpenCV program to track an object, it asks for a bounding box then tracks this…
LeafTeaNeko
  • 113
  • 1
  • 13
1 2 3
99
100