Python Forum
How to Properly Open a Serial Port in a Function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Properly Open a Serial Port in a Function
#3
Thanks guys.

You showed me the problem in my program. Actually 2 problems.

1st, the statement ser = serial.Serial('/dev/ttyS0', should be port = serial.Serial('/dev/ttyS0'.
2nd, I added the statement port = port_open(port) where appropriate.

I have some more fine tuning but that made all of the difference.

Thanks again.
Reply


Messages In This Thread
RE: How to Properly Open a Serial Port in a Function - by bill_z - Jul-22-2021, 12:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Excel isnt working properly after python function is started IchNar 3 212 Yesterday, 10:27 AM
Last Post: lillydalson
  Waiting for input from serial port, then move on KenHorse 3 1,152 Apr-17-2024, 07:21 AM
Last Post: DeaD_EyE
  MCU reboots after opening Serial port when ran from Raspberry PI zazas321 3 476 Mar-19-2024, 09:02 AM
Last Post: zazas321
  pyserial/serial "has no attribute 'Serial' " gowb0w 9 4,379 Aug-24-2023, 07:56 AM
Last Post: gowb0w
  with open context inside of a recursive function billykid999 1 591 May-23-2023, 02:37 AM
Last Post: deanhystad
  Serial Port As Global Prasanjith 2 1,540 Mar-23-2023, 08:54 PM
Last Post: deanhystad
  python serial port barryjo 2 1,688 Dec-27-2021, 11:09 PM
Last Post: barryjo
  is there a way to mention port range or search for port dynamically with qConnection Creepy 0 1,500 Sep-09-2021, 03:15 PM
Last Post: Creepy
Question Python3 - serial port reload parovelb 4 5,966 Apr-08-2021, 09:18 AM
Last Post: parovelb
  Unable to read from serial port br0kenpixel 1 2,512 Aug-08-2020, 10:03 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020