Okay, so a usb port has 4 pins, a ground, two I/O pins, and a (may or may not be switchable) 5V pin. I had an idea to to connect one of the pins to the base of a transistor. Then I would rip the button out of power strip, and connect the other two leads of the transistor where the switch used to be.
- If I connect it to a data pin, it would turn the thing on and off essentially at random. Since I want to hook this up to a Christmas lights, that would be awesome!
- If I connect it to the 5V pin, I could switch it on and off by turning the USB port on and off.
My question is, is this safe/would it work? What transistor should I use (since I'm writing the software, the software could accommodate the specific transistor if needed.)