uploading code to Hoodloader2

hi there, i keep getting this error as i compiled the program. anyone know what should i do?
This is my code sketch :

#include <Mouse.h>
#include <HID.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);
}

/*
reads an axis (0 or 1 for x or y) and scales the
analog input range to a range from 0 to
*/

int readAxis(int axisNumber) {
int distance = 0; // distance from center of the output range

// read the analog input:
int reading = analogRead(axis[axisNumber]);

// of the current reading exceeds the max or min for this axis,
// reset the max or min:
if (reading < minima[axisNumber]) {
minima[axisNumber] = reading;
}
if (reading > maxima[axisNumber]) {
maxima[axisNumber] = reading;
}

// map the reading from the analog input range to the output range:
reading = map(reading, minima[axisNumber], maxima[axisNumber], 0, range);

// if the output reading is outside from the
// rest position threshold, use it:
if (abs(reading - center) > threshold) {
distance = (reading - center);
}

// the Y axis needs to be inverted in order to
// map the movemment correctly:
if (axisNumber == 1) {
distance = -distance;
}

// return the distance for this axis:
return distance;
}

this error that i got :

Arduino: 1.8.1 (Windows 10), Board: “HoodLoader2 16u2, HoodLoader2 Uno”

Build options changed, rebuilding all
mouse:5: error: ‘A1’ was not declared in this scope

const int xAxis = A1; //analog sensor for X axis

^

mouse:6: error: ‘A2’ was not declared in this scope

const int yAxis = A2; // analog sensor for Y axis

^

Multiple libraries were found for “Mouse.h”
Used: C:\Program Files (x86)\Arduino\libraries\Mouse
Not used: C:\Program Files (x86)\Arduino\libraries\HIDmaster
Multiple libraries were found for “HID.h”
Used: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\HID
Not used: C:\Program Files (x86)\Arduino\libraries\HIDmaster
exit status 1
‘A1’ was not declared in this scope

thanks…

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. Using code tags and other important information is explained in the How to use this forum post. Please read it.

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read.

The ATmega16U2 doesn’t have any analog pins, thus the error. I think you need to spend time reading the Hoodloader2 documentation to make sure you understand what you’re doing.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

What model Arduino are you trying to code?
In your other thread you mentioned UNO, but it has no mouse facility as was explained.

Tom.... :slight_smile:

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. Using code tags and other important information is explained in the How to use this forum post. Please read it.

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read.

i’m so sorry, my bad for not read the instruction… i’ll be careful for the next post…

The ATmega16U2 doesn’t have any analog pins, thus the error. I think you need to spend time reading the Hoodloader2 documentation to make sure you understand what you’re doing.

thanks… i’ll look forward for this…

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

What model Arduino are you trying to code?
In your other thread you mentioned UNO, but it has no mouse facility as was explained.

thanks in advanced tom… :slight_smile: