-2

I've come to a problem that I'd like to receive multiple inputs from a USART in my stm32f4. For example, if I press and hold A then S then D on my keyboard (without letting go of A and S) then do something like printing out a value.

I know USART can only receive one input but is there a way using some kind of buffer or interrupt to simulate it at least like this. An example would be nice.

5
  • 2
    If you want to use a keyboard via a UART connection, you must define some protocol (or check for some existing one) to indicate whether a key was pressed normally, or was pressed long or was kept pressed while another was pressed. That is nothing a U(S)ART could do for you.
    – Gerhardh
    Commented Jul 5 at 8:49
  • @Gerhardh it is just a naive explanation of using the serial terminal on OPs computer. OP does not connect keyboard to the STM board. Commented Jul 5 at 10:17
  • 1
    @0___________ I understand that. It seems that some program on the PC shall forward key press events to the STM board via U(S)ART. But keyboard events are something completely different than just some sequence of characters. The OP needs to introduce some translation.
    – Gerhardh
    Commented Jul 5 at 10:22
  • I just want to press something on my keyboard while the uart is connected to my pc and stm32, in the answers is the code thats used for the uart to get a char from my pc to the stm32, and right now it takes only one input Commented Jul 5 at 12:07
  • 1
    What "answers" are you referring to? What software on the PC do you use to transfer the key presses to the STM board? What data is really transferred on the UART? Do you have a problem with sending or with receiving?
    – Gerhardh
    Commented Jul 5 at 16:36

0

Browse other questions tagged or ask your own question.