| August 15th, 2009 Here is a project (took me a few attempts to create, but I was persistent) that demonstrates how to control 5 devices (turn off and on LEDs or make new functions) using certain keyboard keys to operate. In this demo I take 5 LEDs in PB1 to PB5 and then assign numbers 1 to 5 on PC keyboard to turn on each individual LED and keys q,w,e,r,t to turn off each of the lights. This project communicates with your PC through a RS232 serial interface. Download AVR project (NerdKit version). I have also created a Visual Basic 6 application using MSComm for Windows where you can click a simple button to send the commands (turn each individual light on or off, turn all lights off/on) to our barebones AVR kit. You may have to change the COM port (I am suing COM5 in this example). I could even make it so there was a web based interface on my web server so people could turn the LEDs on and off over the internet with ASP, PHP or Perl. Here is a video of my Atmega168 getting commands from Windows software on PC. Download the VB6 source code (and compiled) for this 5 LED controller interface software for Windows.
UPDATES: I found a way for an old PC like a 286 or 386 to control the PC as long as the old clunker has MSDOS 6.22 (Micrososft DOS) or greater (even works in command prompt in Windows XP). Here is a sample DOS batch file that will force the 5 LEDs to become a light chaser (lights go on and off and chase each other back and forth, loops infinitely until you close the cmd.exe window). Good way to put some of those old obsolete PCs back into use instead of the garbage bin or waste dumps (better than recycling I think). Here is the DOS batch file (uses echo command in DOS prompt or DOS emulator) to demonstrate controlling with DOS 6.22 and above (even a 286/386 PC or Windows 3.1 has this). Also, you don't use the USB dongle (no DOS drivers) for serial UART connecting with DOS, the kit needs to plug into the serial port (some people think it looks like an inverted VGA connector). Instead of using a batch file, you can just open your DOS prompt and type echo 1 > com5 to turn on LED 1. To start DOS prompt in Windows, go to your Start button and click on Run and type cmd in the Open field.
Here is an ASP script to turn on LED #1 as basic sample, it basically sends through the DOS command line to the serial port like our DOS ECHO example above (this method could also be used in VB). You need to run this script on Microsoft's IIS and it will allow you to activate commands over the internet from any where in the World. It basically implements the DOS commands to do your bidding. This could easily be ported to PHP. |
Free image widgets HERE.