Hi
I am making a "time trigger relay" project with Attiny85 and DS3231. The project works very well on UNO but after shifting the project to ATTINY85, it is displaying errors. I tried uploading Attiny85 - DS3231 example sketches on Attiny85 and the same result "error".
Simple programs like Blink, Fade are working very well on Attiny85.
#include <DS3231.h>
int Relay = 1;
#define SDA 0
#define SCL 2
DS3231 rtc(SDA, SCL);
Time t;
const int OnHour = 06;
const int OnMin = 00;
const int OffHour = 07;
const int OffMin = 30;
const int OnHour2 = 18;
const int OnMin2 = 00;
const int OffHour2 = 19;
const int OffMin2 = 00;
void setup() {
// Serial.begin(115200); uncomment in case of UNO
rtc.begin();
pinMode(Relay, OUTPUT);
digitalWrite(Relay, LOW);
}
void loop() {
t = rtc.getTime();
// Serial.print(t.hour);
// Serial.print(" hour(s), ");
// Serial.print(t.min);
// Serial.print(" minute(s)");
// Serial.println(" ");
// delay (1000);
if(t.hour == OnHour && t.min == OnMin){
digitalWrite(Relay,HIGH);
// Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin){
digitalWrite(Relay,LOW);
// Serial.println("LIGHT OFF");
}
if(t.hour == OnHour2 && t.min == OnMin2){
digitalWrite(Relay,HIGH);
// Serial.println("LIGHT ON");
}
else if(t.hour == OffHour2 && t.min == OffMin2){
digitalWrite(Relay,LOW);
// Serial.println("LIGHT OFF");
}
}
Errors:
Warning: Board breadboard:avr:atmega328bb doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328BB
In file included from C:\Users\Sunmeet\Desktop\Practice2\libraries\DS3231\DS3231.cpp:26:0:
C:\Users\Sunmeet\Desktop\Practice2\libraries\DS3231\hardware/avr/HW_AVR.h: In member function 'void DS3231::begin()':
C:\Users\Sunmeet\Desktop\Practice2\libraries\DS3231\hardware/avr/HW_AVR.h:3:19: error: '
In file included from c:\program files\arduino-1.8.5\hardware\tools\avr\avr\include\avr\io.h:99:0,
from c:\program files\arduino-1.8.5\hardware\tools\avr\avr\include\avr\pgmspace.h:90,
from C:\Program Files\arduino-1.8.5\hardware\arduino\avr\cores\arduino/Arduino.h:28,
from C:\Users\Sunmeet\Desktop\Practice2\libraries\DS3231\DS3231.h:26,
from C:\Users\Sunmeet\Desktop\Practice2\libraries\DS3231\DS3231.cpp:22:
C:\Users\Sunmeet\Desktop\Practice2\libraries\DS3231\hardware/avr/HW_AVR.h:31:14: error: 'TWEN' was not declared in this scope
TWCR = _BV(TWEN) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTA); // Send START
^
C:\Users\Sunmeet\Desktop\Practice2\libraries\DS3231\hardware/avr/HW_AVR.h:31:26: error: 'TWEA' was not declared in this scope
TWCR = _BV(TWEN) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTA); // Send START
^
C:\Users\Sunmeet\Desktop\Practice2\libraries\DS3231\hardware/avr/HW_AVR.h:31:38: error: 'TWINT' was not declared in this scope
TWCR = _BV(TWEN) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTA); // Send START
^
C:\Users\Sunmeet\Desktop\Practice2\libraries\DS3231\hardware/avr/HW_AVR.h:31:51: error: 'TWSTA' was not declared in this scope
TWCR = _BV(TWEN) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTA); // Send START
^
exit status 1
Error compiling for board ATtiny25/45/85.