Hello to everyone!
My name is Nick and I’m new to the forum.
Can someone help with a simple example code of how to send an update(“LED On”) to LCD widget if lets say onboard LED(D7) is HIGH on a Particle Photon.
Thanks in advance.
Welcome Nick.
I don’t the Photon is any different in this aspect.
There are 3 places where the required sketches are given to you (for FREE).
Could you perhaps name the 3 locations?
Would you like to name them?
GitHub
Arduino IDE
Here
Used alongside a “little” known internet tool called goOgLe.
Oh and a fourth for good measures, the i against each widget in the app.
Thank you Costa for the smart remarks.
Now…can you actually find from the 4 suggested places exactly what I asked for?
If you can’t help, just let me know and I will obviously not ask a simple question like this again in this forum.
Nick you are going to struggle with Blynk if you are not able to find what you need in the 4 places you should be looking.
Sorry I couldn’t resolve your problem.
Thank you Costa for your assistance.
Now I will wait for someone else to assist me with my question.
don’t worry about @Costas,
you could try to find the info here: link to some info
let us know how you go once you try it out…
Thank you Dave for the link, much appreciated.
I had already searched and went through those discussions to no avail.
Post your sketch and we should be able to suggest a fix.
Here is an example for anyone interested.
Thanks Dan… few alterations and got it working.
// This #include statement was automatically added by the Particle IDE.
#include "blynk/blynk.h"
// This #include statement was automatically added by the Particle IDE.
#include "SparkCorePolledTimer/SparkCorePolledTimer.h"
/**************************************************************
* Blynk is a platform with iOS and Android apps to control
* Arduino, Raspberry Pi and the likes over the Internet.
* You can easily build graphic interfaces for all your
* projects by simply dragging and dropping widgets.
*
* Downloads, docs, tutorials: http://www.blynk.cc
* Blynk community: http://community.blynk.cc
* Social networks: http://www.fb.com/blynkapp
* http://twitter.com/blynk_app
*
* Blynk library is licensed under MIT license
* This example code is in public domain.
*
**************************************************************
* Output any data on LCD widget!
*
* App project setup:
* LCD widget, switch to ADVANCED mode, select pin V0
* Button Widget, select Pin D7
*
**************************************************************/
#define BLYNK_PRINT Serial
#define Red D7
char auth[] = "15d8784f032a451eb25b025741c87dc4";
WidgetLCD lcd(V0); //Virtual Pin V0 in Blynk LCD Widget - Switch to Advanced
int OldState;
void setup()
{
Serial.begin(115200);
pinMode(7,OUTPUT); // Onboard LED D7 on PHOTON
Blynk.begin(auth);
Serial.print("Connecting");
while (Blynk.connect() == false) {
// Wait until connected
Serial.print(".");
delay(100);
}
lcd.clear();
OldState=false;
}
void loop()
{
Blynk.run();
if( digitalRead(7) != OldState ) // Stop hammering the server every loop
{
OldState=digitalRead(7);
lcd.clear();
if( digitalRead(7) == 0)
{
lcd.print(4, 0, "LED Light");
lcd.print(7, 1, "OFF");
}
else
{
lcd.print(4, 0, "LED Light");
lcd.print(7, 1, "ON");
}
}
}
@eLumaLite if that is your project finished then the sketch is fine.
Any project more complex than the few lines you have in your sketch will surely fail because you are not using the library you have at line 6.
#include "SparkCorePolledTimer/SparkCorePolledTimer.h"
is the equivalent of the hundreds of references to SimpleTimer on this site and in the basic sketches provided by Blynk.
I am not going into further detail here as it has been covered many times before but if you want to Blynk study SimpleTimer and the Photon variant SparkCorePolledTimer.