# Adafruit Thermal Library Error

**URL:** <https://community.particle.io/t/adafruit-thermal-library-error/30378>\
**Category:** Troubleshooting\
**Created:** [March 10, 2017, 5:33pm UTC](https://community.particle.io/t/adafruit-thermal-library-error/30378 "2017-03-10T17:33:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsmith3](https://avatars.discourse-cdn.com/v4/letter/t/43a26b/32.png) [@tsmith3](https://community.particle.io/u/tsmith3)\
**Post date:** [March 10, 2017, 5:33pm UTC](https://community.particle.io/t/adafruit-thermal-library-error/30378/1 "2017-03-10T17:33:57Z")

</div>

Device: Particle PHOTON

Particle IDE: [build.particle.io](http://build.particle.io)

Attempting to flash the adafruit\_thermal code to the particle photon, which has the library included, returns errors which I’ve included an image of.

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/d/d143d78fca2d533e2abb5842a305c3fa7bacae37.png)

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [March 10, 2017, 5:58pm UTC](https://community.particle.io/t/adafruit-thermal-library-error/30378/2 "2017-03-10T17:58:47Z")

</div>

Without seeing your code, or the full error, I’m afraid there’s not much we can do. Please give us the full steps, and information needed to reproduce the problem.

---

<div class="post-metadata">

**Author:** ![tsmith3](https://avatars.discourse-cdn.com/v4/letter/t/43a26b/32.png) [@tsmith3](https://community.particle.io/u/tsmith3)\
**Post date:** [March 10, 2017, 7:01pm UTC](https://community.particle.io/t/adafruit-thermal-library-error/30378/3 "2017-03-10T19:01:25Z")

</div>

Here is my code :

```cpp
// This #include statement was automatically added by the Particle IDE.
#include <Adafruit_Thermal.h>

Adafruit_Thermal printer;

// String tweet;
char tweet[300];
String oldTweet;

void setup(){
  Serial.begin(9600); // Uses regular serial
  Serial1.begin(19200); //Starts printer serial (RX (green printer wire), TX (yellow printer wire)
  printer.begin(&Serial1); //uses RX and TX
  Particle.subscribe("Treytest", myHandler); //subscribes to the event
  

   printer.println(tweet);
   printer.feed(1);

 }

void loop() {
//empty   
}
    
    
void myHandler(String event, String data) { 
  /* Particle.subscribe handlers are void functions, which means they don't return anything.
  They take two variables-- the name of your event, and any data that goes along with your event.
  In this case, the event will be "buddy_unique_event_name" and the data will be "intact" or "broken"
  Since the input here is a char, we can't do
     data=="intact"
    or
     data=="broken"
  chars just don't play that way. Instead we're going to strcmp(), which compares two chars.
  If they are the same, strcmp will return 0.
  */

  Particle.publish("myhandlerBlue Triggered", "YES"); //Debug - let me know it was triggered

  int result = data.compareTo(oldTweet); //compares to old tweet
  if (result == 0) { 
    Particle.publish("Blue_the_same", "Samesies");
    } else {
    // if the data is something else
      printReal(data); //sends this to the printing function
      oldTweet = String(data); //saves this tweet in oldTweet
      Particle.publish("Blue_the_same", "Not The Same"); //publish a message
  }
}
    
    void printReal(String thing) { //the printer function
        printer.wake();
        printer.boldOn();
        Particle.publish("thing_I_printed_blue", thing);
        printer.println(thing);
        printer.feed(8); //8 lines are enough to clear the opening
        printer.sleep();

    }

void print2(String event, String data) { 
    printer.wake();
    printer.inverseOn();
    printer.println(data);
    printer.inverseOff();
    printer.feed(8);
    printer.sleep();
    Particle.publish("thing_I_printed_blue", data);

}

```

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [March 10, 2017, 8:29pm UTC](https://community.particle.io/t/adafruit-thermal-library-error/30378/4 "2017-03-10T20:29:03Z")

</div>

> [@tsmith3](#):
>
> void myHandler(String event, String data)

`Particle.subscribe()` handlers should look like this tho'  
[https://docs.particle.io/reference/firmware/photon/#particle-subscribe-](https://docs.particle.io/reference/firmware/photon/#particle-subscribe-)

> [@](#):
>
> ```cpp
> void myHandler(const char *event, const char *data)
> 
> ```

And you should _ **not** _ `Particle.publish()` inside the handler _before_ saving away `event` and `data` if you want to use them later on.
