|
Forum Index : Microcontroller and PC projects : Available ComX ports program
| Author | Message | ||||
CircuitGizmos![]() Guru Joined: 08/09/2011 Location: United StatesPosts: 1427 |
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: GermanyPosts: 985 |
Thanks a lot! Very useful! Frank |
||||
| lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3470 |
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 ZealandPosts: 9755 |
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 KingdomPosts: 2171 |
... 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 ![]() |
||||
Quazee137![]() Guru Joined: 07/08/2016 Location: United StatesPosts: 600 |
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 |
||||
Quazee137![]() Guru Joined: 07/08/2016 Location: United StatesPosts: 600 |
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 StatesPosts: 600 |
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: ThailandPosts: 2209 |
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. Microblocks. Build with logic. |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |