This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:examples:sensor:thermistor [2015/11/13 09:43] – heikopikner | en:examples:sensor:thermistor [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 75: | Line 75: | ||
| // If the value in the table is the same or higher than measured | // If the value in the table is the same or higher than measured | ||
| // value, then the temperature is at least as high as the | // value, then the temperature is at least as high as the | ||
| - | // temperature corresponding to the element. | + | // temperature corresponding to the element |
| if (adc_value >= conversion_table[celsius])) | if (adc_value >= conversion_table[celsius])) | ||
| { | { | ||
| // Since the table begins with 0 but values of the elements | // Since the table begins with 0 but values of the elements | ||
| - | // from -20, the value must be shifted. | + | // from -20, the value must be shifted |
| return celsius + min_temp; | return celsius + min_temp; | ||
| } | } | ||
| Line 94: | Line 94: | ||
| <code c> | <code c> | ||
| - | // Example program of the thermistor of Sensors module. | + | // Example program of the thermistor of Sensors module |
| - | // The temperature is displayed on the LCD. | + | // The temperature is displayed on the LCD |
| #include < | #include < | ||
| #include < | #include < | ||
| Line 139: | Line 139: | ||
| temperature = thermistor_calculate_celsius(value); | temperature = thermistor_calculate_celsius(value); | ||
| - | // Converting the temperature in to text. | + | // Converting the temperature in to text |
| - | // To display the degree sign, the octal variable is 56. | + | // To display the degree sign, the octal variable is 56 |
| sprintf(text, | sprintf(text, | ||
| - | // Displaying the text in the beginning of the third row of the LCD. | + | // Displaying the text in the beginning of the third row of the LCD |
| lcd_gfx_goto_char_xy(5, | lcd_gfx_goto_char_xy(5, | ||
| lcd_gfx_write_string(text); | lcd_gfx_write_string(text); | ||