void user_input(){
int rin = 8 ;
int gin = 9 ;
int yin = 10 ;
int array[5]={0,0,0,0,0};
for (int i=0; i<5;i++){
if (digitalRead(rin)==HIGH){ int array[i]=0 ;
}
else if (digitalRead(gin)==HIGH){
int array[i]=3 ;
}
else if (digitalRead(yin)==HIGH){
int array[i]=2 ;
} } }
So i created an empty array with 5 values, of which i want to change the 5 Values with a for-loop depending on the input i get over the i/o Pins. I searched the Forum and i think the method i want to use is generally right. But i still get the following error:
error: array must be initialized with a brace-enclosed initializer
This would be right, if i wanted to crate a new array, but i just want to change the Value of the existing one filled with zeroes. What do i need to change to be able to overwrite the Array with my i/o Input?