SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By fequalsma42
#198213
Hey Folks,

Trying to get the mouse feature to work for my sparkfun pro micro. I get the error noted in the subject when simply trying to verify. Please help point me to what I could be overlooking

***Board info***
Sparkfun Pro Micro
*ATMega 32U4 running at 5V/16MHz
*Supported under Arduino IDE v1.0.1
*On-Board micro-USB connector for programming
*4 x 10-bit ADC pins 12 x Digital I/Os (5 are PWM capable)
*Rx and Tx Hardware Serial Connections

***I'm trying to execute the simple code below****
#include <Mouse.h>
const int xAxis = A1; //analog sensor for X axis
const int yAxis = A2; // analog sensor for Y axis

int range = 12; // output range of X or Y movement
int responseDelay = 2; // response delay of the mouse, in ms
int threshold = range/4; // resting threshold
int center = range/2; // resting position value
int minima[] = {
1023, 1023}; // actual analogRead minima for {x, y}
int maxima[] = {
0,0}; // actual analogRead maxima for {x, y}
int axis[] = {
xAxis, yAxis}; // pin numbers for {x, y}
int mouseReading[2]; // final mouse readings for {x, y}


void setup() {
Mouse.begin();
}

void loop() {

// read and scale the two axes:
int xReading = readAxis(0);
int yReading = readAxis(1);

// move the mouse:
Mouse.move(xReading, yReading, 0);
delay(responseDelay);
}


***I'm getting the error message noted****
./opt/arduino-builder/arduino-builder -compile -core-api-version 10611 -build-path /tmp/508903675/build -hardware opt/arduino-builder/hardware -hardware ./opt/cores -tools opt/arduino-builder/tools -tools ./opt/tools -built-in-libraries opt/libraries/latest -libraries /tmp/508903675/pinned -libraries /tmp/508903675/custom -fqbn arduino:avr:pro:cpu=16MHzatmega168 -build-cache /tmp -logger humantags -verbose=false /tmp/508903675/BasicUsage_copy
Multiple libraries were found for "Mouse.h"
Used: /tmp/508903675/custom/Mouse-1.0.1
Not used: /home/admin/builder/opt/libraries/latest/mouse-1-0-1
/tmp/508903675/BasicUsage_copy/BasicUsage_copy.ino: In function 'void setup()':
/tmp/508903675/BasicUsage_copy/BasicUsage_copy.ino:21:2: error: 'Mouse' was not declared in this scope
Mouse.begin();
^
/tmp/508903675/BasicUsage_copy/BasicUsage_copy.ino: In function 'void loop()':
/tmp/508903675/BasicUsage_copy/BasicUsage_copy.ino:27:28: error: 'readAxis' was not declared in this scope
int xReading = readAxis(0);
^
/tmp/508903675/BasicUsage_copy/BasicUsage_copy.ino:31:5: error: 'Mouse' was not declared in this scope
Mouse.move(xReading, yReading, 0);
^
exit status 1