Page 1 of 1
Using the Hi Injector [Solved]
Posted: Wed Jan 03, 2018 9:58 am
by QMESAR
Hi All.
Please help an old man it seams I lost my brain
I would like to use the Serial monitor in the tools sections(which says it allows for connecting to a com port)
I would like send some data from my micro with UART to my virtual comport take this data in FC and display it on some gauges and dials.
However besides the small popup which says what the serial monitor is searching the wiki I found no results in helping me to get it up and running
can you guys refer me to the help of this component or explain me in short how to do this
I have done this in the past with the simulation components and just us the com port however I noticed now in FC7 we have this component and would like to use it

Sorry if I miss some basics here
Re: Using the Hi Injector
Posted: Wed Jan 03, 2018 11:37 am
by Benj
Hello Peter,
The Serial Monitor is an easy way to pipe data through to the console window without having to use any component macros. You can type data into the console RX Queue tab which will be sent out and you can view incoming data in the Data tab. This is similar to the terminal window available in the Arduino IDE and is useful if you want to add debug statements to your embedded program and then follow along in the Flowcode simulation. I believe the Serial Monitor console tabs will work even when the simulation is not running.
For using the data in your simulation program you have to use either the UART or COM Port component. The COM Port component is currently only available via the search component toolbar item.
For the UART component simply set the data source property to COM Port and set the COM Port property to the port you want to communicate with. You can then call the UART component macros as you normally would.
The COM Port component should work in a similar way, in fact this is built into the UART component to provide the simulation functionality. I hope this makes sense.
Re: Using the Hi Injector
Posted: Wed Jan 03, 2018 11:58 am
by QMESAR
Ben.
Thank you very much !This is clear now
Another simple question what is the correct way in Flow code to initialize an array to zero in the dialog when you create the array

Re: Using the Hi Injector
Posted: Wed Jan 03, 2018 12:21 pm
by Benj
Hi Peter,
Array specification and initialisation is something we have just added to the variable manager in v8.
For now in v7 the best way is to create a loop which loops through the elements in the array and sets them to your initialisation value. Sorry it's not more straightforward.
Re: Using the Hi Injector
Posted: Thu Jan 04, 2018 12:16 pm
by QMESAR
Hi Ben.
I am following your advise regarding initializing an array however I see some strange things and hope you can help me understand what I see.
I use a loop that takes a counter value(corresponding to the array elements) and add 1 to the counter and place it in the element
this works fine and in the debug window I can see the elements getting set to counter value +1
however when I do the same thing with a loop and only clear 1 element it seems in the debug window all elements are cleared and has no value inside
I would have expected all elements keep there value except the one that is set to zero(0)should show a zero(0) but in my case it shows( " ")whole string
What am I missing here

Thank a million
Peter
Re: Using the Hi Injector
Posted: Thu Jan 04, 2018 12:24 pm
by LeighM
Hi Peter,
Byte arrays and strings are very similar, but a 0 or null at any point in the array will terminate a string, hence anything beyond the 0 will be ignored when printing a string.
If you were to zero the array from the end backwards you will see the difference.
Hope that helps,
Leigh
Re: Using the Hi Injector
Posted: Thu Jan 04, 2018 1:01 pm
by QMESAR
leigh
I will give it ago now thanks a million
