Jump to content

Hello I am writing an arduino sketch and would like to set an array equal to another array based on a variable if that make any sense....

i have an analog read thats reading an array of 3 inputs and i want to set that equal to another array but based on a counter

 

here are  may arrays


const int SliderPin[3] = {14,15,16};

int CurrentProfile = 0;

int Profile_0[3]={0,0,0};
int Profile_1[3]={0,0,0};
int Profile_2[3]={0,0,0};
int Profile_3[3]={0,0,0};

 

 

and here is the code i have so far

 


  if (CurrentProfile > 3) {
    CurrentProfile = 0;
    };
  analogRead(SliderPin) = Profile_(CurrentProfile);

 

hopfully you can see what i want to do im trying to make the program as small as possible so i can port it to cheeper (and smaller) chips as the rest of the code is quite lengthy

Link to comment
https://linustechtips.com/topic/720226-help-with-arduino/
Share on other sites

Link to post
Share on other sites

ok so this is what iv come up with so far still dosent work but i thing im making progress

 

Vars



int CurrentProfile = 0;

int Profile[4][3]={
  {0,0,0},
  {0,0,0},
  {0,0,0},
  {0,0,0}
  };

 

and program


  if (CurrentProfile > 3) {
    CurrentProfile = 0;
    };
  analogRead(SliderPin) = Profile[CurrentProfile];

 

hopefull its just a syntax thing but heres my error


lvalue required as left operand of assignment

Link to comment
https://linustechtips.com/topic/720226-help-with-arduino/#findComment-9169893
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×