How to get rid of decimals or add them? Answered
So here's my code.
int pot = analogRead(A0);
float xval = pot * (10.0 / 1023.0);
When I open up serial monitor, I get a number (1-10 depending on my potentiometer) and two decimals. How do I make go in whole number increments? 1, 2, 3, etc? Can you show me the code and explain it?
Also, here's another example
centimeters = (xval * 2.54);
In this example, I only get a whole number. Can somebody show me some code to make it show decimals? Explain some code?