Do you want to eventually do
12 / 10 or
1 / 10 and
2 / 10? If the second one, you'll have to read all the serial values into an array and convert those characters to their plain integer values (subtracting 48 from each value). After that, you'll have to add them together with the correct placeholders (
A * 100 + B * 10 + C).
read() function returns one character in the ASCII format. ACII basically representing characters on your screen with numbers. 48 displays a 0 on your screen, 49 a 1, and so on.
You're also facing a problem where your numbers are getting truncated. This means it cuts off the decimal. For when you send
100, it is
48 / 10 = 4.8, however
4.8 becomes just
4. The same thing happens for 49.
To fix this, you need to use a
float data type. This allows decimal values. You also want to make sure that the conversion from float to string works correctly for the
Serial.print() so you don't end up with
float number = (float)(Serial.read() - 48) / 10;