I am trying to debug the attached IR 7 segment program for my Mega, copied from Google resources. I keep getting an error which says: crosses initialization of 'int i' for(int i = 0; i <= 3; i++){
I am a real rooking, but eager to learn, so what am I doing wrong. I can't get the program to fully load. The only changes I have made to the copied sketch is to replace the IR codes to match my universal IR remote control.
Line 233, There is no closing brace! no wonder you have errors!
for(int i = 0; i<3; i++){
Another missing closing brace?!
case 0x20df40bf:
// VOL UP (increases the visitor count by one)
visitorCount = visitorCount + 1;
if (visitorCount > 99) { // after 99 runs, counter goes back to 0
visitorCount = 0;
Serial.println("Vol Up");
break;
case 0x20dfc03f:
...
There are another 6 occurrences of this...
There is also an extra closing brace...
After fixing all those, now I get only 1 error...
/Applications/Arduino.app/Contents/Java/libraries/RobotIRremote/src/IRremoteTools.cpp:5:16: error: 'TKD2' was not declared in this scope
int RECV_PIN = TKD2; // the pin the IR receiver is connected to
But because I don't want to look up if this library is available online, I am just going to say that TKD2 doesn't mean anything to me...
I am trying to debug the attached IR 7 segment program for my Mega, copied from Google resources.
Does the code you originally copied actually compile ?
As has been pointed out the code is riddled with errors, some of which will not be caught by the compiler, such as missing breaks at the end of cases such as
case 0x20df906f:
Serial.println("Mute");
case 0x20df8877:
Serial.println("One");
case 0x20df48b7:
Serial.println("Two");
etc