How to use 'Mouse.begin()' for ArduinoUNO?

I have an ARDUINO-UNO and I would like to use it for controlling the mouse.

Writing my code there is the errore about the "Mouse.begin()":
'Mouse' only supported on the Arduino Leonardo.

Do you know if there is a way to use with Arduino Uno this set of mouse controlling functionalities?

thanks,

No.

It's possible to get the uno to act as a mouse if you reprogram the usb chip, but then you have to find another way of uploading.

Mouse() and Keyboard() only work on the Leonardo.

Suggestions?? without re-programming the ATmega8U2/16U2???

pittuzzo:
Suggestions?? without re-programming the ATmega8U2/16U2???

If you don't want to do that, then another option is a program on your PC that takes serial input from the Arduino and moves the mouse pointer.

You can use the Arduino UNO as a mouse, without having to reprogram the chip ATmega, you just have to create a communication through the serial port of the PC to receive the movement or the key you press, and from your program (C, Java, Python, etc. ) read the key, and move the mouse whit a sentence command.
but then you must create a library.
I'm working on that right from my UNO R3.

the Video is here:

You can do this with (a port of) the V-USB library.

See here for:

V-USB HID example projects: http://www.obdev.at/products/vusb/prjhid.html
V-USB Arduino HID keyboard: http://blog.petrockblock.com/2012/05/19/usb-keyboard-with-arduino-and-v-usb-library-an-example/
V-USB for Arduino: Google Code Archive - Long-term storage for Google Code Project Hosting.

The solution to this problem is now trivially simple, thanks to meirm. You can just use their UsbMouse library built on VUSB, available here: GitHub - meirm/UsbMouse: Library to set any arduino as a USB mouse .

(You may have to search and replace all instances of "PROGMEM" with "PROGMEM const" to get it to compile, but I'm filing a bug with the author so hopefully that will be fixed soon.)

Hi
I couldn't get this to work on a Leonardo. The example sketch compiles & runs OK.
I added some console prints to make sure the UsbMouse.move routine was executed, however, the mouse doesn't move......
The standard Leonardo Mouse.move works fine, but I don't want to use this, so need the UsbMouse.move working.
Help appreciated.

The standard Leonardo Mouse.move works fine, but I don't want to use this, ...

Why not?

Arduino Uno can't use the Mouse functions, but if you want to move the mouse with any ardunio (as long as it can use Serial) you can use the Serial to send signals to some other program that runs on your computer.

I personaly prefer using Processing for this, but if you use java it also works. The Robot library alows you to control the mouse and keyboard and it works outside of the window it's running on.

The only problem is you need to install the arduino driver on the computer your using, although i am not sure if you can bypass this.

The following is the code i use to control the mouse with some buttons that move the mouse as if its on a coordinate plane, but you can easily fix this by adding some math although it also depends on what your using to control the mouse.

All this Processing code does is it recieves a Serial communication from the Arduino with some number and then it changes the mouse X and Y positions depending on what number it recieves. You can easily see how to click the mouse by looking at the Robot library's reference which by the way lets you control the mouse and keyboard completely..

import processing.serial.*;
import java.awt.Robot;
import java.awt.AWTException;
Serial port;
Robot robby;
int xx = 50, yy = 50;
int mes;

void setup(){
  size(900, 900);
  port = new Serial(this, "COM10", 9600);
  try{
    robby = new Robot();
  }catch(AWTException e){
    println("Robot class not supported by your system!");
    exit();
  }
}
void draw(){
  while(port.available() > 0){
    mes = port.read();
    println(mes);
  }
  mes = mes - '0';
  if(mes == 1){
    xx-=10;
  }else if(mes == 2){
    xx+=10;
  }else if(mes == 3){
    yy+=10;
  }else if(mes == 4){
    yy-=10;
  }
  
  robby.mouseMove(xx, yy);
}

This is the Arduino code that sends the serial message to processing when somone activates a capacitive sensor connected to it which acts just as a normal button.

#include <CapacitiveSensor.h>

CapacitiveSensor left = CapacitiveSensor(3, 2);
CapacitiveSensor right = CapacitiveSensor(5, 4);
CapacitiveSensor down = CapacitiveSensor(7, 6);
CapacitiveSensor up = CapacitiveSensor(9, 8);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  long tot = left.capacitiveSensor(30);
  long tot1 = right.capacitiveSensor(30);
  long tot2= down.capacitiveSensor(30);
  long tot3 = up.capacitiveSensor(30);
  
  if(tot > 500) Serial.print(1);
  else if(tot1 > 500) Serial.print(2);
  else if(tot2 > 500) Serial.print(3);
  else if(tot3 > 500) Serial.print(4);
  else Serial.print(0);
}

Can anyone pls tell me how to use mouse library with uno I am trying for 2 weeks but found nothing

Vishwankit____123:
Can anyone pls tell me how to use mouse library with uno I am trying for 2 weeks but found nothing

I don't understand why you posted your question in this Thread without first carefully reading all the existing Replies.

The answer to your question is on the first line of Reply #10.

...R