I'm new and im trying out the Matrix LED heres my code

#include <LedControl.h>

LedControl lc = LedControl(12, 11, 10, 1);

unsigned long delayime = 100;

void setup()
  lc.shutdown(0, false);
  lc.setIntensity(0, 8);

void writeArduinoOnMatrix()
  byte H[10] = {8, 8, B01100110, B01100110, B01100110, B01111110, B01111110, B01100110, B01100110, B01100110};
  byte E[10] = {8, 8, B01111110, B01111110, B01100000, B01111110, B01111110, B01100000, B01111110, B01111110};
  byte L[10] = {8, 8, B01100000, B01100000, B01100000, B01100000, B01100000, B01100000, B01111110, B01111110};
  byte O[10] = {8, 8, B01100000, B01100000, B01100000, B01100000, B01100000, B01100000, B01111110, B01111110};

  lc.setRow(0, 0, H[0]);

I keep on getting this error no matter what. collect2.exe: error: ld returned 1 exit status

exit status 1 Error compiling for board Arduino/Genuino Uno.

Help What am I doing wrong?

  • Welcome to Arduino SE! Can you post the complete code, with thevoid loop{...} function? Also post the complete error as Michel has requested below. – Fauzan Jul 26 '17 at 11:33

Unfortunately I think you are missing the actual error message and have just copied the result. I suspect if you scroll back up through the output it will say loop is missing.

All Arduino sketches (well almost all) have to have setup() and loop() functions. The underlying 'stuff' will call setup() once and loop() repeatedly.

I hate global variables, but in this case I would be tempted to move those arrays out of the function and make the constant global values. That way they will be in memory as the Arduino boots and you won't have to waste processor cycles setting them up.

It may be a silly question, but are you using the right hardware? This might help check that http://playground.arduino.cc/Main/LedControl

| improve this answer | |
  • ok, yes I'm using the right hardware and the code... – That One Guy Jul 31 '17 at 10:25
  • I am using the right hardware, screw the code i made a new one can u check it for me? #include <LedControl.h> int DIN = 12; int CS = 11; int CLK = 10; byte H[8]= {(0x66,0x66,0x66,0x7e,0x7e,0x66,0x66,0x66)}; byte E[8]= {(0x7e,0x7e,0x60,0x7e,0x7e,0x60,0x7e,0x7e)}; byte L[8]= {(0x60,0x60,0x60,0x60,0x60,0x60,0x7e,0x7e)}; byte O[8]= {(0x7e,0xff,0xc3,0xc3,0xc3,0xc3,0xff,0x7e)}; LedControl lc=LedControl(DIN,CLK,CS,0); void setup() { // put your setup code here, to run once: lc.shutdown(0,false); lc.setIntensity(0,15); lc.clearDisplay(0); } Would this work? – That One Guy Jul 31 '17 at 10:28

A ld error normally means a link error, i.e. you call a function that is not defined.

Are you sure it is the complete error? That it does not show which function you miss?

Also, I notice:

  • function writeArduinoOnMatrix never seems to be called, or you didn't post the full code?
  • In writeArduinOnMatrix, you declare 4 arrays, but you use only one (H).
  • Typo in: unsigned long delayime = 100; ... this should be delayTime
| improve this answer | |
  • If the posted code is complete, then it is missing the loop() function, which might explain calling of an undefined function, as the rest of the runtime should call loop() after setup(). – jose can u c Aug 25 '17 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.