09-25-2018 02:19 PM
Dear all,
I am using pallets of arduino compiler of labview by TSXperts. I am recieving the data over the serial communication.
Arduino read this data as ASCII char. , My question is how to convert it from ASCII to Int.
Please refer screen shot.
Many thanks in advance
Suyash
09-25-2018 02:27 PM
That sounds like a question for an Arduino programming forum, not the LabVIEW forum.
09-25-2018 02:31 PM
I don't have the arduino compiler so I can't say for sure since I know it has a limited palette that you can use, but I think you can probably use the "Scan From String" function. Wire it to the format code "%d" (of "%f" if it will be a decimal number).
To make sure, you mean your string says something like "123" and you want to get the number 123 from that right? Or do you mean like you have a string "A" and you want to get the number 65. In that case, you would use the "Type Cast" function (if that is part of the arduino compiler allowed functions, if it's not, I don't know what you do).
09-25-2018 02:38 PM
Hi,
Thank you for your prompt reply.
If you have check the screen shot, you must have seen the number s like
Sending data on serial - 1_2_3 ("_" with separator )
Arduino reading each and every char as individual ascii 49 = 1, 95 = _ , 50 = 2 and so on
As of now i have make the program which read the serial data and that data i am writing again to serial so i can monitor it.
I want separate
1 (Int)
2 (Int)
3 (Int)
09-25-2018 02:43 PM
Hi,
There is third party tool , arduino compiler for LabVIEW, which contain, labview pallets (arduino compatible).
Solution on Arduino IDE is available but on LabVIEW i am stuck.
That's why i asked here.
Thanks
09-25-2018 02:44 PM
Then use the format string "%d_%d_%d" for scan from string.
09-25-2018 02:50 PM
But still this wont allow me the ASCII chr. to int conversion.
Type cast one of the option , but it is not available in this specific library
09-25-2018 02:58 PM
Is scan from string available in the library? Would this work?
09-25-2018 03:25 PM
Unfortunately No ...
But match pattern is available , can do something from it.
09-25-2018 03:36 PM - edited 09-25-2018 03:41 PM
Hmm, yeah I guess you could try something like this?
If Decimal String To Number is in the palettes?
It's not the most robust or extendable solution - maybe others will have better ideas.