#3
Сообщение
igrik1972 » 22.08.2017{, 01:55}
а блока под ДУЕ ни у кого нет случайно .......... у меня есть то что принимает ДУЕ но нужен блок
Добавлено (21.08.2017, 22:14)
---------------------------------------------
надо сотворить чудо под ДУЕ
/*
DS3231_test.pde
Eric Ayars
4/11
Test/demo of read routines for a DS3231 RTC.
Turn on the serial monitor after loading this to check if things are
working as they should.
*/
#include <DS3231.h>
#include <Wire.h>
DS3231 Clock;
bool Century=false;
bool h12;
bool PM;
byte ADay, AHour, AMinute, ASecond, ABits;
bool ADy, A12h, Apm;
void setup() {
// Start the I2C interface
Wire.begin();
// Start the serial interface
Serial.begin(9600);
}
void loop() {
// send what's going on to the serial monitor.
// Start with the year
Serial.print("2");
if (Century) { // Won't need this for 89 years.
Serial.print("1");
} else {
Serial.print("0");
}
Serial.print(Clock.getYear(), DEC);
Serial.print(' ');
// then the month
Serial.print(Clock.getMonth(Century), DEC);
Serial.print(' ');
// then the date
Serial.print(Clock.getDate(), DEC);
Serial.print(' ');
// and the day of the week
Serial.print(Clock.getDoW(), DEC);
Serial.print(' ');
// Finally the hour, minute, and second
Serial.print(Clock.getHour(h12, PM), DEC);
Serial.print(' ');
Serial.print(Clock.getMinute(), DEC);
Serial.print(' ');
Serial.print(Clock.getSecond(), DEC);
// Display the temperature
Serial.print("T=");
Serial.print(Clock.getTemperature(), 2);
// Tell whether the time is (likely to be) valid
if (Clock.oscillatorCheck()) {
Serial.print(" O+");
} else {
Serial.print(" O-");
}
// Indicate whether an alarm went off
if (Clock.checkIfAlarm(1)) {
Serial.print(" A1!");
}
if (Clock.checkIfAlarm(2)) {
Serial.print(" A2!");
}
// New line on display
Serial.print('\n');
// Display Alarm 1 information
Serial.print("Alarm 1: ");
Clock.getA1Time(ADay, AHour, AMinute, ASecond, ABits, ADy, A12h, Apm);
Serial.print(ADay, DEC);
if (ADy) {
Serial.print(" DoW");
} else {
Serial.print(" Date");
}
Serial.print(' ');
Serial.print(AHour, DEC);
Serial.print(' ');
Serial.print(AMinute, DEC);
Serial.print(' ');
Serial.print(ASecond, DEC);
Serial.print(' ');
if (Clock.checkAlarmEnabled(1)) {
Serial.print("enabled");
}
Serial.print('\n');
// Display Alarm 2 information
Serial.print("Alarm 2: ");
Clock.getA2Time(ADay, AHour, AMinute, ABits, ADy, A12h, Apm);
Serial.print(ADay, DEC);
if (ADy) {
Serial.print(" DoW");
} else {
Serial.print(" Date");
}
Serial.print(' ');
Serial.print(AHour, DEC);
Serial.print(' ');
Serial.print(AMinute, DEC);
Serial.print(' ');
if (Clock.checkAlarmEnabled(2)) {
Serial.print("enabled");
}
Serial.print(ABits, BIN);
Serial.print('\n');
Serial.print('\n');
delay(1000);
}
Добавлено (22.08.2017, 01:55)
---------------------------------------------
все таки крутые полковники, майоры, а мозги где....... я все таки исправил блок DS3231 под ардуино на ардуино дуе и все отлично пошло без проблем .......
БЫЛО _
Wire.requestFrom(0x68, 7); // request seven bytes
while (Wire.available()) {
seconds = bcdToDec( Wire.read() & B01111111 );
minutes = bcdToDec( Wire.read() & B01111111 );
hours = bcdToDec( Wire.read() & B00111111 );
day = bcdToDec( Wire.read() & B00000111 );
date = bcdToDec( Wire.read() & B00111111 );
month = bcdToDec(Wire.read() & B00011111 );
year = (2000 + bcdToDec( Wire.read() ) ); }
СТАЛО_
Wire.requestFrom(0x68, 7); // request seven bytes
while (Wire.available()) {
seconds = bcdToDec( Wire.read() );
minutes = bcdToDec( Wire.read() );
hours = bcdToDec( Wire.read() );
day = bcdToDec( Wire.read() );
date = bcdToDec( Wire.read() );
month = bcdToDec(Wire.read() );
year = (2000 + bcdToDec( Wire.read() ) ); }
а также исправил выход блока с byte на intejer и все отлично работает .... ах да добавил еще DS3231.h перед Wire.h
спасибо за такую быструю помощь ...... может хоть исправите ошибку с MCP23017, бо также не едет на ардуино 2560 ......
Последний раз редактировалось
igrik1972 22.08.2017{, 01:57}, всего редактировалось 1 раз.