Umm hi dear programmers i've question about programming. Im stuck on somewhere lemme show you
#include <Mouse.h>
void setup() {
Serial.begin(9600);
Mouse.begin();
}
void loop() {
if (Mouse.isPressed(MOUSE_LEFT) == false) {
Serial.println("LEFT MOUSE BUTTON CLICK DETECTED");
delay(1000);
}
}
I'm just trying to check my mouse's buttons then i'll do some action like if my mouse left button pressed then start servo motors , i just want to check my mouse's clicks.
I've arduino pro micro.
Print the value of
Mouse.isPressed(MOUSE_LEFT)
What do you see ?
Guide says Mouse.isPressed() gives back a boolean value so i did like ;
if (Mouse.isPressed(MOUSE_LEFT) == false) {
but my code doesnt working (im beginner)
Print the value. Is it what you expect in your sketch with your mouse and your wiring
Sir, it's really hard to understand what you'r teaching to me forgive my rookie. This is what i did, it's still not works.
#include <Mouse.h>
void setup() {
Serial.begin(9600);
Mouse.begin();
}
void loop() {
int checker = Mouse.isPressed(MOUSE_LEFT);
if (checker == true) {
Serial.println("LEFT MOUSE BUTTON CLICK DETECTED");
Serial.println(checker);
delay(1000);
}
}
spycatcher2k:
You cannot READ the mouse from your computer using this method!
Hi there can you give me any proposal for that ?
umm still looking for herp
How do you have your mouse connected to your Arduino?
christop:
How do you have your mouse connected to your Arduino?
i didnt.
still looking for help...
phantomninja:
i didnt.
still looking for help...
So you want the Arduino to detect when the mouse connected to the PC is clicked ?
It that right ?
If so, then how will the Arduino know about the mouse click ?
Actually, never mind about my question.
The Mouse library makes the Arduino pretend to be a mouse. It doesn't let you read a mouse on the Arduino. So that is a dead end approach for what you are trying to do.
It's also my understanding that acting as a USB host is more difficult than acting as a device, and I don't know if it's possible to make an Arduino act as a host anyway.
phantomninja:
Hi there can you give me any proposal for that ?
Yes, you could write a Python program on the PC. Ask for help on a Python forum. It should send serial commands to the Arduino to operate the steppers or do whatever else you want it to do.