Hi everyone.
I'd appreciate some help on what I am trying to achieve here. So:
In my circuit I have a DS18B20 temperature sensor, and 3 seven segment displays.
What I am trying to do is to pass the values of the sensor, into the displays.
As a complete beginner coder, here is what I am thinking to do:
The temperature value is a float, in the form of 29.55
I will multiply this float with 100, in order to give it the form of an integer, like 2955
Then, I need somehow to do the following:
-
- Read the first digit of the 2955 value.
-
- If the first number of the int is 1, then do function 1 (a function that lights the segments for the 1 digit).
-
- If first number is 2, then do function 2 etc...
I will repeat the above process for the next 2 digits of the int 2955, and hopefully I will end with my 3 seven segment displays to show the temperature values.
SO, my question is:
is there a way that I can read the numbers of the int value one by one? Or I will first need to convert the int into some other data type first?
And, above all, is my thinking valid? Or completely out of space?
Any input would be appreciated, I have searched the forum and the reference page but I am not sure how to start.
Cheers!
John