Thermal printer hello world program.
Dependencies: Adafruit_Thermal_Printer mbed
main.cpp@1:9ccf98857297, 2016-03-16 (annotated)
- Committer:
- aross34
- Date:
- Wed Mar 16 19:56:34 2016 +0000
- Revision:
- 1:9ccf98857297
- Parent:
- 0:6325abe92741
Trouble with inverse on even strictly following user manual
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aross34 | 0:6325abe92741 | 1 | #include "mbed.h" |
aross34 | 0:6325abe92741 | 2 | #include "AdafruitThermal.h" |
aross34 | 0:6325abe92741 | 3 | |
aross34 | 0:6325abe92741 | 4 | AdafruitThermal Printer(p9, p10); |
aross34 | 0:6325abe92741 | 5 | |
aross34 | 0:6325abe92741 | 6 | int main() { |
aross34 | 0:6325abe92741 | 7 | Printer.begin(); |
aross34 | 1:9ccf98857297 | 8 | Printer.setDefault(); |
aross34 | 0:6325abe92741 | 9 | //Printer.test(); |
aross34 | 1:9ccf98857297 | 10 | //char *OutputText = "Better Work\n"; |
aross34 | 1:9ccf98857297 | 11 | //Printer.print(OutputText); |
aross34 | 1:9ccf98857297 | 12 | |
aross34 | 0:6325abe92741 | 13 | char *Testing_Foo = "Hello World!\n"; |
aross34 | 0:6325abe92741 | 14 | Printer.print(Testing_Foo); |
aross34 | 0:6325abe92741 | 15 | |
aross34 | 0:6325abe92741 | 16 | Printer.justify('C'); |
aross34 | 0:6325abe92741 | 17 | char *Text_Out11 = "normal\nline\nspacing\n"; |
aross34 | 0:6325abe92741 | 18 | Printer.print(Text_Out11); |
aross34 | 0:6325abe92741 | 19 | Printer.setLineHeight(50); |
aross34 | 0:6325abe92741 | 20 | char *Text_Out12 = "Taller\nline\nspacing\n"; |
aross34 | 0:6325abe92741 | 21 | Printer.print(Text_Out12); |
aross34 | 0:6325abe92741 | 22 | Printer.setLineHeight(); // Reset to default |
aross34 | 0:6325abe92741 | 23 | Printer.justify('L'); |
aross34 | 0:6325abe92741 | 24 | |
aross34 | 0:6325abe92741 | 25 | Printer.setSize('L'); |
aross34 | 0:6325abe92741 | 26 | char *Text_Out8 = "Large\n"; |
aross34 | 0:6325abe92741 | 27 | Printer.print(Text_Out8); |
aross34 | 0:6325abe92741 | 28 | |
aross34 | 0:6325abe92741 | 29 | Printer.setSize('M'); |
aross34 | 0:6325abe92741 | 30 | char *Text_Out9 = "Medium\n"; |
aross34 | 0:6325abe92741 | 31 | Printer.print(Text_Out9); |
aross34 | 0:6325abe92741 | 32 | |
aross34 | 0:6325abe92741 | 33 | Printer.setSize('S'); |
aross34 | 0:6325abe92741 | 34 | char *Text_Out10 = "Small\n"; |
aross34 | 0:6325abe92741 | 35 | Printer.print(Text_Out10); |
aross34 | 1:9ccf98857297 | 36 | |
aross34 | 0:6325abe92741 | 37 | Printer.doubleHeightOn(); |
aross34 | 0:6325abe92741 | 38 | char *Text_Out2 = "Double Height ON\n"; |
aross34 | 0:6325abe92741 | 39 | Printer.print(Text_Out2); |
aross34 | 0:6325abe92741 | 40 | Printer.doubleHeightOff(); |
aross34 | 0:6325abe92741 | 41 | |
aross34 | 0:6325abe92741 | 42 | Printer.justify('R'); |
aross34 | 0:6325abe92741 | 43 | char *Text_Out3 = "Right Justified\n"; |
aross34 | 0:6325abe92741 | 44 | Printer.print(Text_Out3); |
aross34 | 0:6325abe92741 | 45 | |
aross34 | 0:6325abe92741 | 46 | Printer.justify('C'); |
aross34 | 0:6325abe92741 | 47 | char *Text_Out4 = "Center Justified\n"; |
aross34 | 0:6325abe92741 | 48 | Printer.print(Text_Out4); |
aross34 | 0:6325abe92741 | 49 | |
aross34 | 0:6325abe92741 | 50 | Printer.justify('L'); |
aross34 | 0:6325abe92741 | 51 | char *Text_Out5 = "Left Justified\n"; |
aross34 | 0:6325abe92741 | 52 | Printer.print(Text_Out5); |
aross34 | 0:6325abe92741 | 53 | |
aross34 | 0:6325abe92741 | 54 | Printer.boldOn(); |
aross34 | 0:6325abe92741 | 55 | char *Text_Out6 = "Bold Text\n"; |
aross34 | 0:6325abe92741 | 56 | Printer.print(Text_Out6); |
aross34 | 0:6325abe92741 | 57 | Printer.boldOff(); |
aross34 | 0:6325abe92741 | 58 | |
aross34 | 1:9ccf98857297 | 59 | /* |
aross34 | 1:9ccf98857297 | 60 | Used to work. Stopped working after several tests for whatever reason |
aross34 | 1:9ccf98857297 | 61 | |
aross34 | 1:9ccf98857297 | 62 | char *Text_Out1 = "Inverse ON\n"; |
aross34 | 1:9ccf98857297 | 63 | Printer.inverseOn(); |
aross34 | 1:9ccf98857297 | 64 | Printer.print(Text_Out1); |
aross34 | 1:9ccf98857297 | 65 | Printer.inverseOff(); |
aross34 | 1:9ccf98857297 | 66 | */ |
aross34 | 0:6325abe92741 | 67 | } |