1
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\esp323円.0.2\cores\esp32/esp32-hal.h:84,
 from C:\Users\Admin\AppData\Local\Arduino15\packages\esp32\hardware\esp323円.0.2\cores\esp32/Arduino.h:36,
 from C:\Users\Admin\AppData\Local\Temp\arduino\sketches943207円E00B32310A1DFC79D26F7275B3\sketch\sketch_jul10a.ino.cpp:1:
C:\Users\Admin\AppData\Local\Arduino15\packages\esp32\hardware\esp323円.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\esp323円.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)'
dda
1,5951 gold badge12 silver badges17 bronze badges
asked Jul 10, 2024 at 7:40
4
  • 3
    what is your question? ... please add a focused, answerable question to your post Commented Jul 10, 2024 at 7:41
  • Hi Saranya, there are multiple errors above, which one did you want help with? Commented Aug 11, 2024 at 22:55
  • 1
    I had questions ridicularized, closed and deleted for way less that this one. How come the moderators do nothing? Commented Aug 14, 2024 at 17:10
  • Your code seems to be based on an earlier ESP32 Arduino Core version. You can either downgrade the ESP32 Arduino Core to a version earlier than 3.0.0 or you can change the code to use the newer Timer API. See https://docs.espressif.com/projects/arduino-esp32/en/latest/migration_guides/2.x_to_3.0.html#timer. Commented Nov 28, 2024 at 7:43

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.

answered Jul 10, 2024 at 12:12

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.