Hi EveryOne.
I built a Weather stations several months ago only in arduino and now I would like to avoid fighting rain to check manually my SD-Card. So I would like to send ... 17 variables with RF-433 but I'm struggling with type 'Float'
Below my wish:
TX:
#include <VirtualWire.h>
void setup() {
Serial.begin(9600);
vw_set_tx_pin(10);
vw_setup(2000);
}
void loop() {
float valeurs[6];
// Lit les broches analogiques
valeurs[0] = analogRead(0)*5/1024;
valeurs[1] = analogRead(1)*5/1024;
valeurs[2] = analogRead(2)*5/1024;
valeurs[3] = analogRead(3)*5/1024;
valeurs[4] = analogRead(4)*5/1024;
valeurs[5] = analogRead(5)*5/1024;
vw_send((byte *) &valeurs, sizeof(valeurs)); // On envoie le message
vw_wait_tx();
delay(1000);
}
RX:
#include <VirtualWire.h>
void setup() {
Serial.begin(9600);
vw_set_rx_pin(2);
vw_setup(2000);
vw_rx_start();
}
void loop() {
float valeurs[6];
byte taille_message = sizeof(valeurs);
vw_wait_rx();
if (vw_get_message((byte *) &valeurs, &taille_message)) {
// On copie le message, qu'il soit corrompu ou non
Serial.print("valeurs[0]=");
Serial.println(valeurs[0]); // Affiche le message
Serial.print("valeurs[1]=");
Serial.println(valeurs[1]);
Serial.print("valeurs[2]=");
Serial.println(valeurs[2]);
Serial.print("valeurs[3]=");
Serial.println(valeurs[3]);
Serial.print("valeurs[4]=");
Serial.println(valeurs[4]);
Serial.print("valeurs[5]=");
Serial.println(valeurs[5]);
}
}
Serial Monitor answer:
valeurs[0]=1.00
valeurs[1]=1.00
valeurs[2]=1.00
valeurs[3]=1.00
valeurs[4]=1.00
valeurs[5]=1.00
You probably understood my goal... I need to receive dot !!!! how transmit and received float variables???