ESP8266 +Thermal Printer
Posted: Sun Jan 13, 2019 1:02 pm
Hi, this is my first post , hope you could help me
What im trying to do: a ticket printer with a push button that counts +1 each time i print a ticket
why nodemcu 8266 : because i would like to see later how many i printed on my mobile
extra info: this code worked allready fine on arduino, note that im just using nodemcu as an arduino by now
without wifi. i didnt add internet yet, just trying to see if it works the same way
Problem: it prints half of the ticket and stops everything (while in arduino prints each time i press the push button perfect)
why i dont just use arduino: because i would like to add wifi to this project and its easier with nodemcu
Questions: Could it be that ESP8266 prints less information than arduino?
How could i solve this?
code:
Thank you very much
What im trying to do: a ticket printer with a push button that counts +1 each time i print a ticket
why nodemcu 8266 : because i would like to see later how many i printed on my mobile
extra info: this code worked allready fine on arduino, note that im just using nodemcu as an arduino by now
without wifi. i didnt add internet yet, just trying to see if it works the same way
Problem: it prints half of the ticket and stops everything (while in arduino prints each time i press the push button perfect)
why i dont just use arduino: because i would like to add wifi to this project and its easier with nodemcu
Questions: Could it be that ESP8266 prints less information than arduino?
How could i solve this?
code:
Code: Select all
#include "Adafruit_Thermal.h"
#include "SoftwareSerial.h"
int estado = 0;
int ticket = 0;
#define TX_PIN D7 // Arduino transmit YELLOW WIRE labeled RX on printer
#define RX_PIN D8
SoftwareSerial mySerial(RX_PIN, TX_PIN);
Adafruit_Thermal printer(&mySerial);
void setup() {
Serial.begin (9600);
mySerial.begin(19200); // Initialize SoftwareSerial
printer.begin();
pinMode (D4, INPUT_PULLUP);//PULSADOR
//pinMode (13, OUTPUT); // LED
}
void loop() {
Serial.println (estado);
// put your main code here, to run repeatedly:
estado = digitalRead (D4);
if ( estado == LOW) {
ticket=ticket+1;
printer.println("*** welcome ***\n");
printer.println(ticket);
printer.println("*** INCLUYE UNA BEBIDA ***");
printer.print("FECHA:24/01/2018\t");
printer.println("HORA: 00:07");
printer.println("DIA: SABADO");
printer.println(" \n");
}
}
Thank you very much