Background actions with the bluetooth module

Hey guys i just bought the arduino bluetooth module and its working great but i want to make a part of the program runing in the background wihtout interupting the main program but i am ot sure how to do it.
Thank for help!

i want to make a part of the program runing in the background wihtout interupting the main program

What program would that be ?

So the arduino is constantly cheking if there is something sent via bluetooth but i want to make a part of the program run in the background like for exampe flashing a LED

i just bought the arduino bluetooth module and its working great

Post the code that is "working great" and explain when the LED should flash and how often.

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data.

Also have a look at how millis() is used to manage timing without blocking in Several things at a time - 3 flashing LEDs in the example.

...R

The Arduino has a single processor. There is NO background where other stuff can happen. Get over it.

Here is the code. I want the LED to flash when i get lets say LED1 and stop when i get LED0

int forward = 12; int backwards = 11; int LED = 13; char compin; String ser;

void setup() { pinMode(forward,OUTPUT); pinMode(backwards,OUTPUT); pinMode(LED,OUTPUT); }

void loop() { if (Serial.available()) { delay(50);

while(Serial.available()>0) { compin = Serial.read(); if(compin == '+') { while(Serial.available()>0) { compin = Serial.read(); if(compin == '#') break; { ser = ser + compin; } if (ser == "forward1") digitalWrite(forward,HIGH); else if (ser == "forward0") digitalWrite(forward,LOW); if (ser == "backwards1") digitalWrite(backwards,HIGH); else if (ser == "backwards0") digitalWrite(backwards,LOW);

}

}

} ser = ""; } }

Here is the code. I want the LED to flash when i get lets say LED1 and stop when i get LED0

So? What does the code actually do? What input does it get? How does what it does differ from what you want?

Why does the code not compare the input to "LED1" or "LED0"?

Markturki: Here is the code. I want the LED to flash when i get lets say LED1 and stop when i get LED0

Looks like you did not bother to study the links I gave you in Reply #4

Also, it is not a good idea to use the String (capital S) class on an Arduino as it can cause memory corruption in the small memory on an Arduino. Just use cstrings - char arrays terminated with 0.

...R