Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: ADC Library with Teensy 3.2

  1. #1
    Junior Member
    Join Date
    Jan 2017
    Posts
    13

    ADC Library with Teensy 3.2

    Hi,
    working on Teensy 3.2
    I use ADC library in order to sample A2 pin analog input.
    I now use a function readADC() in loop() in order to read a single input. Every time the sample count reaches SAMPLES (2048), i process my samples.
    This is not efficient and I have no control on the sample speed, because the loop() makes other things.

    I'd like to use ADC library with interrupts in order to read the samples in background and process them when ready (2048 reads done).
    Is it possible?
    Does exists any example?

    Thanks a lot in advance
    Best regards
    pmartin

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,054
    Yes, the ADC library can do all that, with interrupts, with DMA...

    There is a long, long thread in this forum where all functions (and flaws) of the ADC library are discussed. For a better understanding, you might just look at the source code of the library's source .h file where all classes, members and functions are listed.
    In order to avoid frustration, I've adopted the following principle for me: "Never use a library before you have fully read and understood its source code and you are able to reproduce it by yourself!"

  3. #3
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    7,046
    This is the ADC thread I found: ADC-library-update-now-with-support-for-Teensy-3-1

    The install path and ADC.h will be here where TeensyDuino was installed : ...\hardware\teensy\avr\libraries\ADC\ADC.h

  4. #4
    Junior Member
    Join Date
    Nov 2018
    Posts
    5
    Thanks for the advice!
    I gave it a try but it only shows 0 on the serial monitor now, i'll try to work on this method to see if there is any other break through

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •