Help with array : How to compare

Hi Paul, yestarday evening i was very happy because I've follow your indication with success. to be hones I don't know why I've tried to run the same program this morning and won't work ... :frowning: again ... what I've did is wait until is pressed, when is pressed send out data, wait until have an answer and then blink each n times based on the keypressed ... from your stand point is there error in my code ?
Trasmitter:

#include <VirtualWire.h>
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
const int ledPin =  13;  
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
 {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {8, 7, 6, 5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {4, 3, 2}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 


void setup()
{
    Serial.begin(9600);	// Debugging only
    pinMode(ledPin, OUTPUT);
    Serial.println("setup");
    // Initialise the IO and ISR
    vw_setup(1200);	 // Bits per sec
    vw_rx_start();       // Start the receiver PLL running
}

void loop()
{
   //delay(80);
   char customKey = customKeypad.getKey();
   char msg[1];
   msg[0] = customKey;
 if (customKeypad.getState() == PRESSED)
   {  
     if (customKey != NO_KEY)
      {
       Serial.println(customKey);
       // digitalWrite(13, true); // Flash a light to show transmitting
       vw_send((uint8_t *)msg, strlen(msg));
       vw_wait_tx(); // Wait until the whole message is gone
       Serial.println("Sent");
       // digitalWrite(13, false);
       customKey = NO_KEY;
       uint8_t buf[VW_MAX_MESSAGE_LEN];
       uint8_t buflen = VW_MAX_MESSAGE_LEN;
       // Wait at most 200ms for a reply
       vw_wait_rx();
       //if (vw_wait_rx_max(265))
       //{
       char testo[buflen];
       char testo1;
         if (vw_get_message(buf, &buflen)) // Non-blocking
	  {
	    int i;
	    // Message with a good checksum received, dump it.
	    Serial.print("Got: ");
	    //for (i = 0; i < buflen; i++)
	    //{
                // testo[i]= buf[i], char();
		// Serial.println((char)buf[i]);
            testo[0]= buf[0], char();
            Serial.println(testo[0]);
            Serial.print(" ");
	    //}
            
           // Serial.println(testo[0]);
	    Serial.println("");
            //Serial.println(testo);
            //Serial.println("");
            switch (testo[0]) 
             {
              case '1':
                Serial.println("Im number 1");
                digitalWrite(13, HIGH);
                delay(250);
                digitalWrite(13, LOW);
                break;
              case '2':
                Serial.println("Im number 2");
                volatile int b;
                volatile int c;
                b = 1;
                c = 3;
                asled(b,c);  
                break;
              case '3':
                Serial.println("Im number 3");
                volatile int d;
                volatile int e;
                d = 1;
                e = 4;
                asled(d,e);     
                break;
              case '4':
                volatile int f;
                volatile int g;
                f = 1;
                g = 5;
                asled(f,g);  
                break;
              case '5':
                volatile int h;
                volatile int i;
                h = 1;
                i = 6;
                asled(h,i); 
                break;
              case '6':
                volatile int l;
                volatile int m;
                l = 1;
                m = 7;
                asled(l,m); 
                break;
              case '7':
                volatile int n;
                volatile int o;
                n = 1;
                o = 8;
                asled(n,o); 
                break;
              case '8':
                volatile int p;
                volatile int q;
                p = 1;
                q = 9;
                asled(p,q); 
                break;
              case '9':
                volatile int r;
                volatile int s;
                r = 1;
                s = 10;
                asled(r,s); 
                break;
              case '0':
                Serial.println("Im number 0");
                break;
              case '*':
                Serial.println("Im number *");
                break;
              case '#':
                Serial.println("Im number #");
                break;  
            
               } 
	}
    //}
    else
	Serial.println("Timout");
     }  
   } 	
}

void asled(int a,int cont)
{
  for (a = 1; a < cont; a++)
    {
     digitalWrite(13, HIGH);
     delay(250);
     digitalWrite(13, LOW);
     delay(250);
    }
  
}

Receiver:

#include <VirtualWire.h>

void setup()
{
    Serial.begin(9600);	// Debugging only
    Serial.println("setup");
    vw_setup(1200);	 // Bits per sec
    vw_rx_start();       // Start the receiver PLL running
}

void loop()
{
    //const char *msg = "hello";
    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;
    // Wait for a message
    vw_wait_rx();
    if (vw_get_message(buf, &buflen)) // Non-blocking
    {
	int i;
        char testo[buflen];
        char msg[1];
	Serial.print("Got: ");
	//for (i = 0; i < buflen; i++)
	// {
	    // Received the string and assign to another variable 
            // testo[i] = buf[i], char();
            testo[0]= buf[0], char();
	    Serial.print(" ");
	// }
            // check the string and do something if are equal ...
        Serial.println(testo[0]);
	// Serial.println("");
        // Serial.println(testo);  
	// Serial.println("");
        msg[0] = testo[0];
	// Send a reply
	vw_send((uint8_t *)msg, strlen(msg));
        vw_wait_tx(); // Wait until the whole message is gone
        Serial.println("Sent");
        // digitalWrite(13, false);
    }
}

Sure I've seen that was working yestarday ...

thanks for yout advise,

Andrea