Hello I'm working on a project for keyboard shortcuts and volume control on my arduino board. The only thing is i don't have a atmega32u4 which is the Leonardo board. I have a SamD51 board which is a adafruit metro M4 express. I can use it as a hid device because it has the hid functions build in.
The problem I'm having is that i found sketches online that uses the Lenardo because it is a AVR processor. However mine is a 32bit processor which i know it is completely overkill but this is the only board i currently have at the moment.
I ran into a problem with this sketch i found online that uses a timerone function i guess you will call it. I'm not much of a coder but I'm trying I'm posting the sketch on here and the error message. Can someone please help me to figure this out how to fix it so i can make my volume control I already have the Keys working as keyboard shortcuts.
#include <ClickEncoder.h>
#include <TimerOne.h>
ClickEncoder encoder(A1, A0, A2);
void timerIsr() {
encoder.service();
}
void setup() {
Timer1.initialize(1000);
Timer1.attachInterrupt(timerIsr);
}
void loop() {
// Get rotation value
int16_t current = encoder.getValue();
// Get button state
ClickEncoder::Button b = encoder.getButton();
if (b != ClickEncoder::Open) {
// ...
}
// ...
}
Here is the error message.
WARNING: library TimerOne-master claims to run on avr architecture(s) and may be incompatible with your current board which runs on samd architecture(s).
C:\Users\jJc\AppData\Local\Temp\arduino_modified_sketch_246326\sketch_jun06a.ino: In function 'void setup()':
sketch_jun06a:11:10: error: 'class TimerOne' has no member named 'initialize'
11 | Timer1.initialize(1000);
| ^~~~~~~~~~
sketch_jun06a:12:10: error: 'class TimerOne' has no member named 'attachInterrupt'
12 | Timer1.attachInterrupt(timerIsr);
| ^~~~~~~~~~~~~~~
exit status 1
'class TimerOne' has no member named 'initialize'
Joseph