c++ - expected';' before '[' token -


i absolutely can not understand possibly wrong code, missing something. have searched similar problems regarding other tokens, have been useless me. since code not long, go ahead , post here.

unsigned int value; #include <adafruit_neopixel.h> #ifdef __avr__ #include <avr/power.h> #endif #define pin 6 #define num_leds 60 #define brightness 10 adafruit_neopixel strip = adafruit_neopixel(60, pin, neo_grb + neo_khz800);  void setup (){ serial.begin(9600); serial.settimeout(50000); strip.begin(); strip.setbrightness(brightness); strip.begin(); strip.show(); // initialize pixels 'off' }  void loop () { boolean lights; int value[100];  for(int i=0;i<100;i++){ value[i] = analogread(0); }  int j=smallestelement(value);  if(value[j-1]-value[j]>=2 , value[j-1]-value[j]<=30) , value[j-2]-value[j-1]>=2 , value[j-2]-value[j-1]<=30 , value[j+1]-value[j]>50 , value[j+2]>value[j+1]){ //the compiler not okay line lights = true; //the compiler has problem line above } else{ lights=false; }  if(lights){    //if there characteristic drop if(value[j]>=600 , value[j]<=699){ int   one=0; for(int j=0;j<60;j++){ strip.setpixelcolor(j,0,0,0); } for(int i=0;i<15;i++,one++){ strip.setpixelcolor(one,0,255,0); strip.show(); delay(10); } } if(value[j]>=500 , value[j]<=599){ int    two1=0,two2=60; for(int j=0;j<60;j++){ strip.setpixelcolor(j,0,0,0); } for(int i=0;i<30;i++,two1++,two2--){ strip.setpixelcolor(two1,255,255,0); strip.setpixelcolor(two2,255,255,0); strip.show(); delay(10); }   }  }    }  int smallestvalue(int values[100]){ int smallest = values[0]; for(int i=1;i<100;i++){ if(values[i]<smallest){ smallest=values[i]; }   } return smallest; }  int smallestelement(int values[100]){ int i=0; while(values[i]!=smallestvalue(values){   i++;  }  return i; } 

any appreciated, thank much.

your if statement has mismatched parentheses.

your code:

if(     value[j-1]-value[j]>=2 ,      value[j-1]-value[j]<=30) , // <- paren here closes if(     value[j-2]-value[j-1]>=2 ,      value[j-2]-value[j-1]<=30 ,      value[j+1]-value[j]>50 ,      value[j+2]>value[j+1]){      lights = true;  } else{     lights=false; } 

notepad nice take advantage of ide!


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -