Arduino Command Communication with PC

Hello, I would like to ask if there is a command to which the PC must respond. When the PC is turned off must be responded to 0, and when he turned so must 1. thank you

Why not just read the voltage from a USB port on an analog input pin? If it's powered, the PC is on. If not, it's off.

how i can read USB port? What's pin? Thank you :slight_smile:

Belzebugs:
Hello, I would like to ask if there is a command to which the PC must respond.

For that to happen you would have to write a program that runs on your PC and is constantly listening for a message from the Arduino. But even that is not simple because the PC will usually cause the Arduino to restart when it opens the Serial port - and you probably don't want that. There are ways around that.

What @SamIAm93 could be an option - but, of course, it does not tell you if the PC is communicating with the Arduino. and I think there are some systems in which the USB power is not shut off when the PC is off (or maybe asleep).

Could you have a photodiode that can detect some light on the PC when it is working?

...R

Maybe i can detect some light, but it would be better to capture pin usb? What a pin. Thank you

but it would be better to capture pin usb?

One end of the USB cable pugs into the PC. Cut the other end off, and get out your multimeter, and find out.

You will NOT be able to read that voltage from the PC-to-Arduino cable that you use to program the Arduino.

okey thank you :slight_smile: