Menu

Issues compiling with TimerOne.h

Andrew E
2023-07-23
2023-07-24
  • Andrew E

    Andrew E - 2023-07-23

    Hi,
    I am using the 'myFFP2_DRV8825_321 package' of files and have downloaded TimerOne.h from the provided link. During compilation, I get errors like:

    In function TimerOne::setPeriod(unsigned long)':
    undefined reference to TimerOne::clockSelectBits'
    undefined reference to TimerOne::pwmPeriod'

    In function TimerOne::attachInterrupt(void ()())':
    undefined reference to TimerOne::isrCallback'

    I am more mechanically inclined and so have struggled with the software side. The best I can see is that it is an issue of compiling between C++ and C code. Some internet suggestions are to include this:

    In the header file, before any function declarations, add:

    #ifdef __cplusplus
     extern "C" {
    #endif
    

    After all function declarations, add:

    #ifdef __cplusplus
    }
    #endif
    

    I have tried to add this code in different areas but it has not solved the issue - I'm not even sure it is in the right place. Has anyone come across this or is there a global setting to correct this?

    I am using Arduino 1.8.13.

    Your assistance is appreciated.

    Thank you

     
  • brownrb

    brownrb - 2023-07-23

    Hi Andrew

    version 321 is obsolete
    please download firmware version 328
    https://sourceforge.net/projects/arduinoascomfocuserpro2diy/files/ARDUINO%20FIRMWARE/Firmware_myFP2_328.zip/download

    You need to install the TimerOne library
    Location:
    https://github.com/PaulStoffregen/TimerOne

    Then start the Arduino IDE
    Use the menu option
    Sketch
    Include Libary
    Add .ZIP

    Navigate to where the timerone libray was downloaded.
    Select the file
    Click Open

    Next, using menu for Arduino IDE
    File
    Preferences
    Set compiler warnings to default.

    The 1.8.14 is pretty old. You should consider updating the Arduino IDE

    Regards
    Robert

     

    Last edit: brownrb 2023-07-23
  • Andrew E

    Andrew E - 2023-07-24

    Hi Robert,

    Thank you for highlighting how far behind I was in the project! I downloaded the files a while ago and got busy with other things.

    I updated all the software and followed your instructions. All good now. I will test the hardware in time.

    Best regards,
    Andrew

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.