I replaced the resistor with a 10k potentiometer, and put my scope's probe on the digital ioPin.
Depending on the position of the wiper, the voltage at the pin goes from 1.8 v to 2.4 v with the switch not pressed, thus reading LOW below around 2.2 v and HIGH above.
With the switch pressed, the voltage varies from 0 to 1.1 v, which always gives a LOW reading.
So calculating the right resistance to have more than 2.2 v at the pin will do the job.
The only drawback from this method is that due to the relative high resistance value, the LED is not very bright.
Then I thought of using an analog input pin, so I could decide myself which value defines the limit between "LOW" and "HIGH". This allows me to keep the resistance value low to have a bright LED: I choose 470 ohms for my yellow LED, which gives a reading of around 400 when the switch is not pressed and 40 when pressed.
The LED is always off when the button is pressed, but that is ok for me.
Thanks again everybody !

Code:
#define ioPinA 0
#define ioPinD A0
short myStatus;
unsigned long lastReading;
unsigned long lastSwap;
void setup (void)
{
pinMode (ioPinD, OUTPUT);
myStatus = HIGH;
lastReading = 0;
lastSwap = 0;
Serial.begin (9600);
}
void loop (void)
{
short reading;
// blinking led
if (millis () - lastSwap > 500)
{
lastSwap = millis ();
myStatus = HIGH - myStatus;
digitalWrite (ioPinD, myStatus);
}
// 100 ms have passed ?
if (millis () - lastReading > 100)
{
lastReading = millis ();
// set as input
digitalWrite (ioPinD, LOW);
pinMode (ioPinD, INPUT);
// read switch
reading = analogRead (ioPinA);
// set as output and restore LED status
digitalWrite (ioPinD, LOW);
pinMode (ioPinD, OUTPUT);
digitalWrite (ioPinD, myStatus);
Serial.println (reading, DEC);
reading = reading > 200 ? HIGH : LOW;
Serial.println (reading == HIGH ? "HIGH" : "LOW");
}
}
#define ioPinD A0
short myStatus;
unsigned long lastReading;
unsigned long lastSwap;
void setup (void)
{
pinMode (ioPinD, OUTPUT);
myStatus = HIGH;
lastReading = 0;
lastSwap = 0;
Serial.begin (9600);
}
void loop (void)
{
short reading;
// blinking led
if (millis () - lastSwap > 500)
{
lastSwap = millis ();
myStatus = HIGH - myStatus;
digitalWrite (ioPinD, myStatus);
}
// 100 ms have passed ?
if (millis () - lastReading > 100)
{
lastReading = millis ();
// set as input
digitalWrite (ioPinD, LOW);
pinMode (ioPinD, INPUT);
// read switch
reading = analogRead (ioPinA);
// set as output and restore LED status
digitalWrite (ioPinD, LOW);
pinMode (ioPinD, OUTPUT);
digitalWrite (ioPinD, myStatus);
Serial.println (reading, DEC);
reading = reading > 200 ? HIGH : LOW;
Serial.println (reading == HIGH ? "HIGH" : "LOW");
}
}
ps: sorry dc42, only two wires available…
edit: typos…