I'm with some friends from my school and we have started to do a project where we send an SMS text message to our Arduino UNO (with GSM module), which then print the text message on a thermal printer(tx, rx). we've got huge problems, and now we can not figure it out anymore.

We started making a machine that will print out a message that is sent from any mobile.So I send an SMS message with my mobile to Arduino connected to a GSM shield (SIM800L). Then sends the Arduino the message to the thermal printer via TX RX, and then the message should be printed out.

We have spent two examples, GSM shield from Arduino itself, and thermal printer example from SparkFun.

These two files work fine separately, but when we try to merge them together, there is a compilation error.

The printer model from Sparkfun.


#include <GSM.h>
#include <SoftwareSerial.h>

#define PINNUMBER ""

SoftwareSerial Thermal(6, 7);
//GSM modul
//SoftwareSerial GSM(4, 5);

int heatTime = 10;
int heatInterval = 2;
char printDensity = 15; 
char printBreakTime = 15;

// initialize the library instances

GSM_SMS sms;

// Array to hold the number a SMS is retreived from
char senderNumber[20];

void setup() {
// Open serial communications and wait for port to open:
  while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
Serial.println("SMS Messages Receiver");

// connection state
boolean notConnected = true;

 Thermal.println("GSM initialized");
 Thermal.println("Waiting for messages");
 Thermal.begin(19200); // to write to our new printer
void initPrinter()
 //Modify the print speed and heat
 Thermal.write(7); //Default 64 dots = 8*('7'+1)
 Thermal.write(heatTime); //Default 80 or 800us
 Thermal.write(heatInterval); //Default 2 or 20us
 //Modify the print density and timeout
 int printSetting = (printDensity<<4) | printBreakTime;
 Thermal.write(printSetting); //Combination of printDensity and     printBreakTime

 void loop() {
 char c;

 // If there are any SMSs available()
  if (sms.available()) {
  Thermal.println("Message received from:");

// Get remote number
sms.remoteNumber(senderNumber, 20);

// An example of message disposal
// Any messages starting with # should be discarded
if (sms.peek() == '#') {
  Thermal.println("Discarded SMS");

// Read message bytes and print them
while (c = sms.read()) {




closed as unclear what you're asking by Michel Keijzers, per1234, jfpoilpret, Code Gorilla, MatsK Oct 30 '17 at 15:20

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • And what actually are these "huge problems" that you have? – Majenko Feb 17 '16 at 13:59
  • 1
    Had a look at that sketch - wont compile, basic stuff. Also, they are sending startup messages to the thermal printer that they should be sending to serial. The usual story - they are hacking up some sample code, and stopping in bewilderment at the very first problem they got. Or simply scrambling the sample code somehow and have no idea about C++ syntax. Guys: get online and google "C++ tutorial". – PaulMurrayCbr Feb 18 '16 at 4:14
  • Your sketch isn't that long. Please include it in the question using the code formatting markdown (four leading spaces). For help see Markdown help. You should be able to do this by selecting the code and pressing Ctrl+K to have your browser do this for you. Also copy and paste the error messages you get. we've got huge problems - we all have problems. Can you be more explicit? Please read How do I ask a good question? – Nick Gammon Feb 18 '16 at 5:30
  • 2
    I'm voting to close this question as off-topic because it's a pure programming question, abandoned, no answers. – user31481 Oct 24 '17 at 14:46