Hi everyone, I am using an Arduino Uno and connected via USB. The issue is the Arduino is not sending any data over to the LCD Widget on my Blynk I followed a bunch of an examples with no luck. Can anyone spot anything wrong?
#define BLYNK_PRINT SwSerial
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11); // RX, TX
#include <BlynkSimpleStream.h>
#include "VernierLib.h" //include Vernier functions in this sketch
VernierLib Vernier; //create an instance of the VernierLib library
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "HzyWnef-S9N-WqIe9BuFNORKxayZ7BSX";
WidgetLCD lcd(V3);
void setup()
{
// Debug console
SwSerial.begin(9600);
// Blynk will work through Serial
// Do not read or write this serial manually in your sketch
Serial.begin(9600);
Blynk.begin(Serial, auth);
Vernier.autoID(); //identify the sensor being used
while (Blynk.connect() == false) {
// Wait until connected
}
}
void sendsensor(){
float sensorReading; //create global variable to store sensor reading
sensorReading = Vernier.readSensor(); //read one data value
delay(500); //wait half second
if (sensorReading >=10) {
digitalWrite(11, HIGH);
digitalWrite(10, LOW);
Serial.write(0);
lcd.clear(); //Use it to clear the LCD Widget
lcd.print(4, 0, "Salt is low"); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
lcd.print(4, 1, sensorReading);
}
if (sensorReading <5) {
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
Serial.write(1);
lcd.clear(); //Use it to clear the LCD Widget
lcd.print(4, 0, "Salt is high"); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
lcd.print(4, 1, sensorReading);
}
}
void loop()
{
Blynk.run();
sendsensor();
}