GY-63_MS5611/libraries/AsyncAnalog
2021-04-07 13:31:22 +02:00
..
.github/workflows update libs 2021-04-07 13:31:22 +02:00
examples 2021-01-29 2021-01-29 12:31:58 +01:00
test 2021-01-29 2021-01-29 12:31:58 +01:00
.arduino-ci.yml 2021-01-29 2021-01-29 12:31:58 +01:00
AsyncAnalog.cpp 2021-01-29 2021-01-29 12:31:58 +01:00
AsyncAnalog.h 2021-01-29 2021-01-29 12:31:58 +01:00
keywords.txt 2021-01-29 2021-01-29 12:31:58 +01:00
library.json 2021-01-29 2021-01-29 12:31:58 +01:00
library.properties 2021-01-29 2021-01-29 12:31:58 +01:00
LICENSE 2021-01-29 2021-01-29 12:31:58 +01:00
README.md 2021-01-29 2021-01-29 12:31:58 +01:00

Arduino CI License: MIT GitHub release

AsyncAnalog

Arduino Library for async reading of an analog pin. [AVR ONLY]

Description

AsyncAnalog is a library to read the analog port in an asynchronous way. This means that the user must explicitly start the ADC, check if it is ready and read out its value.

By using this class, the user prevents the (~112 uSec) blocking of the analogRead() call, and gives the user the ability to do some processing.

The library works only for AVR boards now, other platforms might be supported in the future.

As the UNO has only one ADC that is multiplexed, one can only read one analog pin in async way simultaneously.

Interface

  • AsyncAnalog(uint8_t pin) constructor, defines the analog pin to use.

The library consists of three main function:

  • void start() triggers a new ADC reading.
  • bool ready() returns true if sample is complete
  • int value() returns the value

Operation

The example asyncAnalogTest2.ino shows a loop of 1000 analogReads and prints over Serial at 115200 baud. The async test does this in less time. Note that faster baudrates shows an even bigger difference.

During the printing, the sampling continues.