Thermal Printer Text Density

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
iamtomodea
 
Posts: 17
Joined: Tue Mar 05, 2013 12:53 pm

Re: Thermal Printer Text Density

Post by iamtomodea »

Brilliant.

Thanks again for all the help.

iamtomodea
 
Posts: 17
Joined: Tue Mar 05, 2013 12:53 pm

Re: Thermal Printer Text Density

Post by iamtomodea »

Oh wait. Just one more (one more) thing.

So this is now my code

Code: Select all


#include "SoftwareSerial.h"
#include "Adafruit_Thermal.h"
#include <avr/pgmspace.h>

#define TIMEOUT 2000

String message="";
char character;


int printer1_RX_Pin = 5;  // This is the green wire
int printer1_TX_Pin = 6;  // This is the yellow wire

int printer2_RX_Pin = 7;  // This is the green wire
int printer2_TX_Pin = 8;  // This is the yellow wire

//int printer3_RX_Pin = 9;  // This is the green wire
//int printer3_TX_Pin = 10;  // This is the yellow wire

Adafruit_Thermal printer1(printer1_RX_Pin, printer1_TX_Pin);
Adafruit_Thermal printer2(printer2_RX_Pin, printer2_TX_Pin);
//Adafruit_Thermal printer3(printer3_RX_Pin, printer3_TX_Pin);

Adafruit_Thermal *currentPrinter = &printer1;

void setup(){
  Serial.begin(19200);
  
  printer1.begin(255);
  printer1.setDefault();
  printer1.setTimes(35000,2100);
  printer1.setSize('S');
  printer1.upsideDownOn();
 
  
  printer2.begin(255);
  printer2.setDefault();
  printer2.setTimes(35000,2100);
  printer2.setSize('S');
  printer2.upsideDownOn();

}

void loop() {
  

  if (Serial.available()) {
    uint16_t startTime = millis();
    do{
      character = Serial.read();
      message.concat(character);
    } while (('\n' != character) && ((millis() - startTime) < TIMEOUT));
    
  if (message != "") {
    currentPrinter->println(message);
//    currentPrinter->feed(1);
    
    message="";
    
    if (&printer1 == currentPrinter)
      currentPrinter = &printer2;
//    else if (&printer2 == currentPrinter)
//      currentPrinter = &printer3;
    else
      currentPrinter = &printer1;
    
    }
  }
 
}
    
I have commented out printer three as it isn't connected.

I am getting very strange results, where the printers are feeding one word at a time and then printing diagonally or vertically.
And briefly both at the same time! see attached image.
wonkyprint.JPG
wonkyprint.JPG (361.9 KiB) Viewed 311 times
It seems as if it is jumping out of the first loop and printing the first line after each character.

Also, just for clarity, the code below is what is being used to send strings from processing.

Code: Select all

void speak()
{

 String tweetClean = tweetText.replaceAll("[\\S]+://[\\S]+", " ");
  
 tts.speak(tweetClean);     //this is for a separate tts function so can be ignored here.
 myPort.write(tweetText); 
 delay(10000);
 speak();
 
}

iamtomodea
 
Posts: 17
Joined: Tue Mar 05, 2013 12:53 pm

Re: Thermal Printer Text Density

Post by iamtomodea »

sorry.

the processing code is this

Code: Select all


 void speak()
{

String tweetClean = tweetText.replaceAll("[\\S]+://[\\S]+", " ");
  
tts.speak(tweetClean);     //this is for a separate tts function so can be ignored here.
myPort.write(tweetText); 
myPort.write('\n');
delay(10000);
speak();

}
 

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”