/*
MAX7219_U8g2.ino
A special example for the MAX7219 based LED display matrix
Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
Copyright (c) 2016, [email protected]
All rights reserved.
*/
#include <Arduino.h>
#include <U8g2lib.h>
/*
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
*/
U8G2_MAX7219_32X8_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 11, /* data=*/ 12, /* cs=*/ 10, /* dc=*/ U8X8_PIN_NONE, /* reset=*/ U8X8_PIN_NONE);
//U8G2_MAX7219_16X16_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 11, /* data=*/ 12, /* cs=*/ 10, /* dc=*/ U8X8_PIN_NONE, /* reset=*/ U8X8_PIN_NONE);
void setup(void) {
u8g2.begin();
u8g2.setContrast(10*16);
}
void loop(void) {
u8g2.clearBuffer(); // clear the internal memory
//u8g2.setFont(u8g2_font_helvB08_tr); // choose a suitable font
//u8g2.setFont(u8g2_font_nerhoe_tr); // choose a suitable font
u8g2.setFont(u8g2_font_profont11_tr); // choose a suitable font
u8g2.drawStr(0,u8g2.getAscent(),"123456789.0"); // write something to the internal memory
u8g2.sendBuffer(); // transfer internal memory to the display
delay(1000);
}