Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
lew247 Guru Joined: 23/12/2015 Location: United KingdomPosts: 1702
Posted: 03:16pm 01 Jan 2018
Copy link to clipboard
Print this post
I still cannot get my head around how to tell what is what
On my Explore 100 I have serial data being received [code]STXW , 23.42, 982.11, 253.372, 1.60, 2.24, 3.65, 0.0000, 0.0000, 24.32, 0.00, 21.69, 0.00, 3.88, 51.33,*[/code]
I'm trying to print the pressure which is fieldarray 2
I have pressure declared as an integer
and I'm using this code to print the pressure [code]pressure =VAL(FieldArray$(2)),0,2) print pressure, " pressure"[/code]
However its only printing the whole numbers not the decimals, in this example 982 pressure
What I want to do is compare two sets of pressure and if one is higher then display something on the display, however for now a print statement would do to show its working. but I cant get it to subtract the 2 sets of numbers
PicFan Senior Member Joined: 18/03/2014 Location: AustriaPosts: 133
Posted: 05:28pm 01 Jan 2018
Copy link to clipboard
Print this post
I think:
DIM float pressure
Azure Guru Joined: 09/11/2017 Location: AustraliaPosts: 446
Posted: 12:00am 02 Jan 2018
Copy link to clipboard
Print this post
Integers are whole numbers with no decimal point. MMBasic uses signed integers so it is a positive or negative whole number.
If you want to display numbers that include a fraction of a whole number (something after a decimal point) then you need to use float as PicFan suggested.
robert.rozee Guru Joined: 31/12/2012 Location: New ZealandPosts: 2463
Posted: 04:13am 02 Jan 2018
Copy link to clipboard
Print this post
life used to be so much simpler, when every integer ended in a "%", and every string ended in a "$"...
cheers, rob :-)
CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2171
Posted: 05:27am 02 Jan 2018
Copy link to clipboard
Print this post
Still can... choices eh? variable name fluidity!
strings will be strings and floats will be floats, it's a mixed up, muddled up, shook up world, except for Lola$
lew247 Guru Joined: 23/12/2015 Location: United KingdomPosts: 1702
Posted: 06:31am 02 Jan 2018
Copy link to clipboard
Print this post
Thanks everyone
GoodToGo! Senior Member Joined: 23/04/2017 Location: AustraliaPosts: 188