Connecting LCD Widget to Physical Photon LCD

Hey Blynk community!

I am creating an IOT design project which will include an LCD 16x2 screen display connected to the Blynk App (on IOS) I am trying to connect the LCD Widget to a Particle Photon board using the ‘Particle Web IDE Builder’ so that both will display the same text, but I am having difficulty displaying what’s in the app onto the physical display! Can anyone help? I am pretty new to this! My code is below:

 #include <blynk.h>
    #define BLYNK_PRINT Serial
    #include <LiquidCrystal_I2C.h>

    #include "application.h"

    #include "LiquidCrystal/LiquidCrystal.h"

    char auth[] = "";

    WidgetLCD lcd(V1);

    void setup()
    {
      Serial.begin(9600);
      Blynk.begin(auth);
      LiquidCrystal lcd(D0, D1, D2, D3, D4, D5);
    }

    int buttonState;
    BLYNK_WRITE(V2)
    {
      buttonState = param.asInt();
    }

    void loop()
    {
          Blynk.run();
        if (buttonState == LOW) {
             lcd.print(0, 0, "Disconnect Says"); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
             lcd.print(0, 1, "Read          ");
        } else if (buttonState == HIGH) {
             lcd.print(0, 0, "Disconnect Says"); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
             lcd.print(0, 1, "Draw something");  
        }
    }

You can’t declare BOTH of the displays the same name… lcd :stuck_out_tongue_winking_eye:

2 Likes

Hey Gunner, thanks for quick the response - I have declared the LCDs with 2 different names which works better but is there any way to target both LCDs simultaneously to print the same text? I can now print 2 different texts on the LCD and Blynk widget but not the same. :frowning:

They are two different devices, so need two separate commands to write data to them.
You can place these commands one after another if you wish, like this:

 lcd1.print(0, 0, "Disconnect Says"); // physical LCD
 lcd2.print(0, 0, "Disconnect Says"); // LCD widget

Pete.

1 Like

@Gunner Thanks both for the help! The LCD display and Blynk Widget are now printing the same text and changing upon button click!

Ben

1 Like