FRDM kl25z plus USBmouse

I am using USBMouse to draw a grid of Y into Y dots, with horizontal/vertical spacing of Z pixels, the base program with the APIs imported etc given here - https://developer.mbed.org/handbook/USBMouse
I am using objectname.click(MOUSE_LEFT) and objectname.release(MOUSE_LEFT) to draw the grid point and mouse.move(x,y) to move the cursor.
My program is as follows:
#include “mbed.h”
#include "USBMouse.h"
USBMouse mouse;
int main() {
int16_t x = 0;
int16_t y = 0;
int point = 5;
int scale = 20;
int i,j;

    for(i=1;i<=point;i++)
    {
        wait(0.001);
        for(j=1;j<=point;j++)
        {
            mouse.click(MOUSE_LEFT);
            mouse.release(MOUSE_LEFT);
            x=scale;
            y=0;
            mouse.move(x, y);
        }    
        x = -scale*5;
        y = scale;
        mouse.move(x, y);
        j=1;
    }

}

However what I am observing is that, the in the first line, only four dots are observed, and the next line controlled by the outer loop doesnt start from the origin ie. below the first inital position of the mouse.
Any help regarding this would be appreciated :smiley:

Hi.

Unfortunately, we are not very familiar with the FRDM kl25z plus board or the mbed USB mouse library, so we do not have any suggestions for what might be wrong with your code. You might try asking for help on the mbed forum.

-Claire