Wiki

Clone wiki

TFTConsole Library / Example Use - Serial Monitor

Use this example to send data to the screen only typing on the Serial monitor input! Remember to change the line feed to new line character! Go to the bottom, then you will see this: 550e5c6bc3832d03884861587206904b.png Click over, and change to new line: 855965f621b826f64f9f70d5c35f403f.png


So the code is:

#!Arduino

#include "TFTConsole.h"

//Console acts for us as a bridge between us and the TFT library.
TFTConsole cout;


void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  cout.init();
}

int serialData = 0;

String finale = "";

bool printing = false;

void loop() {
  // put your main code here, to run repeatedly:
  if (Serial.available() > 0)
  {
    serialData = Serial.read();
    if (serialData == 10){
      printing = true;
    } else {
      finale += (char)serialData;
    }
  }
  if (printing) {
    cout.println(finale);
    finale = "";
    printing = false;
  }
}
Enjoy!

Updated