I bought a simple LED light strip that is powered by a USB cable. I was wondering if it is possible to make a simple plugin to turn on and off the power to one of the USB slots. Now I don't know how easy or simple coding is, or if it's even possible to turn a usb slot on and off. I don't need it to do anything else besides simply turning on the USB powered LEDs and turning them off. But if someone can make that happen. That would be awesome!
My best advice is "Don't use it", especially on a Raspberry Pi that is already likely to be on the edge of being underpowered via an USB power supply. Use a led strip that has its own power supply.
Not to mention that the USB ports on the RPi cannot be powered on and off individually, only all on or all off.
Marlin has support for LEDs, but you would need a board that supported them and e.g. an skr with dc power boast module.
But if you already have the strip and don’t have a compatible board then this option not so good. But that is what I did.
You could use many of the available power plug/switch plugin options (I've wrote a few of them) to control an IoT device that can power the USB LED strip.
You could use an active usb hub which is supported by https://github.com/mvp/uhubctl
This could work if you used a "Smart USB Hub". These USB hubs have their own external power supply and the power to each USB port can be controlled by a computer.
The idea would not work for most USB slots on most computers. But if you were to buy a smart hub, then yes. This is what those hubs are designed to do.
See here for a list of smart hubs and some software to control them
I wish I had thought of this sooner...
LOL, you're funny weezl.