Absolute Mouse Mode Not Working

I recently saw this forum about absolute mouse Modehttps://forum.arduino.cc/index.php?topic=94140.0

I followed the author’s instructions and realized that “platform.h” was removed from the arduino IDE many years ago.

Is there still a way to use absolute Mouse mode again?

I’ve tried removing the “platform.h” library from the HID.cpp file, like someone suggested. But it still doesn’t work.

Here is my test code to move the mouse across any screen from left to right, top to bottom.
The code doesn’t work, because the Mouse is in relative Mode.(default)

To test, you must hold the button connected to pin 9.

#include <Mouse.h>
#define button 9
unsigned long pMillis = 0;
int x = 0;
int y = 0;
void setup() {
  pinMode(button, INPUT_PULLUP);

void loop() {
  unsigned long cMillis = millis();
  if (!(digitalRead(button))) {
    if (cMillis - pMillis >= 12) {
      Mouse.move(x, y);
      if (x == 10) {
        x = 0;
        if (y == 101) {
          y = 0;
      pMillis = cMillis;

HID.cpp (11.7 KB)

AbsoluteMouseMode.ino (435 Bytes)

did you find and add the platform.h to your IDE cause you haven't included it in the code ?

Give this a try:

I haven't used it but it certainly seems the easy way to accomplish this.