system.serial.readLine

Does it return ASCII character or string or numbers?

Thanks.

According to the manual, it returns a string.

Right, well my point is how to read floating points or integers?

How would I convert this to double:

…serial code here…

event.source.parent.getComponent(“LED Display”).value = value

event.source.parent.getComponent("LED Display").value = float(value)

When I install the Serial support client module it doesn’t show up in the designer. Why is that?

Thanks.

Is it that system.serial.readLine() isn’t showing up in the intellihints? Or something else isn’t showing up?

If it’s system.serial.* that’s not showing up, check in the Gateway that the module isn’t faulted and it’s the right version for the version of Ignition you have. (If you aren’t sure, post both version numbers here). Also check the logs that there wasn’t a problem on start up.

I guess my question is what does Serial module have? A component? Like for example Instrument module, where I can see the component and the module in the designer. Is Serial module like a library for system.serial support. I didn’t see Serial module appear on the designer with other modules so i was wondering what is it?

I have no problems using serial comm from Ignition to Arduino (for example), it works fine.

Thanks.

Ah, gotcha. No component for the serial module.

Is it possible to trigger something based on the readings from serial? Lets, say switch to another window, or hide a container?

Thanks.

I’m not sure what you’re trying to do, so I’ll answer kind of generally and hope it answers your question.

system.serial.read* executes once, returns a value, and is then done. So you could read that value, and make a decision on what to do, such as changing windows or component visibility, based on that value.

My guess is that you want to read more than a single time. I’d take a look at putting the system.serial.read* in a timer script, and stash that return value in a memory tag. Then you can bind the visibility of the component, say, to the value of the tag. (In the Visible binding, choose expression, and then something like {MyTag} > 5 . When this is true, the component is visible.)

This may seem a bit round about, but what we’re trying to do is be able to read something in a loop, and we’re using the timer script’s ability to run at intervals without taking up all the CPU time. By stashing the value in a tag and binding the tag, it gives you the ability to change which components do what based on the value, without having to change the script each time, plus you get the ability to store that history or chart the value, or anything else tags can do.