secuencia en matriz 8x5 utilizando funciones

Dependencies:   mbed

Funcionamiento de matriz 8X5 utilizando tarjeta NUCLEO-F446RE

Materiales:

  • Tarjeta NUCLEO-FR446RE
  • Matriz 8X5 LTP14158AG
  • Jumpers
  • Cable de conexión usb/miniusb
  • Protoboard

/media/uploads/miguelmstein/20170316_091939.jpg

Pines utilizados:

  • PA_10 - fila 1
  • PB_3 - fila 2
  • PB_5 - fila 3
  • PB_4 - fila 4
  • PB_10 - fila 5
  • PA_8 - fila 6
  • PA_9 - fila 7
  • PC_7 - fila 8
  • PB_13 - columna 1
  • PB_14 - columna 2
  • PB_15 - columna 3
  • PB_2 - columna 4
  • PB_12 - columna 5

Procedimiento

  • Se conectaron los pines de la matriz al pinout de la tarjeta utilizando los jumpers macho/hembra.
  • Se conecto el cable de alimentación y de trasnferencia de datos.
  • Luego con el código siguiente se compiló y se extrajo el archivo .bin que se copio a la carpeta de la tarjeta.

Ejemplo

/media/uploads/miguelmstein/20170316_091646.jpg

Video del montaje con el programa

/media/uploads/miguelmstein/20170316_091733.mp4

  • Nota: El código utiliza funciones para ahorrar lineas de código. Se puede mostrar en la matriz lo que se quiera que quepa en una matriz de LEDs de 8x5. Para modificar lo que se quiere mostrar se cambian los números en binario por lo que se quiere mostrar. El código siguiente muestra una secuencia regresiva de 5 a 0. Para cambiar el tiempo de cambio de imagen se modifica los valores de la variable t.
Committer:
miguelmstein
Date:
Thu Mar 16 14:31:16 2017 +0000
Revision:
0:34b5fc3ae426
secuencia matriz 8x5;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
miguelmstein 0:34b5fc3ae426 1 #include "mbed.h"
miguelmstein 0:34b5fc3ae426 2
miguelmstein 0:34b5fc3ae426 3 BusOut Rows (PA_10, PB_3, PB_5, PB_4, PB_10, PA_8, PA_9, PC_7);
miguelmstein 0:34b5fc3ae426 4 BusOut Cols (PB_13, PB_14, PB_15, PB_2, PB_12);
miguelmstein 0:34b5fc3ae426 5 #define WT 1
miguelmstein 0:34b5fc3ae426 6 void print_rows(unsigned char vr,unsigned char vc)
miguelmstein 0:34b5fc3ae426 7 {
miguelmstein 0:34b5fc3ae426 8 Rows =vr;
miguelmstein 0:34b5fc3ae426 9 Cols =vc;
miguelmstein 0:34b5fc3ae426 10 wait_ms(WT);
miguelmstein 0:34b5fc3ae426 11 }
miguelmstein 0:34b5fc3ae426 12 void print_matrix(unsigned char r1,unsigned char r2, unsigned char r3, unsigned char r4, unsigned char r5)
miguelmstein 0:34b5fc3ae426 13 {
miguelmstein 0:34b5fc3ae426 14 print_rows (r1,0b11110);
miguelmstein 0:34b5fc3ae426 15 print_rows (r2,0b11101);
miguelmstein 0:34b5fc3ae426 16 print_rows (r3,0b11011);
miguelmstein 0:34b5fc3ae426 17 print_rows (r4,0b10111);
miguelmstein 0:34b5fc3ae426 18 print_rows (r5,0b01111);
miguelmstein 0:34b5fc3ae426 19 }
miguelmstein 0:34b5fc3ae426 20 int t;
miguelmstein 0:34b5fc3ae426 21 int main() {
miguelmstein 0:34b5fc3ae426 22
miguelmstein 0:34b5fc3ae426 23 t=0;
miguelmstein 0:34b5fc3ae426 24 while(1){
miguelmstein 0:34b5fc3ae426 25
miguelmstein 0:34b5fc3ae426 26 if(t<=200)
miguelmstein 0:34b5fc3ae426 27 {
miguelmstein 0:34b5fc3ae426 28
miguelmstein 0:34b5fc3ae426 29 print_matrix(0b10001111,0b10001001,0b10001001,0b10001001,0b01110001); // print 5
miguelmstein 0:34b5fc3ae426 30 }
miguelmstein 0:34b5fc3ae426 31 else if(t>=201&&t<=400)
miguelmstein 0:34b5fc3ae426 32 {
miguelmstein 0:34b5fc3ae426 33
miguelmstein 0:34b5fc3ae426 34 print_matrix(0b00011000,0b00010100,0b00010010,0b11111111,0b00010000); // print 4
miguelmstein 0:34b5fc3ae426 35 }
miguelmstein 0:34b5fc3ae426 36 else if(t>=401&&t<=600)
miguelmstein 0:34b5fc3ae426 37 {
miguelmstein 0:34b5fc3ae426 38
miguelmstein 0:34b5fc3ae426 39 print_matrix(0b10000001,0b10010001,0b10011001,0b10010101,0b01100011); // print 3
miguelmstein 0:34b5fc3ae426 40 }
miguelmstein 0:34b5fc3ae426 41 else if(t>=601&&t<=800)
miguelmstein 0:34b5fc3ae426 42 {
miguelmstein 0:34b5fc3ae426 43
miguelmstein 0:34b5fc3ae426 44 print_matrix(0b10000010,0b11000001,0b10100001,0b10010001,0b10001110); // print 2
miguelmstein 0:34b5fc3ae426 45 }
miguelmstein 0:34b5fc3ae426 46 else if(t>=801&&t<=1000)
miguelmstein 0:34b5fc3ae426 47 {
miguelmstein 0:34b5fc3ae426 48
miguelmstein 0:34b5fc3ae426 49 print_matrix(0b10000100,0b10000010,0b11111111,0b10000000,0b10000000); // print 1
miguelmstein 0:34b5fc3ae426 50 }
miguelmstein 0:34b5fc3ae426 51 else if(t>=1001&&t<=1200)
miguelmstein 0:34b5fc3ae426 52 {
miguelmstein 0:34b5fc3ae426 53
miguelmstein 0:34b5fc3ae426 54 print_matrix(0b01111110,0b10000001,0b10000001,0b10000001,0b01111110); // print 0
miguelmstein 0:34b5fc3ae426 55 }
miguelmstein 0:34b5fc3ae426 56 else if(t>=1201&&t<=1600)
miguelmstein 0:34b5fc3ae426 57 {
miguelmstein 0:34b5fc3ae426 58
miguelmstein 0:34b5fc3ae426 59 print_matrix(0b00101110,0b00101000,0b00111110,0b00001010,0b00111010); // print swastika
miguelmstein 0:34b5fc3ae426 60 }
miguelmstein 0:34b5fc3ae426 61
miguelmstein 0:34b5fc3ae426 62 else
miguelmstein 0:34b5fc3ae426 63 {
miguelmstein 0:34b5fc3ae426 64 }
miguelmstein 0:34b5fc3ae426 65 t=t+1;
miguelmstein 0:34b5fc3ae426 66 if(t>=1600)
miguelmstein 0:34b5fc3ae426 67 t=0;
miguelmstein 0:34b5fc3ae426 68 else{}
miguelmstein 0:34b5fc3ae426 69 }
miguelmstein 0:34b5fc3ae426 70 }