How to use the IR port on the back of my netbook to change the channel
I am always sitting on my couch watching tv and surfing the net and I got this hairbrained idea to program the IR port on my laptop to switch the channel. I program C# but wanted to know if anyone else has tried this. How do I access the port? How do I capture what my Universal remote is sending to replay to the TV when I开发者_Python百科 press a button? I could also use this method to program some of my kids IR toy robots. Maybe that will get them interested in programming! Thanks in advance.
I believe you will see the IR as a serial port. You can use it from C# using the System.IO.Ports.SerialPort
class (msdn).
This can be your starting point.
Regarding the strength, it IS powerful enough to control your TV (unless your living room is 10 meters wide :)). There are programs on PocketPC (universal programmable remotes that capture IR remote signal from your TV remote to be configured) that do the same.
You can use the SerialPorts object in .NET. Here's a sample project that might give you some ideas: http://code.msdn.microsoft.com/IRDADemo
Depending on your laptop however, your port may be receive only. TVs, for example, have receive only ports that don't have an emitter LED. If that's the case, there are plenty of cheap USB dongles you can buy that will give you sending capability.
I wouldn't bother, it's probably nowhere near powerful enough to work at any distance.
If, by some stretch, it was, you can normally access them as a COM serial port, so it's just a case of writing the correct bits to perform the magic. Have a look at System.IO.Ports for some inspiration, this gives you a simple event-driven way of accessing a serial port from C#/
I looked into this in the distant past when IR transceivers were commonplace. The majority are not very powerful and will not reach more than 1 meter. Also programming the IR port using serial to make it match the required infra-red code is difficult. Form what I remember it only worked on certain TV's. It was much the same for PDA's they were more successful but generally had a weak IR transmitter so you had to be too near the TV for it to be useful.
精彩评论