LED blink wont work

hello am using photon and I cant get the LED example to blink my LED in the APP

whats wrong with me code ?

// This #include statement was automatically added by the Particle IDE.
#include "SparkCorePolledTimer/SparkCorePolledTimer.h"

// This #include statement was automatically added by the Particle IDE.
#include "blynk/blynk.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.
 *
 **************************************************************
 * Blynk using a LED widget on your phone!
 *
 * App project setup:
 *   LED widget on V1
 *
 * WARNING :
 * For this example you'll need SimpleTimer library:
 *   https://github.com/jfturcot/SimpleTimer
 * Visit this page for more information:
 *   http://playground.arduino.cc/Code/SimpleTimer
 *
 **************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space


// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "af4a41b131974d91bbaac4d7a3709d4c";

WidgetLED led1(V1);



void setup()
{
  Serial.begin(9600); // See the connection status in Serial Monitor
  Blynk.begin(auth);

  while (Blynk.connect() == false) {
    // Wait until connected
  }

  
}

// V1 LED Widget is blinking
void blinkLedWidget()
{
  if (led1.getValue()) {
    led1.off();
    Serial.println("LED on V1: off");
  } else {
    led1.on();
    Serial.println("LED on V1: on");
  }
}

void loop()
{
  Blynk.run();
  
}

The Timer function is missing, try this code:

// This #include statement was automatically added by the Particle IDE.
#include "SparkCorePolledTimer/SparkCorePolledTimer.h"

// This #include statement was automatically added by the Particle IDE.
#include "blynk/blynk.h"

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SimpleTimer.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "af4a41b131974d91bbaac4d7a3709d4c";

WidgetLED led1(V1);


SimpleTimer timer;

void setup()
{
  Serial.begin(9600); // See the connection status in Serial Monitor
  Blynk.begin(auth);

  while (Blynk.connect() == false) {
    // Wait until connected
  }
 timer.setInterval(1000L, blinkLedWidget);
  
}

// V1 LED Widget is blinking
void blinkLedWidget()
{
  if (led1.getValue()) {
    led1.off();
    Serial.println("LED on V1: off");
  } else {
    led1.on();
    Serial.println("LED on V1: on");
  }
}

void loop()
{
  Blynk.run();
  timer.run();
  
}

Regards!

borther I tried ur code it doesn’t compile
it says

vp.cpp:14:25: fatal error: SimpleTimer.h: No such file or directory
#include “SparkCorePolledTimer/SparkCorePolledTimer.h”
^

the simpletimer.h they use it for Arduino if am not mistaking .
am using particle photon ,that’s what am facing the problem .

You have to add the SparkCorePolledTimer throuth the WebIDE UI to bind it to the library correctly.
Hope that helps.

hello sir .

i do go to build ide then librares then in search i type blynk included to the code then i search for sparkcorepulledtimer and i included to the code .but wen i compile it i wont it gives me this error

In file included from blynk/BlynkParticle.h:16:0,
                 from blynk/BlynkSimpleParticle.h:14,
                 from blynk/blynk.h:2,
                 from vp.cpp:5:
blynk/BlynkApiParticle.h:87:6: warning: #warning "analogInputToDigitalPin not defined => Named analog pins will not work" [-Wcpp]
     #warning "analogInputToDigitalPin not defined => Named analog pins will not work"
      ^
vp.cpp:14:25: fatal error: SimpleTimer.h: No such file or directory
 //#include "SparkCorePolledTimer/SparkCorePolledTimer.h"
                         ^

compilation terminated.
make[1]: *** [../build/target/user/platform-6vp.o] Error 1
make: *** [user] Error 2

how i can include simpletimer ?? plz show me how thank u sir

On Particle you need to use other library for timed events. Sparkpolled timer or smth like that.

  1. Learn how this library it works - they have example sketch
  2. Include it in your sketch with Blynk
  3. Use it for timed events to send data to Blynk.