Re: Programming Help

I need help i am using a max7219 board (Just serach it up on goolgle comes with 8x8 led ) but all the codes i tried need a varible and idk what do do. Can somone give me a code that has all varibles and tell me how to control the animations and where to put pins in from the board to the arduino (arduino uno) please help

What i mean is that i cant get my max7219 chip working with my arduino i can't program my arduino cuz i dont know how to plug in varibles: #include <FrequencyTimer2.h>
#include "font.h"
#include "figuras.h"

byte col = 0;
byte leds[8][8];

// Pines conectados al Arduino (-1 es un fantasma para que empience en la posicion 1)
int pins[17]= {-1, 5, 4, 3, 2, 14, 15, 16, 17, 13, 12, 11, 10, 18, 8, 7, 6};

// Columnas de leds = Pines de la matriz
int cols[8] = {pins[13], pins[3], pins[4], pins[10], pins[06], pins[11], pins[15], pins[16]};

// Filas de leds = Pines de la matriz
int rows[8] = {pins[9], pins[14], pins[8], pins[12], pins[1], pins[7], pins[2], pins[5]};

const int numPatterns = 22;
byte patterns[numPatterns][8][8] = {
D,A,V,G,E,E,K,PUNTO,C,O,M,SPACE,CARITA,SPACE,Bike,SPACE,Alto,SPACE,FlechaIzq,SPACE
};

int pattern = 0;

void setup() {
// Todos los pines como salidas
for (int i = 1; i <= 19; i++) {
pinMode(pins*, OUTPUT);*

  • }*
  • // Pines en bajo*
  • for (int i = 1; i <= 8; i++) {*
  • digitalWrite(cols[i + 1], LOW);*
  • }*
  • for (int i = 1; i <= 8; i++) {*
  • digitalWrite(rows[i + 1], LOW);*
  • }*
  • clearLeds();*
  • // Turn off toggling of pin 11*
  • FrequencyTimer2::disable();*
  • // Set refresh rate (interrupt timeout period)*
  • FrequencyTimer2::setPeriod(2000);*
  • // Set interrupt routine to be called*
  • FrequencyTimer2::setOnOverflow(display);*
  • setPattern(pattern);*
    }
    void loop() {
  • pattern = ++pattern % numPatterns;*
  • slidePattern(pattern, 100);*
    }
    void clearLeds() {
  • // Limpiar Display*
  • for (int i = 0; i < 8; i++) {*
  • for (int j = 0; j < 8; j++) {*
    _ leds*[j] = 0;_
    _
    }_
    _
    }_
    _
    }_
    void setPattern(int pattern) {
    _
    for (int i = 0; i < 8; i++) {_
    _
    for (int j = 0; j < 8; j++) {_
    leds_[j] = patterns[pattern][j];
    }
    }
    }
    void slidePattern(int pattern, int del) {
    for (int l = 0; l < 8; l++) {
    for (int i = 0; i < 7; i++) {
    for (int j = 0; j < 8; j++) {
    leds[j] = leds[j][i+1];
    }
    }
    for (int j = 0; j < 8; j++) {
    leds[j][7] = patterns[pattern][j][0 + l];
    }
    delay(del);
    }
    }
    // Rutina de interrupciones*

    void display() {
    * digitalWrite(cols[col], LOW); // Turn whole previous column off*
    * col++;
    if (col == 8) {
    col = 0;
    }
    for (int row = 0; row < 8; row++) {
    if (leds[col][7 - row] == 1) {
    digitalWrite(rows[row], LOW); // Turn on this led*

    * }
    else {
    digitalWrite(rows[row], HIGH); // Turn off this led*

    * }
    }
    digitalWrite(cols[col], HIGH); // Turn whole column on at once (for equal lighting times)
    }_

    _8x8.ino:2:18: error: font.h: No such file or directory*

    _8x8.ino:3:21: error: figuras.h: No such file or directory
    _8x8:19: error: 'D' was not declared in this scope
    _8x8:19: error: 'A' was not declared in this scope
    _8x8:19: error: 'V' was not declared in this scope
    _8x8:19: error: 'G' was not declared in this scope
    _8x8:19: error: 'E' was not declared in this scope
    _8x8:19: error: 'E' was not declared in this scope
    _8x8:19: error: 'K' was not declared in this scope
    _8x8:19: error: 'PUNTO' was not declared in this scope
    _8x8:19: error: 'C' was not declared in this scope
    _8x8:19: error: 'O' was not declared in this scope
    _8x8:19: error: 'M' was not declared in this scope
    _8x8:19: error: 'SPACE' was not declared in this scope
    _8x8:19: error: 'CARITA' was not declared in this scope
    _8x8:19: error: 'SPACE' was not declared in this scope
    _8x8:19: error: 'Bike' was not declared in this scope
    _8x8:19: error: 'SPACE' was not declared in this scope
    _8x8:19: error: 'Alto' was not declared in this scope
    _8x8:19: error: 'SPACE' was not declared in this scope
    _8x8:19: error: 'FlechaIzq' was not declared in this scope
    _8x8:19: error: 'SPACE' was not declared in this scope
    _8x8.ino: In function 'void setup()':
    _8x8:42: error: 'FrequencyTimer2' has not been declared
    _8x8:44: error: 'FrequencyTimer2' has not been declared
    _8x8:46: error: 'FrequencyTimer2' has not been declared

include <FrequencyTimer2.h>
#include "font.h"
#include "figuras.h"

byte col = 0;
byte leds[8][8];

// Pines conectados al Arduino (-1 es un fantasma para que empience en la posicion 1)
int pins[17]= {-1, 5, 4, 3, 2, 14, 15, 16, 17, 13, 12, 11, 10, 18, 8, 7, 6};

// Columnas de leds = Pines de la matriz
int cols[8] = {pins[13], pins[3], pins[4], pins[10], pins[06], pins[11], pins[15], pins[16]};

// Filas de leds = Pines de la matriz
int rows[8] = {pins[9], pins[14], pins[8], pins[12], pins[1], pins[7], pins[2], pins[5]};

const int numPatterns = 22;
byte patterns[numPatterns][8][8] = {
D,A,V,G,E,E,K,PUNTO,C,O,M,SPACE,CARITA,SPACE,Bike,SPACE,Alto,SPACE,FlechaIzq,SPACE
};

int pattern = 0;

void setup() {
// Todos los pines como salidas
for (int i = 1; i <= 19; i++) {
pinMode(pins*, OUTPUT);*

  • }*
  • // Pines en bajo*
  • for (int i = 1; i <= 8; i++) {*
  • digitalWrite(cols[i + 1], LOW);*
  • }*
  • for (int i = 1; i <= 8; i++) {*
  • digitalWrite(rows[i + 1], LOW);*
  • }*
  • clearLeds();*
  • // Turn off toggling of pin 11*
  • FrequencyTimer2::disable();*
  • // Set refresh rate (interrupt timeout period)*
  • FrequencyTimer2::setPeriod(2000);*
  • // Set interrupt routine to be called*
  • FrequencyTimer2::setOnOverflow(display);*
  • setPattern(pattern);*
    }
    void loop() {
  • pattern = ++pattern % numPatterns;*
  • slidePattern(pattern, 100);*
    }
    void clearLeds() {
  • // Limpiar Display*
  • for (int i = 0; i < 8; i++) {*
  • for (int j = 0; j < 8; j++) {*
    _ leds*[j] = 0;_
    _
    }_
    _
    }_
    _
    }_
    void setPattern(int pattern) {
    _
    for (int i = 0; i < 8; i++) {_
    _
    for (int j = 0; j < 8; j++) {_
    leds_[j] = patterns[pattern][j];
    }
    }
    }
    void slidePattern(int pattern, int del) {
    for (int l = 0; l < 8; l++) {
    for (int i = 0; i < 7; i++) {
    for (int j = 0; j < 8; j++) {
    leds[j] = leds[j][i+1];
    }
    }
    for (int j = 0; j < 8; j++) {
    leds[j][7] = patterns[pattern][j][0 + l];
    }
    delay(del);
    }
    }
    // Rutina de interrupciones*

    void display() {
    * digitalWrite(cols[col], LOW); // Turn whole previous column off*
    * col++;
    if (col == 8) {
    col = 0;
    }
    for (int row = 0; row < 8; row++) {
    if (leds[col][7 - row] == 1) {
    digitalWrite(rows[row], LOW); // Turn on this led*

    * }
    else {
    digitalWrite(rows[row], HIGH); // Turn off this led*

    * }
    }
    digitalWrite(cols[col], HIGH); // Turn whole column on at once (for equal lighting times)
    }_

    8x8.ino:2:18: error: font.h: No such file or directory*
    _8x8.ino:3:21: error: figuras.h: No such file or directory
    _8x8:19: error: 'D' was not declared in this scope
    _8x8:19: error: 'A' was not declared in this scope
    _8x8:19: error: 'V' was not declared in this scope
    _8x8:19: error: 'G' was not declared in this scope
    _8x8:19: error: 'E' was not declared in this scope
    _8x8:19: error: 'E' was not declared in this scope
    _8x8:19: error: 'K' was not declared in this scope
    _8x8:19: error: 'PUNTO' was not declared in this scope
    _8x8:19: error: 'C' was not declared in this scope
    _8x8:19: error: 'O' was not declared in this scope
    _8x8:19: error: 'M' was not declared in this scope
    _8x8:19: error: 'SPACE' was not declared in this scope
    _8x8:19: error: 'CARITA' was not declared in this scope
    _8x8:19: error: 'SPACE' was not declared in this scope
    _8x8:19: error: 'Bike' was not declared in this scope
    _8x8:19: error: 'SPACE' was not declared in this scope
    _8x8:19: error: 'Alto' was not declared in this scope
    _8x8:19: error: 'SPACE' was not declared in this scope
    _8x8:19: error: 'FlechaIzq' was not declared in this scope
    _8x8:19: error: 'SPACE' was not declared in this scope
    _8x8.ino: In function 'void setup()':
    _8x8:42: error: 'FrequencyTimer2' has not been declared
    _8x8:44: error: 'FrequencyTimer2' has not been declared
    _8x8:46: error: 'FrequencyTimer2' has not been declared
    I need help with this as i can't declare varibles ( DOnt know how to ) and what pins should i plug data clk etc._

Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

Threads merged.

Please use code tags.

Read this before posting a programming question

How to use this forum

  • Moderator
_8x8.ino:2:18: error: font.h: No such file or directory
_8x8.ino:3:21: error: figuras.h: No such file or directory
_8x8:19: error: 'D' was not declared in this scope
_8x8:19: error: 'A' was not declared in this scope
_8x8:19: error: 'V' was not declared in this scope
_8x8:19: error: 'G' was not declared in this scope
_8x8:19: error: 'E' was not declared in this scope
_8x8:19: error: 'E' was not declared in this scope
_8x8:19: error: 'K' was not declared in this scope
_8x8:19: error: 'PUNTO' was not declared in this scope
_8x8:19: error: 'C' was not declared in this scope
_8x8:19: error: 'O' was not declared in this scope
_8x8:19: error: 'M' was not declared in this scope
_8x8:19: error: 'SPACE' was not declared in this scope
_8x8:19: error: 'CARITA' was not declared in this scope
_8x8:19: error: 'SPACE' was not declared in this scope
_8x8:19: error: 'Bike' was not declared in this scope
_8x8:19: error: 'SPACE' was not declared in this scope
_8x8:19: error: 'Alto' was not declared in this scope
_8x8:19: error: 'SPACE' was not declared in this scope
_8x8:19: error: 'FlechaIzq' was not declared in this scope
_8x8:19: error: 'SPACE' was not declared in this scope
_8x8.ino: In function 'void setup()':
_8x8:42: error: 'FrequencyTimer2' has not been declared
_8x8:44: error: 'FrequencyTimer2' has not been declared
_8x8:46: error: 'FrequencyTimer2' has not been declared

Program code

#include <FrequencyTimer2.h>
#include "font.h"
#include "figuras.h"

byte col = 0;
byte leds[8][8];

// Pines conectados al Arduino (-1 es un fantasma para que empience en la posicion 1)
int pins[17]= {-1, 5, 4, 3, 2, 14, 15, 16, 17, 13, 12, 11, 10, 18, 8, 7, 6};

// Columnas de leds = Pines de la matriz
int cols[8] = {pins[13], pins[3], pins[4], pins[10], pins[06], pins[11], pins[15], pins[16]};

// Filas de leds = Pines de la matriz
int rows[8] = {pins[9], pins[14], pins[8], pins[12], pins[1], pins[7], pins[2], pins[5]};

const int numPatterns = 22;
byte patterns[numPatterns][8][8] = {
  D,A,V,G,E,E,K,PUNTO,C,O,M,SPACE,CARITA,SPACE,Bike,SPACE,Alto,SPACE,FlechaIzq,SPACE
};

int pattern = 0;

void setup() {
   // Todos los pines como salidas
   for (int i = 1; i <= 19; i++) {
     pinMode(pins[i], OUTPUT);
   }

   // Pines en bajo
   for (int i = 1; i <= 8; i++) {
     digitalWrite(cols[i + 1], LOW);
   }

   for (int i = 1; i <= 8; i++) {
     digitalWrite(rows[i + 1], LOW);
   }

   clearLeds();

   // Turn off toggling of pin 11
   FrequencyTimer2::disable();
   // Set refresh rate (interrupt timeout period)
   FrequencyTimer2::setPeriod(2000);
   // Set interrupt routine to be called
   FrequencyTimer2::setOnOverflow(display);

   setPattern(pattern);
}

void loop() {
     pattern = ++pattern % numPatterns;
     slidePattern(pattern, 100);
}

void clearLeds() {
   // Limpiar Display
   for (int i = 0; i < 8; i++) {
     for (int j = 0; j < 8; j++) {
       leds[i][j] = 0;
     }
   }
}

void setPattern(int pattern) {
   for (int i = 0; i < 8; i++) {
     for (int j = 0; j < 8; j++) {
       leds[i][j] = patterns[pattern][i][j];
     }
   }
}

void slidePattern(int pattern, int del) {
   for (int l = 0; l < 8; l++) {
     for (int i = 0; i < 7; i++) {
       for (int j = 0; j < 8; j++) {
         leds[j][i] = leds[j][i+1];
       }
     }
     for (int j = 0; j < 8; j++) {
       leds[j][7] = patterns[pattern][j][0 + l];
     }
     delay(del);
   }
}

// Rutina de interrupciones
void display() {
   digitalWrite(cols[col], LOW);  // Turn whole previous column off
   col++;
   if (col == 8) {
     col = 0;
   }
   for (int row = 0; row < 8; row++) {
     if (leds[col][7 - row] == 1) {
       digitalWrite(rows[row], LOW);  // Turn on this led
     }
     else {
       digitalWrite(rows[row], HIGH); // Turn off this led
     }
   }
   digitalWrite(cols[col], HIGH); // Turn whole column on at once (for equal lighting times)
}

I cannot get this running cause of varible argument and i cant fix it help ;/

Fix this first:

_8x8.ino:2:18: error: font.h: No such file or directory
_8x8.ino:3:21: error: figuras.h: No such file or directory

Did you install the library properly?

I do not know also only the on light lights up on my arduino

I do not know

When you do know whether you downloaded the library, come on back.

When you can remember where you installed the library, come on back.

also only the on light lights up on my arduino

Since you can't even compile the code for the Arduino, why do you expect other things to happen?

Ok got the library but arduino ran out of space used efprom clear but then this happend

/*
 * EEPROM Clear
 *
 * Sets all of the bytes of the EEPROM to 0.
 * This example code is in the public domain.

 */

#include <EEPROM.h>

void setup()
{
  // write a 0 to all 512 bytes of the EEPROM
  for (int i = 0; i < 512; i++)
    EEPROM.write(i, 0);
    
  // turn the LED on when we're done
  digitalWrite(13, HIGH);
}

void loop()
{
}
Binary sketch size: 790 bytes (of a 32,256 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0x00

Ok got the library ...

Good.

... but arduino ran out of space ...

What space?

... used efprom clear ...

Why?

... but then this happend ...

Are you able to upload any sketches at all to your Arduino?

Ran out of memory - Solved
Used efprom clear to erase memory
I cant reaaly find a sketch for 8x8 led(prefrably scrolling smiley face) And pretty much idk if it uploads to program or not

And pretty much idk if it uploads to program or not

Send me your Arduino, and I'll try to upload the blink example sketch.

The blink works it's just that i need to know the pins and where to plug them in on this program

#include <FrequencyTimer2.h>
#include "font.h"
#include "figuras.h"

byte col = 0;
byte leds[8][8];

// Pines conectados al Arduino (-1 es un fantasma para que empience en la posicion 1)
int pins[17]= {-1, 5, 4, 3, 2, 14, 15, 16, 17, 13, 12, 11, 10, 18, 8, 7, 6};

// Columnas de leds = Pines de la matriz
int cols[8] = {pins[13], pins[3], pins[4], pins[10], pins[06], pins[11], pins[15], pins[16]};

// Filas de leds = Pines de la matriz
int rows[8] = {pins[9], pins[14], pins[8], pins[12], pins[1], pins[7], pins[2], pins[5]};

const int numPatterns = 22;
byte patterns[numPatterns][8][8] = {
  D,A,V,G,E,E,K,PUNTO,C,O,M,SPACE,CARITA,SPACE,Bike,SPACE,Alto,SPACE,FlechaIzq,SPACE
};

int pattern = 0;

void setup() {
   // Todos los pines como salidas
   for (int i = 1; i <= 19; i++) {
     pinMode(pins[i], OUTPUT);
   }

   // Pines en bajo
   for (int i = 1; i <= 8; i++) {
     digitalWrite(cols[i + 1], LOW);
   }

   for (int i = 1; i <= 8; i++) {
     digitalWrite(rows[i + 1], LOW);
   }

   clearLeds();

   // Turn off toggling of pin 11
   FrequencyTimer2::disable();
   // Set refresh rate (interrupt timeout period)
   FrequencyTimer2::setPeriod(2000);
   // Set interrupt routine to be called
   FrequencyTimer2::setOnOverflow(display);

   setPattern(pattern);
}

void loop() {
     pattern = ++pattern % numPatterns;
     slidePattern(pattern, 100);
}

void clearLeds() {
   // Limpiar Display
   for (int i = 0; i < 8; i++) {
     for (int j = 0; j < 8; j++) {
       leds[i][j] = 0;
     }
   }
}

void setPattern(int pattern) {
   for (int i = 0; i < 8; i++) {
     for (int j = 0; j < 8; j++) {
       leds[i][j] = patterns[pattern][i][j];
     }
   }
}

void slidePattern(int pattern, int del) {
   for (int l = 0; l < 8; l++) {
     for (int i = 0; i < 7; i++) {
       for (int j = 0; j < 8; j++) {
         leds[j][i] = leds[j][i+1];
       }
     }
     for (int j = 0; j < 8; j++) {
       leds[j][7] = patterns[pattern][j][0 + l];
     }
     delay(del);
   }
}

// Rutina de interrupciones
void display() {
   digitalWrite(cols[col], LOW);  // Turn whole previous column off
   col++;
   if (col == 8) {
     col = 0;
   }
   for (int row = 0; row < 8; row++) {
     if (leds[col][7 - row] == 1) {
       digitalWrite(rows[row], LOW);  // Turn on this led
     }
     else {
       digitalWrite(rows[row], HIGH); // Turn off this led
     }
   }
   digitalWrite(cols[col], HIGH); // Turn whole column on at once (for equal lighting times)
}

If ant of you guys can please declare the varibles for me and tell me where to plug in the DIN,CS and clk

A good starting point would be to stop sending private messages to people who are trying to help you, asking for even more help.

How to use this forum

anyone? :roll_eyes: :drooling_face:

The blink works it's just that i need to know the pins and where to plug them in on this program

int pins[17]= {-1, 5, 4, 3, 2, 14, 15, 16, 17, 13, 12, 11, 10, 18, 8, 7, 6};
(Though I'm not clear why index zero is a special case)

And pretty much idk if it uploads to program or not

You don't know if you can upload programs or not? Neither do I. Nor anyone else I imagine.

well im not sure if it uploads the 8x8 led program because i dont know what pins to plug in and i dont know how to declar varibles :S

Stop. Just a moment.

When people here write "Do you know how to upload a program (or sketch, same thing)", the issue is NOT with this particular program. The issue is that if you do not know if you have uploaded a program AT ALL, then there is no point in discussing the pin assigments.

I can tell you, so far noone has looked at your program/sketch, because if you give the impression nothing gets uploaded into your Arduino.

Here I give you two programs. One is the standard LED blinky:

void setup() {                
  pinMode(13, OUTPUT);     
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);                // wait 
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);                // wait  ...
}

the other slightly modified so it "beats like a heart".

void setup() {                
  pinMode(13, OUTPUT);     
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(40);                // wait 
  digitalWrite(13, LOW);    // set the LED off
  delay(60);                // wait  ...
  digitalWrite(13, HIGH);   //    ... and so on
  delay(150);              
  digitalWrite(13, LOW);   
  delay(1234);             
}

Totally simple. You need to demonstrate to your self that both programs can be alternately loaded into your arduino and the LED blinky changes accordingly. (You can do this several times, it will not wear out your Arduino and you do not need to "clear" anything between attempts) If you know this and it works, the I appologize for telling you something you know, but that is not the impression I get from this thread. In particualar you "clearing the EPROM" activity shows you are "barking up the wrong tree". It is useless but harmless and has no bearing on getting programs to work.

Ok that works whta i mean is that the 8x8 led program is not working?