Arduino Fish Tank Project

This code is for my Fishtank project, when I try to verify it I get an error message saying I haven’t declared an analog. Help Please

Fishtank.ino (878 Bytes)

Welcome to the Forum. Please read this post: How to use this forum - please read. Please post your code using code tags. The code tags make the code look

like this

when posting source code files. It makes it easier to read, and can be copied with a single mouse click. Also, if you don't do it, some of the character sequences in the code can be misinterpreted by the forum code as italics or funny emoticons.

Unless the sketch is too large, it's better if you post your code, rather than attach it. When it's attached, we have to download it, create a folder then open your code in our IDE. And afterwards, the folder remains unless we navigate to the "Temp" folder and manually remove it. It's much easier to just view the code in your post.

The part of the code that the OP posted:

void loop() {
Serial.begin(9600);//
digitalWrite(3,HIGH);
delay(100);
analogReference(DEFAULT);
for(int i=0; i<50; i++)  {analogS=analogRead(0);}
digitalWrite(3,LOW);

Cl=(1.5*100*(2.7589*(pow(10,-30)))*(pow(analog(S),9.578544)));
  t=millis()-tlast;
  Serial.print(190,BYTE);
  Serial.print(Cl,3);
  Serial.print(" ");


if(Cl<LCLsetpoint && t>deadtime ){Salty_State();}

else if(CL>UCLsetpoint &&t>deadtime ){DI_State();}

else(LCLsetpoint<Cl<UCLsetpoint);{Stable_State();}


void Salty_State(){
    C2=(Cl+(Csp-Cl)*G);
    x=((m*(C2-C1))/((1-0F)*(0.01-Cl)));
    topen=(60*(x/FR)/12);
    digitalWrtite(7,HIGH);
    delay(topen);
    digitalWrite(7,LOW);
    tlast=millis();}

void DI_State(){
    C2=(Cl-((Cl-Ssp)*G));
    x=(((m*C2-C1))/((1-0F)*Cl));
    topen=(60*(x/FR)/1.5);
    digitalWrtite(8,HIGH);
    delay(topen);
    digitalWrite(8,LOW);
    tlast=millis();}

You’re missing a pretty good chunk of code there. Why don’t you post the whole thing.

How come analogS sometimes shows up as analog(S). Is that a variable? Or a function? Or what?

else(LCLsetpoint<Cl<UCLsetpoint);{Stable_State();}

else clauses don’t get conditions. They cover everything that isn’t covered by the if statements that they go with. The condition isn’t properly written anyway.