Printing Analog Input with Kevin's new code

We are trying to print analog values from our autonomous switch, but we are only getting 0 values. I was just wondering how do you print analog inputs using Kevin’s new code.

Thanks,
Vijay G.

It should be normal, something like:

        for (k = 1; k <= NUM_ADC_CHANNELS; k++) {
            printf("ADC %d: %d
", k, Get_ADC_Result(k));
        }

If you want to get fancy. Make sure the number of ADC channels is set correctly in adc.h. This looks more like an electrical problem though. You may want to check with an oscilloscope that you are actually getting values from the ADC.

Get_ADC_Result() returns an unsigned int, so you’ll want to use %u in your printf() format string instead of %d.

-Kevin