Forum Members section Show your controller My build.

My build.


Post Number:#61 Post Mon Mar 02, 2015 5:55 am
Posts: 70
Topics: 12
Images: 3
Solve rating: 0
Joined: Tue Oct 28, 2014 11:06 am
Topics: 12
Age: 45
Gender: None specified
National Flag:
Netherlands
I am having a small issue with my new ph stamp code. Since i run this code I see that joy reef is having issues with retreiving the data from my ferduino. I guess it is because of the duration it takes to fullfill the 21 reading. Any hints for improving this?

void check_parametro_ph_aquario()
{
  char inData[150];
  char *inParse[150];
  int index = 0;
  int contador = 0;
  boolean stringComplete = false;
  char *str;   
  int count = 0;

  Open_channel(ph1);
  delay(50);
  Serial3.print("T,");
  Serial3.print(tempC);
  Serial3.print('\r');
  do
  {
    if (Serial3.available()>3)
    {
      char inChar = Serial3.read();
      inData[index] = inChar;
      index++;     
      if (inChar == '\r')
      {
        contador ++;
      }
      if(contador == 23)
      {
        inData[index] = '\0';
        contador = 0; 
        stringComplete = true;
      }
    }
  }
  while(stringComplete == false);

  for (int i= 0; i <= index; i++)
  {
    if (inData[i] == '\r')
    {
      inData[i] = ',';
    }
  }

  char *p = inData;

  if (stringComplete == true)
  {

    while ((str = strtok_r(p, ",", &p)) != NULL)
    {   
      inParse[count] = str;
      count++;     
    }
    PHA = 0;
    for(int i= 13; i < 21; i++) //13
    {
      PHA += atof(inParse[i]);
    }
    PHA /= 8; //8
  }
}

Post Number:#62 Post Mon Mar 02, 2015 9:21 am
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Hi!

Which interval do you have to update the pH?

Changed this line on loop?

if((millis() - millis_antes) >= 120000)


Best regards.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#63 Post Mon Mar 02, 2015 9:46 am
Posts: 70
Topics: 12
Images: 3
Solve rating: 0
Joined: Tue Oct 28, 2014 11:06 am
Topics: 12
Age: 45
Gender: None specified
National Flag:
Netherlands

Post Number:#64 Post Mon Mar 02, 2015 9:57 am
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Add this lines to check how many time is needed to update the pH.

After:

int count = 0;


Add:

unsigned long time = millis();


After:

   PHA /= 8; //8
  }


Add:

Serial.print("Time: ");
Serial.println(millis() - time);
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#65 Post Tue May 19, 2015 9:39 am
Posts: 70
Topics: 12
Images: 3
Solve rating: 0
Joined: Tue Oct 28, 2014 11:06 am
Topics: 12
Age: 45
Gender: None specified
National Flag:
Netherlands

Previous



Return to Show your controller





Who is online

Users viewing this topic: No registered users and 1 guest

cron