tapu
Full Member level 5
- Joined
- Sep 15, 2014
- Messages
- 246
- Helped
- 1
- Reputation
- 2
- Reaction score
- 2
- Trophy points
- 1,298
- Location
- india
- Activity points
- 3,164
Dear All,
I have made ccode for arduino UNO in arduino ide for simple alarm clock by using DS1307 as RTC as follow.
But this shows following Error on Output.
Error compiling for board Arduino Uno.
Please guide.
I have made ccode for arduino UNO in arduino ide for simple alarm clock by using DS1307 as RTC as follow.
Code:
/* ----- C Program for Arduino based Alarm Clock ---- */
#include <Wire.h>
#include<EEPROM.h>
#include <RTClib.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(3, 2, 4, 5, 6, 7);
RTC_DS1307 RTC;
int temp,inc,hours1,minut,add=11;
int next=10;
int INC=11;
int set_mad=12;
#define buzzer 13
int HOUR,MINUT,SECOND;
void setup()
{
Wire.begin();
RTC.begin();
lcd.begin(16,2);
pinMode(INC, INPUT);
pinMode(next, INPUT);
pinMode(set_mad, INPUT);
pinMode(buzzer, OUTPUT);
digitalWrite(next, HIGH);
digitalWrite(set_mad, HIGH);
digitalWrite(INC, HIGH);
lcd.setCursor(0,0);
lcd.print("Real Time Clock");
lcd.setCursor(0,1);
lcd.print("Circuit Digest ");
delay(2000);
if(!RTC.isrunning())
{
RTC.adjust(DateTime(__DATE__,__TIME__));
}
}
void loop()
{
int temp=0,val=1,temp4;
DateTime now = RTC.now();
if(digitalRead(set_mad) == 0) //set Alarm time
{
lcd.setCursor(0,0);
lcd.print(" Set Alarm ");
delay(2000);
defualt();
time();
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" Alarm time ");
lcd.setCursor(0,1);
lcd.print(" has been set ");
delay(2000);
}
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Time:");
lcd.setCursor(6,0);
lcd.print(HOUR=now.hour(),DEC);
lcd.print(":");
lcd.print(MINUT=now.minute(),DEC);
lcd.print(":");
lcd.print(SECOND=now.second(),DEC);
lcd.setCursor(0,1);
lcd.print("Date: ");
lcd.print(now.day(),DEC);
lcd.print("/");
lcd.print(now.month(),DEC);
lcd.print("/");
lcd.print(now.year(),DEC);
match();
delay(200);
}
void defualt()
{
lcd.setCursor(0,1);
lcd.print(HOUR);
lcd.print(":");
lcd.print(MINUT);
lcd.print(":");
lcd.print(SECOND);
}
/*Function to set alarm time and feed time into Internal eeprom*/
void time()
{
int temp=1,minuts=0,hours=0,seconds=0;
while(temp==1)
{
if(digitalRead(INC)==0)
{
HOUR++;
if(HOUR==24)
{
HOUR=0;
}
while(digitalRead(INC)==0);
}
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Set Alarm Time ");
//lcd.print(x);
lcd.setCursor(0,1);
lcd.print(HOUR);
lcd.print(":");
lcd.print(MINUT);
lcd.print(":");
lcd.print(SECOND);
delay(100);
if(digitalRead(next)==0)
{
hours1=HOUR;
EEPROM.write(add++,hours1);
temp=2;
while(digitalRead(next)==0);
}
}
while(temp==2)
{
if(digitalRead(INC)==0)
{
MINUT++;
if(MINUT==60)
{MINUT=0;}
while(digitalRead(INC)==0);
}
// lcd.clear();
lcd.setCursor(0,1);
lcd.print(HOUR);
lcd.print(":");
lcd.print(MINUT);
lcd.print(":");
lcd.print(SECOND);
delay(100);
if(digitalRead(next)==0)
{
minut=MINUT;
EEPROM.write(add++, minut);
temp=0;
while(digitalRead(next)==0);
}
}
delay(1000);
}
/* Function to chack medication time */
void match()
{
int tem[17];
for(int i=11;i<17;i++)
{
tem[i]=EEPROM.read(i);
}
if(HOUR == tem[11] && MINUT == tem[12])
{
beep();
beep();
beep();
beep();
lcd.clear();
lcd.print("Wake Up........");
lcd.setCursor(0,1);
lcd.print("Wake Up.......");
beep();
beep();
beep();
beep();
}
}
/* function to buzzer indication */
void beep()
{
digitalWrite(buzzer,HIGH);
delay(500);
digitalWrite(buzzer, LOW);
delay(500);
}
Arduino: 1.8.19 (Windows 10), Board: "Arduino Uno"
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\ZAKARIYA\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=0000_0000 -ide-version=10819 -build-path C:\Users\ZAKARIYA\AppData\Local\Temp\arduino_build_617449 -warnings=none -build-cache C:\Users\ZAKARIYA\AppData\Local\Temp\arduino_cache_569506 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.arduinoOTA.path=C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -verbose C:\Users\ZAKARIYA\Documents\Arduino\first\first.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\ZAKARIYA\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=0000_0000 -ide-version=10819 -build-path C:\Users\ZAKARIYA\AppData\Local\Temp\arduino_build_617449 -warnings=none -build-cache C:\Users\ZAKARIYA\AppData\Local\Temp\arduino_cache_569506 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.arduinoOTA.path=C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -verbose C:\Users\ZAKARIYA\Documents\Arduino\first\first.ino
Using board 'uno' from platform in folder: C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5
Using core 'arduino' from platform in folder: C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5
Detecting libraries used...
"C:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\variants\\standard" "C:\\Users\\ZAKARIYA\\AppData\\Local\\Temp\\arduino_build_617449\\sketch\\first.ino.cpp" -o nul
Alternatives for Wire.h: [Wire@1.0]
ResolveLibrary(Wire.h)
-> candidates: [Wire@1.0]
"C:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\variants\\standard" "-IC:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\libraries\\Wire\\src" "C:\\Users\\ZAKARIYA\\AppData\\Local\\Temp\\arduino_build_617449\\sketch\\first.ino.cpp" -o nul
Alternatives for EEPROM.h: [EEPROM@2.0]
ResolveLibrary(EEPROM.h)
-> candidates: [EEPROM@2.0]
"C:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\variants\\standard" "-IC:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\libraries\\Wire\\src" "-IC:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\libraries\\EEPROM\\src" "C:\\Users\\ZAKARIYA\\AppData\\Local\\Temp\\arduino_build_617449\\sketch\\first.ino.cpp" -o nul
Alternatives for RTClib.h: [RTClib-2.0.3@2.0.3]
ResolveLibrary(RTClib.h)
-> candidates: [RTClib-2.0.3@2.0.3]
"C:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\variants\\standard" "-IC:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\libraries\\Wire\\src" "-IC:\\Users\\ZAKARIYA\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\libraries\\EEPROM\\src" "-IC:\\Users\\ZAKARIYA\\Documents\\Arduino\\libraries\\RTClib-2.0.3\\src" "C:\\Users\\ZAKARIYA\\AppData\\Local\\Temp\\arduino_build_617449\\sketch\\first.ino.cpp" -o nul
Alternatives for Adafruit_I2CDevice.h: []In file included from C:\Users\ZAKARIYA\Documents\Arduino\first\first.ino:12:0:
ResolveLibrary(Adafruit_I2CDevice.h)C:\Users\ZAKARIYA\Documents\Arduino\libraries\RTClib-2.0.3\src/RTClib.h:25:10: fatal error: Adafruit_I2CDevice.h: No such file or directory
#include <Adafruit_I2CDevice.h>
-> candidates: []
^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Using library Wire at version 1.0 in folder: C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5\libraries\Wire
Using library EEPROM at version 2.0 in folder: C:\Users\ZAKARIYA\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5\libraries\EEPROM
Using library RTClib-2.0.3 at version 2.0.3 in folder: C:\Users\ZAKARIYA\Documents\Arduino\libraries\RTClib-2.0.3
exit status 1
Error compiling for board Arduino Uno.
Please guide.
Last edited by a moderator: