433MHZ and ESP8266 and Nextion
Posted: Wed Apr 05, 2017 11:57 pm
I want sending temperature from Arduino from TX 433Mhz module and Dallas or DHT22 to ESP8266 devkit from RX 433mhz modul and showing temp on Nextion screen.
But OneWire.h library no working together . Or must I use RCSwitch.h library?
Thanks.
But OneWire.h library no working together . Or must I use RCSwitch.h library?
Thanks.
Code: Select all
RX
#include <VirtualWire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
int i;
void setup(){
Serial.begin(9600);
vw_setup(2000);
vw_rx_start();
vw_set_rx_pin(11);
}
void loop(){
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if( vw_get_message(buf, &buflen) )
for (i = 0; i < buflen; i++)
Serial.write(buf[i]);
}
Code: Select all
TX
#include <VirtualWire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 7
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
char msg[6];
void setup() {
sensors.begin();
vw_setup(2000);
vw_set_tx_pin(3);
}
void loop() {
sensors.requestTemperatures();
float temperature = sensors.getTempCByIndex(0);
dtostrf(temperature, 6, 2, msg);
vw_send((uint8_t *)msg, strlen(msg));
vw_wait_tx();
delay(200);
}