Diferencia entre revisiones de «LedControl»

De ArduWiki
Saltar a: navegación, buscar
(Descripción)
(Ejemplo 1)
Línea 36: Línea 36:
  
 
== Ejemplo 1 ==
 
== Ejemplo 1 ==
 +
<syntaxhighlight lang="c++">
 +
#include <LedControl.h>;
 +
LedControl lc = LedControl(12,11,10,1); //El 1 al final indica cuantos MAX en cascada hay. Máximo 8.
 +
 +
void setup(){
 +
  //Despierta display
 +
  lc.shutdown(0,false);
 +
  //Pone brillo en medio
 +
  lc.setIntensity(0,8);
 +
  //Limita a solo 4 digitos
 +
  lc.setScanLimit(0,3);
 +
  //Limpia display
 +
  lc.clearDisplay(0);
 +
}
 +
 +
void loop{
 +
  //Cuenta regresiva
 +
  for(byte n=9, n>0, n--) {
 +
      //Muestra display
 +
      lc.setDigit(0, n, false);
 +
      delay(1000);
 +
      i--;
 +
  }
 +
  lc.setChar(0,0,'H',false);
 +
  lc.setChar(0,1,'E',false);
 +
  lc.setChar(0,2,'L',false);
 +
  lc.setChar(0,3,'P',false);
 +
  delay(1000);
 +
  //Apaga display
 +
  lc.shutDown(0, true);
 +
  lc.clearDisplay(0);
 +
  delay(3000);
 +
  //Prende display
 +
  lc.shutDown(0, false);
 +
}
 +
</syntaxhighlight>
  
 
== Vea también ==
 
== Vea también ==

Revisión del 20:37 11 dic 2019

Descripción

La libreria LedControl.h de Eberhard Fahle para trabajar con MAX7219 o MAX7221 que maneja display 7 segmentos de matriz de LED 8x8

Sintaxis

Parametros

Métodos

Metodos disponibles libreria LedControl.h
Método Descripción Ejemplo
lc.shutdown() TRUE apaga, FALSE para operación normal. lc.shutdown(0,false)
lc.setIntensity() Determina el brillo (0 a 15) lc.setIntensity(0,4)
lc.setScanLimit() Numero de dígitos a usar 0~7 lc.setScanLimit(0,3)
lc.clearDisplay() lc.clearDisplay(0)
lc.setDigit() Muestra un digito decimal. addr,digit,valor,dp lc.setDigit(0,dig,num,false)
lc.setChar() '0','1','2','3','4','5','6','7','8','9','0','A','b','c','d','E','F','H','L','P','.','-','_',' ' lc.setChar(0,0'A?,false)
lc.setLed() addr,row,col,state (true=on) lc.setLed(0,0,0,true)
lc.setRow() addr,row,value lc.setRow(0,0,1)
lc.setColumn() addr,col,value lc.setColumn(0,0,1)

Comentarios

Advertencias

Ejemplo 1

#include <LedControl.h>;
LedControl lc = LedControl(12,11,10,1); //El 1 al final indica cuantos MAX en cascada hay. Máximo 8.

void setup(){
   //Despierta display
   lc.shutdown(0,false);
   //Pone brillo en medio
   lc.setIntensity(0,8);
   //Limita a solo 4 digitos
   lc.setScanLimit(0,3);
   //Limpia display
   lc.clearDisplay(0);
}

void loop{
   //Cuenta regresiva
   for(byte n=9, n>0, n--) {
      //Muestra display
      lc.setDigit(0, n, false);
      delay(1000);
      i--;
   }
   lc.setChar(0,0,'H',false);
   lc.setChar(0,1,'E',false);
   lc.setChar(0,2,'L',false);
   lc.setChar(0,3,'P',false);
   delay(1000);
   //Apaga display
   lc.shutDown(0, true);
   lc.clearDisplay(0);
   delay(3000);
   //Prende display
   lc.shutDown(0, false);
}

Vea también


Referencias