Go to advanced search

by liudr
Thu Jul 05, 2018 4:19 pm
Forum: Python
Topic: Regular expression that turns into a python syntax question
Replies: 11
Views: 367

Re: Regular expression that turns into a python syntax question

Thanks for taking the time to explain. Maybe one will be a more future-proof way than the other? If I can bet that .match() will always be returning None in future versions, it seems to be a more accurate way to do the if-statement. I'm frankly not sure what None represents, coming from a C/C++ back...
by liudr
Tue Jul 03, 2018 8:40 pm
Forum: Python
Topic: Regular expression that turns into a python syntax question
Replies: 11
Views: 367

Re: Regular expression that turns into a python syntax question

The re.search function returns a match object on success, none on failure. https://www.tutorialspoint.com/python/python_reg_expressions.htm Instead of testing for true test for if (m is not None): Fixed your link. Thanks. The answer ericcooper provided was what I was looking for, reason that m is c...
by liudr
Tue Jul 03, 2018 8:34 pm
Forum: Python
Topic: Regular expression that turns into a python syntax question
Replies: 11
Views: 367

Re: Regular expression that turns into a python syntax question

ericcooper wrote:
Tue Jul 03, 2018 8:28 pm
Any non-zero / non-empty value is treated as True for "if" statements and other conditionals.
I see. That's why. It makes sense. Thanks.
by liudr
Tue Jul 03, 2018 8:13 pm
Forum: Python
Topic: Regular expression that turns into a python syntax question
Replies: 11
Views: 367

Regular expression that turns into a python syntax question

I am using regular expression to match a number at the end of a string using '[0-9]$'. It works perfectly except when the string is empty (didn't get a response from serial port). See the following snippet: m=re.search('[0-9]$','A7') print(m.group(0)) I read from Python doc that the m object evaluat...
by liudr
Fri Jun 29, 2018 8:22 pm
Forum: Python
Topic: What communication protocol does Pyserial run?
Replies: 8
Views: 247

Re: What communication protocol does Pyserial run?

Your servo needs 5V UART. I think you mentioned that you have a 3.3V to 5V converter so it's covered. The problem may be the code, which is long. I suggest you to use the adapter the manufacturer sells and tap into the adapter and listen to the communication. There are serial port sniffer software t...
by liudr
Fri Jun 29, 2018 7:09 pm
Forum: Python
Topic: What communication protocol does Pyserial run?
Replies: 8
Views: 247

Re: What communication protocol does Pyserial run?

Does the write function in PySerial automatically add the start and stop bits onto the data I am trying to transmit? This is the byte array that I am transmitting through the connection: b'\x15\xaa\x87\xe8\xae' No, pyserial calls lower-level functions probably in the system and hands over the data....
by liudr
Fri Jun 29, 2018 5:03 pm
Forum: Python
Topic: Issue with Pyserial module extracting device serial number
Replies: 9
Views: 311

Re: Issue with Pyserial module extracting device serial number

Thanks. Here is my new code to detect the correct USB-UART adapter on windows system (I'll test it on linux tonight but don't expect it will fail): import serial.tools.list_ports # For listing available serial ports import serial # For serial communication port_ID='A817EQLG' # List ports for user to...
by liudr
Thu Jun 28, 2018 7:45 pm
Forum: Python
Topic: Issue with Pyserial module extracting device serial number
Replies: 9
Views: 311

Re: Issue with Pyserial module extracting device serial number

Wow, that's the response of the week! Thank you so much hippy! For what matters to me, I have FT232R chip that has a single port per chip as FT231X that some Arduino compatible boards use. This means I am OK with either chip ID or port ID. I'll make sure when I am matching the chip ID and ignore the...
by liudr
Thu Jun 28, 2018 4:52 pm
Forum: Python
Topic: Issue with Pyserial module extracting device serial number
Replies: 9
Views: 311

Re: Issue with Pyserial module extracting device serial number

I tried a win 7 computer. Same issue. I then deleted the device and its driver so that the device stops showing in device manager. I then ran FT_Prog and it detected the device again and got the correct serial number. Once I reinstalled driver and the device showed up again, Python again got a seria...
by liudr
Thu Jun 28, 2018 12:13 am
Forum: Python
Topic: Issue with Pyserial module extracting device serial number
Replies: 9
Views: 311

Re: Issue with Pyserial module extracting device serial number

My arduino MEGA2560 has 5533233313035180A140, also 20-characters. This is the same on windows and rpi. I agree, something in FTDI driver on windows is buggy.
by liudr
Wed Jun 27, 2018 10:44 pm
Forum: Python
Topic: Issue with Pyserial module extracting device serial number
Replies: 9
Views: 311

Re: Issue with Pyserial module extracting device serial number

The FT_Prog program from FTDI is also running on Windows. The serial number, according to the program, is 16 characters. I've just tried 16 characters. This time there was no added "A" in the end. As you know what all scientists do, I tried 15 characters. And the "A" is back. I guess, without trying...
by liudr
Wed Jun 27, 2018 9:40 pm
Forum: Python
Topic: Issue with Pyserial module extracting device serial number
Replies: 9
Views: 311

Issue with Pyserial module extracting device serial number

I have encountered an issue using pyserial to find serial number of FTDI chip on different operating systems: Under Raspberry Pi 3B+ /dev/ttyUSB1 (USB VID=0403) Serial#:=AJ02WA8P Under Windows 10 COM14 (USB VID=0403) Serial#:=AJ02WA8PA Notice the added "A" in serial number. I also tried several othe...
by liudr
Wed Jun 13, 2018 3:41 am
Forum: General discussion
Topic: Black screen with cursor (basic openbox?)
Replies: 4
Views: 196

Re: Black screen with cursor (basic openbox?)

I would not use Windows on any device with Unix/Linux file system since Windows does not recognize the Unix/Linux file system unless some special programs are added to the Windows system. Using a USB card reader on the Pi 3B+ you can use the SD Copier to clone the running OS. Have you tried the ori...
by liudr
Wed Jun 13, 2018 12:59 am
Forum: General discussion
Topic: Black screen with cursor (basic openbox?)
Replies: 4
Views: 196

Re: Black screen with cursor (basic openbox?)

Thanks. My original sd card runs fine on an RPI0 system headless. The resolution I got is 720*480. I am not sure how to change that. The command.txt is identical between my original and clone sd cards. I went into raspi-config and set the resolution to 1280*720 and rebooted. The result is the same. ...
by liudr
Mon Jun 11, 2018 11:12 pm
Forum: General discussion
Topic: Black screen with cursor (basic openbox?)
Replies: 4
Views: 196

Black screen with cursor (basic openbox?)

I have the most recent Raspbian on an SD card running on RPI3B+. Did the apt-get upgrade. I enabled vnc and was using vnc for all my interactions with it. I then made a copy using win32 image writer. The original sd card went into an RPI0. The clone went into the RPI3B+. The original card in RPI0 wo...
by liudr
Sat Mar 31, 2018 1:46 am
Forum: Python
Topic: Pyserial ungraceful handling of disconnected USB serial adapter
Replies: 5
Views: 435

Re: Pyserial ungraceful handling of disconnected USB serial adapter

For those that develop projects in python on a PC and deploy them on an rpi, this might be relevant. I don't think it is rpi, but rather linux kernel that is better than windows.
by liudr
Fri Mar 30, 2018 5:13 pm
Forum: Python
Topic: Pyserial ungraceful handling of disconnected USB serial adapter
Replies: 5
Views: 435

Pyserial ungraceful handling of disconnected USB serial adapter

I thought since many of us use pyserial with python, it's worth mentioning. I have a recent distro of raspbian running on RPI0W. I have a USB hub and a serial adapter (FT232 based). I have the stock python 3.4 and an older pyserial 3.1.1. If I disconnect the USB serial adapter while the serial port ...
by liudr
Wed Nov 15, 2017 6:12 pm
Forum: General discussion
Topic: Configure RPI 3B as both AP and station?
Replies: 7
Views: 929

Re: Configure RPI 3B as both AP and station?

Yeah, countless subjects on how to set RPI to AP (only) but not alternating or having both up that I could find. I think that the RPI is not ready to do both. I'll think about a different way, maybe bluetooth. The RPI is sealed in a waterproof box and connection to is can only be wireless. I can bri...
by liudr
Tue Nov 14, 2017 7:42 pm
Forum: General discussion
Topic: Configure RPI 3B as both AP and station?
Replies: 7
Views: 929

Re: Configure RPI 3B as both AP and station?

Most things you said didn't reflect my intent so I will describe once more for everyone to better understand what I am trying to do. I have a little example from a wifi-enabled camera. This camera made by a networking company can connect to my home wifi router so it can upload pictures to an online ...
by liudr
Tue Nov 14, 2017 6:43 am
Forum: General discussion
Topic: Configure RPI 3B as both AP and station?
Replies: 7
Views: 929

Configure RPI 3B as both AP and station?

I am looking for ways to configure RPI 3B as both AP and station. My goal is to use the AP mode and a simple webpage hosted on RPI to collect information. Say I have my RPI running headless and just powered up. I need to give it PSK for the hotspot it's supposed to connect to. I connect to RPI's AP ...
by liudr
Wed Oct 11, 2017 6:11 pm
Forum: General discussion
Topic: I am trying to build my own display device for my raspberry pi
Replies: 8
Views: 2634

Re: I am trying to build my own display device for my raspberry pi

It's a risk but maybe they are going with USB color coding (if it is USB):

https://www.google.com/search?q=USB+col ... 8&oe=utf-8

Don't destroy the cable just yet. Use jumper wire on the two-row connector for a test. Got an old USB mouse that's no longer working? Use its cable.
by liudr
Tue Oct 10, 2017 9:17 pm
Forum: General discussion
Topic: I am trying to build my own display device for my raspberry pi
Replies: 8
Views: 2634

Re: I am trying to build my own display device for my raspberry pi

How is C1 connected to your laptop, via a ribbon cable? Are there any markings on either C1 or the connector on the motherboard?

Does the small board have anything on the other side for a touch screen controller IC?
by liudr
Tue Oct 10, 2017 3:08 am
Forum: Raspberry Pi Desktop for PC and Mac
Topic: STICKY: X86 Debian Jessie with PIXEL desktop for PC and Mac (obsolete)
Replies: 231
Views: 79572

Re: STICKY: Debian Jessie with PIXEL desktop i386 for PC and Mac

best-tester, Thanks for your help. I will definitely wait for the stretch version of rpi PC. I tried debian 9 after posting here but it has only a little bit of advantage. The integrated wifi worked after some googling. The audio still won't work and touch pad is difficult to work with. I never got ...
by liudr
Sun Oct 08, 2017 9:29 pm
Forum: General discussion
Topic: What to do if you can't port forward rasperry pi?
Replies: 9
Views: 1103

Re: What to do if you can't port forward rasperry pi?

I use teamviewer. Install this host on raspberry pi:

https://download.teamviewer.com/downloa ... _armhf.deb


Install a regular PC client to connect to your raspberry pi:

https://www.teamviewer.com/en/download/

Go to advanced search