Controlling Spark core using Blynk App

Hi, i am trying to use Blynk App, so i can turn on and off relays attach to my spark core, but i can’t find any documentation about it and i can’t use the libraries included on the build app. Can anyone help me? Thanks in advance. Javier

It actually works really well on the Spark Core. Just search the Particle Libraries for “blynk”. Documentation is a bit lacking at the moment I’ve seen, but hopefully will improve. Here’s an app I pieced together from a bunch of different documentation sources:

Make sure you change the AUTH token to your own.

/**************************************************************
 * 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.
 *
 **************************************************************
 * Rotate a servo connected to D1 using a slider!
 *
 * App dashboard setup:
 *   Slider widget (0...180) on V0
 *   Switch widget on V10 to turn Particle Cloud on/off
 *   Momentary button widget on D7 to activate blue LED
 *
 **************************************************************/
//#define BLYNK_DEBUG // Uncomment this to see debug prints
#define BLYNK_PRINT Serial
#include "blynk/BlynkSimpleSparkCore.h"

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

Servo servo;

void setup()
{
    Serial.begin(9600); // See the connection status in Serial Monitor
    Blynk.begin(auth);
    servo.attach(D1);
    Spark.disconnect();
}

//  Slider widget (0...180) on V0
BLYNK_WRITE(0)
{
    servo.write(param.asInt());
}

// Switch widget on V10 to turn Particle Cloud on/off
BLYNK_WRITE(10) {
    if (param.asInt()) {
        Spark.connect();
    } else {
        Spark.disconnect();
    }
}

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

@javiercviegas, I am using the latest version also and works well. Check out the Blynk community forum for details on how to use Blynk. Once you get the concept, it is very easy to use. :smile:

It helped me to poke around the example code in the Blynk Github repo. I was able to figure out the things I needed. It was pretty easy to hook up a slider control on my phone and make my Spark Core rotate through some colors on a string of WS2812 LEDs.

I was pleasantly surprised at how responsive it is!

I am pleased so far as well. I have an I2C sensor reporting data back and it was super easy to do. There are still some rough edges and lots to do but I believe that Blynk is really committed to its continued development. I can’t wait till they add the Photon to the arsenal. :smile:

it does look very interesting, they also have a local server, so not tied to their cloud service.

@peekay123 - surely photon already works - isn’t core/photon now a single platform (other than pinout?)

@sej7278, the firmware on the Photon is still being refined. It should not be far off but it needs to be tested :smile:

Glad you guys like Blynk.

We are working on the documentation for Blynk. Just have no time to do everything we want. Right now, the best way to explore possibilities is to check example sketches in the library. Not everything might work for Particle, but we try to keep everything in sync.

When including Blynk library into your projects, please check the version and always try to use the latest one:

If you have any questions, please ask them on our forum. Please also share your projects made with Particle and Blynk.

Thanks!

1 Like

We’ve added Photon support to Blynk. You are very welcome to test it out!

1 Like

I’m getting a library error for “blynk/BlynkSimpleSparkCore.h” not found even though I selected the Blynk library to be included in my app. Any idea what’s going?

Did you “include” the library in your Particle app?
Please also check the version:

Escko,

Blynk library is 0.3.1. Here is the error I’m getting.

Hi,

I got it working after deleting the library and reimporting it.

-flann321

1 Like