@Imahilus
Did some experiments on switching between OUTPUT and INPUT. The results may have something to do with your problem.
Basically, I found that if a pin is OUTPUT and it's last state was HIGH, then when the pin is switched to INPUT, it's internal pull-up will be set. (If it's last state was LOW, they will not be set and it will float.)
I'm not sure how having pullups on or off may affect your results, but the converse is also true, if pullups are set on an INPUT pin, the PIN will init as HIGH when set to OUTPUT. If they are not, the pin will init as LOW.)
Try setting pin 19 LOW either before or after you set it to INPUT. (In my test it didn't matter.) You might also try resetting your output pins.
Here is the code I used to test this. I connected a DMM to the test pin and ground. You can spot the pullups by the slightly lower output V. "Pure" floating shows up a AC on my DMM.
#define TEST_PIN 7
void setup() {
Serial.begin(9600);
}
void loop() {
char response; // response from serial in
Serial.println("o=OUTPUT, i=INPUT, h=HIGH, l=LOW");
while(!Serial.available()); // wait for input
response = Serial.read();
switch(response) {
case 'o':
Serial.println("Output");
pinMode(TEST_PIN,OUTPUT);
break;
case 'i':
Serial.println("Input");
pinMode(TEST_PIN,INPUT);
break;
case 'h':
Serial.println("High");
digitalWrite(TEST_PIN,HIGH);
break;
case 'l':
Serial.println("Low");
digitalWrite(TEST_PIN,LOW);
break;
default:
break;
}
}
Maybe this is a clue, maybe it's a red herring. (Seems strange to say that to a guy from Holland :)) You might also re-check your wiring to make sure your not getting some kind of crosstalk.