Receive a string

I'm working with arduino nano, a bluetooth module(AT-09) and with BLE scanner(a mobile application) to send data to the arduino and i´m using the registers of the microcontroller to use the serial interrupt. Now i can receive only one character,but i want to receive a whole string, How can I do that? My code:

#include <avr/interrupt.h>
#include <avr/io.h>
char temp;
void setup(){
pinMode(13, OUTPUT); // configuring pin 13 as output
BRR0 = 103; // for configuring baud rate of 9600bps
UCSR0C |= (1 << UCSZ01) | (1 << UCSZ00);
// Use 8-bit character sizes
UCSR0B |= (1 << RXEN0) | (1 << TXEN0) | (1 << RXCIE0);
// Turn on the transmission, reception, and Receive interrupt
sei();// enable global interrupt
}

void loop(){
switch(temp){
case '0':
digitalWrite(13,LOW);
break;

case '1':
digitalWrite(13,HIGH);
break;
}
}

ISR(USART_RX_vect){
temp=UDR0;// read the received data byte in temp
}
I expect to receive a string and then do something

You need to re-structure your code a bit, consider the following pseudo code:

#define BUFF_SIZE 100
char temp;
char buff[BUFF_SIZE] = "";
int current_index;
boolean process_data = false;

void setup()
{
   //...
   
   //process data here
   if (process_data) {
      //processing data
      current_index = 0;
      process_data = false;
   }
}

ISR(USART_RX_vect){  
    temp=UDR0;// read the received data byte in temp
   buff[current_index++] = temp;
   if (temp == END_OF_BUFFER_MARKER) {
      buff[current_index] = '\0'; //terminate if it's a string
      process_data = true;
   }
}

Note: code does not check for overflowing.

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

...R

ibrajim191:
and i´m using the registers of the microcontroller to use the serial interrupt

The normal Serial class is interrupt driven. It uses a 64-byte buffer to store received data and a 64-byte buffer to store data that needs to be transmitted.

No need to re-invent the wheel unless you want to learn from it.

Your code might not work because variables that are shared between the main code and an ISR need to be volatile.

Lastly, please read How to use this forum - please read., specifically point #7 about posting code.