Should I use digitalwrite HIGH, or Pinmode Input, to stop grounding a pin?

So I’ve made my space heater wifi-enabled with just a Photon and 3 wires:


I did this by taking the IR remote from the space heater, which operates on a 3.3v coin cell battery, and replacing it with wires from my Photon instead. 3.3v and GND from the Photon to the battery tabs, and a single digital GPIO pin to control the remote’s IC pin that is normally triggered by the ON button on the remote.

Problem is, I tested that pin with a multimeter and it’s normally HIGH, outputting 3.3v, and the button grounds the pin. Don’t worry, it only sinks about 12uA of current, I’m pretty sure that’s much less than what the Photon can handle. So what I did is I soldered D2 from the photon to that pin on the remote, and then I just do this:

digitalWrite(D2, LOW);

…when I want to simulate a button press on the remote by grounding the IC pin, and I do this:

digitalWrite(D2, HIGH);  

…when I want to release the button.

The problem is that when I write that pin high, it means both my Photon, and the IC pin on the remote, are both trying to output 3.3v, into each other. And I measured it with a multimeter and there’s about a 0.04v difference between the two, and I’m not sure if that’s going to damage one or the other.

So I thought “Well all I really want to do is ground the pin, which I do with a LOW write, and then stop grounding the pin. Maybe I can digitalWrite floating instead of digitalWrite HIGH? But wait, that’s what setting the pin mode to INPUT does!”

So would it be better to replace the digitalWrite HIGH with a pinmode INPUT, which is akin to “STOP grounding this pin, and just leave it alone now”? Or would I be better off continuing what I’m doing now, but maybe adding a diode somewhere? Or is it perfectly safe the way I have it now, even though both the remote and the Photon are trying to send 3.3v into each other?

The risk of damaging any of the two isn’t to great, but I’d still do this

void setPinActiveLOW(int pin, int state, bool forceLOW = false) {
  if (forceLOW)        // if you can't be sure the OUTPUT would turn on LOW
    pinResetFast(pin); // optional to ensure the pin will be LOW on OUTPUT
  pinMode(pin, state ? INPUT : OUTPUT);