Page 1 of 1

Incorrect GPIO readings

Posted: Fri Sep 20, 2019 12:33 am
by gibson12345
Hey everyone,

I've been trying to work specifically with a few pins connected to my battery, specifically 32,36,39 and 35. I know that I can only set 34-39 as input only, but I am trying to set 32 as high and for whatever reason when using gpio_get_level I'm not getting back the correct value. I'm reading directly on the pin with a voltmeter and it's high but when I read with gpio_get_level it's returning 0. Any suggestions? Here is my code please check if I'm doing something incorrectly:

Code: Select all

gpio_pad_select_gpio(GPIO_NUM_32);

    gpio_set_direction(GPIO_NUM_32, GPIO_MODE_OUTPUT);

    gpio_set_level(GPIO_NUM_32, 1);
Cheers,
Gibson

Re: Incorrect GPIO readings

Posted: Fri Sep 20, 2019 4:34 am
by WiFive
GPIO_MODE_INPUT_OUTPUT

Re: Incorrect GPIO readings

Posted: Fri Sep 20, 2019 5:44 am
by gibson12345
Hey WiFive,

Thanks for the reply that solved my problem. Could you explain why normal output mode did not work?

And also to follow up I'd like to read the values of pin 36/37/34 but am unable to get anything could you advise?

Cheers,
Gibson