Projects › Projects › Distance measurement using InfraRed sensor › Hi Kausu,It is very
Hi Kausu,
It is very difficult to comment on the working of this piece of code only since we don’t have the details of your project and the complete code.
What I understood is that, the “convert()” function does the following operations.
-displays a string “output:”
-it extracts the digits from the digit integer “test_final”
-store the digit into two seperate integrs
-convert the integrs into characters, so that they can be displayed on the lcd
-checks whether the number of characters exeeds the number which can be displayed on the first line
-if exeeds go to the next line
-and print “CALIBERATE IT”
Printing an integer on LCD:
You assume a value to test_final variable, say 567.
s=test_final/100; //now s = 5
lcd_data(s+48); // 48 is the ascii value of ‘0’ and 48+5 gives ascii value of ‘5’
//and hence print ‘5’ on LCD
similary it does for 6 and 7.
Have I made it more complex for you?? Take sample value and analyse yourself.