Absolute Mouse Position for Arduino Zero - 1.6.7 IDE

Hello all!

I have been searching for a method to give my Arduino Zero absolute mouse positioning. I found several threads in the Arduino forums but when I tried to implement them I ended up for compiling error after error. The problem is that these threads used older IDE/headers so the new ones don't work the same. Does anyone know how to get absolute positioning on a zero using IDE 1.6.7. These are some of the methods I tried before with no success:

forum.arduino.cc/index.php?topic=94140.0
forum.arduino.cc/index.php?topic=161784.0
forum.arduino.cc/index.php?topic=175031.0

Now these methods might work but I gave up after a few hours of making changes to the headers as it made the compiling errors increasingly difficult to debug. I appreciate any help you can give. Thank you for your time!

You have some code that you didn't show. You have made changes to header files that you have not provided links to, and have not shown the changes to. You are getting errors that you have not shown. And, yet you want us to help resolve them.

Fat chance of that happening.

So here’s how the first attempt at getting absolute positioning went.

Elmue posted at the http://forum.arduino.cc/index.php?topic=94140.0 link that you can use his modified headers for getting absolute positioning with the mouse (headers attached below). Now the usb_desc.h and usb_mouse.h are made for Teensy Duino. So I copied the files into my Arduino/Library folder and made this test program:

#include <usb_mouse.h>
#include <usb_desc.h>



void setup()
{
	Mouse.begin();
	Mouse.screenSize(1600, 900);
	pinMode(8, INPUT);

  /* add setup code here */

}

void loop()
{
	if (digitalRead(8) == HIGH) {
		for (int i = 0; i < 100; i++) {
			Mouse.moveTo(8 * i, 4 * i);
		}
	}
  /* add main program code here */

}

and I got the following compiling error:

usb_mouse.c:33:21: fatal error: usb_dev.h: No such file or directory
:#include “usb_dev.h”
:compilation terminated
Error compiling libraries

which makes sense since the usb_mouse.h header was made for Teensy but I’m working with an Arduino Zero. So I’ve been trying to find a copy of usb_dev.h however there are other headers that I need as well, such as:

#include “usb_dev.h”
#include “usb_mouse.h”
#include “core_pins.h” // for yield()
#include “HardwareSerial.h”
#include <string.h> // for memcpy()

So I need the HardwareSerial.h and the core_pins.h however these are meant to be used for a Teensy Duino.

This looks like it’s going to be a long path of conversions and work arounds but Elume claims that it works for the Duino and the changes he made to usb_mouse.h look very easy to work with. Is there anyway I can use HID.h instead of core_pins.h and HardwareSerial.h or is there any other work around I can use to make the usb_mouse header work on a zero in absolute mode?

usb_desc.c (60 KB)

usb_desc.h (14.6 KB)

usb_mouse.c (7.31 KB)

usb_mouse.h (6.8 KB)

yield.cpp (1.94 KB)