Python Forum
Serial communication with a board
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Serial communication with a board
#2
I think your problem is here

out = ser.read()
for byte in out:
   print(byte)
By default ser.read() function reads just 1 bytes of the port. You need to specify the total number of bytes you want to read before reading. read function take an argument, argument to specify number of bytes to read or use readlines().

out = ser.read(20)   # make sure you have timeout set or it make block forever
for byte in out:
   print(byte)
See documentation for more details
http://pythonhosted.org/pyserial/shortin...l#readline
Reply


Messages In This Thread
Serial communication with a board - by Bokka - Dec-06-2017, 02:42 PM
RE: Serial communication with a board - by hshivaraj - Dec-06-2017, 05:41 PM
RE: Serial communication with a board - by Bokka - Dec-07-2017, 07:34 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to make a board with turtle, nothing happens when running script Quascia 3 689 Nov-01-2023, 03:11 PM
Last Post: deanhystad
  pyserial/serial "has no attribute 'Serial' " gowb0w 9 4,182 Aug-24-2023, 07:56 AM
Last Post: gowb0w
Photo HOW FIX MY BOARD GAME LAZABI 3 1,485 Apr-01-2022, 04:23 PM
Last Post: BashBedlam
  The game should now run and terminate once the board is full, but still can’t identif rango 0 1,464 Jul-22-2021, 03:24 AM
Last Post: rango
  Enabling interrupt on Adafruits button/led board Moris526 0 2,028 Apr-30-2021, 03:29 PM
Last Post: Moris526
  High-Precision Board Voltage Reading from Python into PD Liam484 1 2,094 Mar-29-2021, 02:57 PM
Last Post: Marbelous
  Interrupt for Adafruits Neotrellis button/led board Moris526 0 1,814 Dec-28-2020, 05:42 AM
Last Post: Moris526
  packet radio communication EmpireAndrew 1 2,202 Nov-01-2019, 06:35 PM
Last Post: micseydel
  WiFi communication Milad 2 2,494 Sep-07-2019, 11:53 AM
Last Post: ndc85430
  Serial communication with raspberry pi 3B and Xbee kj7 0 2,186 Mar-25-2019, 03:39 AM
Last Post: kj7

Forum Jump:

User Panel Messages

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