I cant understand what is going on here , I was trying to find way to send through Serial a number for example 12 and then extract from it number 1 and 2 and store them in two different variables , but suddenly i was unable to make a simple division !!
Anonymous Penguin's code works for me on an Uno after fixing a couple of typos. It is often best to make sure that both the numerator and the denominator are floats to ensure that the result is also treated as a float. So please try the following where the 10 is replaced with a 10.0:
If you want to deal with each digit separately an array might be best but that will depend on your end goal.
|
|||||||||||||||||
|
Do you want to eventually do Basically, the You're also facing a problem where your numbers are getting truncated. This means it cuts off the decimal. For when you send To fix this, you need to use a Final code:
|
|||||||||||||||||||||
|
Serial.read()
does? – Ignacio Vazquez-Abrams Sep 13 '14 at 15:39