Obrázky projektu: Schéma zapojení: Soupis položek + odkazy na nákup:
1x CP2102 MICRO USB to UART TTL Module
jednostranné PCB 5x7CM
2x MAX7219 CWG 8-Digit Digital Tube Display Control Module Red
6x propojovací káblík
1x Attiny85
1x DIP8 IC Sockets
8x pin
Program pro AtTiny85:
Testovací program:
Kód: Vybrat vše
//We always have to include the library
#include "LedControl.h"
#define DIN A1
#define CS A3
#define CLK A2
/*
Now we need a LedControl to work with.
***** These pin numbers will probably not work with your hardware *****
pin 12 is connected to the DataIn
pin 11 is connected to the CLK
pin 10 is connected to LOAD
We have only a single MAX72XX.
*/
LedControl lc = LedControl(DIN, CLK, CS, 2);
/* we always wait a bit between updates of the display */
int delaytime = 250;
/**********************************/
void setup() {
for (int index = 0; index < lc.getDeviceCount(); index++) { //resetovani dalsich segmentu
lc.shutdown(index, false);
}
/* Set the brightness to a medium values */
lc.setIntensity(0, 4);
lc.setIntensity(1, 4);
/* and clear the display */
lc.clearDisplay(0);
lc.clearDisplay(1);
}
/**********************************/
void scrollDigits() {
for (byte i = 0; i < 16; i++) {
lc.setDigit(0, 7, i, false);
lc.setDigit(0, 6, i, false);
lc.setDigit(0, 5, i, false);
lc.setDigit(0, 4, i, false);
lc.setDigit(0, 3, i, false);
lc.setDigit(0, 2, i, false);
lc.setDigit(0, 1, i, false);
lc.setDigit(0, 0, i, false);
lc.setDigit(1, 7, i, false);
lc.setDigit(1, 6, i, false);
lc.setDigit(1, 5, i, false);
lc.setDigit(1, 4, i, false);
lc.setDigit(1, 3, i, false);
lc.setDigit(1, 2, i, false);
lc.setDigit(1, 1, i, false);
lc.setDigit(1, 0, i, false);
delay(delaytime);
}
lc.clearDisplay(0);
lc.clearDisplay(1);
}
/**********************************/
void loop() {
scrollDigits();
}