Hello,
I was wondering which type I am supposed to use for the DS1302. Maybe I have used the right type but imported the wrong library. Here is my code.
#include <Wire.h>
#include <DS1302.h>
DS1302 clock;
RTCDateTime dt;
#include <Robojax_SevenSegmentClock.h>
const int digits[]={9,10,11,12};// define digits pins
const int displayPins[] = {2,3,4,5,6,7,8}; // define segment pins
const int colonPin = 13;// colon pin
const int type =1;//1 common Anode, 2 for common cathode
Robojax_SevenSegmentClock clk(displayPins,digits,colonPin,type);
int blinkTime=0;
int blinkStatus=0;
void setup() {
Serial.begin(9600);
// Initialize DS1302
Serial.println("Initialize DS1302");
clock.begin();//for DS1302
clk.begin();
Serial.println("Seven Segment Display Clock");
Serial.println("V 1.0 July 28, 2019");
clock.setDateTime(DATE, TIME);
}
void loop() {
dt = clock.getDateTime();
Serial.print(dt.hour); Serial.print(":");
Serial.print(dt.minute); Serial.print(":");
// Serial.print(dt.second); Serial.println("");
clk.displayTime(dt.hour,dt.minute);
delay(1);
}
and the error
Arduino:1.8.11 (Windows 10), Board:"Arduino Uno"
sketch_may10a:3:8: error: no matching function for call to 'DS1302::DS1302()'
DS1302 clock;
^~~~~
In file included from C:\Users\NATHAN~1\AppData\Local\Temp\arduino_modified_sketch_948489\sketch_may10a.ino:2:0:
C:\Users\Nathan Deveux\Documents\Arduino\libraries\arduino-ds1302-master/DS1302.h:65:3: note: candidate: DS1302::DS1302(uint8_t, uint8_t, uint8_t)
DS1302(uint8_t ce_pin, uint8_t io_pin, uint8_t sclk_pin);
^~~~~~
C:\Users\Nathan Deveux\Documents\Arduino\libraries\arduino-ds1302-master/DS1302.h:65:3: note: candidate expects 3 arguments, 0 provided
C:\Users\Nathan Deveux\Documents\Arduino\libraries\arduino-ds1302-master/DS1302.h:54:7: note: candidate: constexpr DS1302::DS1302(const DS1302&)
class DS1302 {
^~~~~~
C:\Users\Nathan Deveux\Documents\Arduino\libraries\arduino-ds1302-master/DS1302.h:54:7: note: candidate expects 1 argument, 0 provided
C:\Users\Nathan Deveux\Documents\Arduino\libraries\arduino-ds1302-master/DS1302.h:54:7: note: candidate: constexpr DS1302::DS1302(DS1302&&)
C:\Users\Nathan Deveux\Documents\Arduino\libraries\arduino-ds1302-master/DS1302.h:54:7: note: candidate expects 1 argument, 0 provided
sketch_may10a:4:1: error: 'RTCDateTime' does not name a type
RTCDateTime dt;
^~~~~~~~~~~
C:\Users\NATHAN~1\AppData\Local\Temp\arduino_modified_sketch_948489\sketch_may10a.ino:11:63: warning: invalid conversion from 'const int*' to 'int*' [-fpermissive]
Robojax_SevenSegmentClock clk(displayPins,digits,colonPin,type);
^
In file included from C:\Users\NATHAN~1\AppData\Local\Temp\arduino_modified_sketch_948489\sketch_may10a.ino:6:0:
C:\Users\Nathan Deveux\Documents\Arduino\libraries\Robojax-SevenSegmentClock/Robojax_SevenSegmentClock.h:47:5: note: initializing argument 1 of 'Robojax_SevenSegmentClock::Robojax_SevenSegmentClock(int*, int*, int, int)'
Robojax_SevenSegmentClock(int segments[], int digits[], int colon, int type);
^~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\NATHAN~1\AppData\Local\Temp\arduino_modified_sketch_948489\sketch_may10a.ino:11:63: warning: invalid conversion from 'const int*' to 'int*' [-fpermissive]
Robojax_SevenSegmentClock clk(displayPins,digits,colonPin,type);
^
In file included from C:\Users\NATHAN~1\AppData\Local\Temp\arduino_modified_sketch_948489\sketch_may10a.ino:6:0:
C:\Users\Nathan Deveux\Documents\Arduino\libraries\Robojax-SevenSegmentClock/Robojax_SevenSegmentClock.h:47:5: note: initializing argument 2 of 'Robojax_SevenSegmentClock::Robojax_SevenSegmentClock(int*, int*, int, int)'
Robojax_SevenSegmentClock(int segments[], int digits[], int colon, int type);
^~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\NATHAN~1\AppData\Local\Temp\arduino_modified_sketch_948489\sketch_may10a.ino: In function 'void setup()':
sketch_may10a:22:9: error: 'class DS1302' has no member named 'begin'
clock.begin();//for DS1302
^~~~~
sketch_may10a:30:9: error: 'class DS1302' has no member named 'setDateTime'
clock.setDateTime(DATE, TIME);
^~~~~~~~~~~
C:\Users\NATHAN~1\AppData\Local\Temp\arduino_modified_sketch_948489\sketch_may10a.ino: In function 'void loop()':
sketch_may10a:36:4: error: 'dt' was not declared in this scope
dt = clock.getDateTime();
^~
sketch_may10a:36:15: error: 'class DS1302' has no member named 'getDateTime'
dt = clock.getDateTime();
^~~~~~~~~~~
exit status 1
no matching function for call to 'DS1302::DS1302()'
Dit rapport zou meer informatie bevatten met
"Uitgebreide uitvoer weergeven tijden compilatie"
optie aan in Bestand -> Voorkeuren.
I have used the Robojax_SevenSegmentClock library
and the arduino-ds1302-master library
Big thanks in advance.