Array with large number of elements

As it is just a small part which I am discussing here

Several other scripts are there to add

I mean just to save space and make it compact one

or all the time we need to scroll through a number of lines which is time consuming

and blah blah blah blah reasons are involved

One of them is the speed or response time which I observed practically throughout the year with both type of scripts

  1. pointers
  2. passing values directly
    :blush:

Is this script below

void VAL2(int * jug)
{
  if(!digitalRead(ValUp))
  {
    if (level2<* jug)
    {
      level2++;
      delay(250);
      Serial.print(level2);
    }
  }
  if(!digitalRead(ValDw))
  {
    if (level2>7)
    {
      level2--;
      delay(250);
      Serial.print(level2);
    }
  }
}

can be written with full of pointers like this below ??

void VAL2(int * jug, int * mug)
{
  if(!digitalRead(ValUp))
  {
    if (* mug<* jug)
    {
      * mug++;
      delay(250);
      Serial.print(* mug);
    }
  }
  if(!digitalRead(ValDw))
  {
    if (* mug>7)
    {
      * mug--;
      delay(250);
      Serial.print(* mug);
    }
  }
}

Please comment about the mistakes or errors or the right way to write

I am sorry but you have totally lost me. By drip drip feeding information, and not coming clean about what and why you asked this question none for the above code makes any sense to me.

You started off by asking a simple question about array filling which I answered in post #5. Then it seems that you threw in all sorts of curved balls, with lines of code that would not work because you tried to combine the generation of the numbers in the array, with functions that uses those same numbers in an array.

You then continue to bombard the thread with all sorts of nonsense, about pointers and addresses, and wanting the code to be as fast as possible. The way you should go about a project is to get it working and only then do some optimization IF you find it runs slower than you want / need.

Another drip, of information not previously given.

I think this comment sums up your total thread. I guess this is just a classic case of the XY problem - Wikipedia

What happens in this case if you do not resolve it, and keep on ignoring things from all who try and help you, is that volunteers here, stop replying to you. I am very close to bailing out myself.

2 Likes

I bailed out a while ago… unless we see a full requirement document I feel this won’t go anywhere.

4 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.