battling to get started

12 views
Skip to first unread message

Dominique Ingala

unread,
Dec 4, 2019, 10:01:15 AM12/4/19
to SerialPundit
Hi, Please help.
I'm using Windows 10, Netbeans 11.2, Maven.

I managed to add dependency for SerialPundit in my project.

I imported the following:

import com.serialpundit.core.SerialComPlatform;
import com.serialpundit.core.SerialComSystemProperty;
import com.serialpundit.serial.SerialComInByteStream;
import com.serialpundit.serial.SerialComManager;
import com.serialpundit.serial.SerialComManager.BAUDRATE;
import com.serialpundit.serial.SerialComManager.DATABITS;
import com.serialpundit.serial.SerialComManager.FLOWCONTROL;
import com.serialpundit.serial.SerialComManager.PARITY;
import com.serialpundit.serial.SerialComManager.STOPBITS;
import com.serialpundit.serial.SerialComOutByteStream;


I have 1 button in my GUI to test the serial comms. In the button method, I have this:


private void btnLed_OnActionPerformed(java.awt.event.ActionEvent evt) {                                          
        
        lblFeedback.setText("LED ON ");
        
        /*********  Serial port   */
       try {
            SerialComManager scm = new SerialComManager();
            long handle = scm.openComPort("COM6", true, true, false);
            scm.configureComPortData(handle, DATABITS.DB_8, STOPBITS.SB_1, PARITY.P_NONE, BAUDRATE.B9600, 0);
           // scm.configureComPortControl(handle, FLOWCONTROL.NONE, 'x', 'x', false, false);
            scm.writeString(handle, "H", 0);// == true);
            String data = scm.readString(handle);
            System.out.println("data read is :" + data);
            //scm.closeComPort(handle);
            } 
        catch (Exception e) {
e.printStackTrace();
            }
        
        
    }   


Unfortunately, it's not working. Could you please help me know what I need to change?

Thanks,
Dominique



rishi gupta

unread,
Dec 4, 2019, 10:08:37 AM12/4/19
to Dominique Ingala, SerialPundit
Please use this:
long handle = scm.openComPort("COM6", true, true, true);

-Rishi
> --
> You received this message because you are subscribed to the Google Groups "SerialPundit" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to SerialPundit...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/SerialPundit/07bb483a-455a-49d9-b877-9812331adeb9%40googlegroups.com.

Dominique Ingala

unread,
Dec 4, 2019, 10:15:17 AM12/4/19
to SerialPundit
Briiliant Rishi,
It worked!
I'm so happy.

Regards,
Dominique
> To unsubscribe from this group and stop receiving emails from it, send an email to Serial...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages