This code is taken from the website http://www.obdev.at/products/avrusb/powerswitch.html and slightly modified to use as a sample for a tutorial on 'how to use avr-atMega16-usb'. Before you run the code you should have libusb installed on your PC, the link for which is given below.

After downloading the 'avrM16usbcode.tgz' file or the 'PowerSwitch*.tgz', please go through the following instructions.


1. In case you are using 'avrM16usbcode.tgz' , untar it, `tar -xvzf avrM16usbcode.tgz`.
2. Go to the directory "PowerSwitch.2007-06-25".
3. You should see a folder named "commandline" in that directory.
4. Move to that folder and just run './powerSwitch', to see the instructions on how to use that program.

Please recompile the program using 'make' to create a new 'powerSwitch.o' file so that it can run on your computer. The 'powerSwitch.o' residing currently in the folder may not be compatible with your system always.

Ankur Handa
28 Feb '08
3:38 PM IST
[Download the Code]
[Download libusb.tgz]