-1

I have connected an STM32 MCU to a Windows desktop PC using a USB to serial converter, with the USB side connected to the PC and serial pins connected to the UART port of the MCU.

I am aware that character data can be sent over serial port. Is there any way to send control signal/data from the PC to an LED or relay connected to the MCU that can change the state of the LED or relay from its previous state?

Null
  • 7,448
  • 17
  • 36
  • 48
  • 1
    You send some message to the MCU with a defined protocol via serial line (and it is not necessarily a character data, it can be any binary data), the MCU is decoding it and is turning on/off the LED or the relay accordingly. A bit of discussion about serial protocol formatting techniques in my old [question](https://electronics.stackexchange.com/questions/186254/serial-protocol-delimiting-synchronization-techniques) – Eugene Sh. Jun 28 '21 at 14:00

1 Answers1

1

Yes there is, many ways. One example is to send letter 'a' to turn relay on and letter 'b' to turn relay off, or letter 'c' to toggle the state, if the relay is under MCU control. If it isn't, then you can use the serial port handshake signals to control anything you want in any way you want, like for example bit-bang I2C.

Justme
  • 127,425
  • 3
  • 97
  • 261