BTW, your code works fine for me. How have you typed myInt? The number 163 is the value of the lower 8 bits of 95651, so it seems that myInt must be typed to an 8 bit type.
I don't know why you chose to create params the way you did. Because you used new, I think you have to free the memory with delete [] params. The more usual way to do it would be,
I didn’t check that I had declared myInt as an 8 bit unsigned Int!
Anyway, how do I check that myString has Double quotes in it both at the beginning and the end before I substring it?
Or is there a way I can extract the value between the Double Quotes using the Double Quotes as delimiters? Something like strtok
Now the issue I have is that my String is actually “95667.7” when I strip the double quotes out and move that to a float variable using toFloat() my float has a value of 95667.703125.
And 95667.9 becomes 95667.898438 as a float.
How do I get the float to be exactly the value of the String with a single decimal point.
That is not possible without rounding due to the way how floats are stored in memory (sums of powers of two).
But that is a common issue which everybody using float has to face.
You can use double which reduces the problem but can’t remove it completely either.
If you want to “print” a floating point variable with a set number of decimal places you need to do things like
Serial.print(myFloat, 1);
// or
char txtNumber[16];
snprintf(txtNumber, sizeof(txtNumber), "%.1f", myFloat);
Can I use another data type if I just want a single decimal place on an always positive number? I need to be able to do some maths on the number, so it’s not just for printing purposes. I am adding 0.1 to number and need it to become a whole number every 10 times I add 0.1