Arduino + DS1307 + 16x8 Led Matrix with Max7219


hi,
i'm new in programming , want build clock arduino uno + ds1307 + 16x8 led matrix max7219 modules. found on net code displays time scroll .. , if can guide me or modify code time displayed static.. 1 second refresh or that.
thanks.
code: [select]
#if defined(arduino) && arduino >= 100
#include "arduino.h"
#else
#include "wprogram.h"
#endif
#include "rtclib.h"
#include <wire.h>
#include <maxmatrix.h>
#include <avr/pgmspace.h>
//#include <font.h>

progmem prog_uchar ch[] = {
3, 8, b0000000, b0000000, b0000000, b0000000, b0000000, // space
1, 8, b1011111, b0000000, b0000000, b0000000, b0000000, // !
3, 8, b0000011, b0000000, b0000011, b0000000, b0000000, // "
5, 8, b0010100, b0111110, b0010100, b0111110, b0010100, // #
4, 8, b0100100, b1101010, b0101011, b0010010, b0000000, // $
5, 8, b1100011, b0010011, b0001000, b1100100, b1100011, // %
5, 8, b0110110, b1001001, b1010110, b0100000, b1010000, // &
1, 8, b0000011, b0000000, b0000000, b0000000, b0000000, // '
3, 8, b0011100, b0100010, b1000001, b0000000, b0000000, // (
3, 8, b1000001, b0100010, b0011100, b0000000, b0000000, // )
5, 8, b0101000, b0011000, b0001110, b0011000, b0101000, // *
5, 8, b0001000, b0001000, b0111110, b0001000, b0001000, // +
2, 8, b10110000, b1110000, b0000000, b0000000, b0000000, // ,
4, 8, b0001000, b0001000, b0001000, b0001000, b0000000, // -
2, 8, b1100000, b1100000, b0000000, b0000000, b0000000, // .
4, 8, b1100000, b0011000, b0000110, b0000001, b0000000, // /
3, 8, 0x7c, 0x44, 0x7c, 0x00, 0x00, // 0
1, 8, 0x7c, 0x00, 0x00, 0x00, 0x00, // 1
3, 8, 0x74, 0x54, 0x5c, 0x00, 0x00, // 2
3, 8, 0x54, 0x54, 0x7c, 0x00, 0x00, // 3
3, 8, 0x1c, 0x10, 0x7c, 0x00, 0x00, // 4
3, 8, 0x5c, 0x54, 0x74, 0x00, 0x00, // 5
3, 8, 0x7c, 0x50, 0x70, 0x00, 0x00, // 6
3, 8, 0x04, 0x04, 0x7c, 0x00, 0x00, // 7
3, 8, 0x7c, 0x54, 0x7c, 0x00, 0x00, // 8
3, 8, 0x1c, 0x14, 0x7c, 0x00, 0x00, // 9
1, 8, 0x28, 0x00, 0x00, 0x00, 0x00, // :
2, 8, b10000000, b01010000, b0000000, b0000000, b0000000, // ;
3, 8, b0010000, b0101000, b1000100, b0000000, b0000000, // <
3, 8, b0010100, b0010100, b0010100, b0000000, b0000000, // =
3, 8, b1000100, b0101000, b0010000, b0000000, b0000000, // >
4, 8, b0000010, b1011001, b0001001, b0000110, b0000000, // ?
5, 8, b0111110, b1001001, b1010101, b1011101, b0001110, // @
4, 8, b1111110, b0010001, b0010001, b1111110, b0000000, // a
4, 8, b1111111, b1001001, b1001001, b0110110, b0000000, // b
4, 8, b0111110, b1000001, b1000001, b0100010, b0000000, // c
4, 8, b1111111, b1000001, b1000001, b0111110, b0000000, // d
4, 8, b1111111, b1001001, b1001001, b1000001, b0000000, // e
4, 8, b1111111, b0001001, b0001001, b0000001, b0000000, // f
4, 8, b0111110, b1000001, b1001001, b1111010, b0000000, // g
4, 8, b1111111, b0001000, b0001000, b1111111, b0000000, // h
3, 8, b1000001, b1111111, b1000001, b0000000, b0000000, // i
4, 8, b0110000, b1000000, b1000001, b0111111, b0000000, // j
4, 8, b1111111, b0001000, b0010100, b1100011, b0000000, // k
4, 8, b1111111, b1000000, b1000000, b1000000, b0000000, // l
5, 8, b1111111, b0000010, b0001100, b0000010, b1111111, // m
5, 8, b1111111, b0000100, b0001000, b0010000, b1111111, // n
4, 8, b0111110, b1000001, b1000001, b0111110, b0000000, // o
4, 8, b1111111, b0001001, b0001001, b0000110, b0000000, // p
4, 8, b0111110, b1000001, b1000001, b10111110, b0000000, // q
4, 8, b1111111, b0001001, b0001001, b1110110, b0000000, // r
4, 8, b1000110, b1001001, b1001001, b0110010, b0000000, // s
5, 8, b0000001, b0000001, b1111111, b0000001, b0000001, // t
4, 8, b0111111, b1000000, b1000000, b0111111, b0000000, // u
5, 8, b0001111, b0110000, b1000000, b0110000, b0001111, // v
5, 8, b0111111, b1000000, b0111000, b1000000, b0111111, // w
5, 8, b1100011, b0010100, b0001000, b0010100, b1100011, // x
5, 8, b0000111, b0001000, b1110000, b0001000, b0000111, // y
4, 8, b1100001, b1010001, b1001001, b1000111, b0000000, // z
2, 8, b1111111, b1000001, b0000000, b0000000, b0000000, // [
4, 8, b0000001, b0000110, b0011000, b1100000, b0000000, // backslash
2, 8, b1000001, b1111111, b0000000, b0000000, b0000000, // ]
3, 8, b0000010, b0000001, b0000010, b0000000, b0000000, // hat
4, 8, b1000000, b1000000, b1000000, b1000000, b0000000, // _
2, 8, b0000001, b0000010, b0000000, b0000000, b0000000, // `
4, 8, b0100000, b1010100, b1010100, b1111000, b0000000, // a
4, 8, b1111111, b1000100, b1000100, b0111000, b0000000, // b
4, 8, b0111000, b1000100, b1000100, b0101000, b0000000, // c
4, 8, b0111000, b1000100, b1000100, b1111111, b0000000, // d
4, 8, b0111000, b1010100, b1010100, b0011000, b0000000, // e
3, 8, b0000100, b1111110, b0000101, b0000000, b0000000, // f
4, 8, b10011000, b10100100, b10100100, b01111000, b0000000, // g
4, 8, b1111111, b0000100, b0000100, b1111000, b0000000, // h
3, 8, b1000100, b1111101, b1000000, b0000000, b0000000, // i
4, 8, b1000000, b10000000, b10000100, b1111101, b0000000, // j
4, 8, b1111111, b0010000, b0101000, b1000100, b0000000, // k
3, 8, b1000001, b1111111, b1000000, b0000000, b0000000, // l
5, 8, b1111100, b0000100, b1111100, b0000100, b1111000, // m
4, 8, b1111100, b0000100, b0000100, b1111000, b0000000, // n
4, 8, b0111000, b1000100, b1000100, b0111000, b0000000, // o
4, 8, b11111100, b0100100, b0100100, b0011000, b0000000, // p
4, 8, b0011000, b0100100, b0100100, b11111100, b0000000, // q
4, 8, b1111100, b0001000, b0000100, b0000100, b0000000, // r
4, 8, b1001000, b1010100, b1010100, b0100100, b0000000, // s
3, 8, b0000100, b0111111, b1000100, b0000000, b0000000, // t
4, 8, b0111100, b1000000, b1000000, b1111100, b0000000, // u
5, 8, b0011100, b0100000, b1000000, b0100000, b0011100, // v
5, 8, b0111100, b1000000, b0111100, b1000000, b0111100, // w
5, 8, b1000100, b0101000, b0010000, b0101000, b1000100, // x
4, 8, b10011100, b10100000, b10100000, b1111100, b0000000, // y
3, 8, b1100100, b1010100, b1001100, b0000000, b0000000, // z
3, 8, b0001000, b0110110, b1000001, b0000000, b0000000, // {
1, 8, b1111111, b0000000, b0000000, b0000000, b0000000, // |
3, 8, b1000001, b0110110, b0001000, b0000000, b0000000, // }
4, 8, b0001000, b0000100, b0001000, b0000100, b0000000, // ~
};



int data = 11;
int load = 10;
int clock = 13;
int maxinuse = 1;    //change variable set how many max7219's you'll use
maxmatrix m(data, load, clock, maxinuse);
byte buffer[10];
rtc_millis rtc;

void setup()
{
m.init();
m.setintensity(0);
serial.begin(9600);
rtc.begin(datetime(__date__, __time__));
}

void loop()


datetime = rtc.now();
char timenow[14];

//sprintf(timenow," %.2d:%.2d:%.2d  ",now.hour(),now.minute(),now.second());
sprintf(timenow," %.2d:%.2d ",now.hour(),now.minute());
//printstringwithshift(msg,130);
printstringwithshift(timenow,300);     
 
        delay(100);
m.shiftleft(false, true);

}

void printcharwithshift(char c, int shift_speed)
{
if (c < 32) return;   
c -= 32;
memcpy_p(buffer, ch + 7*c, 7);
m.writesprite(8, 0, buffer);
m.setcolumn(8 + buffer[0], 0);

for (int i=0; i<buffer[0]+1; i++)
{

                delay(shift_speed);
m.shiftleft(false, false);
}
}

void printstringwithshift(char* s, int shift_speed)
{
while (*s != 0)
{
printcharwithshift(*s, shift_speed);
s++;
}
}



Arduino Forum > Using Arduino > Programming Questions > Arduino + DS1307 + 16x8 Led Matrix with Max7219


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support