2
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2024610-7740-sfbutd.e9d77\sketch_jul10a\sketch_jul10a.ino: In function 'void setup()':
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2024610-7740-sfbutd.e9d77\sketch_jul10a\sketch_jul10a.ino:97:22: error: too many arguments to function 'hw_timer_t* timerBegin(uint32_t)'
   97 |   timer1 = timerBegin(0, 80, true);  // 80 MHz APB clock / 80 = 1 MHz (1 us per tick)
      |            ~~~~~~~~~~^~~~~~~~~~~~~
In file included from C:\Users\Admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\cores\esp32/esp32-hal.h:84,
                 from C:\Users\Admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\cores\esp32/Arduino.h:36,
                 from C:\Users\Admin\AppData\Local\Temp\arduino\sketches\943207E00B32310A1DFC79D26F7275B3\sketch\sketch_jul10a.ino.cpp:1:
C:\Users\Admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\cores\esp32/esp32-hal-timer.h:35:13: note: declared here
   35 | hw_timer_t *timerBegin(uint32_t frequency);
      |             ^~~~~~~~~~
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2024610-7740-sfbutd.e9d77\sketch_jul10a\sketch_jul10a.ino:99:23: error: too many arguments to function 'void timerAttachInterrupt(hw_timer_t*, void (*)())'
   99 |   timerAttachInterrupt(timer1, &dim_check, true);
      |   ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\Admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\cores\esp32/esp32-hal-timer.h:50:6: note: declared here
   50 | void timerAttachInterrupt(hw_timer_t *timer, void (*userFunc)(void));
      |      ^~~~~~~~~~~~~~~~~~~~
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2024610-7740-sfbutd.e9d77\sketch_jul10a\sketch_jul10a.ino:101:3: error: 'timerAlarmWrite' was not declared in this scope; did you mean 'timerWrite'?
  101 |   timerAlarmWrite(timer1, freqStep, true);
      |   ^~~~~~~~~~~~~~~
      |   timerWrite
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2024610-7740-sfbutd.e9d77\sketch_jul10a\sketch_jul10a.ino:103:3: error: 'timerAlarmEnable' was not declared in this scope; did you mean 'timerAlarm'?
  103 |   timerAlarmEnable(timer1);
      |   ^~~~~~~~~~~~~~~~
      |   timerAlarm

exit status 1

Compilation error: too many arguments to function 'hw_timer_t* timerBegin(uint32_t)'
1
  • 2
    what is your question? ... please add a focused, answerable question to your post
    – jsotola
    Commented Jul 10 at 7:41

1 Answer 1

0

I think Espressif is changing the API for timer usage.

In 3.0.2 (which is the one you are using), the new API is timerBegin(uint32_t frequency), you can see the library example here. For version 2.0.17 or earlier, the API is timerBegin(0, 80, true), as seen here.

You have two options:

  1. roll back your ESP32 Arduino Core (Do it on IDE Tools->Board->Board Manager menu) to v2.0.17 if you want to use the API that you used in your sketch; or
  2. port your code based on the new Timer API with the help from the new API documentation.

If you are new to Arduino programming, the option one would be easier for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.