Hola, estoy enviando datos por bluetooth, pero quisiera mostrarlos en una LCD. Estoy enviando los datos desde un LM35 y usando la configuración de maestro en el modulo HC-06.Lo unico que consigo es hacer que se muestren en el monitor serial del modulo esclavo.
CODIGO MAESTRO
#include <LiquidCrystal.h>
//MAESTRO ARDUINO UNO
//ROLE=1 MAESTRO
#include <SoftwareSerial.h> // Incluimos la librerÃa SoftwareSerial
SoftwareSerial BT(10,11); // Definimos los pines RX y TX del Arduino conectados al Bluetooth
float temp;
int OutLM35=0;
LiquidCrystal lcd(7, 6, 5, 4, 3, 2); // crea objeto, PINES conectados RS, E, D4, D5, D6, D7
void setup()
{
BT.begin(9600); // Inicializamos el puerto serie BT que hemos creado
Serial.begin(9600); // Inicializamos el puerto serie
lcd.begin(16,2);
}
void loop()
{
if(BT.available()) // Si llega un dato por el puerto BT se envía al monitor serial
{
Serial.write(BT.read());
}
if(Serial.available()) // Si llega un dato por el monitor serial se envía al puerto BT
{
BT.write(Serial.read());
}
while (Serial.available())
{
OutLM35=analogRead(A0);
temp=((OutLM35*5000.0)/1023)/10;
BT.print("Temp: "); // escribe Temp:
BT.print(temp);
BT.println(" C"); // imprime Centigrados
delay(1000);
lcd.setCursor(0,0);
lcd.print("Temp: "); // escribe Temp:
lcd.print(temp);
lcd.print(" C"); // imprime Centigrados
delay(1000);
}
}
CODIGO ESCLAVO
#include <LiquidCrystal.h>
//ESCLAVO ARDUINO NANO
//ROLE=0 ESCLAVO
#include <SoftwareSerial.h> // Incluimos la librería SoftwareSerial
SoftwareSerial BT(10,11); // Definimos los pines RX y TX del Arduino conectados al Bluetooth
float temp;
int OutLM35=0;
LiquidCrystal lcd(7, 6, 5, 4, 3, 2); // crea objeto, PINES conectados RS, E, D4, D5, D6, D7
void setup()
{
BT.begin(9600); // Inicializamos el puerto serie BT que hemos creado
Serial.begin(9600); // Inicializamos el puerto serie
lcd.begin(16,2);
}
void loop()
{
if(BT.available()) // Si llega un dato por el puerto BT se envía al monitor serial
{
Serial.write(BT.read());
}
if(Serial.available()) // Si llega un dato por el monitor serial se envía al puerto BT
{
BT.write(Serial.read());
}
}