Hola. Ante todo un saludo a las personas que ayudáis a comprender el mundillo de arduino. Me ha entrado con arduino el tema de comunicaciones básicas y he empezado por RF, seguiré por wi-fi, ethernet.
El problema es que en un arduino UNO emisor mando 3 variables float que son set point (valor consigna), temperatura medida sensor, y humedad, lo consigo transmitir por RF y lo consigo almacenar en el receptor (MEGA) en una matriz char en la que por cada indice o posición tiene un carácter numérico. Los valores son del tipo 25.18, pudiendo tener tres números enteros.
Cuando imprimo por puerto serial todo lo recibido es por ejemp. 95.43,23.14,35.17.
Lo que necesito es sacar las tres variable y convertirlas en float.
Codigo del receptor:
#include <VirtualWire.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6 , 7, 3, POSITIVE);
// Sensors y variables float
float SensorData1; // Variable tª SP
float SensorData2; // Variable temperatura
float SensorData3; // Variable humedad
char StringReceived[22]; //inicial 22
void setup() {
// VirtualWire
// Initialise the IO and ISR
// Required for DR3100
// Bits per sec
vw_setup(2000);
vw_set_rx_pin(9);
// Start the receiver PLL running
vw_rx_start();
// PANTALLA Y TRANSMISION
Serial.begin (9600);
lcd.backlight();
lcd.clear();
} // END void setup
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
/
if (vw_get_message((uint8_t *)buf,&buflen))
{
int i;
for (i = 0; i < buflen; i++)
{
StringReceived[i] = char(buf[i]);
Serial.print(StringReceived[i]);
}