Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino hangs when reading from non-existent pins. #674

Open
AwesomeTornado opened this issue Jun 25, 2022 · 0 comments
Open

Arduino hangs when reading from non-existent pins. #674

AwesomeTornado opened this issue Jun 25, 2022 · 0 comments

Comments

@AwesomeTornado
Copy link

the hang happens in the function pinPeripheral in the file wiring_private.c at line 96 or 105 (it changes depending on an if statement) when the function tries to multiplex the pin number.

this can be easily fixed by adding the code below to the analogRead function at line 135 in the file wiring_analog.c

  if (g_APinDescription[pin].ulPinType != PIO_ANALOG){
    return  -1;
  }

this will check if the pin is an analog pin before trying to read/multiplex it.

you can read more on the Arduino forums here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant