Blynk Update! You can now share your Blynk interface

@Escko Thanks! I had to modify the code to get it working but it does indeed work :smiley:

It’s really awesome to be able to remotely see the serial print data on my phone from anywhere that I have a internet connection.

Here is the modified code to get it to run on the Photon.

Is there any way to resize the terminal widget size so I can see more of the incoming text? I can’t seem to change the size. The only thing I can do is choose to show or not show the input box for the terminal where no window gives you a little more room form incoming text.

I had to add this line of code to keep the Photon connected to the cloud because it was disconnecting after about 30 seconds because of the blocking “while loop in setup”. Adding “SYSTEM_THREAD(ENABLED)” fixed that.

/**************************************************************
 * 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[] = "Enter Token Here";

// 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!// Attach virtual serial terminal to Virtual Pin V1
WidgetTerminal terminal(V1);

SYSTEM_THREAD(ENABLED)


void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth);

  while (Blynk.connect() == false) {
    // Wait until connected
  }
  // This will print Blynk Software version to the Terminal Widget when
  // your hardware gets connected to Blynk Server
  terminal.println(F("Blynk v" BLYNK_VERSION ": Device started"));
  terminal.println("-------------");
  terminal.println("Type 'Marco' and get a reply, or type");
  terminal.println("anything else and get it printed back.");
  terminal.flush();
}

// You can send commands from Terminal to your hardware. Just use
// the same Virtual Pin as your Terminal Widget 
BLYNK_WRITE(V1) 
{

  // if you type "Marco" into Terminal Widget - it will respond: "Polo:"
  if (String("Marco") == param.asStr()) {
      terminal.println("You said: 'Marco'") ;
      terminal.println("I said: 'Polo'") ;
  } else {

  // Send it back
  terminal.print("You said:");
  terminal.write(param.getBuffer(), param.getLength());
  terminal.println();
  }

  // Ensure everything is sent
  terminal.flush();
}

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