Problem with Shield Shield?

I am having a problem where a configuration and code which works on the breadboard does not work when transferred to the shield.

Basically I am passing current from a separate 12v circuit through the coil of a relay. Going into the switch side of the is the Photon’s 3.3v output © and the NO terminal is then connected back to D6 on the Photon. When the 12v signal is switched, the relay is closed and the 3.3v is allowed to pass from the output to D6, where it is sensed as a HIGH value and actions triggered.

All of this works fine on the breadboard, but when I plug the Photon into the Shield Shield it will trigger but it will stay triggered even when the current to relay coil is shut off. In other words, even though there is no current flowing to the Photon’s D6 pin, the firmware is still detecting current. I have to then ground D6 to remove the trigger voltage.

What am I doing wrong? Perhaps I’ve hooked it up incorrectly, but I have a 9V wall wart powering the Shield Shied through the terminal connection.

Here’s my code…

int led2 = D7;  // Assigns the on board LED to boardLed
int sensor = D6;  // Assigns the input pin

void setup() {
pinMode(led2, OUTPUT); // Oon-board LED is output
pinMode(sensor, INPUT_PULLDOWN);  // Sensor pin is input
digitalWrite(led2, LOW);
}

void loop() {    
    while(digitalRead(sensor) == HIGH) {
        digitalWrite(led2, HIGH);
        RGB.control(true);
        RGB.color(255, 0, 0);
        Spark.publish("status", "#occupied", 60);
        delay(1000);
    }
    RGB.control(false);
    digitalWrite(led2, LOW);
    delay(5000);
}

I’ve just been playing around a bit more, trying different configurations and it seems that once D6 gets current, it won’t let go until it’s been grounded manually. This only happens when the Photon is plugged into the Shield Shield and the shield is properly grounded.

With the help of Particle’s support and hardware engineering team we finally figured out what was going on. Apparently, when using the Shield Shield the internal pulldowns specified in my firmware are deactivated (or ignored) and the values tend to float.

It took a bit of trial and error but I put an 2.2K external pulldown resistor between the D6 and GND and it appears to be working. In addition, I was directed to remove the “pulldown” from my code and just go with plain old “input”.