Error message "Stray \'342' " HELP!!!!

Why?
What did I do wrong?
Help me :slight_smile:

#include "Adafruit_Thermal.h"
#include <Wire.h>
#include "SoftwareSerial.h"



int randomNum1 = random(0, 4);
int randomNum2 = random(0, 82);
#define TX_PIN 6 // Arduino transmit  YELLOW WIRE  labeled RX on printer
#define RX_PIN 5 // Arduino receive   GREEN WIRE   labeled TX on printer

SoftwareSerial mySerial(RX_PIN , TX_PIN ); // Declare SoftwareSerial obj first
Adafruit_Thermal printer(&mySerial);     // Pass addr to printer constructor

byte customChar[8] = {
  0b01110,
  0b10001,
  0b11111,
  0b11001,
  0b11001,
  0b11111,
  0b10001,
  0b01110
};





String msgs1[]= {"1 beat of","2 beats of","3 beats of","1 measure of","2 measures of"};
String msgs2[]= {"Cmaj7","C#maj7","Dmaj7","D#maj7","Emaj7","Fmaj7","F#maj7","Gmaj7","G#maj7","Amaj7","A#maj7","Bmaj7","C-7","C#-7","D-7","D#-7","E-7","F-7","F#-7","G-7","G#-7","A-7","A#-7","B-7",“C”, "C#”, “D”, “D#”, “E”, “F”, “F#”, “G”, “G#”, “A”, “A#”, “B”, “Cmaj7/9”, “C#maj7/9” “Dmaj7/9”, “D#maj7/9”, “Emaj7/9” “Fmaj7/9” “F#maj7/9”, “Gmaj7/9”, “G#maj7/9”, “Amaj7/9’, “A#maj7/9”, “Bmaj7/9”,"C/D","C#/D#","D/E","Eb/F","E/F#","F/G","F#/G#","G/A","G#/A#","A/B","A#/C","B/C#", “C-7/9”, “C#-7/9”, “D-7/9”, D#-7/9”, “E-7/9”, “F-7/9”, “F#-7/9”, “G-7/9”, “G#-7/9”, “A-7/9”, “A#-7/9”, “B-7/9”, “C7”, “C#7”, “D7”, “D#7”, “E7”, “F7”, “F#7”, “G7”, “G#7”, “A7”, “A#7”, “B7”};



//I need to replace these "msg1" and msgs 2 with more logical (and more through) matches! 
// as of oct 17 this has been (i think) completed


void setup()
{
  randomSeed(analogRead(A0));
  Serial.begin(19200);  
  pinMode(7, OUTPUT); digitalWrite(7, LOW); 
  pinMode(4, INPUT);           // set pin to input
  digitalWrite(4, HIGH);       // turn on pullup resistors

}

void loop()
{
  if(digitalRead(4) == LOW)
  {
    randomNum1 = random(0, 4);
    printer.setSize('L');  
    printer.justify('C');
    printer.println(msgs1[randomNum1]);
    printer.feed(2);
    
    randomNum2 = random(0, 35);
    printer.setSize('L');  
    printer.justify('C');
    printer.println(msgs2[randomNum2]);
    printer.feed(2);
    delay(2000);

    randomNum1 = random(0, 4);
    printer.setSize('L');  
    printer.justify('C');
    printer.println(msgs1[randomNum1]);
    printer.feed(2);
    
    randomNum2 = random(0, 35);
    printer.setSize('L');  
    printer.justify('C');
    printer.println(msgs2[randomNum2]);
    printer.feed(2);

    randomNum1 = random(0, 4);
    printer.setSize('L');  
    printer.justify('C');
    printer.println(msgs1[randomNum1]);
    printer.feed(2);

    randomNum1 = random(0, 4);
    printer.setSize('L');  
    printer.justify('C');
    printer.println(msgs1[randomNum1]);
    printer.feed(2);
    
    randomNum2 = random(0, 35);
    printer.setSize('L');  
    printer.justify('C');
    printer.println(msgs2[randomNum2]);
    printer.feed(2);
    delay(2000);
    
    randomNum2 = random(0, 35);
    printer.setSize('L');  
    printer.justify('C');
    printer.println(msgs2[randomNum2]);
    printer.feed(2);
    delay(2000);
    
    printer.doubleHeightOn();
    printer.setSize('L');  
    printer.justify('C');
    printer.println("That's all!");
    printer.feed(4);
    delay(3000);

    printer.doubleHeightOn();
    printer.setSize('L');  
    printer.justify('C');
    printer.write((uint8_t)0);
    printer.feed(4);
    printer.println("noah hellman");
    delay(800);
     
    }
  else;
  {
    waiting();
  }    
}

void waiting();
{}

canstantprinter.ino (3.51 KB)

Thanks for posting the codes in code tags! But why was that hard for the FULL error message? It holds a whole lot more info :wink:

What did I do wrong?

You probably copied the code from a source that included Unicode characters which the IDE editor can't cope with. This usually happens when code is copied from a Web page. If that was the case, does the page have an option to copy or download the raw file ?

Your INO file:

String msgs2[]= { ... lots of left/right double quotes instead of straight double quotes ... }

Your [code] box:

String msgs2[]= { ... forum software converted them to straight double quotes ... }

Just copy & paste the fixed version. :slight_smile:
(Okay, there are a few errors remaining: missing commas, single instead of double quotes...)