How do you turn off an Infrared transmitter

Im trying to make a TV remote control with buttons, but since i need a command to turn off the led when the button is off, the led just stays on even after i leave the button. i can't use digitalWrite because its not an output pin, and setting it as one just leaves it on no matter what, even before i press the button. So, how DO i turn off an infrared led?

Please read and follow the instructions in the "How to use this forum" post.

jremington:
Please read and follow the instructions in the "How to use this forum" post.

i read it

i read it

Excellent, a great first step!

cut the power supply ?

(alternatively show us your code and how your hardware is designed and we might be able to give you some hints)

/*

  • IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
  • An IR LED must be connected to Arduino PWM pin 3.
  • Version 0.1 July, 2009
  • Copyright 2009 Ken Shirriff
  • http://arcfn.com
    */

#include <IRremote.h>
#include <SoftwareSerial.h>
const int rx=3;
const int tx=4;
int Up = 0;
int ButtonUp = 7;
SoftwareSerial mySerial(rx,tx);
IRsend irsend;

void setup()
{
pinMode(ButtonUp, INPUT);

mySerial.begin(9600);
}

void loop() {
Up = digitalRead(ButtonUp);
if(Up == HIGH){

irsend.sendNEC(557634603, 32); // YES up button
}
if(Up == LOW){

//this is where i need help
}
/213C24DB
}
1
213CC43B
/

}

Edwin1:
So, how DO i turn off an infrared led?

By wiring and reading the button correctly and acting on button state changes.

Now you probably read from a floating pin and send the IR command while there is a HIGH signal.

PS. you did not really read the 'how to'. No code tags, no schematic.

See item #7 here:- How do you turn off an Infrared transmitter

Also, a schematic diagram would help, as suggested by Whandall.