Set days of week begin

I have code data types array but cannot set is value a begin. I can set value time start and time stop and it work. How to fix it. Thank you

bool tempDayOfWeek[7] = {true,true,true,true,true,true,true};

Blynk.virtualWrite(V17, checkTimes[0].Start * 60, checkTimes[0].End * 60, tz ,checkTimes[0].daysOfWeek[7]);

The full code would help to understand what the problem is.

Just a guess: Could it be that you try to address an element of an array with an index that is out o range?

Example:

// Define the array @ size of 2
byte anyArray[2] = {11,22};

// access first element with index 0
byte tmp_0 = anyArray[0];
// access second element with index 1
byte tmp_1 = anyArray[1];

In your extract I see:

 ... checkTimes[0].daysOfWeek[7] ...  // i.e checkTimes[0].daysOfWeek[7] has (must have) 8 elements

My calendar only shows seven days … :slightly_smiling_face:

I mean we can setup days of week by set by code

days

This is code for setup time start and time stop begin

  checkTimes[0].Start = 1 *60;
  checkTimes[0].End = 4 * 60;

Hard to guess what goes wrong without seeing the complete code.
Dealing with code snipes does not make sense …

Coming back to your first post:

What is the content of: checkTimes[0].daysOfWeek[7] ?

I assume it is “7” if tempDayOfWeek[6] is true and “” if tempDayOfWeek[6] is false, right?

An example might also help: UpdateTimeInputState.ino

1 Like