Dear forum,
I have a question regarding the WiFi shield and the pin 4 which (hopefully) only is used, when I use the SD card library.
I have wired a button to the pin (with pulldown) and configured it as an input.
See this very trivial example:
void setup()
{
Serial.begin(9600);
pinMode(4, INPUT);
}
void loop()
{
Serial.println(digitalRead(4));
}
On a "naked" Arduino Uno R3, this works as expected. I get a lot of 0s and when I push the button, I get 1s. When I release the button, I get 0s again.
Now this exact same code on an Arduino Uno R3 with a WiFi shield on top acts weird:
First I get 0s, when I push the button I get 1s. And when I release the button, I keep getting 1s forever.
I have the same behavious when I set up and use the WiFi shield to actually connect to a network. I set up just the WiFi part. I do not use the sd library in my code.
The documentation says, that pin 4 is used for the sd library. Do I have to turn it off somehow, so that the pin acts as a normal I/O pin when I don't use it?
Since I have wired a LCD, I'm running out of pins, so it really would be great, if I could use pin 4.
My forum and google searches did not bring any hints.
Does anybody have an idea?
Greetings
Konk