Hi Guys
I build a Wordclock and all works fine...
Now i wannna do some animation on my led Matrix, but i don't now how... can anyone help?
I wanna for instance light up every led after the other
by the way, i coulndt post the full code, so I attached it
/*****************************************************************************
Word Clock
*
******************************************************************************/
#include <Time.h>
#include "TimerOne.h"
long int t=1476434640; // Seconds passed since 01.01.1970
int h; // hours
int m; // minutes
int s;// seconds
int te;//temperature
int LM35 = A0;
float SensorValue = 0;
float temp[5];
float temperature;
// Latch-Pin ("LT")
int latchPin = 8 ;
// Clock-Pin ("SK")
int clockPin = 12;
// Data-Pin ("R1I")
int dataPin = 11;
//tempnumbers
byte test[64] = {
B10000000, B00000000,
B00000000, B00000000,
B00000000, B00000000,
B00000000, B00000000,
B00000000, B00000000,
B00000000, B00000000,
B00000000, B00000000,
B00000000, B00000000,
B00000000, B00000000,
B00000000, B00000000,
B00000000, B00000000,
B00000000, B00000000,
B00000000, B00000000,
B00000000, B00000000,
B00000000, B00000000,
B00000000, B00000000,
};
byte picture[32] = {
B00000000, B00000000,
B00000000, B00000000,
B01111001, B10001111,
B00001001, B10000001,
B00001001, B10000001,
B01111001, B10001111,
B01000001, B10000001,
B01111001, B10000001,
B00000000, B00000000,
B11111100, B00000010,
B10000100, B00000010,
B10000100, B00000010,
B11111100, B00111110,
B10000100, B00100010,
B10000100, B00100010,
B10000100, B00111110,
};
byte counter = 0;
void setup() {
Serial.begin(9600);
//set pins to output so you can control the shift register
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
// Initialize the Timer to 15ms, lower numbers give a more bright matrix, but uses more processing power.
Timer1.initialize(1500);
// Execute the function "draw" every time the timer is fired
Timer1.attachInterrupt(draw);
}
void loop() {
// Main draw routine
void draw() {
int offset;
// draw the icon
for (int i = 0; i < 32; i+=2) {
writeLine(tempscreen[i+offset], tempscreen[i+1+offset], nrows[i], nrows[i+1]);
}
}
// shift register routine
void writeLine(int byte1, int byte2, int byte3, int byte4) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, byte3);
shiftOut(dataPin, clockPin, MSBFIRST, byte4);
shiftOut(dataPin, clockPin, MSBFIRST, byte1);
shiftOut(dataPin, clockPin, MSBFIRST, byte2);
digitalWrite(latchPin, HIGH);
}
Wordclock_Code.ino (54.1 KB)