ESP8266 code to use Terminal

Sorry to bother you again.

Call me stupid, but I have been searching for an hour now and cannot find the ESP8266 code to get Terminal working.

Could you point me to where it is described?
Thank you.

Hi, this is an experimental feature that will be properly released and documented with the upcoming library version (3.0), that will include major changes for better performance.

At this moment you can test it using by adding the ThingerConsole header and then creating an instance with it. Here it is an example for the ESP32, but should work with any other device:

#include <ThingerESP32.h>
#include <ThingerConsole.h>

#define USERNAME "your_user_name"
#define DEVICE_ID "your_device_id"
#define DEVICE_CREDENTIAL "your_device_credential"

#define SSID "your_wifi_ssid"
#define SSID_PASSWORD "your_wifi_ssid_password"

ThingerESP32 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
ThingerConsole console(thing);

void setup() {

  thing.add_wifi(SSID, SSID_PASSWORD);

  // resource output example (i.e. reading a sensor value)
  thing["millis"] >> outputValue(millis());

  // more details at http://docs.thinger.io/arduino/
}

void loop() {
  thing.handle();
  delay(1000);
  console.println("Testing console");
}

You can use the console object just as a regular Serial object, but instead of printing to you Serial console, it will be available in the Cloud console. It has some optimizations, like the device will not send any data if you don’t have your cloud console open.

Best!

2 Likes

Wow! Such a cool function!

I must confess that sometimes I use thinger to debug, I mean to change some variables values and see the microcontroller’s response across the serial monitor…

Basically I will do all by the console now… haha

Thank you @alvarolb

…and you must first have dowloaded ThingerConsole.cpp and ThingerConsole.h into your \libraries\thinger.io \src\thinger folder, else your sketch will not compile.

I have replaced in my sketch all occurrences of “Serial” by “ConOut” and begun my sketch with
#define ConOut “console”
//define ConOut “Serial”
so I can switch from Serial console to Thinger console upon commenting out a single code line at the beginning of my sketch.

Thank you for the cool feature!

Moreover, Thinger.io is evolving, and we will be able to handle remote shells from Linux devices :slightly_smiling_face: