Incorrect GPIO readings

gibson12345
Posts: 58
Joined: Wed Jul 17, 2019 11:45 pm

Incorrect GPIO readings

Postby gibson12345 » Fri Sep 20, 2019 12:33 am

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

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Incorrect GPIO readings

Postby WiFive » Fri Sep 20, 2019 4:34 am

GPIO_MODE_INPUT_OUTPUT

gibson12345
Posts: 58
Joined: Wed Jul 17, 2019 11:45 pm

Re: Incorrect GPIO readings

Postby gibson12345 » Fri Sep 20, 2019 5:44 am

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

Who is online

Users browsing this forum: Baidu [Spider], Dloranger and 107 guests