Arduino + BT

hi, i have a basic question about the use of the bluetooth module. when i send a command to arduino it states all the time and i have to send another stop command. is there a way to avoid this? i want to use my keyboard buttons as push-buttons high when pushed, off otherwise

when i send a command to arduino it states all the time

It does what?

e and i have to send another stop command. is there a way to avoid this?

Of course. Fix line 27.

i want to use my keyboard buttons as push-buttons high when pushed, off otherwise

The buttons on the keyboard of the Arduino? My Arduino doesn't have a keyboard.

sorry for my english and the way i expressed the question. i will try to explain better :slight_smile:

i want to control arduino with the keyboard of my pc. the problem is that, for example to turn on and off a led i have to use two commands (for example keyboard '1' for on and '2' for off). i want to know if it is possible to:

  • turn on and off the led with the same command (first time '1' =led on, second time '1' =led off)
  • only turn on the led WHILE i press a button of my pc keyboard ('1' in this case)

hope you can understand me better now

  • turn on and off the led with the same command (first time '1' =led on, second time '1' =led off)

Yes. When you receive a '1', set the state to whatever the state is not. Then, apply the state to the pin.

  • only turn on the led WHILE i press a button of my pc keyboard ('1' in this case)

That depends on what is listening to the keyboard/talking to the serial port. If you are using the Serial Monitor application, that is not possible. If you write your own application, you can send 'A' when the A key is pressed and 'a' when it is released. Then, do whatever is relevant when 'A' and 'a' arrive. A bit trickier with the number keys, though.