AS-289R2 library test code for mbed OS 5
Fork of mbed-os-example-mbed5-blinky by
Diff: main.cpp
- Revision:
- 27:9547c5d41dde
- Parent:
- 25:9fe4286c3515
- Child:
- 29:c0d23edea193
--- a/main.cpp Fri Feb 03 10:08:52 2017 +0000 +++ b/main.cpp Mon Jan 20 00:51:06 2020 +0900 @@ -1,5 +1,5 @@ /* AS289R2 library test program for mbed OS - * Copyright (c) 2016, Toyomasa Watarai + * Copyright (c) 2016-2020, Toyomasa Watarai * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,9 +24,9 @@ #include "AS289R2.h" DigitalOut led1(LED1); -AS289R2 tp(D1); +AS289R2 tp(AS289R2_TX, AS289R2_RX); -const char url[] = "https://developer.mbed.org/components/AS-289R2-Thermal-Printer-Shield/"; +const char url[] = "https://os.mbed.com/components/AS-289R2-Thermal-Printer-Shield/"; void AS289R2_demo() { @@ -76,7 +76,7 @@ tp.printBarCode(AS289R2::BCODE_UPC_A, "01234567890"); tp.putLineFeed(4); - +#if 0 // LineSpaceing tp.printf("ABCDE\r"); tp.printf("ABCDE\r"); @@ -179,16 +179,15 @@ tp.defaultBarCodeBarSize(); tp.printBarCode(AS289R2::BCODE_JAN13, "123456789012"); tp.putLineFeed(4); +#endif } -// main() runs in its own thread in the OS -// (note the calls to wait below for delays) int main() { AS289R2_demo(); while (true) { led1 = !led1; - wait(0.5); + thread_sleep_for(500); } }