Go Down

Topic: Nothing showing on screen (Read 88 times) previous topic - next topic



I am trying to use the following code, but the text "The tank is OFF " and " The tank is ON " is not showing on the screen as desired. All serial.print instructions are showing correctly in the serial monitor however. Is anybody able to assist?

Code: [Select]
#include <SPI.h>
#include <Ethernet.h>      // Enable if using Ethernetshield

//#include <UIPEthernet.h>     // Enable if using ENC28J60
#include <LiquidCrystal.h>

boolean reading = false;

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

// assign a MAC address for the ethernet controller.
// fill in your address here:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
// fill in an available IP address on your network here,
// for manual configuration:
IPAddress ip(192,168,0,178);

// fill in your Domain Name Server address here:
//IPAddress myDns(1,1,1,1);

// initialize the library instance:
EthernetClient client;

char server[] = "aveshop.co.uk";

unsigned long lastConnectionTime = 0;          // last time you connected to the server, in milliseconds
boolean lastConnected = false;                 // state of the connection last time through the main loop
const unsigned long postingInterval = 5000;  // delay between updates, in milliseconds

void setup() {
  // start serial port:
  lcd.begin(16, 2);
  // give the ethernet module time to boot up:
  //lcd.setCursor(0, 0);
  //lcd.print("                ");
  // start the Ethernet connection using a fixed IP address and DNS server:
  Ethernet.begin(mac, ip);
  // print the Ethernet board/shield's IP address:
  Serial.print("My IP address:  ");

void loop() {
 // if there are incoming bytes available
 // from the server, read them and print them:
 if (client.available()) {
   char c = client.read();
        if(reading && c == ' ') reading = false;
        if(c == '*') reading = true; //found the *, begin reading the info


switch (c) {
            case '0':
              //add code here for LCD display when tank off
                //lcd.setCursor(0, 0);
              //lcd.print("                ");
                lcd.setCursor(0, 0);
  lcd.print("The tank is OFF ");
                Serial.println("The screen would show off");

            case '1':
            //add code here for LCD display when tank on
                //lcd.setCursor(0, 0);
                //lcd.print("                ");
                lcd.setCursor(0, 0);
          lcd.print(" The tank is ON ");
                Serial.println("The screen would show on");


  // if there's no net connection, but there was one last time
  // through the loop, then stop the client:
  if (!client.connected() && lastConnected) {

  // if you're not connected, and ten seconds have passed since
  // your last connection, then connect again and send data:
  if(!client.connected() && (millis() - lastConnectionTime > postingInterval)) {
  // store the state of the connection for next time through
  // the loop:
  lastConnected = client.connected();

// this method makes a HTTP connection to the server:
void httpRequest() {
  // if there's a successful connection:
  if (client.connect(server, 80)) {
    // send the HTTP PUT request:
    client.println("GET http://aveshop.co.uk/MySql-scripts/report_tankstate.php HTTP/1.0");

    // note the time that the connection was made:
    lastConnectionTime = millis();
  else {
    // if you couldn't make a connection:
    Serial.println("connection failed");




You need to provide more details.
First is: how is your display connected, and a clear photo of that should help.
Did you ever use that screen before,and was it in the same setup ?
Is there anything visible on the screen ?
Load another sketch that does nothing else than put stuff on the display in the current hardware setup.
Get the screen to work that way first so you can find what you're doing wrong at the moment.
Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html


Screen works fine as have used it in another setup before

Wiring is also fine as uploading the standard sketches from the LCD library (HelloWorld / Scroll etc) all work fine.

I've narrowed it down to it must be something to do with the code. The problem is I can't see any reason (from the code) that nothing would show up on the screen in ease of the "case" statements. The code is definitely advancing to that point, as the output to the serial monitor is showing up as expected.


....now working. I changed the pins used to 7 / 6/ 5/ 4/ 3/ 2/ 1.

I've got a feeling that since the ethernet shield uses pins 10, 11, and 12 there were conflicts using both the shield and the screen at the same time.

Go Up