TM-T82II EPSON Thermal Printer. RS232 Interface Nucleo

Dependencies:   EPSON mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002  
00003  #include "EPSON.h"
00004  
00005   Serial pc(USBTX, USBRX);
00006  EPSON tp(D1,D0); // tx, 9600bps
00007  
00008   int main()
00009   {
00010       tp.initialize();
00011       tp.putLineFeed(2);
00012  
00013       tp.printf("**EPSON  Thermal Printer  **\r\r");
00014  
00015      
00016       
00017      tp.setDoubleSizeWidth();
00018      tp.printf("ABCDEFG 0123456789\r");
00019      tp.clearDoubleSizeWidth();
00020  
00021      tp.setDoubleSizeHeight();
00022      tp.printf("ABCDEFG 0123456789\r");
00023      tp.clearDoubleSizeHeight();
00024      
00025      tp.PrintBarCode("1234567890123456",16);
00026  
00027      pc.printf("EPSON Thermal Printer\n\n");
00028      
00029      
00030      while(1) {
00031          if (pc.readable()) {
00032              int c = pc.getc();
00033              pc.putc(c);
00034              tp.putc(c);
00035          }
00036      }
00037   }