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

Thread: FreqMeasure lib issues

  1. #1

    FreqMeasure lib issues

    I am trying to use the FreqMeasure library here: https://www.pjrc.com/teensy/td_libs_FreqMeasure.html

    I added the FreqMeasure library (unzipped) into the libraries directory under the main Arduino directory where all the sketches are stored.

    Then I added the header file to my sketch and I get this error:
    error: #error "Unknown chip, please edit me with timer+counter definitions"

    My IDE is set for Teensy 3.1 and inside the FreqMeasureCapture.h file is a definition for __MK20DX256__.

    Here is some test code to show this in action:
    Code:
    #include <FreqMeasure.h>
    
    void setup() {
      // put your setup code here, to run once:
    }
    void loop() {
      // put your main code here, to run repeatedly:   
    }
    I tried adding #include <Arduino.h> before the FreqMeasure include, but that did not change anything. For some reason it is not seeing __MK20DX256__ defined when it should be.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,007
    Quote Originally Posted by DemolishunWork View Post
    I added the FreqMeasure library (unzipped) into the libraries directory under the main Arduino directory where all the sketches are stored.
    No, that's not where it goes.

    The simplest way to get this installed is with the 1.20-rc2 installer, which has the latest FreqMeasure. Just select it on the page about installing extra libraries, and the installer will copy it to the proper location.

  3. #3
    Oh, okay, I will do that. Thanks.

    I am using 1.20 at home, but at work I was still on 1.19.

  4. #4
    Hey Paul,

    I have FreqMeasure working now and it uses pin 3. I also have tone running on pin 5. I understand these are separate PWM hardware counters for those pins. Are there any interactions I should worry about? I noticed FreqMeasure talks about analogWrite (PWM) and I assume that is because someone could select a pin on the counter as FreqMeasure?

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,007
    They're separate timers, so no conflict.

    Also, if you're using the tone() function, it doesn't use the PWM timer at all. It uses an IntervalTimer and code in an interrupt, because tone() needs to support all digital pins, not merely the ones with PWM.

Posting Permissions

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