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)'
asked Jul 10, 2024 at 7:40
-
3what is your question? ... please add a focused, answerable question to your postjsotola– jsotola2024年07月10日 07:41:46 +00:00Commented Jul 10, 2024 at 7:41
-
Hi Saranya, there are multiple errors above, which one did you want help with?Rohit Gupta– Rohit Gupta2024年08月11日 22:55:13 +00:00Commented Aug 11, 2024 at 22:55
-
1I had questions ridicularized, closed and deleted for way less that this one. How come the moderators do nothing?Clóvis Fritzen– Clóvis Fritzen2024年08月14日 17:10:24 +00:00Commented 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.StarCat– StarCat2024年11月28日 07:43:28 +00:00Commented Nov 28, 2024 at 7:43
1 Answer 1
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:
- 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
- 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