Getting binary version of numeric data types

Rx7man

New member
Joined
Feb 18, 2016
Messages
3
Location
BC Canada
Programming Experience
1-3
Hello.. newbie here.. mild experience designing my own stuff... (been playing with Basic for 20 years)

I have a project that involves receiving data from an Arduino over the serial port... and I'm working on parsing that data

currently, the data comes in a message, with part of the message being the type of data it contains.. on the Arduino side of it, I have no problem converting a floating point (or any other.. integer, etc) number to it's binary representation using a union.

On the VB side of it, the math is really simple and can be done in a bitwise manner for integral types.. but for floating point numbers, how would I go about this?

I will also need to do the reverse operation to send data back to the Arduino.. I will have a floating point (Single or Double) that I need to convert into binary form to send back.

Any tips on how to go about this?

Thanks.
 

Rx7man

New member
Joined
Feb 18, 2016
Messages
3
Location
BC Canada
Programming Experience
1-3
My bad for the ambiguous language.. I mean an array or sequence of bytes.. MSB first in my case would be preferred. I will take a look at the bitconverter class, thank you
 

Rx7man

New member
Joined
Feb 18, 2016
Messages
3
Location
BC Canada
Programming Experience
1-3
I just gave it a quick test.. seems to do what I want it, though I may need to reverse the byte array to suit my needs.. Cheers, this will be useful in many projects!
 
Top Bottom