Connecting RC remote to Arduino

arduinopower supplyremote controlwireless

I found a old RC Car. I'm electronic begginer, so my question might be dump, but I can't figure out how I can do this. I Separated the remote and connected it's power to the Arduino board.

At this time the project looks like this: ( It's working )
enter image description here

My goal:

enter image description here

The Problem:

The buttons are connected to the chip and to the ground. If the button was connecting the 3.3v to the chip, it was going to be fine, I was just going to do as the picture ( My goal ) above, but now I don't know how I can accomplish my goal. My question is how I can switch pins between ground and "chain breaker" ?

Best Answer

I fixed my problem by switching the pinMode like this:

void on(int btn) {
    pinMode(btn, OUTPUT);
    digitalWrite(btn, LOW);
}

void off(int btn) {
    pinMode(btn, INPUT);
}

void setup() {
    off(13);
}

void loop() {
    on(13);
    delay(1000);
    off(13);
    delay(1000);
}