Good afternoon,
Excuse my inexperience in the world of Arduino, I am trying to print directly from Arduino to a thermal printer, this thermal printer uses the STPL language, to get it to print I use the STPL language in the form of strings, I leave you a first example that every time I I press the button prints the number 1:
const int boton1 = 8;
bool valorBoton1, valorBotonAnt1 = false;
int count = 0;
void setup() {
Serial.begin(19200);
pinMode(boton1,INPUT);
}
void loop() {
valorBoton1 = digitalRead(boton1);
if (valorBoton1 && !valorBotonAnt1){
Serial.print("SIZE 72 mm,50 mm\r\n"); /*aqui le decimos a la impresora el tamaño del papel*/
Serial.print("TEXT 5,350,\"3.EFT\",0,7,7,\"1 \"\r\n"); /*aqui imprimo el numero 1*/
Serial.print("PRINT 1,1\r\n"); /*aqui mando la función de imprimir*/
}
valorBotonAnt1 = valorBoton1;
delay (5);
}
What I want is instead of printing only the number 1, I want to print the value of a counter, so that every time I press the button, it prints a different number: 1, 2, 3, 4 .. ....
But I can't integrate a counter in the chain:
Serial.print("TEXT 5,350,\"3.EFT\",0,7,7,\"1 \"\r\n");
I will be very grateful for any help or suggestion.
Thanks in advance.