Photon and blynk connection?

I used blynk with my particle photon.
First, I accidentally chose my hardware as “particle core” but it works. (I made a lot of project)
Then I use particle official android app to make some test about my project.
When I returned to blynk app I realized and changed hardware as “particle photon” but it didn’t work i also try “core” but it didn’t work either.

I tried different codes and tokens. Any help ?

One of my code is here:

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

char auth[] = "my_auth_token";

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth);
  pinMode(D7, OUTPUT);
}

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

Did you flash your photon with Tinker? Or what do you mean by “test”

yes i used tinker on my phone

When you flash Tinker, your previous code is erased. You need to reflash with Blynk code

I know, I flashed ( after tinker) different codes and i tried different tokens but it didn’t work.

When i run project on blynk app. Blynk app shows me an error “your particle photon was disconnected” during reflashing my blynk code to photon. (because photon restart itself when flashing).

So i think there is no problem connection between blynk and photon but somehow widgets didn’t work (i tried different pins and widgets too).

Could you try to create a new project wit new token and try Blynk example for Particle?

thanks

I tried it also. I used a lot of different tokens and projects, none of them work.

What do you mean “Blynk example” ?

when i flashed “01-particle.ino” file which is in blynk library, serial monitor shows me this :

[12700] Blynk v0.3.2
[13702] Connecting to cloud.blynk.cc:8442
[18706] Connecting to cloud.blynk.cc:8442
[19842] Ready (ping: 162ms).

I don’t know which widgets used for this code, i only flash and open serial monitor.

Just double-checked. Everything works for me.
Do you use iPhone or Adnroid?

I use android phone.

Are you sure you use the latest app version?

Yes, I use latest version.

Since everything is working for everyone else, I can only recommend deleting and reinstalling the app, creating a new Project and generate a new token.

Also, post your code here. Maybe the problem is there.

Reinstalling didn’t work.

My code and project :

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

char auth[] = "my_token";

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth);
  
  pinMode(D7, OUTPUT);
  pinMode(A5, OUTPUT);
}

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

Your code doesn’t look like an example sketch we provide…

/**************************************************************
 * 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 groups:              http://www.fb.com/blynkapp
 *                               http://twitter.com/blynk_app
 *
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 *
 **************************************************************/
//#define BLYNK_DEBUG // Uncomment this to see debug prints
#define BLYNK_PRINT Serial
#include "blynk/BlynkSimpleParticle.h"

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

// Attach a Button widget (mode: Switch) to the Digital pin 7 - and control the built-in blue led.
// Attach a Graph widget to Analog pin 1
// Attach a Gauge widget to Analog pin 2
// No coding is required for direct pin operations!

void setup()
{
    Serial.begin(9600);
    delay(5000); // Allow board to settle
    Blynk.begin(auth);
}

// Attach a Button widget (mode: Push) to the Virtual pin 1 - and send sweet tweets!
BLYNK_WRITE(V1) {
    if (param.asInt() == 1) { // On button down...
        // Tweeting!
        // Note:
        //   We allow 1 tweet per minute for now.
        //   Twitter doesn't allow identical subsequent messages.
        Blynk.tweet("My Particle project is tweeting using @blynk_app and it’s awesome!\n @Particle #IoT #blynk");
        
        // Pushing notification to the app!
        // Note:
        //   We allow 1 notification per minute for now.
        Blynk.notify("You pressed the button and I know it ;)");
    }
}

// Attach a Slider widget to the Virtual pin 2 - and control the built-in RGB led!
BLYNK_WRITE(V2) {
    if (param.asInt() > 0) {
        RGB.control(true);
        
        byte rgb[3];
        HsvToRgb(param.asDouble()/255, 1, 1, rgb);
        RGB.color(rgb[0], rgb[1], rgb[2]);
    } else {
        RGB.control(false);
    }
}

void loop()
{
    Blynk.run();
    
    if (ModeBtnPressed()) {
        Blynk.notify("Mode button was pressed");
    }
}

// *** Utility functions

bool ModeBtnPressed() {
    if(millis() > 5000) {
        if(BUTTON_GetDebouncedTime(BUTTON1) >= 50) {
            BUTTON_ResetDebouncedState(BUTTON1);
            return 1;
        }
    }
    return 0;
}

void HsvToRgb(double h, double s, double v, byte rgb[]) {
    double r, g, b;

    int i = int(h * 6);
    double f = h * 6 - i;
    double p = v * (1 - s);
    double q = v * (1 - f * s);
    double t = v * (1 - (1 - f) * s);

    switch(i % 6){
        case 0: r = v, g = t, b = p; break;
        case 1: r = q, g = v, b = p; break;
        case 2: r = p, g = v, b = t; break;
        case 3: r = p, g = q, b = v; break;
        case 4: r = t, g = p, b = v; break;
        case 5: r = v, g = p, b = q; break;
    }

    rgb[0] = r * 255;
    rgb[1] = g * 255;
    rgb[2] = b * 255;
}


Especially this line.

#include "blynk/BlynkSimpleParticle.h"

Make sure you use the latest Blynk library

I used latest Blynk library.

I replace

#include "blynk/blynk.h" 

with

#include "blynk/BlynkSimpleParticle.h"

but it didn’t work.

I saw it (“blynk/blynk.h”) in this tutorial (i know he used core not photon), but it works for me at first.
In addition when i try to include blynk library to my code in particle ide it include like first one (“blynk/blynk.h”)

To figure out problem; I create two code, two project and two token. One of this used photon as hardware and the other one is core (which works for me at first).
None of them works.

To summarize, I try all different combinations but i can’t figure out why it doesn’t work.

I would still ask you to follow every steps listed here:
http://docs.blynk.cc/#hardware-set-ups-particle-formely-spark

In docs says “SparkCore.ino example” I think it means “01_Particle.ino” because I couldn’t find “SparkCore”.

I follow all those steps and I just add my token to code (I didn’t change anything, just add token). I used the project which i take from QR code in docs. Although, it doesn’t work.

By the way, thanks for patience and help, even though we couldn’t find any solution.

I’ve sent you a personal message. Please reply

Hi, I might need to post on different thread, but it is happen to me this couple days where my Android phone: Galaxy S4, could not be used to control Blynk (various code running on ESP8266 and Particle photon). The Apps seems to be running when I press play, and any data sent from hardware was displayed on the phone, but I could not activate buttons, sliders, etc. Also I could not edit on any widgets when on stop mode. I have another phone: galaxy note 3 and Nexus tablet, all working fine. So it could be something happen recently on some type of phone? I did uninstall the Apps on my Galaxy S4 and re-install it again, but the result was the same.

Just to update, what I did is to move the phone to different WiFi network, and it works (monitor as well as control). Then once it work, there was not problem when coming back to the same wifi network. So what ever the problem was, it is something to do with the WiFi router, not with the Apps.