EasyManua.ls Logo

sparkfun Pro Micro - Troubleshooting and FAQ; General Troubleshooting Steps

sparkfun Pro Micro
27 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
if (vertValue!= 0)
Mouse.move(0,vertValue/sensitivity,0);//movemouseo
nyaxis
if (horzValue!= 0)
Mouse.move(horzValue/sensitivity,0,0);//movemouseo
nxaxis
if ((digitalRead(selPin)== 0)&& (!mouseClickFlag))//if
thejoystickbuttonispressed
{
mouseClickFlag=1;
Mouse.press(MOUSE_LEFT);//clicktheleftbuttondown
}
else if ((digitalRead(selPin))&&(mouseClickFlag))//ifthe
joystickbuttonisnotpressed
{
mouseCl
ickFlag=0;
Mouse.release(MOUSE_LEFT);//releasetheleftbutton
}
}
This sketch is set up so that an analog joystick connected to analog pins A0
and A1 can be used to move your mouse cursor.
The
loop() of this code continuously monitors the horizontal and vertical
analog values of the joystick and sends the
Mouse.move() command based
on what it reads. It’ll move the mouse in steps, depending on what the
sensitivity variable is set to. With sensitivity set to 2, the cursor will move in
either 1 or 2 pixel steps.
The select switch on the joystick is used to control the mouse left click.
Notice this code is using
Mouse.press() and Mouse.release() , rather
than just calling a single
Mouse.click() . This requires a bit more coding,
but it allows you to do things like drag-and-drop, double click, etc.
For more HID example code, check out the Arduino-supplied examples
under the ‘File’ > ‘Examples’ > ‘09.USB’ menu.
Troubleshooting and FAQ
On this page you’ll find troubleshooting tips and FAQs. Here’s a directory of
the subjects covered:
Troubleshooting
Serial Port Not Showing Up in “Tools > Board” menu
How to Reset to Bootloader
How to Revive a “Bricked” Pro Micro
Page 2
2
of 2
7

Related product manuals