Programming: Applying the Slope Intercept Formula to Adjust the ADC Value for Trimmer Potentiometers Showing on the LCD
Share
The code in the ADC channels are updated to reflect the slope intercept formula so the trimmer potentiometers show a range or 0 - 33 rather than the raw ADC result of 0 - 1023.
#include #include "MrLCD.h" #include int static volatile InchesOfHg, High, Low = 0; int main(void) { InitializeMrLCD(); Send_A_StringToMrLCDWithLocation(1, 1, "Inches of Hg:"); Send_A_StringToMrLCDWithLocation(1, 2, "H: L:"); DDRD |= 1< High) enoughVacuum = 1; if (InchesOfHg < Low) enoughVacuum = 0; if (enoughVacuum == 0 && bit_is_clear(PORTD, PIND0)) PORTD |= 1<