Thermal printer hello world program.
Dependencies: Adafruit_Thermal_Printer mbed
Diff: main.cpp
- Revision:
- 0:6325abe92741
- Child:
- 1:9ccf98857297
diff -r 000000000000 -r 6325abe92741 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Mar 16 01:43:45 2016 +0000
@@ -0,0 +1,68 @@
+#include "mbed.h"
+#include "AdafruitThermal.h"
+
+DigitalOut myled(LED1);
+AdafruitThermal Printer(p9, p10);
+
+int main() {
+ myled = 1;
+ Printer.begin();
+ //Printer.test();
+ // **char *OutputText = "Better Work Dammit\n";
+ // **Printer.print(OutputText);
+
+ char *Testing_Foo = "Hello World!\n";
+ Printer.print(Testing_Foo);
+
+ Printer.justify('C');
+ char *Text_Out11 = "normal\nline\nspacing\n";
+ Printer.print(Text_Out11);
+ Printer.setLineHeight(50);
+ char *Text_Out12 = "Taller\nline\nspacing\n";
+ Printer.print(Text_Out12);
+ Printer.setLineHeight(); // Reset to default
+ Printer.justify('L');
+
+ Printer.setSize('L');
+ char *Text_Out8 = "Large\n";
+ Printer.print(Text_Out8);
+
+ Printer.setSize('M');
+ char *Text_Out9 = "Medium\n";
+ Printer.print(Text_Out9);
+
+ Printer.setSize('S');
+ char *Text_Out10 = "Small\n";
+ Printer.print(Text_Out10);
+
+ Printer.inverseOn();
+ char *Text_Out1 = "Inverse ON\n";
+ Printer.print(Text_Out1);
+ Printer.inverseOff();
+
+ Printer.doubleHeightOn();
+ char *Text_Out2 = "Double Height ON\n";
+ Printer.print(Text_Out2);
+ Printer.doubleHeightOff();
+
+ Printer.justify('R');
+ char *Text_Out3 = "Right Justified\n";
+ Printer.print(Text_Out3);
+
+ Printer.justify('C');
+ char *Text_Out4 = "Center Justified\n";
+ Printer.print(Text_Out4);
+
+ Printer.justify('L');
+ char *Text_Out5 = "Left Justified\n";
+ Printer.print(Text_Out5);
+
+ Printer.boldOn();
+ char *Text_Out6 = "Bold Text\n";
+ Printer.print(Text_Out6);
+ Printer.boldOff();
+
+ myled = 0;
+
+
+}
Adafruit Thermal Printer