Disable Arduino uno if Pc is offline ??

Hello everyone,
I have a problem with my arduino and I seriously need help to solve it.

The Problem:

I placed LED stripes behind my Monitor and connected it to my arduino.
I do already have the right code to change the colors.
Now: I want the arduino UNO to automaticly turn itself off when i put my pc/Mac
to sleep so i don’t have to every time pull out the usb cable from it.

At the end of the Day it seems to more an “problem” with my Mac than my arduino,
but I still need help.

Thank you for helping me out :wink:

A few options.

  1. have your PC send a command (can be a single character) over Serial when it's shutting down, your Arduino may react to this. Likewise when starting up.
  2. a push button on your Arduino: push to tell it you want lights off, push it again for lights on.
  3. power switch on the Arduino (in the USB cable switching its power wire?).

Nezithebhai:
Now: I want the Arduino UNO to automaticly turn itself off when i put my pc/Mac to sleep so I don't have to every time pull out the USB cable from it.

There are a few problems with this description.

One is: Why do you want to "turn the Arduino off"? It draws about 50 mA in idle, which is about a quarter of a Watt. I suspect that is the same or less than the idle current of your PC/Mac; you are not going to save any meaningful amount of power or lifetime of the parts in case you have some perverse idea about that.

Now these "LED stripes" - are they perchance "NeoPixels" or similar? If so, how do you turn off the power to them, because without data from the Arduino, they will simply retain the last pattern that you fed to them as long as they are supplied with power? Hopefully you have not attempted to draw power for them from the Arduino.