Hello,
I'm just starting with Arduino with some experience in other languages (but little in C++). I'm sorry if this question should be asked somewhere else, I did the obligatory searching through this forum and others, but couldn't find anything to help out.
Basically I'm trying to write code that, based on a variable will control LED's connected to different pins. As the code currently stands, the variables I'm using are Strings. I imagine this is the root of my problem, but don't know what to do about it.
An example bit of code is:
int Rled1 = 12;
int Rled2 = 11;
void Setup(){
pinMode(Rled1, OUTPUT);
pinMode(Rled2, OUTPUT);
}
void loop(){
//i have a segment of code here I can confirm is working, through the serial monitor. get's me to:
if (var == 1){
String red_led = "Rled";
red_led.concat(var); //up till here works
digitalWrite(red_led, 255);
}
}
The last line of my code gives the error:
" cannot convert 'String' to 'uint8_t' for argument '1' to 'void digitalWrite(uint8_t, uint8_t)'".
Any help would be greatly appreciated.
Thanks