int to char and concatenate char

Hi,

Here is an example code I took and modified for my purpose with an 315MHz transmitter.

Currently, I test it by changing value in variable char *msg = “12321”;

What about if I want to send some sensors value? I put some random variable at the top of the code, volt and temp. How should I convert those to concatenate to form the same variable type as char *msg?

Thanks

#include <VirtualWire.h>

int temp = 25 ;
int volt = 5 ;

void setup()
{

  pinMode(13, OUTPUT);

  vw_set_ptt_inverted(true);  
  vw_setup(2000);            // Bits per sec
  vw_set_tx_pin(3);          //Tx pin
  
}


void loop()
{
  
  delay(100);               //Send a message every half second

  
  char *msg = "12321";
  digitalWrite(13, HIGH ); // Flash a light to show transmitting
  vw_send((byte *)msg, strlen(msg));
  vw_wait_tx(); // Wait until the whole message is gone
  digitalWrite(13, LOW);


}

Hello ^_^

Maybe this will help you? http://arduino.cc/forum/index.php/topic,45187.msg327393.html#msg327393

sprintf is your friend:

char temp[10];
int volts = 231;

sprintf(temp, "%dV", volts);
// temp now contains "231V"