I have been trying to connect to a adafruit cuicuit playground via the USB serial connection. I’ve set up a gateway timer script:
system.serial.openSerialPort(‘COM6’)
data=system.serial.readBytesAsString(‘COM6’, 115200 ,250, ‘UTF-8’)
system.tag.write(’[default]open_serial’,data)
system.serial.closeSerialPort(‘COM6’)
This is not the first iteration of this, but I keep getting this error.
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File “”, line 1, in at com.inductiveautomation.ignition.modules.serial.scripting.SerialScriptModule.getAndLockSerialPort(SerialScriptModule.java:143) at com.inductiveautomation.ignition.modules.serial.scripting.SerialScriptModule.readBytes(SerialScriptModule.java:328) at com.inductiveautomation.ignition.modules.serial.scripting.SerialScriptModule.readBytesAsString(SerialScriptModule.java:389) at jdk.internal.reflect.GeneratedMethodAccessor25.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) java.io.IOException: java.io.IOException: Port COM6 has not been opened.
at org.python.core.Py.JavaError(Py.java:547)
at org.python.core.Py.JavaError(Py.java:538)
at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:192)
at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:208)
at org.python.core.PyObject.call(PyObject.java:512)
at org.python.core.PyObject.call(PyObject.java:517)
at org.python.pycode._pyx10.f$0(:2)
at org.python.pycode._pyx10.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1687)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:806)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runCode(ProjectScriptLifecycle.java:680)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:752)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runCode(ProjectScriptLifecycle.java:661)
at com.inductiveautomation.ignition.common.script.TimerScriptTask.run(TimerScriptTask.java:92)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.python.core.PyException: java.io.IOException: java.io.IOException: Port COM6 has not been opened.
… 22 common frames omitted
Caused by: java.io.IOException: Port COM6 has not been opened.
at com.inductiveautomation.ignition.modules.serial.scripting.SerialScriptModule.getAndLockSerialPort(SerialScriptModule.java:143)
at com.inductiveautomation.ignition.modules.serial.scripting.SerialScriptModule.readBytes(SerialScriptModule.java:328)
at com.inductiveautomation.ignition.modules.serial.scripting.SerialScriptModule.readBytesAsString(SerialScriptModule.java:389)
at jdk.internal.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:190)
… 19 common frames omitted
Any ideas or what I’m missing.
Oh by the way the port is not being held by something else as I can connect via terra term.