USB Mouse library working for anyone?

I’m quite desperate to get the USBMouse library to work again for me, for a big school project. I’m making an alternative cursor control device that depends on the arduino acting as a USB HID.

2 days ago I got the library to work, but then overnight it stopped working. I have no idea why.

I’m using an Arduino Duemilanove and Arduino 15 and 16.

Code I’m trying to compile:

#include <UsbMouse.h>

#define BUTTON_PIN 12

void setup() {
digitalWrite(BUTTON_PIN, HIGH);

void loop() {
UsbMouse.refresh(); // Do some house keeping

if(digitalRead(BUTTON_PIN) == LOW){

But these are the errors I am getting:

hardware\libraries\UsbMouse/UsbMouse.h: In constructor ‘UsbMouseDevice::UsbMouseDevice()’:

hardware\libraries\UsbMouse/UsbMouse.h:32: error: ‘sei’ was not declared in this scope

Any assistance would be greatly appreciated!

I haven't seen this library, it's not one on the library page. But what that error message is telling you is that when the software went into the file UsbMouse.h it found a variable called sei that hadn't been declared.

Now the question is why and what can you do about it? It could just be it is a bad library but more likely is that this variable was declared in another include file that you haven't included in your code.

So look at any examples you have that use this library and see if they include other files before it calls the UsbMouse.h file, and if you find one include that as well. You might even have to add another dependant library.

It is this library:

perhaps try contacting the author of that library:;username=follower

I think it might be important to point out that this sort of problem can NOT "just happen"!

My students often bring me questions like this. As part of the engineering process I have to reply with - "well, what did you change"?

and so - what did you change? lines of code do not go "missing" or get altered by themselves! It CAN happen if you download a new version of part of your software. Thus even though you did not change "your code", you actually changed part of the code you reference through the include files...

I hope that gives you a starting point! Good luck. Mark

im get the same problem :slight_smile:
if you’ll insert into UsbMouse.h

#include <avr/interrupt.h>

you will solve it, but get another :-/

\Temp\build34831.tmp\UsbMouse\usbdrv.c.o: In function `usbBuildTxBlock’:

\Arduino\libraries\UsbMouse/usbdrv.c:484: undefined reference to `usbCrc16Append’

Temp\build34831.tmp\UsbMouse\usbdrv.c.o: In function `usbSetInterrupt’:

Arduino\libraries\UsbMouse/usbdrv.c:249: undefined reference to `usbCrc16Append’


The OP error looks like a change of Arduino IDE version.

The second error looks compilation related.

Note that version 0017 does not work with this library due to the new library compilation method.

When version 0018 is released it should work again due to the inclusion of assembler support.


Hi people,

Following the instructions of noonv I solved this problem of compilation:

"hardware\libraries\UsbMouse/UsbMouse.h: In constructor 'UsbMouseDevice::UsbMouseDevice()': hardware\libraries\UsbMouse/UsbMouse.h:32: error: 'sei' was not declared in this scope"

But then appeard this another:

o: In function usbSetInterrupt': C:\Users\Rita\AppData\Local\Temp\build5353425294472682581.tmp/usbdrv.c:249: undefined reference tousbCrc16Append'

How can I solved this error? I'm already using version 0018.

Is there another alternative to create a USB mouse? Camila

Well, this thread is no longer valid (I think) due to us advancing 2-3 software versions

same problem for me....