0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

使用Arduino的大型实时时钟的制作

454398 来源:wv 2019-10-22 17:36 次阅读

步骤1:

使用p10 Matrix Display和DS3231 RTC时钟

硬件

Arduino Uno x 1

按钮(键盘)x 4

RTC模块(DS3231)

P10点矩阵显示

软件:

Arduino IDE

DMD 2库/DMD库

在此之前,您需要一个必须在Arduino IDE上安装的支持库。要下载上面提到的DMD2库

步骤2:连接

* Arduino-》 RTC模块*

A4-》 SDA

A5-》 SCL

VCC-》 5V

GND-》 GND

* Arduino-》 P10 DMD *

D8-》 SCK

D6-》 A

D7- 》 B

D11-》 R

D13-》 CLK

D9-》 OE

第3步:代码

You can find the sample code below.

//使用Arduino的Chakra Healing Harmonizer

/*访问Channel以获得更有趣的信息项目https://www.youtube.com/channel/UCks-9JSnVb22dlqt.。.*/

byte dayOfWeek=4;

byte dayOfMonth=1;#include //SPI.h must be included as DMD is written by SPI (the IDE complains otherwise)

#include //

#include //

#include “Wendy3x5.h”

#include “Wire.h”

#define DS1307_I2C_ADDRESS 0x68int AlarmSetPin = 2;

int SnoozePin = 3;

int Alarm = 4;

int AlarmSet = 0;

int Snooze = 0;

int a,b;

// Convert normal decimal numbers to binary coded decimal

byte decToBcd(byte val)

{

return ( (val/10*16) + (val%10) );

}// Convert binary coded decimal to normal decimal numbers

byte bcdToDec(byte val)

{

return ( (val/16*10) + (val%16) );

}// 1) Sets the date and time on the ds1307

// 2) Starts the clock

// 3) Sets hour mode to 24 hour clock// Assumes you‘re passing in valid numbersvoid setDateDs1307(byte second, // 0-59

byte minute, // 0-59

byte hour, // 1-23

byte dayOfWeek, // 1-7

byte dayOfMonth, // 1-28/29/30/31

byte month, // 1-12

byte year) // 0-99

{

Wire.beginTransmission(DS1307_I2C_ADDRESS);

Wire.write(0);

Wire.write(decToBcd(second)); // 0 to bit 7 starts the clock

Wire.write(decToBcd(minute));

Wire.write(decToBcd(hour));

Wire.write(decToBcd(dayOfWeek));

Wire.write(decToBcd(dayOfMonth));

Wire.write(decToBcd(month));

Wire.write(decToBcd(year));

Wire.write(00010000); // sends 0x10 (hex) 00010000 (binary) to control register - turns on square wave

Wire.endTransmission();

}// Gets the date and time from the ds1307

void getDateDs1307(byte *second,

byte *minute,

byte *hour,

byte *dayOfWeek,

byte *dayOfMonth,

byte *month,

byte *year)

{

// Reset the register pointer

Wire.beginTransmission(DS1307_I2C_ADDRESS);

Wire.write(0);

Wire.endTransmission();

Wire.requestFrom(DS1307_I2C_ADDRESS, 7);

}//Fire up the DMD library as dmd

DMD dmd(1,1);void ScanDMD()

{

dmd.scanDisplayBySPI();

}void setup()

{

byte second, minute, hour, dayOfWeek, dayOfMonth, month, year; //initialize TimerOne’s interrupt/CPU usage used to scan and refresh the display

Timer1.initialize( 5000 ); //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.

Timer1.attachInterrupt( ScanDMD ); //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI() //clear/init the DMD pixels held in RAM

dmd.clearScreen( true ); //true is normal (all pixels off), false is negative (all pixels on)

dmd.selectFont(Wendy3x5 ); Wire.begin(); // Change these values to what you want to set your clock to.

// You probably only want to set your clock once and then remove

// the setDateDs1307 call. second = 0;

minute = 35;

hour = 11; // use 24-hour time otherwise day/date calculations will be off

dayOfWeek = 1;

dayOfMonth = 23;

month = 3;

year = 14;

//uncomment the setDateDs1307 call below to set time to intervals above. Remember if you set the time

//you need to uncomment the line below again otherwise the sketch will only stay at the time set.

//setDateDs1307(second, minute, hour, dayOfWeek, dayOfMonth, month, year); pinMode(AlarmSetPin, INPUT_PULLUP);

pinMode(SnoozePin, INPUT_PULLUP);

pinMode(Alarm, OUTPUT);

digitalWrite(Alarm, LOW);

}void drawDay()

// shows day of week

{

byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;

getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);

switch(dayOfWeek)

{

case 1:

dmd.drawString( 1,0, “Sun,”, 3, GRAPHICS_NORMAL );

break; case 2:

dmd.drawString( 1,0, “Mon,”, 3, GRAPHICS_NORMAL );

break; case 3:

dmd.drawString( 1,0, “Tue,”, 3, GRAPHICS_NORMAL );

break; case 4:

dmd.drawString( 1,0, “Wed,”, 3, GRAPHICS_NORMAL );

break; case 5:

dmd.drawString( 1,0, “Thu,”, 3, GRAPHICS_NORMAL );

break; case 6:

dmd.drawString( 1,0, “Fri,”, 3, GRAPHICS_NORMAL );

break; case 7:

dmd.drawString( 1,0, “Sat,”, 3, GRAPHICS_NORMAL );

break;

}

}void drawDate()

// shows numerical date

{

byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;

getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);

switch(dayOfMonth)

{

case 1:

dmd.drawString( 20,0, “01”, 2, GRAPHICS_NORMAL );

break;

case 2:

dmd.drawString( 20,0, “02”, 2, GRAPHICS_NORMAL );

break;

case 3:

dmd.drawString( 20,0, “03”, 2, GRAPHICS_NORMAL );

break;

case 4:

dmd.drawString( 20,0, “04”, 2, GRAPHICS_NORMAL );

break;

case 5:

dmd.drawString( 20,0, “05”, 2, GRAPHICS_NORMAL );

break;

case 6:

dmd.drawString( 20,0, “06”, 2, GRAPHICS_NORMAL );

break;

case 7:

dmd.drawString( 20,0, “07”, 2, GRAPHICS_NORMAL );

break;

case 8:

dmd.drawString( 20,0, “08”, 2, GRAPHICS_NORMAL );

break;

case 9:

dmd.drawString( 20,0, “09”, 2, GRAPHICS_NORMAL );

break;

case 10:

dmd.drawString( 20,0, “10”, 2, GRAPHICS_NORMAL );

break;

case 11:

dmd.drawString( 20,0, “11”, 2, GRAPHICS_NORMAL );

break;

case 12:

dmd.drawString( 20,0, “12”, 2, GRAPHICS_NORMAL );

break;

case 13:

dmd.drawString( 20,0, “13”, 2, GRAPHICS_NORMAL );

break;

case 14:

dmd.drawString( 20,0, “14”, 2, GRAPHICS_NORMAL );

break;

case 15:

dmd.drawString( 20,0, “15”, 2, GRAPHICS_NORMAL );

break;

case 16:

dmd.drawString( 20,0, “16”, 2, GRAPHICS_NORMAL );

break;

case 17:

dmd.drawString( 20,0, “17”, 2, GRAPHICS_NORMAL );

break;

case 18:

dmd.drawString( 20,0, “18”, 2, GRAPHICS_NORMAL );

break;

case 19:

dmd.drawString( 20,0, “19”, 2, GRAPHICS_NORMAL );

break;

case 20:

dmd.drawString( 20,0, “20”, 2, GRAPHICS_NORMAL );

break;

case 21:

dmd.drawString( 20,0, “21”, 2, GRAPHICS_NORMAL );

break;

case 22:

dmd.drawString( 20,0, “22”, 2, GRAPHICS_NORMAL );

break;

case 23:

dmd.drawString( 20,0, “23”, 2, GRAPHICS_NORMAL );

break;

case 24:

dmd.drawString( 20,0, “24”, 2, GRAPHICS_NORMAL );

break;

case 25:

dmd.drawString( 20,0, “25”, 2, GRAPHICS_NORMAL );

break;

case 26:

dmd.drawString( 20,0, “26”, 2, GRAPHICS_NORMAL );

break;

case 27:

dmd.drawString( 20,0, “27”, 2, GRAPHICS_NORMAL );

break;

case 28:

dmd.drawString( 20,0, “28”, 2, GRAPHICS_NORMAL );

break;

case 29:

dmd.drawString( 20,0, “29”, 2, GRAPHICS_NORMAL );

break;

case 30:

dmd.drawString( 20,0, “30”, 2, GRAPHICS_NORMAL );

break;

case 31:

dmd.drawString( 20,0, “31”, 2, GRAPHICS_NORMAL );

break;

}

}void drawHour()

// draws the hour hand

{

byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;

getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);

if (hour》12) //Remove this if command for 24 hour time

{

hour=hour-12; // This is a 12 hour Clock

}

switch(hour)

{

case 1:

dmd.drawString( 0,0, “01”, 2, GRAPHICS_NORMAL );

break;

case 2:

dmd.drawString( 0,0, “02”, 2, GRAPHICS_NORMAL );

break;

case 3:

dmd.drawString( 0,0, “03”, 2, GRAPHICS_NORMAL );

break;

case 4:

dmd.drawString( 0,0, “04”, 2, GRAPHICS_NORMAL );

break;

case 5:

dmd.drawString( 0,0, “05”, 2, GRAPHICS_NORMAL );

break;

case 6:

dmd.drawString( 0,0, “06”, 2, GRAPHICS_NORMAL );

break;

case 7:

dmd.drawString( 0,0, “07”, 2, GRAPHICS_NORMAL );

break;

case 8:

dmd.drawString( 0,0, “08”, 2, GRAPHICS_NORMAL );

break;

case 9:

dmd.drawString( 0,0, “09”, 2, GRAPHICS_NORMAL );

break;

case 10:

dmd.drawString( 0,0, “10”, 2, GRAPHICS_NORMAL );

break;

case 11:

dmd.drawString( 0,0, “11”, 2, GRAPHICS_NORMAL );

break;

case 12:

dmd.drawString( 0,0, “12”, 2, GRAPHICS_NORMAL );

break;

case 13:

dmd.drawString( 0,0, “13”, 2, GRAPHICS_NORMAL );

break;

case 14:

dmd.drawString( 0,0, “14”, 2, GRAPHICS_NORMAL );

break;

case 15:

dmd.drawString( 0,0, “15”, 2, GRAPHICS_NORMAL );

break;

case 16:

dmd.drawString( 0,0, “16”, 2, GRAPHICS_NORMAL );

break;

case 17:

dmd.drawString( 0,0, “17”, 2, GRAPHICS_NORMAL );

break;

case 18:

dmd.drawString( 0,0, “18”, 2, GRAPHICS_NORMAL );

break;

case 19:

dmd.drawString( 0,0, “19”, 2, GRAPHICS_NORMAL );

break;

case 20:

dmd.drawString( 0,0, “20”, 2, GRAPHICS_NORMAL );

break;

case 21:

dmd.drawString( 0,0, “21”, 2, GRAPHICS_NORMAL );

break;

case 22:

dmd.drawString( 0,0, “22”, 2, GRAPHICS_NORMAL );

break;

case 23:

dmd.drawString( 0,0, “23”, 2, GRAPHICS_NORMAL );

break;

case 24:

dmd.drawString( 0,0, “24”, 2, GRAPHICS_NORMAL );

break;

}

}void drawMinute()

{

byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;

getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);

switch(minute)

{

case 0:

dmd.drawString( 12,0, “00”, 2, GRAPHICS_NORMAL );

break;

case 1:

dmd.drawString( 12,0, “01”, 2, GRAPHICS_NORMAL );

break;

case 2:

dmd.drawString( 12,0, “02”, 2, GRAPHICS_NORMAL );

break;

case 3:

dmd.drawString( 12,0, “03”, 2, GRAPHICS_NORMAL );

break;

case 4:

dmd.drawString( 12,0, “04”, 2, GRAPHICS_NORMAL );

break;

case 5:

dmd.drawString( 12,0, “05”, 2, GRAPHICS_NORMAL );

break;

case 6:

dmd.drawString( 12,0, “06”, 2, GRAPHICS_NORMAL );

break;

case 7:

dmd.drawString( 12,0, “07”, 2, GRAPHICS_NORMAL );

break;

case 8:

dmd.drawString( 12,0, “08”, 2, GRAPHICS_NORMAL );

break;

case 9:

dmd.drawString( 12,0, “09”, 2, GRAPHICS_NORMAL );

break;

case 10:

dmd.drawString( 12,0, “10”, 2, GRAPHICS_NORMAL );

break;

case 11:

dmd.drawString( 12,0, “11”, 2, GRAPHICS_NORMAL );

break;

case 12:

dmd.drawString( 12,0, “12”, 2, GRAPHICS_NORMAL );

break;

case 13:

dmd.drawString( 12,0, “13”, 2, GRAPHICS_NORMAL );

break;

case 14:

dmd.drawString( 12,0, “14”, 2, GRAPHICS_NORMAL );

break;

case 15:

dmd.drawString( 12,0, “15”, 2, GRAPHICS_NORMAL );

break;

case 16:

dmd.drawString( 12,0, “16”, 2, GRAPHICS_NORMAL );

break;

case 17:

dmd.drawString( 12,0, “17”, 2, GRAPHICS_NORMAL );

break;

case 18:

dmd.drawString( 12,0, “18”, 2, GRAPHICS_NORMAL );

break;

case 19:

dmd.drawString( 12,0, “19”, 2, GRAPHICS_NORMAL );

break;

case 20:

dmd.drawString( 12,0, “20”, 2, GRAPHICS_NORMAL );

break;

case 21:

dmd.drawString( 12,0, “21”, 2, GRAPHICS_NORMAL );

break;

case 22:

dmd.drawString( 12,0, “22”, 2, GRAPHICS_NORMAL );

break;

case 23:

dmd.drawString( 12,0, “23”, 2, GRAPHICS_NORMAL );

break;

case 24:

dmd.drawString( 12,0, “24”, 2, GRAPHICS_NORMAL );

break;

case 25:

dmd.drawString( 12,0, “25”, 2, GRAPHICS_NORMAL );

break;

case 26:

dmd.drawString( 12,0, “26”, 2, GRAPHICS_NORMAL );

break;

case 27:

dmd.drawString( 12,0, “27”, 2, GRAPHICS_NORMAL );

break;

case 28:

dmd.drawString( 12,0, “28”, 2, GRAPHICS_NORMAL );

break;

case 29:

dmd.drawString( 12,0, “29”, 2, GRAPHICS_NORMAL );

break;

case 30:

dmd.drawString( 12,0, “30”, 2, GRAPHICS_NORMAL );

break;

case 31:

dmd.drawString( 12,0, “31”, 2, GRAPHICS_NORMAL );

break;

case 32:

dmd.drawString( 12,0, “32”, 2, GRAPHICS_NORMAL );

break;

case 33:

dmd.drawString( 12,0, “33”, 2, GRAPHICS_NORMAL );

break;

case 34:

dmd.drawString( 12,0, “34”, 2, GRAPHICS_NORMAL );

break;

case 35:

dmd.drawString( 12,0, “35”, 2, GRAPHICS_NORMAL );

break;

case 36:

dmd.drawString( 12,0, “36”, 2, GRAPHICS_NORMAL );

break;

case 37:

dmd.drawString( 12,0, “37”, 2, GRAPHICS_NORMAL );

break;

case 38:

dmd.drawString( 12,0, “38”, 2, GRAPHICS_NORMAL );

break;

case 39:

dmd.drawString( 12,0, “39”, 2, GRAPHICS_NORMAL );

break;

case 40:

dmd.drawString( 12,0, “40”, 2, GRAPHICS_NORMAL );

break;

case 41:

dmd.drawString( 12,0, “41”, 2, GRAPHICS_NORMAL );

break;

case 42:

dmd.drawString( 12,0, “42”, 2, GRAPHICS_NORMAL );

break;

case 43:

dmd.drawString( 12,0, “43”, 2, GRAPHICS_NORMAL );

break;

case 44:

dmd.drawString( 12,0, “44”, 2, GRAPHICS_NORMAL );

break;

case 45:

dmd.drawString( 12,0, “45”, 2, GRAPHICS_NORMAL );

break;

case 46:

dmd.drawString( 12,0, “46”, 2, GRAPHICS_NORMAL );

break;

case 47:

dmd.drawString( 12,0, “47”, 2, GRAPHICS_NORMAL );

break;

case 48:

dmd.drawString( 12,0, “48”, 2, GRAPHICS_NORMAL );

break;

case 49:

dmd.drawString( 12,0, “49”, 2, GRAPHICS_NORMAL );

break;

case 50:

dmd.drawString( 12,0, “50”, 2, GRAPHICS_NORMAL );

break;

case 51:

dmd.drawString( 12,0, “51”, 2, GRAPHICS_NORMAL );

break;

case 52:

dmd.drawString( 12,0, “52”, 2, GRAPHICS_NORMAL );

break;

case 53:

dmd.drawString( 12,0, “53”, 2, GRAPHICS_NORMAL );

break;

case 54:

dmd.drawString( 12,0, “54”, 2, GRAPHICS_NORMAL );

break;

case 55:

dmd.drawString( 12,0, “55”, 2, GRAPHICS_NORMAL );

break;

case 56:

dmd.drawString( 12,0, “56”, 2, GRAPHICS_NORMAL );

break;

case 57:

dmd.drawString( 12,0, “57”, 2, GRAPHICS_NORMAL );

break;

case 58:

dmd.drawString( 12,0, “58”, 2, GRAPHICS_NORMAL );

break;

case 59:

dmd.drawString( 12,0, “59”, 2, GRAPHICS_NORMAL );

break;

}

}void drawSec()

{

byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;

getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);

switch(second)

{

case 0:

dmd.drawString( 24,0, “00”, 2, GRAPHICS_NORMAL );

break;

case 1:

dmd.drawString( 24,0, “01”, 2, GRAPHICS_NORMAL );

break;

case 2:

dmd.drawString( 24,0, “02”, 2, GRAPHICS_NORMAL );

break;

case 3:

dmd.drawString( 24,0, “03”, 2, GRAPHICS_NORMAL );

break;

case 4:

dmd.drawString( 24,0, “04”, 2, GRAPHICS_NORMAL );

break;

case 5:

dmd.drawString( 24,0, “05”, 2, GRAPHICS_NORMAL );

break;

case 6:

dmd.drawString( 24,0, “06”, 2, GRAPHICS_NORMAL );

break;

case 7:

dmd.drawString( 24,0, “07”, 2, GRAPHICS_NORMAL );

break;

case 8:

dmd.drawString( 24,0, “08”, 2, GRAPHICS_NORMAL );

break;

case 9:

dmd.drawString( 24,0, “09”, 2, GRAPHICS_NORMAL );

break;

case 10:

dmd.drawString( 24,0, “10”, 2, GRAPHICS_NORMAL );

break;

case 11:

dmd.drawString( 24,0, “11”, 2, GRAPHICS_NORMAL );

break;

case 12:

dmd.drawString( 24,0, “12”, 2, GRAPHICS_NORMAL );

break;

case 13:

dmd.drawString( 24,0, “13”, 2, GRAPHICS_NORMAL );

break;

case 14:

dmd.drawString( 24,0, “14”, 2, GRAPHICS_NORMAL );

break;

case 15:

dmd.drawString( 24,0, “15”, 2, GRAPHICS_NORMAL );

break;

case 16:

dmd.drawString( 24,0, “16”, 2, GRAPHICS_NORMAL );

break;

case 17:

dmd.drawString( 24,0, “17”, 2, GRAPHICS_NORMAL );

break;

case 18:

dmd.drawString( 24,0, “18”, 2, GRAPHICS_NORMAL );

break;

case 19:

dmd.drawString( 24,0, “19”, 2, GRAPHICS_NORMAL );

break;

case 20:

dmd.drawString( 24,0, “20”, 2, GRAPHICS_NORMAL );

break;

case 21:

dmd.drawString( 24,0, “21”, 2, GRAPHICS_NORMAL );

break;

case 22:

dmd.drawString( 24,0, “22”, 2, GRAPHICS_NORMAL );

break;

case 23:

dmd.drawString( 24,0, “23”, 2, GRAPHICS_NORMAL );

break;

case 24:

dmd.drawString( 24,0, “24”, 2, GRAPHICS_NORMAL );

break;

case 25:

dmd.drawString( 24,0, “25”, 2, GRAPHICS_NORMAL );

break;

case 26:

dmd.drawString( 24,0, “26”, 2, GRAPHICS_NORMAL );

break;

case 27:

dmd.drawString( 24,0, “27”, 2, GRAPHICS_NORMAL );

break;

case 28:

dmd.drawString( 24,0, “28”, 2, GRAPHICS_NORMAL );

break;

case 29:

dmd.drawString( 24,0, “29”, 2, GRAPHICS_NORMAL );

break;

case 30:

dmd.drawString( 24,0, “30”, 2, GRAPHICS_NORMAL );

break;

case 31:

dmd.drawString( 24,0, “31”, 2, GRAPHICS_NORMAL );

break;

case 32:

dmd.drawString( 24,0, “32”, 2, GRAPHICS_NORMAL );

break;

case 33:

dmd.drawString( 24,0, “33”, 2, GRAPHICS_NORMAL );

break;

case 34:

dmd.drawString( 24,0, “34”, 2, GRAPHICS_NORMAL );

break;

case 35:

dmd.drawString( 24,0, “35”, 2, GRAPHICS_NORMAL );

break;

case 36:

dmd.drawString( 24,0, “36”, 2, GRAPHICS_NORMAL );

break;

case 37:

dmd.drawString( 24,0, “37”, 2, GRAPHICS_NORMAL );

break;

case 38:

dmd.drawString( 24,0, “38”, 2, GRAPHICS_NORMAL );

break;

case 39:

dmd.drawString( 24,0, “39”, 2, GRAPHICS_NORMAL );

break;

case 40:

dmd.drawString( 24,0, “40”, 2, GRAPHICS_NORMAL );

break;

case 41:

dmd.drawString( 24,0, “41”, 2, GRAPHICS_NORMAL );

break;

case 42:

dmd.drawString( 24,0, “42”, 2, GRAPHICS_NORMAL );

break;

case 43:

dmd.drawString( 24,0, “43”, 2, GRAPHICS_NORMAL );

break;

case 44:

dmd.drawString( 24,0, “44”, 2, GRAPHICS_NORMAL );

break;

case 45:

dmd.drawString( 24,0, “45”, 2, GRAPHICS_NORMAL );

break;

case 46:

dmd.drawString( 24,0, “46”, 2, GRAPHICS_NORMAL );

break;

case 47:

dmd.drawString( 24,0, “47”, 2, GRAPHICS_NORMAL );

break;

case 48:

dmd.drawString( 24,0, “48”, 2, GRAPHICS_NORMAL );

break;

case 49:

dmd.drawString( 24,0, “49”, 2, GRAPHICS_NORMAL );

break;

case 50:

dmd.drawString( 24,0, “50”, 2, GRAPHICS_NORMAL );

break;

case 51:

dmd.drawString( 24,0, “51”, 2, GRAPHICS_NORMAL );

break;

case 52:

dmd.drawString( 24,0, “52”, 2, GRAPHICS_NORMAL );

break;

case 53:

dmd.drawString( 24,0, “53”, 2, GRAPHICS_NORMAL );

break;

case 54:

dmd.drawString( 24,0, “54”, 2, GRAPHICS_NORMAL );

break;

case 55:

dmd.drawString( 24,0, “55”, 2, GRAPHICS_NORMAL );

break;

case 56:

dmd.drawString( 24,0, “56”, 2, GRAPHICS_NORMAL );

break;

case 57:

dmd.drawString( 24,0, “57”, 2, GRAPHICS_NORMAL );

break;

case 58:

dmd.drawString( 24,0, “58”, 2, GRAPHICS_NORMAL );

break;

case 59:

dmd.drawString( 24,0, “59”, 2, GRAPHICS_NORMAL );

break;

}

}void drawCol1()

{

dmd.drawString( 8,0, “:”, 1, GRAPHICS_NORMAL );

}void drawCol2()

{

dmd.drawString( 20,0, “:”, 1, GRAPHICS_NORMAL );

}void runClock()

{

// drawDay();

// drawDate();

drawHour();

drawCol1();

drawMinute();

drawCol2();

drawSec();

// CheckAlarm();}/*void AlarmSequence() {

drawDay();

drawDate();

drawHour();

drawCol();

drawMinute();

digitalWrite(Alarm, HIGH);

delay(1000);

dmd.clearScreen( true );

digitalWrite(Alarm, LOW);

delay(1000);

}

*/

/*void CheckAlarm() {

AlarmSet = digitalRead(AlarmSetPin);

Snooze = digitalRead(SnoozePin);

byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;

getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);*/

/* Only Trigger Alarm If it is a day listed below. This can be changed by changing the numbers to any of the following:

1 = Sunday

2 = Monday

3 = Tuesday

4 = Wednesday

5 = Thursday

6 = Friday

7 = Saturday

*/

/* if(dayOfWeek == 2 || dayOfWeek == 3 || dayOfWeek == 4 || dayOfWeek == 5 ||dayOfWeek == 6) { //This is days ALLOWED to ring alarm

if(hour == 18 && minute == 05 ) { //Set Time Here (In 24 hour Time)

if(AlarmSet == LOW) { //If alarm pin is on

Snooze = digitalRead(SnoozePin);

while(Snooze == HIGH)

{

Snooze = digitalRead(SnoozePin);

AlarmSequence();

}

}

}

}

}

*/

void loop()

{

runClock();

}

第4步:功能

DMD

32 x 16个高亮度红色LED(总共512个LED),间距为10mm

支持5V操作

可以在12米远的地方看到

坚固的塑料框架

板载控制器IC

Arduino兼容库,图形功能

RTC

计算秒,分钟,小时和年份

Accura cy:0ºC至+40ºC时为+ 2ppm至-2ppm,-40ºC至+85ºC时为+ 3.5ppm至-3.5ppm

数字温度传感器,精度为±3ºC

两次日警报

编程方波输出

寄存器老化调整400Khz I2C接口

低功耗

自动断电电池开关电路

CR2032备用电池,使用寿命为两到三年

步骤5:该项目的工作:简单时钟

第6步:该项目的工作:按设置进行计时

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • 时钟
    +关注

    关注

    10

    文章

    1722

    浏览量

    131383
  • Arduino
    +关注

    关注

    187

    文章

    6464

    浏览量

    186693
收藏 人收藏

    评论

    相关推荐

    TPS65950实时时钟时序补偿分析

    电子发烧友网站提供《TPS65950实时时钟时序补偿分析.pdf》资料免费下载
    发表于 10-29 10:01 0次下载
    TPS65950<b class='flag-5'>实时时钟</b>时序补偿分析

    使用实时时钟

    电子发烧友网站提供《使用实时时钟库.pdf》资料免费下载
    发表于 10-22 10:09 0次下载
    使用<b class='flag-5'>实时时钟</b>库

    bq32000实时时钟(RTC)数据表

    电子发烧友网站提供《bq32000实时时钟(RTC)数据表.pdf》资料免费下载
    发表于 08-23 11:23 0次下载
    bq32000<b class='flag-5'>实时时钟</b>(RTC)数据表

    BQ32002实时时钟(RTC)数据表

    电子发烧友网站提供《BQ32002实时时钟(RTC)数据表.pdf》资料免费下载
    发表于 08-23 11:23 0次下载
    BQ32002<b class='flag-5'>实时时钟</b>(RTC)数据表

    bq3285实时时钟(RTC)数据表

    电子发烧友网站提供《bq3285实时时钟(RTC)数据表.pdf》资料免费下载
    发表于 08-23 11:21 0次下载
    bq3285<b class='flag-5'>实时时钟</b>(RTC)数据表

    TCXO RTC实时时钟模块的特性

    高精度实时时钟模块内建TCXO数字式实时时钟模块的特征【序文】时间是我们日常生活中的基本概念。火车运行管理、进出场管理等各种处理系统和应用程序按照时间信息工作。在金融、股市领域中,时间操纵着巨大利益
    的头像 发表于 08-14 11:44 303次阅读
    TCXO RTC<b class='flag-5'>实时时钟</b>模块的特性

    京准电钟:基于GPS与北斗高精度实时时钟的时间同步方法

    京准电子分享:基于GPS与北斗卫星高精度实时时钟的时间同步方法
    的头像 发表于 06-18 14:35 644次阅读
    京准电钟:基于GPS与北斗高精度<b class='flag-5'>实时时钟</b>的时间同步方法

    RTC实时时钟的基本概念和工作原理

    在现代电子设备中,精确的时间管理和控制是至关重要的。为了实现这一功能,实时时钟(RTC, Real-Time Clock)模块被广泛应用于各种设备和系统中。RTC模块作为一个独立的定时器,能够提供
    的头像 发表于 05-27 15:43 3428次阅读

    RX-4571LC、NB、SA实时时钟模块

    RX-4571LC实时时钟模块是EPSON推出的一求款额定频率32.768KHz,接口为SPI(3-wire),月偏差为±60 s的实时时钟模块,12脚贴片,具有小尺寸,高稳定性。该款实时时钟模块
    发表于 01-31 11:46 0次下载

    基于51单片机的实时时钟设计

    电子发烧友网站提供《基于51单片机的实时时钟设计.rar》资料免费下载
    发表于 01-12 10:43 12次下载

    基于51单片机的实时时钟+温度应用设计

    电子发烧友网站提供《基于51单片机的实时时钟+温度应用设计.rar》资料免费下载
    发表于 01-12 10:20 0次下载

    基于51单片机的实时时钟设计

    电子发烧友网站提供《基于51单片机的实时时钟设计.rar》资料免费下载
    发表于 01-02 10:15 43次下载

    基于51单片机的实时时钟+温度应用设计

    基于51单片机的实时时钟+温度应用设计(仿真)
    发表于 01-02 09:55 6次下载

    带电池的实时时钟1338 数据表

    电子发烧友网站提供《带电池的实时时钟1338 数据表.pdf》资料免费下载
    发表于 12-21 10:47 0次下载
    带电池的<b class='flag-5'>实时时钟</b>1338 数据表

    RA8804CE实时时钟模块内置调频32.768 kHz晶体单元和DTCXO

    RA8804CE 实时时钟模块内置调频32.768 kHz晶体单元和DTCXO
    的头像 发表于 12-08 10:40 471次阅读
    RA8804CE<b class='flag-5'>实时时钟</b>模块内置调频32.768 kHz晶体单元和DTCXO