Go Down

Topic: Re: Programming Help (Read 1 time) previous topic - next topic

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.

Nick Gammon

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
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Code: [Select]
_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
Code: [Select]
#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 ;/

Nick Gammon

Fix this first:

Quote

_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?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

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

PaulS

Quote
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.

Quote
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
Code: [Select]
/*
* 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()
{
}



Code: [Select]
Binary sketch size: 790 bytes (of a 32,256 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0x00



Nick Gammon

Quote
Ok got the library ...


Good.

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


What space?

Quote
... used efprom clear ...


Why?

Quote
... but then this happend ...


Are you able to upload any sketches at all to your Arduino?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

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

PaulS

Quote
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
Code: [Select]
#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

Nick Gammon

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
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics


Go Up