Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8082

General • rp2350b GPIO_IN not working for ADC pins

$
0
0
Hi, I'm trying to use pin 40 of the rp2350b as a regular gpio input pin.

Code:

#define INPUT_PIN 40int main(){  stdio_init_all();  gpio_init(INPUT_PIN);  gpio_set_dir(INPUT_PIN, GPIO_IN);  gpio_pull_up(INPUT_PIN);  while (1) {    printf("Hello, world %d!\n", gpio_get(INPUT_PIN));    sleep_ms(200);  }}
Unfortunately it always returns 0. Of course I checked the pin and it's pulled up, so it should read it as 1.
If I set it to adc, and do an adc read, it works just fine. Even GPIO_OUT works fine, it turns on/off as requested.
Why is that? I couldn't find anything regarding this in the documentation.

Statistics: Posted by nik012003 — Thu Mar 06, 2025 6:32 pm



Viewing all articles
Browse latest Browse all 8082

Trending Articles