Further to what KarstenK and OriginalGriff had said about scope, if you indent your code better, it becomes clearer what's going on e.g.
void setup()
{
Serial.begin(9600); pinMode(LED, OUTPUT);
pinMode(ledPin, OUTPUT); pinMode(inputPin, INPUT);
{
Serial.begin(9600); irrecv.enableIRIn(); pinMode(ledr,OUTPUT);
pinMode(ledy,OUTPUT);
pinMode(ledg,OUTPUT);
pinMode(ledb,OUTPUT);
}
long bts[]={16582903,16615543,16599223,16591063};
int leds[]={10,13,12,11};
}
We can now clearly see that
bts
is declared within the scope of the setup() function, so is not available to code outside that function. Looking at this code, I think you meant to declare both
bts
and
leds
at the file level, but the indentation style of the posted code makes it hard to see that it they are actually defined only within the
setup()
function.
Using good indentation also reveals an odd use of a local block, from before
Serial.begin()
to after
pinMode(ledb,OUTPUT)
for no apparent reason. That isn't an error at all, and a code formatting tool will indent the contained code similarly to what I have here, which may be the intention, but its not required here, and would not normally be done.
Check your compiler documentation and see how you can turn up the warning levels. You should then get warnings from the compiler that both
bts
and
leds
are unused, which might have been another clue as to the error reported in your question.