Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Serial USB problem
#1
Hi,
I have received very valuable help here last week, so i'll try again :-)
I have a bunch of microbits that collect data (max 10).
They "radio" the data to a central microbit that is connected to the PC via USB.(COM9)
The data come in the form of (max 10) very small files.

My problem:
I need to monitor via the PC, in python of course, which filenames have arrived on the microbit.
I don't have to read their content, i don't have to copy or move them,
i just need to veryfy that all 10 files have arrived on the central microbit.

Hours of internet searching seem to indicate that this is an unknown area.
The closest i have come was to use "microFS", but that only seems to work in command mode.
It must be possible, because the "MU" editor lists them nicely.

Once my list of 10 is complete, i signal to the central microbit
that it can delete all 10 files, and the whole cycle starts again.

thx,
Paul

Edit: i went to look in the MU source code how they do it (written in python after all)
I found something exotic like so:
path = QFileDialog.getExistingDirectory(self.widget, 'Locate BBC micro:bit',folder if self.previous_folder is None else self.previous_folder,QFileDialog.ShowDirsOnly)
?
Reply
#2
You can find information about Q5dialog (part of pyQt5 which you can get using pip) here: http://zetcode.com/gui/pyqt5/dialogs/
packages dealing with USB can be found here (you will have to do some research, click on homepage to see details for each pagkage):
https://pypi.org/search/?q=USB
You may wish to search pypi.org for "max 10" as well
Reply
#3
OK, thanks, but it confirms my idea that it IS a big deal.
Can anyone enlighten me in a few simple words, why it is so difficult (aka non-standard)
to peek into a USB microbit and get a list of filenames?

Paul
Reply
#4
If all you want to do is read and display bytes, you can use the serial package which you can install using pip

see: https://pyserial.readthedocs.io/en/lates...intro.html
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  pyserial/serial "has no attribute 'Serial' " gowb0w 9 3,877 Aug-24-2023, 07:56 AM
Last Post: gowb0w
  Problem reading from serial python_beginner 5 13,444 Jan-19-2018, 11:13 AM
Last Post: python_beginner
  Problem with serial data. How do I ignor incorrect data? donmerch 1 2,919 Jul-11-2017, 01:55 AM
Last Post: donmerch

Forum Jump:

User Panel Messages

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