Infra Red Remote Control

Okay, so i am planning on making a remote controlled tank. I Have decided that the cheapest way would be to use infra red... so, i went to radio shack and i bought myself an ir emitter and receiver.

Here they are

emitter:

heres my receiver

im using a digital input pin for the receiver...

and for the emitter im using an analog output.

im trying to send an analog output to the emitter and then receive it with this code:

for (byte i = 0; i < BITS_PER_MESSAGE; i++) {
      code |= (pulseIn(IR_PIN, LOW) > BIT_THRESH) << i;  
  }

it doesnt seem to be working... is there something else i can do? would there be an easier way? or do i have it all wrong?

so how would i modulate my output to the 38kHz? and how do i make it still send what i want it to send

You could use your tv remote:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1279084882

Try out the IR library and the example IR test sketch to see if your remote works easily

yeah i saw that... but i want to make my own controller because i want to do some things my tv remote wont be able to do... and i want to use my arduino to do it... any more ideas? ill keep googling

ok well at for the 555 timer circuit it tells you to change the output from a potentiometer, i want to do it from a ps2 joystick and i dont see a way to hook it up, i want to output it from the arduino... maybe hook up a 556 and use two emitters one for x and one for y or maybe just use a different receiver. and i dont see on the website how to actually change the modulation of the emitter...

the IR library can also send data like it's a TV remote. I did an undocumented project where I made a NES controller a TV remote.
controller--> arduino ---> IR LED
some unrelated ir sending (and receiving) code:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1277840151

yeah, thats true... i understand how to use the pot. and what do i send to the MOD? the output data? so like a byte? also how do i modulate it? the 555 timer should modulate it to 38MHz? or i have to do something else, i.e. change resistors capacitors?

btw. sorry for being kind of annoying, i am pretty new =/

well i understand that... what kind of command does it send? is it a number from 0 - 255 in binary or what?