Taking in a byte turning it into a value 4096-0 and dividing it
AcquaLife
Posts: 19
The title says it all. I'm trying to figure out how to take in bytes from a sensor(which I've done) and then divide and multiply them. I'm using this working code
pst.Str(string("adcVal["))
pst.Dec(channel)
pst.Str(string("] = "))
adcVal[channel] := adc.In(channel)
pst.Position(12, channel)
pst.dec(adcVal[channel]) <---- here is where i print it out as a decimal 0-4096
pst.str(string(" ",pst#NL))
pst.ClearEnd
I tried using the FloatMath library. and the command PUB FFloat(integer)
what i did was
math.FFloat(adcVal[channel]) <
this might be wrong not sure if this is the proper way to use the command
then im kind of confused i dont see a pst.float or anything.
Any help would be appreciated
pst.Str(string("adcVal["))
pst.Dec(channel)
pst.Str(string("] = "))
adcVal[channel] := adc.In(channel)
pst.Position(12, channel)
pst.dec(adcVal[channel]) <---- here is where i print it out as a decimal 0-4096
pst.str(string(" ",pst#NL))
pst.ClearEnd
I tried using the FloatMath library. and the command PUB FFloat(integer)
what i did was
math.FFloat(adcVal[channel]) <
this might be wrong not sure if this is the proper way to use the command
then im kind of confused i dont see a pst.float or anything.
Any help would be appreciated
Comments
If you used adcVal[channel] := math.FFloat(adcVal[channel]) that would convert the values to floating point. From that point on any math MUST be done using the floating point routines.
OBJ fs : "FloatString"
pst.str(fs.FloatToString(xxx))
Bean