Hi there. below are my code for my nodemcu. somehow when compiling it returns "conversion from BlynkTimer:Handle 'float' is ambigous" something like that. But when i tried to compile it with my friends pc somehow it succesfully compiled. what seems to be the problem? is it my libraries?
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SoftwareSerial.h>
//#include <SimpleTimer.h>
//#include <Timer.h> //'timer' does not name a type
//#define Timer t
#define SimpleTimer_H
char auth[] = "ieMqDiAtG4zFVe3xoPP4g2zIb0xasdasdasdJ";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "asdasdasd";
char pass[] = "qawasdasd";
BlynkTimer t;
float Timer1 = 0;
String myString; // complete message from arduino, which consistors of snesors data
char cdata; // received charactors
float FLOW; // sensors
// This function sends Arduino's up time every second to Virtual Pin (1).
// 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(V0, millis() / 1000);
}
void setup()
{
//Timer= timer;
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
Timer1 = t.setInterval(1000L,flow);
}
void loop() /////////////////////////////////////////////////////////////
{
//Timer = timer;
if (Serial.available() == 0 )
{
Blynk.run();
t.run(); // Initiates BlynkTimer
}
if (Serial.available() > 0 )
{
cdata = Serial.read();
myString = myString+ cdata;
// Serial.print(rdata);
if( cdata == '\n')
{
// Serial.println(myString);
// Serial.println("fahad");
// new code
String l = getValue(myString, ',', 0);
FLOW = l.toFloat();
myString = "";
// end new code
}
}
}
void flow()
{
float sdata1 = FLOW;
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V0, sdata1);
}
String getValue(String cdata, char separator, int index)
{
int found = 0;
int strIndex[] = { 0, -1 };
int maxIndex = cdata.length() - 1;
for (int i = 0; i <= maxIndex && found <= index; i++) {
if (cdata.charAt(i) == separator || i == maxIndex) {
found++;
strIndex[0] = strIndex[1] + 1;
strIndex[1] = (i == maxIndex) ? i+1 : i;
}
}
return found > index ? cdata.substring(strIndex[0], strIndex[1]) : "";
}