B4J Question jserial

jayel

Active Member
Licensed User
Longtime User
Hello,

I try this :
B4X:
    sp.Initialize("")   
    sp.SetParams(115200,8,1,0) 'here I get the error
    sp.Open("/dev/ttyUSB0")
   
    astream.Initialize(sp.GetInputStream, sp.GetOutputStream, "astream") 'geen prefix
    'InitInputsOutputs
    tmrReconnect.Initialize("tmrReconnect",5000)
    tmrReconnect.Enabled = False

And I get this error :
Waiting for debugger to connect...
Program started.
Error occurred on line: 39
java.lang.NullPointerException
at anywheresoftware.b4j.serial.Serial.SetParams(Serial.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:656)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:232)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:90)
at anywheresoftware.b4a.BA.raiseEven
t(BA.java:84)
at b4j.example.main.main(main.java:29)

John
 
Top