Python Forum
Pyserial issues with proper loops and binary
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pyserial issues with proper loops and binary
#1
So i bought my python programmable Lidar Chip and havent recieved data yet because after opening it up in pyserial i have no idea how to test it...

so i built serial tester code.
with what i have deciphered from the users manual........
           
serialtest.py
#!/usr/bin/env python

import serial
import time

serious = serial.Serial('/dev/ttyUSB0',921600,timeout=.1)
print ('serial port name: '+str(serious.name))        
startCMDchar =  b'0b10101010101010101010101010101010'
deviceaddress = b'00000000'
cmdcodestart = b'0b10'
cmdcodestop = b'0b1111'
cmdcodeok = b'0b10010'
cmdstart = b'0b10101010101010101010101010101010000000000b10'
cmdstop = b'0b10101010101010101010101010101010000000000b1111'
cmdok = b'0b10101010101010101010101010101010000000000b10010'
serious.flush()
serious.write(cmdok)
counter = serious.in_waiting
print (counter)
answer = serious.read(counter)
print (answer)
serious.flush()
serious.write(cmdstart)
counter2 = serious.in_waiting
answer2 = serious.read(counter)
print (counter2)
print (answer2)
serious.write(cmdstop)
I must be way off .....

this is what i am receiving...

   
Reply


Messages In This Thread
Pyserial issues with proper loops and binary - by jttolleson - Aug-03-2023, 07:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Correct/proper way to create save files snakes 0 438 Mar-11-2025, 06:58 PM
Last Post: snakes
  Getting proper x,y axis values pyhill00 8 3,725 Jul-29-2022, 06:48 PM
Last Post: pyhill00
  Proper way to do the OR statement? Mark17 5 2,790 Mar-01-2022, 01:54 PM
Last Post: Mark17
  How to make this function general to create binary numbers? (many nested for loops) dospina 4 6,158 Jun-24-2020, 04:05 AM
Last Post: deanhystad
  proper use of 'end' in a 'with' statement ccrider27 1 2,561 Mar-18-2020, 10:33 PM
Last Post: buran
  Proper use of if..elif..else statement nick1941 2 3,060 Mar-06-2020, 11:22 PM
Last Post: nick1941
  Proper Layout of Code Question TheJax 2 2,814 Feb-08-2020, 06:14 PM
Last Post: TheJax
  hex file to binary or pcap to binary baran01 1 6,877 Dec-11-2019, 10:19 PM
Last Post: Larz60+
  Unable to do the proper split using re.sub incase of missing data. Karz 1 2,394 Nov-17-2019, 05:58 PM
Last Post: buran
  getopt with tuple not working proper Frank123456 0 2,309 Aug-21-2019, 12:46 PM
Last Post: Frank123456

Forum Jump:

User Panel Messages

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