When learning programming, most of the integrated development environment (IDE) you will/might have used will have a console for output and will often be used for debugging for you to keep track of certain variables and to trace-out truth tables or so forth.
In different programming languages, you can print/show your variable's value in the program using print function.
For Example
In C,
int c =25;printf("The value of c-squared is : %d",c*c);//Output will come as "The value of c-squared is : 625"
In Python,
c =25print("The value of c-squared is: ",c*c)# c**2#Output will come as "The value of c-squared is : 625"
In Java,
int c =25;System.out.println("The value of c-squared is "+ c*c);//Output will come as "The value of c-squared is : 625"
In our embedded system, usually we do not have a console to output our variable values to when debugging.
However, with the help of TFT (a small LCD monitor), you will be able to "print out" the values of your variable on a monitor.
You may choose one of the following colours according to your own desire for the TFT. Of course! You may also define new color yourself. The following are RGB565 format
/* * Initialisation Example * * Orientation : Pin_on_top * Background color : black * Text color : white * Special Text color : red * Highlight color : dark green */tft_init(PIN_ON_TOP, BLACK, WHITE, RED, DARK_GREEN);
x: nth horizontal column ranging from 0 to 15 (16 columns)
y: nth vertical row, ranging from 0 to 9 (10 rows)
fmt: string with format templates (same as C's printf)
... : variable to replace the placeholder in the string (same as C's printf)
Example
int a =10;tft_prints(0,0,"The value of a is %d", a);// The value of a is 10tft_prints(0,1,"The |underlined| word");// "underlined" is underlined by a pair of |tft_prints(0,2,"Escape [this `[`]]");// Escape this []// first pair of [] changes text inside to special text color// use ` (backtick) to escape the character right after
while(1){ /*This is referring to your main while(1) loop, Do not create another while(1)*/if(tft_update(50)==0){tft_prints(0,0,"Hello World"); // normaltft_prints(0,1,"[Hello World]"); // This is a special text with differnt colortft_prints(0,2,"{Hello World}"); // This is a higlighted texttft_prints(0,3,"|Hello World|"); // This is a underlined text }}
Remember to include the relevant libraries
#include"xxx.h"
FYI: There are some functions that will be useful.