`Hey, I have been struggling to display the data that I have received from another arduino, that houses my sensor, via an nrf and then uploads it via blynk and an eps8266. My problem is trying to display the data on the data while also uploading it to blynk. I suspect the issue is because I am using the esp module as I can display data fine on a simple sketch. Is there a work around or will I have to use a mega?
Thanks for any help
//
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_DEVICE_NAME "Quickstart Template"
#define BLYNK_AUTH_TOKEN ""
#define BLYNK_PRINT Serial
#include <SoftwareSerial.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
char auth[] = BLYNK_AUTH_TOKEN;
RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001";
float diff ;
float sum2;
float x = 99.99; //test value to display first
float sum1;
//char ssid[] = "";
//char pass[] = "";
char ssid[] = "";
char pass[] = "";
SoftwareSerial EspSerial(2, 3); // RX, TX
// Your ESP8266 baud rate:
#define ESP8266_BAUD 9600
ESP8266 wifi(&EspSerial);
//=========================================================================================================================================
BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
{
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V5, millis() / 1000);
radio.startListening(); //This sets the module as receiver
if (radio.available())
{
radio.read(&sum1, sizeof(sum1));
delay(10);
Serial.print(sum1);
radio.read(&sum2, sizeof(sum2));
delay(10);
radio.read(&diff, sizeof(diff));
delay(10);
Blynk.virtualWrite(V8, sum1);
Blynk.virtualWrite(V9, sum2);
// delay(100);
//Serial.print("difference = ");
Blynk.virtualWrite(V7, diff);
//Serial.println(diff);
//delay(100);
}
}
//==============================================================================
//void menu()
//{
// delay(2000);
// Serial.print("t4.txt=\"");
// Serial.print(x);
// Serial.print("\"");
//// Serial.write(0xff);
//// Serial.write(0xff);
//// Serial.write(0xff);
//}
//=========================================================================================================================================
void setup()
{
Serial.begin(9600);
radio.begin(); //Starting the radio communication
radio.openReadingPipe(0, address); //Setting the address at which we will send the data
//radio.openReadingPipe(1, addresses[0]); //Setting the address at which we will receive the data
radio.setPALevel(RF24_PA_MAX); //You can set it as minimum or maximum depending on the distance between the transmitter and receiver.
// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
// Setup a function to be called every second
timer.setInterval(1000L, myTimerEvent);
}
//=========================================================================================================================================
void loop()
{
Blynk.run();
timer.run(); // Initiates BlynkTimer
}