Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:35 12 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Available ComX ports program

Author Message
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 06:29pm 30 Oct 2018
Copy link to clipboard 
Print this post

I play a little game every time I hook up a micromite to my PC. The game is called "I wonder what com port this connection will be today?" It isn't a very fun game.

So I put together a little executable that shows what com ports are available. I run this (it can run all the time) to see what ports are available on my machine:



Then I plug something in and voila! I now know the port of the thing I just plugged in:



Free to use. Might need to have Java installed to use it as I use a java library - please let me know.

Here is the executable:

2018-10-31_042829_AvailPorts.zip
Micromites and Maximites! - Beginning Maximite
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 985
Posted: 07:01pm 30 Oct 2018
Copy link to clipboard 
Print this post

Thanks a lot! Very useful!

Frank
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3470
Posted: 08:02pm 30 Oct 2018
Copy link to clipboard 
Print this post

I know the game well, but I look under "Ports" in Device Manager. I have it open all the time (because of the idiosyncrasies of this game).

PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9755
Posted: 09:02pm 30 Oct 2018
Copy link to clipboard 
Print this post

Thanks. I play that game myself all the time too, and it is a pain in the arse.
Smoke makes things work. When the smoke gets out, it stops!
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2171
Posted: 09:27am 31 Oct 2018
Copy link to clipboard 
Print this post

... which is why I have a shortcut to the DeviceManager on my desktop. This also shows the device type of the port which helps determine which is which



Edited by CaptainBoing 2018-11-01
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 600
Posted: 10:26am 26 May 2019
Copy link to clipboard 
Print this post

Here is a python3 I wrote today. It works on mint 18.


#!/usr/bin/env python3

''' This will let you know what serial port is
used when you plug your Micromite in.
It uses the Notify-send style.
I left the print statements just commented them
if you want to play/test.

'''

import pyudev
import notify2
from playsound import playsound

notify2.init('app name')
context = pyudev.Context()
monitor = pyudev.Monitor.from_netlink(context)
monitor.filter_by(subsystem='tty')

for device in iter(monitor.poll,'usb'):

if device.action == 'add':
''' print(device.get("DEVNAME"), " Connected")'''
n = notify2.Notification(device.get("DEVNAME"), 'Connected')
n.show()
playsound('TaDa.ogg')

if device.action == 'remove':
''' print(device.get("DEVNAME"), " Disconnected")'''
n = notify2.Notification(device.get("DEVNAME"), 'Disconnected')
n.show()
playsound('Voila.ogg')




I dont have a windows system to test on but it might work as is.
There is import os that I havent checked out so tools like this
can run on Linux, Mac and Windows without modding.

Having more FUN
Quazee137

here is the sound files I used
2019-05-26_222216_2sounds.zip


Edited by Quazee137 2019-05-27
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 600
Posted: 04:35pm 26 May 2019
Copy link to clipboard 
Print this post


more of me playing with python3

[CODE
#!/usr/bin/env python3

''' This will let you know what serial port
are in when using your Micromites.
a fun version LOL
'''
import os
import pyudev
import notify2
from playsound import playsound

notify2.init('app name')
context = pyudev.Context()
monitor = pyudev.Monitor.from_netlink(context)
monitor.filter_by(subsystem='tty')

for device in iter(monitor.poll,'usb'):

if device.action == 'add':
''' print(device.get("DEVNAME"), " Connected")'''
n = notify2.Notification(device.get("DEVNAME"), 'Connected')
n.show()

dn = (device.get("DEVNAME") + " is connected")
os.system( 'espeak -ven -k1 -s140 -g15 -p60 --punct="<characters>" "%s" 2>>/dev/null' % dn)
'''playsound('TaDa.ogg')'''

if device.action == 'remove':
''' print(device.get("DEVNAME"), " Disconnected")'''
n = notify2.Notification(device.get("DEVNAME"), 'Disconnected')
n.show()

dn = (device.get("DEVNAME") + " is disconnected")
os.system( 'espeak -ven -k1 -s150 -g15 -p60 --punct="<characters>" "%s" 2>>/dev/null' % dn)
'''playsound('Voila.ogg')'''


]

I left the print and sound for you to play with

 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 600
Posted: 01:23pm 28 May 2019
Copy link to clipboard 
Print this post


Here is two videos showing the program

youtube one

youtube two


I was going to edit the last bits out but it's been 3 years
and 4 systems last I did any youtube. Forgot what editor I
used and the youtube editor just would not cut off the tail
end so I just let it go.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 03:32pm 28 May 2019
Copy link to clipboard 
Print this post

https://www.uwe-sieber.de/comportman_e.html :)

You can also assign a comport and that will be used when it is plugged in.
When you plug it into a different port or use a hub then you can do this multiple times to give a certain device always the same comport.

Normally a device that gets plugged into the same USB port wil get the same comport assigned to it.

The above program does that regardless of which USB port is used. Just define it in a small config file.

Edited by MicroBlocks 2019-05-30
Microblocks. Build with logic.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025