Timer on nano 33 BLE

Hi,

Recently I've been trying several libraries to implement a timer on my code to call a function periodically, just to read continously a sensor. The problem is that most of the libraries are not compatible or they don't work.

Particularly, the Timer-2.1 library is returning me the "error: 'timer' does not name a type; did you mean 'time'?" message although I have installed the library. (Yes, I moved the .cpp and the .h files to .../Arduino/libraries/Timer-2.1/ , i restarted the pc, and reinstalled the IDE).

Anyone knows how to set up a timer on this new nano 33 board?

Please post your full sketch.

If possible, you should always post code directly in the forum thread as text using code tags:

  • Do an Auto Format (Tools > Auto Format[/b) on your code. This will make it easier for you to spot bugs and make it easier for us to read.[/li]
  • - Edit > Copy for Forum*
  • - In a forum reply here, click on the reply field.*
    - Click the </> button on the forum toolbar. This will add the forum's code tags markup to your reply.
  • - Press "Ctrl + V". This will paste the sketch between the code tags.*
  • - Move the cursor outside of the code tags before you add any additional text to your reply.*
  • - Repeat the above process if your sketch has multiple tabs.*
  • [/list]*
  • This will make it easy for anyone to look at it, which will increase the likelihood of you getting help.*
  • If the sketch is longer than the 9000 characters maximum allowed by the forum, then it's OK to add it as an attachment. After clicking the "Reply" button, you will see an "Attachments and other settings" link.*
    When your code requires a library that's not included with the Arduino IDE please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries in the Arduino IDE or Libraries > Library Manager in the Arduino Web Editor) then say so and state the full name of the library.
  • Please do this:*
  • - When you encounter an error, you'll see a button on the right side of the orange bar "Copy error messages" in the Arduino IDE (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button..*
  • - In a forum reply here, click on the reply field.*
    - Click the </> button on the forum toolbar. This will add the forum's code tags markup to your reply.
  • - Press "Ctrl + V". This will paste the error between the code tags.*
  • - Move the cursor outside of the code tags before you add any additional text to your reply.*
  • If the text exceeds the forum's 9000 character limit, save it to a .txt file and post it as an attachment. If you click the "Reply" button here, you will see an "Attachments and other settings" link.*