Sketch: Terminal, takes down Particle Photon

Sketch from here:
http://docs.blynk.cc/#widgets-displays-terminal
takes Particle Photon offline

Used #include <blynk.h> instead of #include <BlynkSimpleEthernet.h>
Could this be the reason for Photon going offline?

Code used:

// This #include statement was automatically added by the Particle IDE.
#include <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
    Sketch generator:           http://examples.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.
 *************************************************************
  You can send/receive any data using WidgetTerminal object.
  App project setup:
    Terminal widget attached to Virtual Pin V1
 *************************************************************/

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

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

// Attach virtual serial terminal to Virtual Pin V1
WidgetTerminal terminal(V3);

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

  // 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.println("You said:");
    terminal.println(param.asStr());
  }

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

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth);
  
  for(int i=1;i<=25;i++)
  {
      terminal.println();
  }
  terminal.flush();

  // 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(F("-------------"));
  terminal.println(F("Type 'Marco' and get a reply, or type"));
  terminal.println(F("anything else and get it printed back."));
  terminal.flush();
}

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

Code resposible for this is:
terminal.write(param.getBuffer(), param.getLength());
Once this code is executed, Particle Photon shows status: Offline, in 10 seconds (Breathing Green).

What could be causing this issue?

This works:

    // Send it back
    terminal.println("You said:");
    terminal.println(param.asStr());
  }```

But what's wrong with the code from docs?

hello!

yes, the blynk.h can be the problem (maybe), but you didn’t mention what hardware are you using…

what i do not understand, why are you doing this:

?

also, did you checked the serial debug, to see if there are any clues there?

He is clearing the terminal so it looks empty. I don’t think terminal supports a clear method yet so this is one way that has been suggested before.

Hardware is the Particle Photon, with firmware 0.6.1
The code in “for” loop is to clear the terminal as @Fettkeewl mentioned… Haven’t done the serial debug yet…

A post was split to a new topic: Particle Photon problem