Example not working for me, can someone verify please

Trying some example code that doesn't see to find built in libraries.

Load Examples\USB\Mouse\JoystickMouseControl
compile it.

What I'm finding is that Mouse isn't predefined.
If I go to ~/Arduino/Libraries/Mouse/src/ and move Mouse.h to Mouse1.h it (rightfully) complains that it can't find Mouse.h. So it is finding the file ok.
Inside Mouse.h is a class Mouse_ that does all the work. At the bottom is extern Mouse_ Mouse; which is located in Mouse.cpp
If I add Mouse_ Mouse in my file, it doesn't know what Mouse_ is.

So apparently it will miss the Mouse.h if it's not there, but not actually use it if it is...

Hi @iplayfast.

I'm going to ask you to post some additional information that might help us to identify the problem.

Please do this:

  1. Select File > Preferences from the Arduino IDE's menus.
  2. Check the box next to "Show verbose output during: [] compilation".
  3. Click the OK button.
  4. Select Sketch > Verify/Compile from the Arduino IDE's menus.
  5. Wait for the compilation to end.
  6. Right click on the black "Output" pane at the bottom of the Arduino IDE 2.x window.
  7. From the context menu, click Copy All.
  8. Open a forum reply here by clicking the Reply button.
  9. Click the </> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code block
  10. Press Ctrl+V.
    This will paste the compilation output into the code block.
  11. Move the cursor outside of the code tags before you add any additional text to your reply.
  12. Click the Reply button to post the output.

Worked for me.

I bet you're trying a board like Uno or Mega. These boards won't work as USB HIDs -- they are serial only and use an extra chip to do serial<->USB conversion. Since you aren't programming on the USB chip, it won't work.

Try a board using a built-in USB interface, like the ATMega32u-based Leonardo. It compiles for me on the Leonardo, but fails on the Uno.

OK, I think I know what's going on. Mouse.h won't compile for most arduino boards, because it relies on HID which will only compile for the Lenardo and Due
I saw the warning, but the warning didn't warn that it wouldn't compile at all!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.