arduino 小贱钟源码及教程
arduino 小贱钟源码及教程.
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 16274 2012-02-08 22:56 Plotclock程序及安装说明librariesDS3231_TESTDS3231.cpp
文件 5161 2012-02-08 22:51 Plotclock程序及安装说明librariesDS3231_TESTDS3231.h
文件 4645 2014-11-13 22:49 Plotclock程序及安装说明librariesDS3231_TESTExamplesDS3231_TESTDS3231_TEST.ino
文件 548 2012-02-07 11:17 Plotclock程序及安装说明librariesDS3231_TESTkeywords.txt
文件 243 2012-02-08 23:05 Plotclock程序及安装说明librariesDS3231_TESTReadme.txt
文件 2641 2010-03-06 11:09 Plotclock程序及安装说明librariesTimeDateStrings.cpp
文件 392 2009-12-29 17:24 Plotclock程序及安装说明librariesTimeExamplesProcessingSyncArduinoClock
eadme.txt
文件 2015 2009-12-30 18:02 Plotclock程序及安装说明librariesTimeExamplesProcessingSyncArduinoClockSyncArduinoClock.pde
文件 2115 2010-01-06 09:45 Plotclock程序及安装说明librariesTimeExamplesTimeGPSTimeGPS.pde
文件 3458 2010-03-06 19:20 Plotclock程序及安装说明librariesTimeExamplesTimeNTPTimeNTP.pde
文件 1043 2010-01-05 14:13 Plotclock程序及安装说明librariesTimeExamplesTimeRTCTimeRTC.pde
文件 3180 2010-01-06 10:30 Plotclock程序及安装说明librariesTimeExamplesTimeRTCLogTimeRTCLog.pde
文件 2228 2010-01-06 09:53 Plotclock程序及安装说明librariesTimeExamplesTimeRTCSetTimeRTCSet.pde
文件 2392 2010-01-06 10:55 Plotclock程序及安装说明librariesTimeExamplesTimeSerialTimeSerial.pde
文件 2129 2010-01-06 10:55 Plotclock程序及安装说明librariesTimeExamplesTimeSerialDateStringsTimeSerialDateStrings.pde
文件 805 2010-01-05 12:02 Plotclock程序及安装说明librariesTimekeywords.txt
文件 6979 2010-01-11 21:36 Plotclock程序及安装说明librariesTimeReadme.txt
文件 7897 2010-11-01 20:32 Plotclock程序及安装说明librariesTimeTime.cpp
文件 5602 2011-07-22 17:30 Plotclock程序及安装说明librariesTimeTime.h
文件 9323 2017-03-21 23:15 Plotclock程序及安装说明Plotclock程序1.plotclock调试摆臂程序plotclockadjplotclockadj.ino
文件 11308 2017-03-21 23:15 Plotclock程序及安装说明Plotclock程序2.plotclock主程序 - 有时钟模块版plotclockplotclock.ino
文件 10636 2016-07-10 18:24 Plotclock程序及安装说明Plotclock程序3.plotclock主程序 - 无时钟模块版plotclockplotclock.ino
文件 244 2014-11-08 00:48 Plotclock程序及安装说明Plotclock程序3.plotclock主程序 - 无时钟模块版什么是时钟模块?.txt
文件 5409227 2017-07-30 11:31 Plotclock程序及安装说明小贱钟安装说明201707.docx
文件 832 2014-12-20 21:31 Plotclock程序及安装说明说明.txt
目录 0 2016-07-15 17:07 Plotclock程序及安装说明librariesTimeExamplesProcessingSyncArduinoClock
目录 0 2016-07-15 17:07 Plotclock程序及安装说明librariesDS3231_TESTExamplesDS3231_TEST
目录 0 2016-07-15 17:07 Plotclock程序及安装说明librariesTimeExamplesProcessing
目录 0 2016-07-15 17:07 Plotclock程序及安装说明librariesTimeExamplesTimeGPS
目录 0 2016-07-15 17:07 Plotclock程序及安装说明librariesTimeExamplesTimeNTP
............此处省略21个文件信息
/*
DS3231.cpp: DS3231 Real-Time Clock library
original code by
Eric Ayars
4/1/11
updated to Arduino 1.0
John Hubert
Feb 7 2012
Released into the public domain.
*/
#include
#define CLOCK_ADDRESS 0x68
// Constructor
DS3231::DS3231() {
// nothing to do for this constructor.
}
/*****************************************
Public Functions
*****************************************/
void DS3231::getTime(byte& year byte& month byte& date byte& DoW byte& hour byte& minute byte& second) {
byte tempBuffer;
bool PM;
bool h12;
Wire.beginTransmission(CLOCK_ADDRESS);
Wire.write(uint8_t(0x00));
Wire.endTransmission();
Wire.requestFrom(CLOCK_ADDRESS 7);
second = bcdToDec(Wire.read());
minute = bcdToDec(Wire.read());
tempBuffer = bcdToDec(Wire.read());
h12 = tempBuffer & 0b01000000;
if (h12) {
PM = tempBuffer & 0b00100000;
hour = bcdToDec(tempBuffer & 0b00011111);
} else {
hour = bcdToDec(tempBuffer & 0b00111111);
}
DoW = bcdToDec(Wire.read());
date = bcdToDec(Wire.read());
month = bcdToDec(Wire.read() & 0b01111111);
year = bcdToDec(Wire.read());
}
byte DS3231::getSecond() {
Wire.beginTransmission(CLOCK_ADDRESS);
Wire.write(uint8_t(0x00));
Wire.endTransmission();
Wire.requestFrom(CLOCK_ADDRESS 1);
return bcdToDec(Wire.read());
}
byte DS3231::getMinute() {
Wire.beginTransmission(CLOCK_ADDRESS);
Wire.write(0x01);
Wire.endTransmission();
Wire.requestFrom(CLOCK_ADDRESS 1);
return bcdToDec(Wire.read());
}
byte DS3231::getHour(bool& h12 bool& PM) {
byte temp_buffer;
byte hour;
Wire.beginTransmission(CLOCK_ADDRESS);
Wire.write(0x02);
Wire.endTransmission();
Wire.requestFrom(CLOCK_ADDRESS 1);
temp_buffer = Wire.read();
h12 = temp_buffer & 0b01000000;
if (h12) {
PM = temp_buffer & 0b00100000;
hour = bcdToDec(temp_buffer & 0b00011111);
} else {
hour = bcdToDec(temp_buffer & 0b00111111);
}
return hour;
}
byte DS3231::getDoW() {
Wire.beginTransmission(CLOCK_ADDRESS);
Wire.write(uint8_t(0x03));
Wire.endTransmission();
Wire.requestFrom(CLOCK_ADDRESS 1);
return bcdToDec(Wire.read());
}
byte DS3231::getDate() {
Wire.beginTransmission(CLOCK_ADDRESS);
Wire.write(uint8_t(0x04));
Wire.endTransmission();
Wire.requestFrom(CLOCK_ADDRESS 1);
return bcdToDec(Wire.read());
}
byte DS3231::getMonth(bool& Century) {
byte temp_buffer;
byte hour;
Wire.beginTransmission(CLOCK_ADDRESS);
Wire.write(uint8_t(0x05));
Wire.endTransmission();
Wire.requestFrom(CLOCK_ADDRESS 1);
temp_buffer = Wire.read();
Century = temp_buffer & 0b10000000;
return (bcdToDec(temp_buffer & 0b01111111)) ;
}
byte DS3231::getYear() {
Wire.beginTransmission(CLOCK_ADDRESS);
Wire.write(uint8_t(0x06));
Wire.endTransmission();
Wire.requestFrom(CLOCK_ADDRESS 1);
return bcdToDec(Wire.read());
}
void DS3231::setSecond(byte Second) {
// Sets the seconds
// This function also resets the Oscillator Stop Flag which is set
// whenever power is interrupted.
Wire.beginTransmission(CLOCK_ADDRESS);
Wire.wr
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 16274 2012-02-08 22:56 Plotclock程序及安装说明librariesDS3231_TESTDS3231.cpp
文件 5161 2012-02-08 22:51 Plotclock程序及安装说明librariesDS3231_TESTDS3231.h
文件 4645 2014-11-13 22:49 Plotclock程序及安装说明librariesDS3231_TESTExamplesDS3231_TESTDS3231_TEST.ino
文件 548 2012-02-07 11:17 Plotclock程序及安装说明librariesDS3231_TESTkeywords.txt
文件 243 2012-02-08 23:05 Plotclock程序及安装说明librariesDS3231_TESTReadme.txt
文件 2641 2010-03-06 11:09 Plotclock程序及安装说明librariesTimeDateStrings.cpp
文件 392 2009-12-29 17:24 Plotclock程序及安装说明librariesTimeExamplesProcessingSyncArduinoClock
eadme.txt
文件 2015 2009-12-30 18:02 Plotclock程序及安装说明librariesTimeExamplesProcessingSyncArduinoClockSyncArduinoClock.pde
文件 2115 2010-01-06 09:45 Plotclock程序及安装说明librariesTimeExamplesTimeGPSTimeGPS.pde
文件 3458 2010-03-06 19:20 Plotclock程序及安装说明librariesTimeExamplesTimeNTPTimeNTP.pde
文件 1043 2010-01-05 14:13 Plotclock程序及安装说明librariesTimeExamplesTimeRTCTimeRTC.pde
文件 3180 2010-01-06 10:30 Plotclock程序及安装说明librariesTimeExamplesTimeRTCLogTimeRTCLog.pde
文件 2228 2010-01-06 09:53 Plotclock程序及安装说明librariesTimeExamplesTimeRTCSetTimeRTCSet.pde
文件 2392 2010-01-06 10:55 Plotclock程序及安装说明librariesTimeExamplesTimeSerialTimeSerial.pde
文件 2129 2010-01-06 10:55 Plotclock程序及安装说明librariesTimeExamplesTimeSerialDateStringsTimeSerialDateStrings.pde
文件 805 2010-01-05 12:02 Plotclock程序及安装说明librariesTimekeywords.txt
文件 6979 2010-01-11 21:36 Plotclock程序及安装说明librariesTimeReadme.txt
文件 7897 2010-11-01 20:32 Plotclock程序及安装说明librariesTimeTime.cpp
文件 5602 2011-07-22 17:30 Plotclock程序及安装说明librariesTimeTime.h
文件 9323 2017-03-21 23:15 Plotclock程序及安装说明Plotclock程序1.plotclock调试摆臂程序plotclockadjplotclockadj.ino
文件 11308 2017-03-21 23:15 Plotclock程序及安装说明Plotclock程序2.plotclock主程序 - 有时钟模块版plotclockplotclock.ino
文件 10636 2016-07-10 18:24 Plotclock程序及安装说明Plotclock程序3.plotclock主程序 - 无时钟模块版plotclockplotclock.ino
文件 244 2014-11-08 00:48 Plotclock程序及安装说明Plotclock程序3.plotclock主程序 - 无时钟模块版什么是时钟模块?.txt
文件 5409227 2017-07-30 11:31 Plotclock程序及安装说明小贱钟安装说明201707.docx
文件 832 2014-12-20 21:31 Plotclock程序及安装说明说明.txt
目录 0 2016-07-15 17:07 Plotclock程序及安装说明librariesTimeExamplesProcessingSyncArduinoClock
目录 0 2016-07-15 17:07 Plotclock程序及安装说明librariesDS3231_TESTExamplesDS3231_TEST
目录 0 2016-07-15 17:07 Plotclock程序及安装说明librariesTimeExamplesProcessing
目录 0 2016-07-15 17:07 Plotclock程序及安装说明librariesTimeExamplesTimeGPS
目录 0 2016-07-15 17:07 Plotclock程序及安装说明librariesTimeExamplesTimeNTP
............此处省略21个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)