I was working on a sketch that controls the serial monitor with a parallax joystick for my assignment. When I checked it the following error was showing"Expected initializer before '/' token". I'm new to the arduino and to coding, so if there is any mistake in my coding don't hesitate to write it down. Thank you very much. Below is the sketch and error was on the 4th line.
const int U/D = A0;
const int L/R = A1;
int U/D val = 0;
int L/R val = 0;
void setup(){
pinMode(U/D = INPUT);
pinMode(L/R = INPUT);
Serial.begin(9600);
}
void loop() {
{
val = analogRead (U/D);
if (val == HIGH) {
Serial.println("Up/Down value = HIGH");
}
else{
Serial.println("Up/Down value = LOW");
}
}
{
val = analogRead (L/R);
if (val == HIGH) {
Serial.println("Left/Right value = HIGH");
}
else{
Serial.println("Left/Right value = LOW");
}
}
}
Joystick_NJ.ino (554 Bytes)