Arduino IDE programming question: error in initialize arrays in Class using header and cpp #6
Unanswered
GitHubedklam
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
learn_RTC_use_demo_DS1307_struct_r2_B.zip
Please help me to correct or advise how to correctly initialized.
The followings are screen shots of the main.ino .h and .cpp that are relevant to the errors generated:
errors:
sch_setup::sch_setup(bool _use_date_of_week, char _on_date_week[1][6], float _on_time[3],
= error: no matching function for call to 'sch_setup::sch_setup(bool&, char [1][5], float [3], const char .........
Questions:
Thanks very much for the time in advance? I am new into OOP.
// main program
#include <Arduino.h>
#include <RTClib.h>
#include "All_fixed_setting.h"
// **** For DS1307 chip
// >>>*****very important need to connect ground pin in between UNO *****<<<<<<<nc_
RTC_DS1307 rtc;
DateTime now;
void func_print_time();
bool enb_time_of_week = 0;
char set_on_date_week[1][5] = { "NA" };
float set_on_time[3] = { 0, 0, 0 };
const char set_off_date_week[1][12] = { "NA" };
const float set_off_time[3] = { 11, 05, 22 }; // hr,min,sec
sch_setup set1(enb_time_of_week, set_on_date_week, set_on_time, set_off_date_week, set_off_time);
void setup() { ..............................
///////////////////////////////////////////
// All_fixed_setting.h
#include <Arduino.h>
#ifndef All_fixedsetting_h
#define All_fixedsetting_h
class sch_setup {
public:
static bool use_date_of_week; // 1 is yes
static char on_date_week[1][6]; //{ "Mon" }
static float on_time[3];
static char off_date_week[1][6];
static float off_time[3];
sch_setup(bool, char, float, char, float);
};
const char daysOfTheWeek[7][6] = {
"Sun", "Mon", "Tues", "Wed", "Thur", "Fri", "Sat"
};
#endif
//////////////////////////////////////////////
CPP.cpp
#include "All_fixed_setting.h"
#include <Arduino.h>
sch_setup::sch_setup(bool _use_date_of_week, char _on_date_week[1][6], float _on_time[3],
char _off_date_week[1][6], float _off_time[3]) {
use_date_of_week = _use_date_of_week;
on_date_week = _on_date_week;
on_time = _on_time;
};
Beta Was this translation helpful? Give feedback.
All reactions