I'm trying to recreate the game Simon in Arduino without using any push buttons, and I keep running into the same problem. Whenever I try to print a string or an int into the serial monitor, a "⸮" appears before it (ex. ⸮1). If I use the pinMode() function once, the code works the way I want it to. If I use the pinMode() function more than one time, the "⸮" appears again. How can I remove this "⸮"?
int leds[] = {16, 14, 12}; //LED pins {RED, YELLOW, GREEN}
int sequence[100];
void setup() {
// put your setup code here, to run once:
for (int pin = 0; pin < 3; pin++)
{
pinMode(leds[pin], OUTPUT);
}
Serial.begin(9600);
sequence[0] = random(0, 3);
delay(300);
digitalWrite(leds[sequence[0]], HIGH);
delay(700);
digitalWrite(leds[sequence[0]], LOW);
Serial.println(sequence[0]);
}
void loop() {
// put your main code here, to run repeatedly:
}
The LED that is being written to is will be red, yellow, or green. The random function will set the first index of the sequence array to a number between 0-2. If sequence[0] is equal to 0, the LED will be red. If it is equal to 1 the LED will be yellow, and if it is equal to 2 the LED will be green.
I'm not using Arduino UNO, so that might be the issue. I'm using a SLATE Experimenters Board. I tried switching my pins around and I still have a ⸮ in my serial monitor. Thanks for the help.