I'm only used to programming things in PHP, so I understand there are differences. I don't understand why, no matter where I declare this variable, I keep getting the same errors.
My entire program so far is as follows:
int greenPin = 11;
int redPin = 10;
int switchPin = 9;
if (digitalRead(switchPin) == HIGH)
All I want to do is be able to call the lightDisplay() function and tell it whether to light a green LED, a red LED, or nothing at all. Seems like this would be easier than rewriting the digitalWrite() statements over and over.
Anyway, when clicking the Verify button, I get this:
sketch_apr01a:-1: error: 'lightState' was not declared in this scope
sketch_apr01a:12: error: redefinition of 'int lightDisplay'
sketch_apr01a:-1: error: 'int lightDisplay' previously defined here
lightState is declared at the top of the code so I don't understand how this can be happening. Am I using the wrong datatype or something?