In the following code fragment, I get the compilation errors below.
The single reverse slash at the end of the const declaration for RED_LED_PIN causes the following line to be treated as a comment.
If I simply delete that slash or even just add a space after it, it compiles just fine.
Anyone know what's going on with that?
Thanks,
.Andy
// pins used
const int HEARTBEAT_PIN = LED_BUILTIN; // on board LED for heartbeat
const int RX_PIN = 2; // for xBee RX
const int TX_PIN = 3; // for xBee TX
const int RED_LED_PIN = 4; // \
const int GRN_LED_PIN = 5; // > RGB LED for door state
const int BLU_LED_PIN = 6; // /
const int BUTTON_PIN = 7; // button for mode changes
const int BUZZER_PIN = 8; // Piezo for UI confirmations
const int SENSOR_PIN = 9; // magnetic sensor for door state
const int MSG_LED_PIN = A5; // LED for UI confirmations
void setup() {
// initialize all pins
pinMode(RX_PIN, INPUT);
pinMode(TX_PIN, OUTPUT);
pinMode(MSG_LED_PIN, OUTPUT);
pinMode(RED_LED_PIN, OUTPUT);
pinMode(GRN_LED_PIN, OUTPUT);
pinMode(BLU_LED_PIN, OUTPUT);
pinMode(BUZZER_PIN, OUTPUT);
pinMode(SENSOR_PIN, INPUT_PULLUP);
}
void loop() {}
/private/var/folders/_l/ld1sdgpx2nl4jgn8l6txc4mw0000gn/T/.arduinoIDE-unsaved2024111-90783-1kgihyw.1sf0k/sketch_dec1a/sketch_dec1a.ino: In function 'void setup()':
/private/var/folders/_l/ld1sdgpx2nl4jgn8l6txc4mw0000gn/T/.arduinoIDE-unsaved2024111-90783-1kgihyw.1sf0k/sketch_dec1a/sketch_dec1a.ino:19:11: error: 'GRN_LED_PIN' was not declared in this scope
pinMode(GRN_LED_PIN, OUTPUT);
^~~~~~~~~~~
/private/var/folders/_l/ld1sdgpx2nl4jgn8l6txc4mw0000gn/T/.arduinoIDE-unsaved2024111-90783-1kgihyw.1sf0k/sketch_dec1a/sketch_dec1a.ino:19:11: note: suggested alternative: 'MSG_LED_PIN'
pinMode(GRN_LED_PIN, OUTPUT);
^~~~~~~~~~~
MSG_LED_PINexit status 1
Compilation error: 'GRN_LED_PIN' was not declared in this scope