Forum Software Ferduino code Scheduled dosages review code

Scheduled dosages review code  [SOLVED]


Post Number:#1 Post Mon Feb 19, 2018 10:18 am
Posts: 69
Topics: 18
Images: 2
Solve rating: 1
Joined: Tue Apr 14, 2015 11:54 pm
Topics: 18
Age: 42
Gender: Male
National Flag:
Indonesia
Halow bro Fernando..
i plan to install dosing schedule in tft for schedule like that exist on the web,

Image

is this complicated enough in code?, if may know can give sample code for pump 1, others can i duplicate .. that if you have time .. :ymblushing: :ymblushing:

thank you,
hope you can help. :ymblushing:

Post Number:#2 Post Mon Feb 19, 2018 10:38 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!

  if (file.open("HDP1.TXT", O_READ))
  {
    while ((n = file.read(buf, sizeof(buf))) > 0)
    {
      minutes = atoi(buf); // time in minutes
    }
    file.close();
  }


This code will get the values in minutes from SD card. You should convert it to hour and print on TFT.

Look for "graficos" tab to see more examples.

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:#3 Post Mon Feb 19, 2018 12:02 pm
Posts: 69
Topics: 18
Images: 2
Solve rating: 1
Joined: Tue Apr 14, 2015 11:54 pm
Topics: 18
Age: 42
Gender: Male
National Flag:
Indonesia
thanks for your quick reply, really this is very complicated .. :)
but i will try to see line by line ... later I will ask you when I hit a dead end :) ,
I hope not bored to answer.

many thanks.

Post Number:#4 Post Tue Feb 27, 2018 11:23 am
Posts: 69
Topics: 18
Images: 2
Solve rating: 1
Joined: Tue Apr 14, 2015 11:54 pm
Topics: 18
Age: 42
Gender: Male
National Flag:
Indonesia
in ferduino tab add
int reviewDos1 = 0; // review for dos1


add new tab
void reviewDos(boolean refreshAll = false)
{
  int16_t n;
  char buf[7];
  int minuto = 0;
  boolean match = false;
  if (file.open("HDP1.TXT", O_READ))
  {
    while ((n = file.read(buf, sizeof(buf))) > 0)
    {
      minuto = atoi(buf);
      reviewDos1 = minuto;       
    }
    file.close();
  }

}


print on TFT
setFont(SMALL, 255, 255, 255, 0, 0, 0);
myGLCD.printNumI(reviewDos1 % 60, 85, 22);
myGLCD.printNumI(reviewDos1 /60, 56, 22);
myGLCD.print(":", 75, 22);


try convert it to hour
is this correct?

have tried many times it turns out my brain can not follow. @-) @-)

Post Number:#5 Post Tue Feb 27, 2018 12:06 pm
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!

Friend try learn the basic first. This is not only copy and paste.

What's the reason for it?

boolean refreshAll = false


What's the reason to copy an int to int?

reviewDos1 = minuto;


The output of this function can be untill 24 values. How do you want save the values in only an int? It should be an array.

while ((n = file.read(buf, sizeof(buf))) > 0)


It will print just a value from text file. A table is needed try using a for.

setFont(SMALL, 255, 255, 255, 0, 0, 0);
myGLCD.printNumI(reviewDos1 % 60, 85, 22);
myGLCD.printNumI(reviewDos1 /60, 56, 22);
myGLCD.print(":", 75, 22);


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:#6 Post Thu Mar 01, 2018 11:21 am
Posts: 69
Topics: 18
Images: 2
Solve rating: 1
Joined: Tue Apr 14, 2015 11:54 pm
Topics: 18
Age: 42
Gender: Male
National Flag:
Indonesia
hi, thanks fernando for quick replay,
I think it was easy just copy paste. but apparently this is quite difficult to understand by me as a beginner. I'm sorry if you can take the time .. to help me make the code for 1 pump only, others maybe I can copy and paste. ;;) :D


thannks.

Post Number:#7 Post Thu Mar 01, 2018 3:24 pm
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

Learn is more important anyway I won't make your job.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.




  • Similar Topics
    Replies
    Views
    Last post

Return to Ferduino code





Who is online

Users viewing this topic: No registered users and 1 guest

cron