regarding loop function

Hello,

I am new to this arduino programming and i need a bit of help with the loop statement. I am trying to get the data from text file to display on the lcd connecting to arduino yun. Which I got it to work.

Problem is as i update the text file the ardunio still displays the old results on lcd until i hit "upload" from the ide.

I want to make it so that it refreshes everytime i update the text file or refresh at certain interval like 5 seconds.

any help is appreciated

below is my code

#include <Bridge.h>
#include <HttpClient.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>

Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);

void setup() {
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
  Bridge.begin();
  Serial.begin(9600);
  display.begin();
  display.setContrast(50);
  display.clearDisplay();
 
  loop();
  display.display();
  display.clearDisplay();
}

void loop (){
  HttpClient client;
  client.get("http://testsite.ucoz.net/data.txt");

  while (client.available()) {

    char c = client.read();
    display.print(c);}


}

You don't need to call 'loop()' from setup().

loop(); //not needed

if I commented out the loop() in setup than nothing is being displayed on the LCD now :frowning:

How long, how many characters is the message?
Since you have no delay in the loop is it possible your are clearing the LCD too fast?
Put some Serial prints before you clear the LCD to make sure.

I think you need to move this line into loop() to update the display.

display.display();