Go Down

Topic: IRremote for my 8x8x8 led cube on the mega (Read 2051 times) previous topic - next topic

sterretje

It will take a bit of time. Can you add your attempt for the jumping box?
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Roonie

Hi ...

Uh ... well ....

  As I didn`t know which methode would be best which to use, the state machine or the currentTime thing I tried both a bit (for about 5 hours  :o ) but finally gave up. At first the state machine with the switch and case look promissing but halfway the effect the delay was put in the for loop instead of after like the first few. This gave me a bit of a headache....  :smiley-confuse:

  And the currentTime thing I still don`t really understand how the timing works even though I have used it on others effects (space and wormsqueeze) succesfully and also how to use it in the for loop to get rid of the delay.....
  Now mayby they are both not suited for the job and there is an otherway. So after a while I thought it was time to ask for some help. But I don`t have any sketches  :(



Roon,

sterretje

By the looks of it, state machine is the correct approach. I'm working on an example for the jumping box.

For the loops, you can use an additional counter (static variable); stay in the same atate till you have done the number of iterations.

I will also explain the currentTime approach.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

sterretje

First the timing  (currentTime). The general approach is possibly most easily explained with the analogy of boiling an egg. You put an egg in water and start boiling it. When you put the egg in the water, you look on the clock to check what the time is; this is the delayStartTime in the delayMS function. Now you go and do something else and on a regular you look on the clock and check if e.g. 4 minutes have lapsed. If not, you continue doing something else again and so on. While the time has not lapsed, delayMS will return false because the egg is not done yet.

Eventually the 4 minutes have lapsed and if (currentTime - delayStartTime >= duration) will evaluate to true and you know that your egg is done. delayMS will return true when your egg is done.

I needed an additional variable so when the delay starts, the code can set the delayStartTime to the current time; if inProgress equals false, we will set the delayStartTime (this is, when you start boiling the egg). As we now have set the delayStartTime, we set the inProgress flag to true so the next time we call delayMS it will not set the delayStartTime again.

Once the 4 minutes have passed, we set inProgress to false so the next time we call delayMS (e.g. you decide to boil another egg) it will look on the clock again to remember the delayStartTime.

I hope that clarifies how it works.

Now to the effect_jumping_box.

I'm going to use a slightly different approach for effect_jumping_box and make use of a few functions that can be called in your jumping box state machine. Analysing your code, I've put the function calls where I see the different states (below identified by >> at the beginning of the line). All function calls for this start with jb (for jumping box).

Code: [Select]
void effect_jumping_box()
{

  // digitalWrite(dp_left,LOW);      // extra effect options off
  // options = 0;
  if (random_run == 1)
  {
    random2 = 2;
  }

  PORTC = B10110110; // display on 2

  int cnt, cnt_2, time;

  //Bottom To Top
>>  jbBottomToTop();
  for (cnt = 0; cnt <= 7; cnt++)
  {
    box_wireframe(0, 0, 0, 7, 7, cnt);
    delay_ms(2000);
  }

  for (cnt = 0; cnt < 7; cnt++)
  {
    clrplane_z(cnt);
    delay_ms(2000);
  }

  //Shift Things Right
>>  jbShiftThingsRight();
  //1
  shift(AXIS_Y, -1);
  for (cnt = 0; cnt <= 7; cnt++)
  {
    setvoxel(cnt, 0, 6);
  }
  delay_ms(2000);
  //2
  shift(AXIS_Y, -1);
  for (cnt = 0; cnt <= 7; cnt++)
  {
    setvoxel(cnt, 0, 5);
  }
  setvoxel(0, 0, 6);
  setvoxel(7, 0, 6);
  delay_ms(2000);
  //3
  shift(AXIS_Y, -1);
  for (cnt = 0; cnt <= 7; cnt++)
  {
    setvoxel(cnt, 0, 4);
  }
  setvoxel(0, 0, 5);
  setvoxel(7, 0, 5);
  setvoxel(0, 0, 6);
  setvoxel(7, 0, 6);
  delay_ms(2000);

  //4
  shift(AXIS_Y, -1);
  for (cnt = 0; cnt <= 7; cnt++)
  {
    setvoxel(cnt, 0, 3);
  }
  setvoxel(0, 0, 4);
  setvoxel(7, 0, 4);
  setvoxel(0, 0, 5);
  setvoxel(7, 0, 5);
  setvoxel(0, 0, 6);
  setvoxel(7, 0, 6);
  delay_ms(2000);

  //5
  shift(AXIS_Y, -1);
  for (cnt = 0; cnt <= 7; cnt++)
  {
    setvoxel(cnt, 0, 2);
  }
  setvoxel(0, 0, 3);
  setvoxel(7, 0, 3);
  setvoxel(0, 0, 4);
  setvoxel(7, 0, 4);
  setvoxel(0, 0, 5);
  setvoxel(7, 0, 5);
  setvoxel(0, 0, 6);
  setvoxel(7, 0, 6);
  delay_ms(2000);

  //6
  shift(AXIS_Y, -1);
  for (cnt = 0; cnt <= 7; cnt++)
  {
    setvoxel(cnt, 0, 1);
  }
  setvoxel(0, 0, 2);
  setvoxel(7, 0, 2);
  setvoxel(0, 0, 3);
  setvoxel(7, 0, 3);
  setvoxel(0, 0, 4);
  setvoxel(7, 0, 4);
  setvoxel(0, 0, 5);
  setvoxel(7, 0, 5);
  delay_ms(2000);

  //7
  shift(AXIS_Y, -1);
  for (cnt = 0; cnt <= 7; cnt++)
  {
    setvoxel(cnt, 0, 0);
  }
  setvoxel(0, 0, 1);
  setvoxel(7, 0, 1);
  setvoxel(0, 0, 2);
  setvoxel(7, 0, 2);
  setvoxel(0, 0, 3);
  setvoxel(7, 0, 3);
  setvoxel(0, 0, 4);
  setvoxel(7, 0, 4);
  setvoxel(0, 0, 5);
  setvoxel(7, 0, 5);
  delay_ms(2000);


  //Right To Left
>>  jbRightToLeft();
  
  for (cnt = 0; cnt <= 7; cnt++)
  {
    box_wireframe(0, 0, 0, 7, cnt, 7);
    delay_ms(2000);
  }
  for (cnt = 0; cnt < 7; cnt++)
  {
    clrplane_y(cnt);
    delay_ms(2000);
  }

  //Shift to the bottom
>>  jbShiftToBottom();
  for (cnt_2 = 6; cnt_2 >= 0; cnt_2--)
  {
    shift(AXIS_Z, -1);
    for (cnt = 0; cnt <= 7; cnt++)
    {
      setvoxel(cnt, cnt_2, 0);
    }
    for (cnt = 6; cnt > cnt_2; cnt--)
    {
      setvoxel(0, cnt, 0);
      setvoxel(7, cnt, 0);
    }

    delay_ms(2000);
  }


  //Make All Wall Box
>>  jbMakeAllWallBox();
  for (cnt = 0; cnt <= 6; cnt++)
  {
    fill(0x00);
    box_walls(0, 0, 0, 7, 7, cnt);
    delay_ms(2000);
  }

  jbResizeBox();
  time = 2000;
  for (cnt_2 = 0; cnt_2 < 5; cnt_2++)
  {
    time = time - 300;
    //Make Box Smaller
    for (cnt = 0; cnt <= 3; cnt++)
    {
      fill(0x00);
      box_walls(cnt, cnt, cnt, 7 - cnt, 7 - cnt, 7 - cnt);
      delay_ms(time);
    }

    //Make Box Bigger
    for (cnt = 0; cnt <= 3; cnt++)
    {
      fill(0x00);
      box_walls(3 - cnt, 3 - cnt, 3 - cnt, 4 + cnt, 4 + cnt, 4 + cnt);
      delay_ms(time);
    }
  }

>>  jbNoIdea();
  for (cnt_2 = 0; cnt_2 < 5; cnt_2++)
  {
    time = time + 300;
    //Make Box Smaller
    for (cnt = 0; cnt <= 3; cnt++)
    {
      fill(0x00);
      box_walls(cnt, cnt, cnt, 7 - cnt, 7 - cnt, 7 - cnt);
      delay_ms(time);
    }
  }
}


Add empty functions after effect_jumping_box.

Code: [Select]
// ==========================================================================================
// jumping box functions                                                                   ==
// ==========================================================================================

/*
  jumping box effect: build a box from bottom to top
  Returns:
    true once completed, else false
*/
bool jbBottomToTop()
{

}

/*
  jumping box effect: shift the box to the right
  Returns:
    true once completed, else false
*/
bool jbShiftThingsRight()
{

}

/*
  jumping box effect: shift the box from the right to the left
  Returns:
    true once completed, else false
*/
bool jbRightToLeft()
{

}

/*
  jumping box effect: shift the box to the bottom
  Returns:
    true once completed, else false
*/
bool jbShiftToBottom()
{

}

/*
  jumping box effect: draw a box with all walls
  Returns:
    true once completed, else false
*/
bool jbMakeAllWallBox()
{

}

/*
  jumping box effect: resize the box
  Returns:
    true once completed, else false
*/
bool jbResizeBox()
{

}

/*
  jumping box effect: I have no idea what this exactly does
  Returns:
    true once completed, else false
*/
bool jbNoIdea()
{

}

You can give better descriptions in the comment blocks of each function as you can exactly see what each part of the effect does.

Next you can move the current functionalities to those functions as shown in the next post.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

sterretje

Code: [Select]
// ==========================================================================================
// jumping box variables and functions                                                     ==
// ==========================================================================================

// because this is used in a few function, it's a global variable; used to be time
int jbTime;

/*
  jumping box effect: build a box from bottom to top
  Returns:
    true once completed, else false
*/
bool jbBottomToTop()
{
  int cnt;

  for (cnt = 0; cnt <= 7; cnt++)
  {
    box_wireframe(0, 0, 0, 7, 7, cnt);
    delay_ms(2000);
  }

  for (cnt = 0; cnt < 7; cnt++)
  {
    clrplane_z(cnt);
    delay_ms(2000);
  }

  return true;
}

/*
  jumping box effect: shift the box to the right
  Returns:
    true once completed, else false
*/
bool jbShiftThingsRight()
{
  int cnt;

  //1
  shift(AXIS_Y, -1);
  for (cnt = 0; cnt <= 7; cnt++)
  {
    setvoxel(cnt, 0, 6);
  }
  delay_ms(2000);
  //2
  shift(AXIS_Y, -1);
  for (cnt = 0; cnt <= 7; cnt++)
  {
    setvoxel(cnt, 0, 5);
  }
  setvoxel(0, 0, 6);
  setvoxel(7, 0, 6);
  delay_ms(2000);
  //3
  shift(AXIS_Y, -1);
  for (cnt = 0; cnt <= 7; cnt++)
  {
    setvoxel(cnt, 0, 4);
  }
  setvoxel(0, 0, 5);
  setvoxel(7, 0, 5);
  setvoxel(0, 0, 6);
  setvoxel(7, 0, 6);
  delay_ms(2000);

  //4
  shift(AXIS_Y, -1);
  for (cnt = 0; cnt <= 7; cnt++)
  {
    setvoxel(cnt, 0, 3);
  }
  setvoxel(0, 0, 4);
  setvoxel(7, 0, 4);
  setvoxel(0, 0, 5);
  setvoxel(7, 0, 5);
  setvoxel(0, 0, 6);
  setvoxel(7, 0, 6);
  delay_ms(2000);

  //5
  shift(AXIS_Y, -1);
  for (cnt = 0; cnt <= 7; cnt++)
  {
    setvoxel(cnt, 0, 2);
  }
  setvoxel(0, 0, 3);
  setvoxel(7, 0, 3);
  setvoxel(0, 0, 4);
  setvoxel(7, 0, 4);
  setvoxel(0, 0, 5);
  setvoxel(7, 0, 5);
  setvoxel(0, 0, 6);
  setvoxel(7, 0, 6);
  delay_ms(2000);

  //6
  shift(AXIS_Y, -1);
  for (cnt = 0; cnt <= 7; cnt++)
  {
    setvoxel(cnt, 0, 1);
  }
  setvoxel(0, 0, 2);
  setvoxel(7, 0, 2);
  setvoxel(0, 0, 3);
  setvoxel(7, 0, 3);
  setvoxel(0, 0, 4);
  setvoxel(7, 0, 4);
  setvoxel(0, 0, 5);
  setvoxel(7, 0, 5);
  delay_ms(2000);

  //7
  shift(AXIS_Y, -1);
  for (cnt = 0; cnt <= 7; cnt++)
  {
    setvoxel(cnt, 0, 0);
  }
  setvoxel(0, 0, 1);
  setvoxel(7, 0, 1);
  setvoxel(0, 0, 2);
  setvoxel(7, 0, 2);
  setvoxel(0, 0, 3);
  setvoxel(7, 0, 3);
  setvoxel(0, 0, 4);
  setvoxel(7, 0, 4);
  setvoxel(0, 0, 5);
  setvoxel(7, 0, 5);
  delay_ms(2000);

  return true;
}

/*
  jumping box effect: shift the box from the right to the left
  Returns:
    true once completed, else false
*/
bool jbRightToLeft()
{
  int cnt;
  for (cnt = 0; cnt <= 7; cnt++)
  {
    box_wireframe(0, 0, 0, 7, cnt, 7);
    delay_ms(2000);
  }
  for (cnt = 0; cnt < 7; cnt++)
  {
    clrplane_y(cnt);
    delay_ms(2000);
  }

  return true;
}

/*
  jumping box effect: shift the box to the bottom
  Returns:
    true once completed, else false
*/
bool jbShiftToBottom()
{
  int cnt, cnt_2;

  for (cnt_2 = 6; cnt_2 >= 0; cnt_2--)
  {
    shift(AXIS_Z, -1);
    for (cnt = 0; cnt <= 7; cnt++)
    {
      setvoxel(cnt, cnt_2, 0);
    }
    for (cnt = 6; cnt > cnt_2; cnt--)
    {
      setvoxel(0, cnt, 0);
      setvoxel(7, cnt, 0);
    }

    delay_ms(2000);
  }

  return true;
}

/*
  jumping box effect: draw a box with all walls
  Returns:
    true once completed, else false
*/
bool jbMakeAllWallBox()
{
  int cnt;

  for (cnt = 0; cnt <= 6; cnt++)
  {
    fill(0x00);
    box_walls(0, 0, 0, 7, 7, cnt);
    delay_ms(2000);
  }
  return true;
}

/*
  jumping box effect: resize the box
  Returns:
    true once completed, else false
*/
bool jbResizeBox()
{
  int cnt, cnt_2;
  jbTime = 2000;
  for (cnt_2 = 0; cnt_2 < 5; cnt_2++)
  {
    jbTime = jbTime - 300;
    //Make Box Smaller
    for (cnt = 0; cnt <= 3; cnt++)
    {
      fill(0x00);
      box_walls(cnt, cnt, cnt, 7 - cnt, 7 - cnt, 7 - cnt);
      delay_ms(jbTime);
    }

    //Make Box Bigger
    for (cnt = 0; cnt <= 3; cnt++)
    {
      fill(0x00);
      box_walls(3 - cnt, 3 - cnt, 3 - cnt, 4 + cnt, 4 + cnt, 4 + cnt);
      delay_ms(jbTime);
    }
  }

  return true;
}

/*
  jumping box effect: I have no idea what this exactly does
  Returns:
    true once completed, else false
*/
bool jbNoIdea()
{
  int cnt, cnt_2;

  for (cnt_2 = 0; cnt_2 < 5; cnt_2++)
  {
    jbTime = jbTime + 300;
    //Make Box Smaller
    for (cnt = 0; cnt <= 3; cnt++)
    {
      fill(0x00);
      box_walls(cnt, cnt, cnt, 7 - cnt, 7 - cnt, 7 - cnt);
      delay_ms(jbTime);
    }
  }

  return true;
}


And effect_jumping_box now looks like
Code: [Select]
bool effect_jumping_box()
{

  // digitalWrite(dp_left,LOW);      // extra effect options off
  // options = 0;
  if (random_run == 1)
  {
    random2 = 2;
  }

  PORTC = B10110110; // display on 2

  //Bottom To Top
  jbBottomToTop();

  //Shift Things Right
  jbShiftThingsRight();

  //Right To Left
  jbRightToLeft();

  //Shift to the bottom
  jbShiftToBottom();

  //Make All Wall Box
  jbMakeAllWallBox();

  jbResizeBox();

  jbNoIdea();
 
  return true;
}

You might already see the state machine for effect_jumping_box taking shape. Next we can implement the state machine
Code: [Select]
/*
  jumping box effect
  Returns:
    true once completed, else false
*/
bool effect_jumping_box()
{
  // current state of the jumping box effect
  static int currentState;

  // digitalWrite(dp_left,LOW);      // extra effect options off
  // options = 0;
  if (random_run == 1)
  {
    random2 = 2;
  }

  PORTC = B10110110; // display on 2

  switch (currentState)
  {
    // Bottom To Top
    case 0:
      if (jbBottomToTop() == true)
      {
        currentState++;
      }
      break;
    // Shift Things Right
    case 1:
      if (jbShiftThingsRight() == true)
      {
        currentState++;
      }
      break;
    // Right To Left
    case 2:
      if (jbRightToLeft()() == true)
      {
        currentState++;
      }
      break;
    // Shift to the bottom
    case 3:
      if (jbShiftToBottom() == true)
      {
        currentState++;
      }
      break;
    // Make All Wall Box
    case 4:
      if (jbMakeAllWallBox() == true)
      {
        currentState++;
      }
      break;
    // resize box
    case 5:
      if (jbResizeBox() == true)
      {
        currentState++;
      }
      break;
    // no idea
    case 6:
      if (jbNoIdea() == true)
      {
        // this was the last state of the jumping box effect; reset currentState
        currentState = 0;
        // indicate that jumping box is finished
        return true;
      }
      break;
  }

  // indicate that jumping box is not finished yet
  return false;
}

Please note that there is no delay state as for the roon effect; those 'delays' will be implemented in the functions and work similar as the 'delay' in the rain effect.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

sterretje

Now you can rework the functions. If you look closely at jbBottomToTop, you can see two states (the two for-loops). You can use two functions but as I have difficulty visualising wat happens on your cube, I can't come up with proper names for them and hence left it.

So with two states, we can implement them in this function
Code: [Select]
/*
  jumping box effect: build a box from bottom to top
  Returns:
    true once completed, else false
*/
bool jbBottomToTop()
{
  // current state
  static byte currentState = 0;
  // loop counter
  static byte counter = 0;

  // last time that bottom-to-top was updated
  static unsigned long lastUpdateTime;

  switch (currentState)
  {
    case 0:
      // if first time or if 'delay' lapsed
      if (counter == 0 || currentTime - lastUpdateTime > 2000)
      {
        lastUpdateTime = currentTime;

        // if we have done all steps
        if (counter == 8)
        {
          // reset counter for the next step
          counter = 0;
          // next step
          currentState = 1;
        }
        else
        {
          // draw and increment counter
          box_wireframe(0, 0, 0, 7, 7, counter++);
        }
      }
      break;
    case 1:
      // if first time or if 'delay' lapsed
      if (counter == 0 || currentTime - lastUpdateTime > 2000)
      {
        lastUpdateTime = currentTime;

        // if we have done all steps
        if (counter == 8)
        {
          // reset counter for the next time
          counter = 0;
          // next step (go back to first step)
          currentState = 0;

          // here we're done with the full bottom-to-top
          return true;
        }
        else
        {
          // draw and increment counter
          clrplane_z(counter++);
        }
      }
      break;
  }
 
  // not done yet with this part of the effect
  return false;
}


And that's it for today. Maybe more tomorrow (time permitting).
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Roonie

 :o  :o  super explanation ...

thankx a lot.

I think I got it a bit  :)
I got ` jbShiftThingsRight` as you call it, also working.





Roonie

I seem to be a bit stuck now ....

3 `jumping_box` functions have for loops in for loops..... This has me a bit puzzled????


sterretje

I thought that those nested for loops would give you a bit of gray hairs. From memory, you can create a new function for the inner loop based on the given principles; for e.g. jbResizeBox, you can call them e.g. jbMakeBoxBigger() and jbMakeBoxSmaller().

Now those functions need to know about the variable jbTime (because the inner loop uses it). One of the functions that I gave you long ago used a parameter (I think it was called iterations in effect_rain, not sure). So e.g. your jbMakeBoxBigger can look like
Code: [Select]
bool jbMakeBoxBigger(int delayTime)
{
  ...
  ...
}

and you can use dat in the compare of the times.

Next you can work on bool jbResizeBox() calling those two functions. I might have time today or else in the weekend to look further into it. There might be another approach as well.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Roonie

Yes yes ....

I got the rest of the effect to work ....
Now one last effect to go, haven`t look at it yet. Been sitting too long behind the computer as it is.

Again thankx for al your help...
Still have a couple of lillte problems to sovle  :o

So probally I`ll give you another shout again .

Roonie

Now I got them all to work with my remote....  8)

Again thankx for the help.

sterretje

Gefeliciteerd :)

That's great. If you attach your complete code, I will see if I can find time to look at it and maybe rework it to a more consistent code; I showed (and used) different approaches for different problems but probably everything can be caught with one generic approach.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Roonie

Ja, dank je wel  :)


I must say I`m a bit proud of myself. But without the help of you and J-M-L in the beginning with the programming from the Uno to the Mega. I wouldn`t have been able to get it working.
Now the coding probally isn`t the neatest or effeicent, but hey it gets the job done and as they `er zijn meerdere wegen naar Rome`.  ;)
I also want to `add` some extra features like time and temperature. But for now it`s time for a bit of a rest. Also need to do some chores around my house ........

I put a video online so you can see the result......



sterretje

You have a few bugs in your code. In the IDE menu File -> preferences, set compiler warnings to all and compile your code. You will see plenty orange lines coming along. They are all warnings but the ones that state "warning: control reaches end of non-void function [-Wreturn-type]" need attention.

They indicate that the function at that point does not return anything so it basically 'returns' something unknown. When you check the return value in the caller, it will interpret the unknown (in the below true or false, but no-one knows what it will be). This unknown can one time be e.g. true, the other time false.

e.g. your code contains
Code: [Select]
      if (jumping_box4() == true) {
        currentState++;
      }

but one of the warnings indicates
Code: [Select]
C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino: In function 'bool jumping_box4()':

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:1694:1: warning: control reaches end of non-void function [-Wreturn-type]

 }

 ^



Below a complete list that I get
Code: [Select]

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino: In function 'void loop()':

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:192:7: warning: unused variable 'i' [-Wunused-variable]

   int i,x,y,z;

       ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:267:13: warning: unused variable 'iir' [-Wunused-variable]

 static byte iir;

             ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino: In function 'bool effect_text()':

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:1367:1: warning: no return statement in function returning non-void [-Wreturn-type]

 }

 ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino: In function 'bool jumping_box6()':

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:1731:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

 if (var2==1 && currentTime - lastUpdateTime > jbTime){ 

                                             ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:1744:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

 if (var2==2 && currentTime - lastUpdateTime > jbTime){

                                             ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino: In function 'bool jumping_box7()':

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:1777:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

 if (var2==1 && currentTime - lastUpdateTime > jbTime){ 

                                             ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:1790:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

 if (var2==2 && currentTime - lastUpdateTime > jbTime){

                                             ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:1803:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

 if (var2==3 && currentTime - lastUpdateTime > jbTime){ 

                                             ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino: In function 'void effect_random_filler()':

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:1910:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

 if (currentTime - lastUpdateTime > 4 - i){     // speed

                                  ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino: In function 'void effect_rain()':

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:1983:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

 if (var4==1 && currentTime - lastUpdateTime >= 90-(ii/2)){ // faster falling raindrops 

                                             ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino: In function 'void effect_boxside_randsend_parallel(char, int)':

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:2182:5: warning: variable 'notdone' set but not used [-Wunused-but-set-variable]

 int notdone = 1;

     ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino: In function 'void effect_space()':

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:2302:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

 if  (var7==0 && currentTime - lastUpdateTime >= timing){

                                              ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:2321:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

 if  (var7==1 && currentTime - lastUpdateTime >= timing){    // same speed

                                              ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:2340:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

 if (var7==2 && currentTime - lastUpdateTime >= timing){

                                             ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:2362:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

 if (var7==3 && currentTime - lastUpdateTime >= timing){    // same speed   

                                             ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino: In function 'void effect_wormsqueeze(int, int, int)':

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:2547:5: warning: unused variable 'i' [-Wunused-variable]

 int i,j,k,dx,dy;

     ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:2550:5: warning: unused variable 't' [-Wunused-variable]

 int t = 0;

     ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino: In function 'void line(int, int, int, int, int, int)':

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:3052:17: warning: variable 'lasty' set but not used [-Wunused-but-set-variable]

   unsigned char lasty,lastz;

                 ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:3052:23: warning: variable 'lastz' set but not used [-Wunused-but-set-variable]

   unsigned char lasty,lastz;

                       ^

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino: In function 'bool jumping_box4()':

C:\Users\sterretje\Documents\Arduino\Forums\roonie\roonie_final\roonie_final.ino:1694:1: warning: control reaches end of non-void function [-Wreturn-type]

 }

 ^
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Roonie

hey,

  Thankx for showing me that I thought that everything was good, since everything seems to work now the way I want. But like I said ` the coding probally isn`t the neatest or effeicent, but hey it gets the job done`.
  I will have a look at it when I`m going to do some upgrades..... I want to display the time and temperature when I press the `info` button on the remote. And also try to build some options in some of the effects.

Go Up