Go Down

Topic: how to read port names for an additional tool ? (Read 1 time) previous topic - next topic

palary18

Hello

I'm working on a tool (ArduBlock) which give a graphical programming environment for arduino.
I would like to display these informations on the JFrame of this tool :
  • the name of the selected board
  • the name of the selected serial port


It's OK for the name of the selected board : an itemStateChanged listener on the board menu does the job.
But this method has no effect with the serial port menu. I can create a listener, i can get it, but it haven't any reaction when the serial port is modified.

Somebody has an idea ?

Pierre

Robin2

Doesn't the user have to select the Serial port on the PC - and having done that won't your program know what it is ?

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

palary18

No, the user select the serial port from the tool/serial port/COM1, COM2, ... menu of the arduino EDI.
And so i want my adding tool (ArduBlock) to detct any modification of serial port and display it.

Robin2

No, the user select the serial port from the tool/serial port/COM1, COM2, ... menu of the arduino EDI.
And so i want my adding tool (ArduBlock) to detct any modification of serial port and display it.
Can you explain more clearly what your tool is intended to do?

For example, if the User is using the Arduino IDE to connect to an Arduino board I don't see how another program can do so at the same time with the same COM serial port.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

palary18

My program is an addon to Arduino EDI. It is build as a tool for processing :
https://github.com/processing/processing/wiki/Tool-Basics

In the addon, this java instruction is OK for listening a board choice :
itemRB.addActionListener(this);
where itemRB is pointing to the radio buttons "arduino uno", ..., "arduino BT", ..., "arduino leonardo", ... from the board menu.

but this one don't work for listening a serial port choice :
itemCB.addActionListener(this);
where itemCB is pointing to the check boxes "COM1", "COM2", ... from the serial port menu.

You can see ardublock blog for more explanation about it.

thanks for your replies

PaulS

Quote
My program is an addon to Arduino EDI.
I'll assume that you've been taking typing lessons from Grumpy_Mike.

I guess I don't understand why your addin needs to know which com port the IDE is going to tell avrdude to send the resulting hex file to.

Robin2

My program is an addon to Arduino EDI. It is build as a tool for processing :
https://github.com/processing/processing/wiki/Tool-Basics

You can see ardublock blog for more explanation about it.
If you want help provide the necessary information here and don't expect people to go chasing about the internet to save you trouble.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

palary18

My wish is to show in real time the board name and the serial port on my addon. Like this :



the addon is programmed in java language. I can access to the arduino "editor" class, so my program can implement menu listeners. those relating to the choice of the board are active, but those affecting the serial ports do not respond.

public void run() {
   try {
   ...
   final JRadioButtonMenuItem itemRB = (JRadioButtonMenuItem)menu.getItem(i);
   itemRB.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
      //// it's OK
      //// i can read the selected board
      //// so i can actualize the nale of the board on the addon Frame
   }
   ...
   final JCheckBoxMenuItem itemCB = (JCheckBoxMenuItem)menu.getItem(i);
   itemRB.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
      //// it's not OK
      //// this listener is never fired
      //// and no discount is possible
   }
   ...
}

Robin2

That is well beyond my pay grade.

And it looks like it needs a Java programming expert rather than someone with Arduino programming knowledge.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

palary18

Yes, you are right
And i have solved my problem

if somebody is interested, that's the solution :
everytime that the tool menus are selected, arduino updates the sub port menu and also the action listeners attached. So i must do the same in my addon.

thanks for everyone
thank you robin2

Go Up