0@0
LibraryRoot
LibraryGroup-Строки
LibraryGroup-Конвертация типов
0@-105
296
0@-110
240
498
0@0
root
input
1
43abbe01-b936-4363-b4ae-1e39b1d500c7
LibraryGroup-Установка времени часов
0@0
0
5
3
130@150
150@150 corner: 230@190
130@150 corner: 250@190
171.5d@163.5d
9
2
370@130
390@130 corner: 470@190
370@130 corner: 490@190
396.5d@143.5d
send
370@160
384@160
370@180
9600
398@558
70975375
398@538
36119198
change
1000
D
390@180
250@180 corner: 250@180
StrD-T
31.0d
230@180
250@180
230@170 corner: 250@190
A
A
12@560
227998537
19
4
12@538
30433071
18
DS3231
d-m-Y, H:i:s, D
250@70
270@70 corner: 310@110
250@70 corner: 330@110
282.5d@83.5d
150@70
170@70 corner: 210@110
150@70 corner: 230@110
176.5d@84.5d
6
30@90
50@90 corner: 70.0d@110
30@90 corner: 90.0d@110
54@102.5d
90.0d@100
5.0d
12.0d
кн
398@518
75108618
0.0d
76.0d@100
90.0d@100 corner: 90.0d@100
I
150@100
170@100
230@100
Q
9.0d
210@100
230@100 corner: 230@100
T
250@100
270@100
250@90 corner: 270@110
7
370@70
390@70 corner: 462.0d@110
370@70 corner: 503.0d@110
395.0d@84.0d
370@90 corner: 390@110
370@100
setRTC 3231
setRTC
en
f39e2ef3-8512-41dc-af08-ee4535180a2b
0d24c56d-2661-4b48-9961-4bb57a1da952
46bc3b0a-36e2-440b-8d2d-b1f301962bdd
setRTC
if(en){
if (canResiveData) {
if (Serial.available()) {
inChar = (char)Serial.read();
if (inChar == 1) {
tempIndex = 0;
hasData = 0;
} else {
if (inChar == 2) {
inputString = "";
} else {
if (inChar == 3) {
switch (tempIndex) {
case 0: _RTC1.settime(-1, -1, (inputString.toInt())); break;
case 1: _RTC1.settime(-1, (inputString.toInt())); break;
case 2: _RTC1.settime((inputString.toInt())); break;
case 3: _RTC1.settime(-1, -1, -1, (inputString.toInt())); break;
case 4: _RTC1.settime(-1, -1, -1, -1, (inputString.toInt())); break;
case 5: _RTC1.settime(-1, -1, -1, -1, -1, (inputString.toInt())); break;
case 6: _RTC1.settime(-1, -1, -1, -1, -1, -1, (inputString.toInt())); break;
}
tempIndex++;
} else {
if (inChar == 4) {
hasData = 1;
canResiveData = 0;
} else {
inputString += inChar;
}
}
}
}
}
}
_RTC1.gettime();
if (1)
{
if (! _gen1I)
{
_gen1I = 1;
_gen1O = 1;
_gen1P = millis();
}
}
else
{
_gen1I = 0 ;
_gen1O = 0;
}
if (_gen1I )
{
if ( _isTimer ( _gen1P , 250 ))
{
_gen1P = millis();
_gen1O = ! _gen1O;
}
}
if (_gen1O)
{
if (! _csb1)
{
Serial.write (1);
Serial.write (2);
Serial.print (_RTC1.Hours);
Serial.write (3);
Serial.write (2);
Serial.print (_RTC1.minutes);
Serial.write (3);
Serial.write (2);
Serial.print (_RTC1.seconds);
Serial.write (3);
Serial.write (2);
Serial.print (_RTC1.day);
Serial.write (3);
Serial.write (2);
Serial.print (_RTC1.month);
Serial.write (3);
Serial.write (2);
Serial.print (_RTC1.weekday);
Serial.write (3);
Serial.write (2);
Serial.print (_RTC1.year);
Serial.write (3);
Serial.write (4);
_csb1 = 1;
}
} else {
_csb1 = 0;
}
if (hasData) {
canResiveData = 1;
hasData = 0;
}
}
2208
_RTC1.begin();
Serial.begin(9600);
34
#include
<iarduino_RTC.h>
_RTC1
(RTC_DS1307);
iarduino_RTC
_gen1I
= 0;
bool
_gen1O
= 0;
bool
_gen1P
= 0;
unsigned long
_csb1
= 0;
bool
hasData
= 0;
boolean
canResiveData
= 1;
boolean
tempIndex
= 0;
int
inChar
;
char
inputString
;
String
unsigned long endTime;
endTime = startTime + period;
return (millis() >= endTime);
86
bool
_isTimer
unsigned long
startTime
unsigned long
period
de1be82f-a282-485a-8931-c3948f5b5f8b
setRTC 3231(FlProg V3.0.1 и выше)
if(en){
{ if (canResiveData) {
if (Serial.available()) {
inChar = (char)Serial.read();
if (inChar == 1) {
tempIndex = 0;
hasData = 0;
} else {
if (inChar == 2) {
inputString = "";
} else {
if (inChar == 3) {
switch (tempIndex) {
case 0: set3231Date(seconds, minutes, (inputString.toInt()), date, month, year, day); break;
case 1: set3231Date(seconds, (inputString.toInt()), hours, date, month, year, day); break;
case 2: set3231Date((inputString.toInt()), minutes, hours, date, month, year, day) ; break;
case 3: set3231Date(seconds, minutes, hours, (inputString.toInt()), month, year, day); break;
case 4: set3231Date(seconds, minutes, hours, date, (inputString.toInt()), year, day) ; break;
case 5: set3231Date(seconds, minutes, hours, date, month, (inputString.toInt()), day); break;
case 6: set3231Date(seconds, minutes, hours, date, month, year, (inputString.toInt())); break;
}
tempIndex++;
} else {
if (inChar == 4) {
hasData = 1;
canResiveData = 0;
} else {
inputString += inChar;
}
}
}
}
}
}
if (1)
{
if (! _gen1I)
{
_gen1I = 1;
_gen1O = 1;
_gen1P = millis();
}
}
else
{
_gen1I = 0 ;
_gen1O = 0;
}
if (_gen1I )
{
if ( _isTimer ( _gen1P , 250 ))
{
_gen1P = millis();
_gen1O = ! _gen1O;
}
}
if (_gen1O)
{
if (! _csb1)
{
get3231Date();
_csb1 = 1;
}
} else {
_csb1 = 0;
}
if (hasData) {
canResiveData = 1;
hasData = 0;
}
}
}
1792
Wire.begin();
Serial.begin(9600);
Wire.beginTransmission(DS3231_I2C_ADDRESS);
Wire.write(0x0E);
Wire.write(B00000000);
Wire.write(B10001000);
Wire.endTransmission();
get3231Date();
197
year
;
byte seconds, minutes, hours, day, date, month,
_gen1I
= 0;
bool
_gen1O
= 0;
bool
_gen1P
= 0;
unsigned long
_csb1
= 0;
bool
hasData
= 0;
boolean
canResiveData
= 1;
boolean
tempIndex
= 0;
int
inChar
;
char
inputString
;
String
#define
DS3231_I2C_ADDRESS
0x68
{
Wire.beginTransmission(DS3231_I2C_ADDRESS);
Wire.write(0x00);
Wire.endTransmission();
Wire.requestFrom(DS3231_I2C_ADDRESS, 7);
if (Wire.available()) {
seconds = Wire.read();
minutes = Wire.read();
hours = Wire.read();
day = Wire.read();
date = Wire.read();
month = Wire.read(); //temp month
year = Wire.read();
seconds = (((seconds & B11110000) >> 4) * 10 + (seconds & B00001111));
minutes = (((minutes & B11110000) >> 4) * 10 + (minutes & B00001111));
hours = (((hours & B00110000) >> 4) * 10 + (hours & B00001111));
day = (day & B00000111); // 1-7
date = (((date & B00110000) >> 4) * 10 + (date & B00001111));
month = (((month & B00010000) >> 4) * 10 + (month & B00001111));
year = (((year & B11110000) >> 4) * 10 + (year & B00001111));
}
else { }
}
854
void
get3231Date
{
Wire.beginTransmission(DS3231_I2C_ADDRESS);
Wire.write(0x00);
Wire.write(decToBcd(sec));
Wire.write(decToBcd(minut));
Wire.write(decToBcd(hou));
Wire.write(decToBcd(daW));
Wire.write(decToBcd(dat));
Wire.write(decToBcd(mo));
Wire.write(decToBcd(ye));
Wire.endTransmission();
get3231Date();
}
319
void
set3231Date
byte
sec
byte
minut
byte
hou
byte
dat
byte
mo
byte
ye
byte
daW
{
return ( (val / 10 * 16) + (val % 10) );
}
46
byte
decToBcd
byte
val
72.0d
390@100
330@100 corner: 330@100
310@100
330@100
310@90 corner: 330@110
271.0d
arduinoIDE
20
1024
4096
57
Arduino Uno
142360727