Andrew Ross / Mbed 2 deprecated Thermal_HelloWorld

Dependencies:   Adafruit_Thermal_Printer mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "AdafruitThermal.h"
00003 
00004 AdafruitThermal Printer(p9, p10);
00005 
00006 int main() {
00007         Printer.begin();
00008         Printer.setDefault();
00009         //Printer.test();
00010         //char *OutputText = "Better Work\n";
00011         //Printer.print(OutputText);
00012 
00013         char *Testing_Foo = "Hello World!\n";
00014         Printer.print(Testing_Foo);
00015         
00016         Printer.justify('C');
00017         char *Text_Out11 = "normal\nline\nspacing\n";
00018         Printer.print(Text_Out11);
00019         Printer.setLineHeight(50);
00020         char *Text_Out12 = "Taller\nline\nspacing\n";
00021         Printer.print(Text_Out12);
00022         Printer.setLineHeight(); // Reset to default
00023         Printer.justify('L');
00024         
00025         Printer.setSize('L');
00026         char *Text_Out8 = "Large\n";
00027         Printer.print(Text_Out8);
00028         
00029         Printer.setSize('M');
00030         char *Text_Out9 = "Medium\n";
00031         Printer.print(Text_Out9);
00032         
00033         Printer.setSize('S');
00034         char *Text_Out10 = "Small\n";
00035         Printer.print(Text_Out10);
00036 
00037         Printer.doubleHeightOn();
00038         char *Text_Out2 = "Double Height ON\n";
00039         Printer.print(Text_Out2);
00040         Printer.doubleHeightOff();
00041         
00042         Printer.justify('R');
00043         char *Text_Out3 = "Right Justified\n";
00044         Printer.print(Text_Out3);
00045         
00046         Printer.justify('C');
00047         char *Text_Out4 = "Center Justified\n";
00048         Printer.print(Text_Out4);
00049         
00050         Printer.justify('L');
00051         char *Text_Out5 = "Left Justified\n";
00052         Printer.print(Text_Out5);
00053         
00054         Printer.boldOn();
00055         char *Text_Out6 = "Bold Text\n";
00056         Printer.print(Text_Out6);
00057         Printer.boldOff();
00058         
00059         /*
00060         Used to work. Stopped working after several tests for whatever reason
00061                       
00062         char *Text_Out1 = "Inverse ON\n";
00063         Printer.inverseOn();
00064         Printer.print(Text_Out1);
00065         Printer.inverseOff();
00066         */
00067 }