Bonjour,
J'ai le code suivant :
#include <VirtualWire.h>
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("setup");
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(2000); // Bits per sec
}
void loop()
{
const char *msg = "hello";
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
digitalWrite(13, false);
delay(200);
}
J'aimerai, à la place du "hello" mettre une variable (Qui corresponds a la température delivré par mon capteur).
Comment faire ?
Merci d'avance
EDIT :
#include <VirtualWire.h>
float c = 0;
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("setup");
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(2000); // Bits per sec
}
void loop()
{
c++;
sprintf(text,"Temperature : %f", c);
digitalWrite(13, true); // Flash a light to show transmitting
vw_send((uint8_t *)text, strlen(text));
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(13, false);
delay(200);
}
Ca peut marcher comme ça ?