i already had a theme here that led me to a different problem: So if i use the arduino Mouse.h and Keyboard.h with my r4 minima, my computer doesnt react to it. sometimes there is the error: "expected primary-expression before string constant" sometimes there is no error but nothing happenes
It might help if you posted some additional information.
Like what sketch are you trying to compile?
What were the exact error messages?
What type of computer? Windows? Linux? MAC?
PC is windows 11
#include <Keyboard.h>
#include <KeyboardLayout.h>
#include <Keyboard_de_DE.h>
#include <Mouse.h>
void setup() {
// put your setup code here, to run once:
Mouse.begin();
Keyboard.begin();
}
void loop() {
// put your main code here, to run repeatedly:
Keyboard.press(uint8_t "k");
delay(10000);
}
the error messages are partly german so...
gotta translate realquick
lose the uint8_t and put single quotes.
Keyboard.press('k');
do i need ('k')? because i tried it with ("k") and it didnt work
Error messages:
WARNING: Library Keyboard claims to run on avr, samd, sam architecture(s) and may be incompatible with your current board running on renesas_uno architecture(s).
C:\Users\pirmi\OneDrive\Desktop\Mouse.h_testfile\Mouse.h_testfile.ino: In function 'void loop()':
C:\Users\pirmi\OneDrive\Desktop\Mouse.h_testfile\Mouse.h_testfile.ino:18:24: error: expected primary-expression before string constant
Keyboard.press(uint8_t "k");
^~~
Multiple libraries found for "Keyboard.h".
Used: C:\Users\pirmi\OneDrive\Documents\Arduino\libraries\Keyboard.
Not used: C:\Users\pirmi\AppData\Local\Arduino15\libraries\Keyboard.
Several libraries were found for "Mouse.h".
Used: C:\Users\pirmi\OneDrive\Documents\Arduino\libraries\Mouse.
Not used: C:\Users\pirmi\AppData\Local\Arduino15\libraries\Mouse
exit status 1
Compilation error: expected primary-expression before string constant
This isn't python. 'k' and "k" are two completely different things.
'k' is the ascii character code for k. That's what your function expects.
"k" is a pointer to a string literal composed of an array of two characters, the k and a null terminator. This is not what your function expects.
Oh ok thank you
Now the code doesnt give me errors but the pc still doesnt react. in the serial monitor it says that it isnt connected but it defently is. my cable is fine too
Hi how did you manage to fix the first error?
I still have issues with that.