Hello
I’m not really good with programming and finding errors in my programm, so i need your help.
I wrote a sketch that should programm the Arduino to read the time out of the DS1307RTC-Module and than show the time on a 4-digit 7-Segment-Display. I’m using the LedControl Library to control the 7-Segment-Display which is connected to a MAX7219.
This is my code:
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 rtc;
//7-Segment
#include <LedControl.h>
void setup () {
Serial.begin(9600);
//RTC - Vom Beispiel einfach übernommen
#ifdef AVR
Wire.begin();
#else
Wire1.begin()
#endif
rtc.begin();
if (! rtc.isrunning()) {
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
void loop () {
DateTime now = rtc.now();
LedControl seg=LedControl (11, 13, 7, 0);
seg.shutdown(0, false);
seg.setIntensity(0, 15);
//// ANZEIGE DER UHRZEIT
//wie oben: führende 0 bei der Stunde
if (now.hour() < 10) {
seg.setDigit (0, 3, 0, false);
}
//Anzeige Stunde
{seg.setDigit (0, 2, now.hour(), false);}
//wie oben: führende 0 bei der Minute
if (now.minute() < 10) {
seg.setDigit (0, 1, 0, false);
}
//Anzeige der Minute
{seg.setDigit (0, 0, now.minute(), false);
}
}
And this is the ERROR-Message i get:
C:\Users\Alexia\Desktop\programme_arduino\ma\time\time.ino: In function 'void setup()':
time:32: error: a function-definition is not allowed here before '{' token
void loop () {
^
time:57: error: expected '}' at end of input
}
^
time:57: error: expected '}' at end of input
exit status 1
a function-definition is not allowed here before '{' token
Is there anyone who could help me?
Thank you
techniclover