I am trying to activate an led based on the throttle of a joystick. My code is having an issue compiling for my Arduino Uno.
Here is the code:
int XPin = A0;
int ledPin2 = 2;
void setup() {
// put your setup code here, to run once:
pinMode(ledPin2,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int XThrottle = analogRead(XPin);
if (XThrottle < 10) digitalWrite(ledPin2,HIGH);
}
This is the error message:
Arduino: 1.8.5 (Windows Store 1.8.10.0) (Windows 10), Board: "Arduino/Genuino Uno"
GetFileAttributesEx C:\Users\Brody\AppData\Local\Temp\arduino_build_579452: The system cannot find the file specified.
Error compiling for board Arduino/Genuino Uno.
Everything outside the 'void loop' worked in a previous program.
Thank you for your help.
Try uninstalling the Windows Store version and just install the version from here.
PS this:
int ledPin2 = 2;
int ledPin3 = 3;
int ledPin4 = 4;
int ledPin5 = 5;
int ledPin6 = 6;
int ledPin7 = 7;
int ledPin8 = 8;
int ledPin9 = 9;
int ledPin10 = 10;
int ledPin11 = 11;
is stupid!
a) where's ledPin1?
b) if you start numbering things, arrays!
c) do you expect a pin of -2178? Aka, a byte will do 
d) if you want to save memory, make them const byte
Thanks Septillion, that worked. Also I will use arrays next time.
Hi,
Please do not go back and edit you post with any solutions given in later posts.
You have made this thread useless for anyone who looks here with a similar problem by basically removing the ORIGINAL code.
Always update your code by posting it in a new post, so the evolution of your solution can be seen and used to aid otherts.
You have made @septillion response look irrelevant, yet this is the contributor who helped you.
Tom... 