What is the fastest way to read a digital pin status in an Arduino Due? Is it possible to achieve speed in the Nanosecond area?
With which type of code I can achieve this?
Edit: This question is not a duplicate please see my comment.
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It only takes a minute to sign up.
Sign up to join this communityWhat is the fastest way to read a digital pin status in an Arduino Due? Is it possible to achieve speed in the Nanosecond area?
With which type of code I can achieve this?
Edit: This question is not a duplicate please see my comment.
If the pin is declared as input, let's say pin 13:
uint32_t pin_status;
pin_status = PIOB->PIO_PDSR & PIO_PDSR_P27;
If the pin is declared as output, let's say pin 13:
uint32_t pin_status;
pin_status = PIOB->PIO_ODSR & PIO_ODSR_P27;