Exit status 1: Error compiling for board Arduino/Genuino Uno

Hi everyone,

This is my first post. Please correct my problems with my post ???

I'm working on my Arduino UNO to control a 4 digit common anode 7 segment display. The computer gives an integer via Serial, and the display shows it. Here's my code:

const int digitPin[5] = {2, 3, 4, 5}; //declare digit pins
const int outputPin[9] = {6, 7, 8, 9, 10, 11, 12, 13}; //declare output pins(a, b, c, d, e, f, g, dp)
int returnInt = 0; //declare Serial INPUT(integer) for further proccessing
int D1 = 0, D2 = 0, D3 = 0, D4 = 0; //declare the 4 digits of the number(serial input)
const int displayDigits[10][8] = {
  {0, 0, 0, 0, 0, 0, 1},
  {1, 0, 0, 1, 1, 1, 1},
  {0, 0, 1, 0, 0, 1, 0},
  {0, 0, 0, 0, 1, 1, 0},
  {1, 0, 0, 1, 1, 0, 0},
  {0, 1, 0, 0, 1, 0, 0},
  {1, 1, 0, 0, 0, 0, 0},
  {0, 0, 0, 1, 1, 1, 1},
  {0, 0, 0, 0, 0, 0, 0},
  {0, 0, 0, 1, 1, 0, 0},
};
//define a 2D array for segments of the common anode 7 segment display, from 0 to 9

void setup() {
  for (int i = 0; i <= 3; i++) {
    pinMode(digitPin[i], OUTPUT); //declare digit pins as OUTPUT pins
  }
  for (int j = 0; j <= 3; j++) {
    pinMode(outputPin[j], OUTPUT); //declare digit pins as OUTPUT pins
  }
  Serial.begin(9600);
  while (!Serial) {
    ;
  }//wait for Serial connection
  Serial.println('Serial Ready.\n Enter a 4 digit integer to display on the 4 digit 7 segment display.'); //indicate the user to input an integer
}

void loop() {
  if ( Serial.available() != 0) {
    int returnint = Serial.parseInt(); //get the input integer
    intToDigit(returnint); //call the function to extract digits from integer
  } //do only if user inputs the integer
  displayInt(D1, 1);
  displayInt(D2, 2);
  displayInt(D3, 3);
  displayInt(D4, 4); //refresh the display with the 4 digits
  Serial.print(returnInt);
  Serial.print('is printed.'); //tell the user that the integer was printed
}

void intToDigit(int k) {
  float temp;
  temp = (k / 1000) % 10;
  D1 = (int) temp;
  temp = (k / 100) % 10;
  D2 = (int) temp;
  temp = (k / 10) % 10;
  D3 = (int) temp;
  temp = k % 10;
  D4 = (int) temp;
}//extract 4 digits from the integer to by dividing the integer with the corresponding power of 10 and modulo it by 10

void displayInt(int input, int digitNumber) {
  switch (digitNumber) {
    case 1:
      digitalWrite(digitPin[0], HIGH);
      digitalWrite(digitPin[1], LOW);
      digitalWrite(digitPin[2], LOW);
      digitalWrite(digitPin[3], LOW);
      break;
    case 2:
      digitalWrite(digitPin[0], LOW);
      digitalWrite(digitPin[1]. HIGH);
      digitalWrite(digitPin[2], LOW);
      digitalWrite(digitPin[3], LOW);
      break;
    case 3:
      digitalWrite(digitPin[0], LOW);
      digitalWrite(digitPin[1]. LOW);
      digitalWrite(digitPin[2], HIGH);
      digitalWrite(digitPin[3], LOW);
      break;
    case 4:
      digitalWrite(digitPin[0], LOW);
      digitalWrite(digitPin[1]. LOW);
      digitalWrite(digitPin[2], LOW);
      digitalWrite(digitPin[3], HIGH);
      break;
    default:
      digitalWrite(digitPin[0], LOW);
      digitalWrite(digitPin[1]. LOW);
      digitalWrite(digitPin[2], LOW);
      digitalWrite(digitPin[3], LOW);
      break;
  }//set the digit pins for different digits according to the given value. Set 4 pins to low if the statements doesn't match(just for debugging).
  for (int count = 0; count <= 6; count++) {
    digitalWrite(outputPin[count], displayDigits[input][count]);//set the pins for seven segment display to display a single digit
  }
}

I tried to compile it but it returns me the 'Exit status 1: Error compiling for compiling for board Arduino/Genuino Uno'. I scrolled up the log and I found this:

(Sketch Path)4_digit_7_segment_display_driver.ino:30:18: warning: character constant too long for its type

   Serial.println('Serial Ready.\n Enter a 4 digit integer to display on the 4 digit 7 segment display.'); //indicate the user to input an integer

                  ^

(Sketch Path)4_digit_7_segment_display_driver.ino:43:16: warning: character constant too long for its type

   Serial.print('is printed.'); //tell the user that the integer was printed

                ^

(Sketch Path)4_digit_7_segment_display_driver.ino: In function 'void displayInt(int, int)':


(Path)Arduino.h:40:14: error: expected unqualified-id before numeric constant

 #define HIGH 0x1

              ^
(Sketch Path)4_digit_7_segment_display_driver.ino:68:33: note: in expansion of macro 'HIGH'

       digitalWrite(digitPin[1]. HIGH);

                                 ^

(Path)Arduino.h:41:14: error: expected unqualified-id before numeric constant

 #define LOW  0x0

              ^

(Sketch path)4_digit_7_segment_display_driver.ino:74:33: note: in expansion of macro 'LOW'

       digitalWrite(digitPin[1]. LOW);

                                 ^
(Path)Arduino.h:41:14: error: expected unqualified-id before numeric constant

 #define LOW  0x0

              ^
(Sketch path)4_digit_7_segment_display_driver.ino:80:33: note: in expansion of macro 'LOW'

       digitalWrite(digitPin[1]. LOW);

                                 ^

(Path)Arduino.h:41:14: error: expected unqualified-id before numeric constant

 #define LOW  0x0

              ^
(Sketch path)4_digit_7_segment_display_driver.ino:86:33: note: in expansion of macro 'LOW'

       digitalWrite(digitPin[1]. LOW);

                                 ^

Does anyone have any idea what's wrong with my code? Please help me with my code. Thank you 8)

FearlessSniper:

(Sketch Path)4_digit_7_segment_display_driver.ino:30:18: warning: character constant too long for its type

Serial.println('Serial Ready.\n Enter a 4 digit integer to display on the 4 digit 7 segment display.'); //indicate the user to input an integer

^

In C++ (the language of Arduino sketches) single quotes (as you used here) are used to surround a single character (e.g. 'A'). Double quotes are used to surround a string literal (e.g. "Serial Ready.\n Enter a 4 digit integer to display on the 4 digit 7 segment display.").

FearlessSniper:

(Path)Arduino.h:41:14: error: expected unqualified-id before numeric constant

#define LOW  0x0

^
(Sketch path)4_digit_7_segment_display_driver.ino:80:33: note: in expansion of macro 'LOW'

digitalWrite(digitPin[1]. LOW);

^

Function arguments are separated by commas, not periods.

pert:
Function arguments are separated by commas, not periods.

Oh, I didn't even notice that. I should read my sketch more carefully next time. I corrected them and the sketch compiled successfully. Thanks a lot!

I'm glad to hear it's compiling now. Enjoy!
Per