Show Posts
Pages: [1]
1  Using Arduino / Displays / Re: Problem to erase LCD Screen afer displayed message on: December 12, 2012, 03:07:08 am
Hi,

The problem is "lcd.clear()" erase totaly of screen. We havn't Time read the message.
But when I set a delay, the LCD screen display the message character by character ( I send a string ).

That's to say, he displays a first letter, The LCD is erased And he display the second letter And thus on.

(When use CTRL-T, i's opens a new tab ).

PS : I modified the code, when instructions is in a "setup" function, nothing display on LCD.
2  Using Arduino / Displays / Problem to erase LCD Screen afer displayed message on: December 11, 2012, 01:09:27 pm
Hi,

For a few hours, I'm faced a problem with the LCD screen (LiquidCrystal).

I must, with a socket, send messages and display on the LCD Screen. The problem is that messages are displayed side by side but I would like they are erased for display another messages.

I search so to clear the LCD screen between each messages.

Here is my code (the comments are all my test) :
Code:
#include <LiquidCrystal.h>
#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network.
// gateway and subnet are optional:
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
byte mac[] = {
  0x90, 0xA2, 0xDA, 0x0D, 0x02, 0xC7 };
IPAddress ip(192, 168, 1, 17);
//IPAddress gateway(192,168,1, 1);
IPAddress subnet(255, 255, 255, 0);


EthernetServer server(23);
boolean alreadyConnected = false; // whether or not the client was connected previously

void setup() {
  Ethernet.begin(mac, ip, subnet);
  server.begin();
   lcd.clear();
  Serial.begin(9600);
  lcd.begin(16, 2);
}
void loop() {
  //wait for a new client:
int in=0,i;char message[16] = "";
  EthernetClient client = server.available();
  char thisChar;
 
  // when the client sends the first byte, say hello:
 /* if (client) {
    if (!alreadyConnected) {
      // clead out the input buffer:
      client.flush();   
     //lcd.print("We have a new client");

      alreadyConnected = true;
     
    } */
  //i=0;
 
    if (client.available() > 0) {
      //in=1;
 
       thisChar = client.read();
       lcd.print(thisChar);
       delay(300);
       lcd.clear();
     
      /* server.write(thisChar);   
      message[i]=thisChar;
      i++;
      Serial.print("i");
      Serial.println(i);
      //delay(300);
     
      //sprintf(message, "%c", thisChar);
      Serial.print("message");
      Serial.println(message);
     
    }*/
    if(i!=0) message[i]=0;
    if (in==1){
      delay(3000);
      lcd.setCursor(1,0);
    in=0;
  }
}

}

Thanks you in advance for your help.

Cordialy,

(Sorry if my english isn't very good, i'm french).
 
Pages: [1]