I am trying to learn how to read/write to an array. The onboard led should change its blink rate when I either ground pin 2, or connect to +5v. Unfortunately, the led remains off. Any suggestions how to fix the code will be appreciated. I have been working on it a few days now without success.
const int ledPin = 13; // onboard LED
const int hallPin = 2;
byte test[3][8] {{0, 0, 0, 0, 0, 0, 1, 1}, {0, 0, 1, 0, 0, 0, 0, 0}, {1, 1, 1, 1, 1, 1, 1, 1}};
void setup()
{
pinMode(ledPin,OUTPUT);
pinMode(hallPin,INPUT);
}
void loop()
{
if (hallPin == HIGH)
{
test[2][2] = 1;
digitalWrite(ledPin, test[2][2]);
delay(200);
test[2][2] = 0;
digitalWrite(ledPin, test[2][2]);
delay(200);
}
else if (hallPin == LOW)
{
test[2][2] = 0;
digitalWrite(ledPin, test[2][2]);
delay(100);
test[2][2] = 1;
digitalWrite(ledPin, test[2][2]);
delay(500);
}
}