MAX7219 Sketch for random flashing - Error messages....

Hi All,

As is probably clear - I'm very new at Arduino, programming, etc.

I'm trying to get the pixels in the MAX7219 to flash randomly and am using IDE V1.6.9 with a Elegoo Uno R3. The LedControl library is installed and works with other sketches.

I found the code here: http://arduinolearning.com/code/random-flashing-max7219-example.php

When verifying it falls over on the first line with the message:
#include expects "FILENAME" or

The Sketch follows:

#include “LedControl.h” // need the library
LedControl lc=LedControl(12,11,10,1); //

// pin 12 is connected to the MAX7219 pin 1 labelled DIN
// pin 11 is connected to the CLK pin 13 labelled CLK
// pin 10 is connected to LOAD pin 12 labelled as CS
// 1 as we only have 1 MAX 7219 atatched
long randNumberX;
long randNumberY;

void setup()
{
// the zero refers to the MAX7219 number
lc.shutdown(0,false);// turn off power saving
lc.setIntensity(0,4);// sets brightness (0~15 possible values)
lc.clearDisplay(0);// clear screen
Serial.begin(9600);

// if analog input pin 0 is unconnected, random analog
// noise will cause the call to randomSeed() to generate
randomSeed(analogRead(0));
}

void loop()
{
randNumberX = random(0,8);
randNumberY = random(0,8);
lc.setLed(0,randNumberX,randNumberY,true); // turns on LED at col, row
delay(20);
lc.setLed(0,randNumberX,randNumberY,false); // turns on LED at col, row
delay(20);

}

Many thanks in advance.

NevT

OK, I've fixed it and the sketch works but I can't see why...

The first line of the sketch is:

#include “LedControl.h” and that creates the error

I then copied the first line from a different sketch that appears to be the same - and it works and prompts no error.. The new line that works is:

#include "LedControl.h"

Can someone please explain the logic here?

Many thanks in anticipation.

Nev

Look closely at the quotes. See the difference?

Screen Shot 2017-01-06 at 17.06.56.png

Brilliant, many thanks.

On my UK keyboard I can generate the second, correct " with SHIFT + 2. I have no idea how to generate the incorrect one, which in my case was copy/pasted from a web page.

I have no idea how to generate the incorrect one, which in my case was copy/pasted from a web page.

Many word processing systems automatically change pairs of double quotes to the forward and backwards leaning pairs.