I'm trying to modify the ForLoopIteration example so I can debug it through serial & start playing around. I noticed that when I tell the code to do this:
void loop() {
char field = "0";
Serial.println(field);
for (int field = 2; field < 8; field++) {
Serial.println(field, "on");
delay(timer);
Serial.println(field, "off");
}
I get an "Invalid conversion from 'const char*' to 'char'" error. I've searched around, but I haven't quite figured out what that means. Can anyone help out a newcomer?
char field = "0"
is wrong, you are trying to assign a string to a char
char field = '0'
Is what to do.
Also
Serial.println(field, "off")
is wrong, you can't do that look at the syntax for Serial.print() you can't have a value and a string in there
Also won't using the same variable name but with a different type in the loop and your for statement cause problems?
If what your trying to do is write the number of iteration your on and then its state (with the Serial.println(field, "on"); bit) I think what you want is actually