Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
while (Serial.available()
#3
(Feb-09-2017, 05:20 PM)DougArndt Wrote: I'm doing something similar with a PicAXE over bluetooth, and found the ser.inWaiting() of use

while 1:
      while ser.inWaiting() > 20:

Hi thanks for that I did this.

while 1:
        try:
            msg = ser.readline()
            msg=msg.decode('utf-8')
            if len(msg) > 0:
                print(msg)
 
Now that only goes to print if msg is > than 0.
That stopped the code printing empty lines.
I will use your code next time.
holt24.
Reply


Messages In This Thread
while (Serial.available() - by holt24 - Jan-23-2017, 06:26 PM
RE: while (Serial.available() - by DougArndt - Feb-09-2017, 05:20 PM
RE: while (Serial.available() - by holt24 - Feb-10-2017, 11:15 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  pyserial/serial "has no attribute 'Serial' " gowb0w 9 4,438 Aug-24-2023, 07:56 AM
Last Post: gowb0w

Forum Jump:

User Panel Messages

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