loop as long as tera term is connecting to my pc Bluetooth and ardouin Bluetooth

I want to connect a Bluetooth pc port to my ardouino connected Bluetooth ... I used Tera Term...
my question how to loop my program as long as tera connecting both ports... eg.

void loop()
{
{bluetooth loop as long it's connected "bluetooth led fixed red light"}

{other code while it's not connected "bluetooth  red led blinking"}

}

I don't think there is any logic in what you are saying. You can have a condition within the loop that responds to an outside signal but that is not the same thing. The LED on the bluetooth has nothing to do with Arduino and I don't think bluetooth can send messages back to Arduino about whether it is connected or not. I guess you could have an optical coupling with the LED but I think you should think about whether you really need to do this.

what I mean... that my program controlling a stepper motor... that stepper motor controlled using sensors read. and that was ok>>>...

the second part that the user will stop the arduino from taking the sensors read. and take a control of the stepper from bluetooth...

when I connected the bluetooth ckt,, and start the connection >>> H letter was for clockwise and L was for counter clockwise using keyboard, but when the delay finish without pressing any key it return directly to read from sensors... what I want is 2 separate worlds .. one for sensors and one for bluetooth ... when the bluetooth is ready to read no sensors will control the stepper .....

any hint how to do it?

fwrlfo:
any hint how to do it?

Not much. I'm afraid............

I think I now understand:

  1. Arduino "normally" uses readings from sensors to control motors - automatically

  2. You want to be able to occasionally take over control via Bluetooth - manually

It seems to me that you are just interrupting the process with bluetooth but you really need a specific manual-start command and a manual-stop command that Arduiono must listen for.

Maybe that is too simple.......