hi,
i trying use following code, text "the tank off " , " tank on " not showing on screen desired. serial.print instructions showing correctly in serial monitor however. able assist?
thanks.
i trying use following code, text "the tank off " , " tank on " not showing on screen desired. serial.print instructions showing correctly in serial monitor however. able 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 mac address ethernet controller.
// fill in address here:
byte mac[] = {
0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed};
// fill in available ip address on network here,
// manual configuration:
ipaddress ip(192,168,0,178);
// fill in domain name server address here:
//ipaddress mydns(1,1,1,1);
// initialize library instance:
ethernetclient client;
char server[] = "aveshop.co.uk";
unsigned long lastconnectiontime = 0; // last time connected server, in milliseconds
boolean lastconnected = false; // state of connection last time through main loop
const unsigned long postinginterval = 5000; // delay between updates, in milliseconds
void setup() {
// start serial port:
serial.begin(9600);
lcd.begin(16, 2);
//lcd.print("initialising....");
// give ethernet module time boot up:
delay(1000);
//lcd.setcursor(0, 0);
//lcd.print(" ");
// start ethernet connection using fixed ip address , dns server:
ethernet.begin(mac, ip);
// print ethernet board/shield's ip address:
serial.print("my ip address: ");
serial.println(ethernet.localip());
}
void loop() {
// if there incoming bytes available
// server, read them , print them:
if (client.available()) {
char c = client.read();
if(reading && c == ' ') reading = false;
if(c == '*') reading = true; //found *, begin reading info
if(reading){
serial.println(c);
switch (c) {
case '0':
//add code here lcd display when tank off
//lcd.setcursor(0, 0);
//lcd.print(" ");
lcd.setcursor(0, 0);
lcd.print("the tank off ");
serial.println("the screen show off");
break;
case '1':
//add code here lcd display when tank on
//lcd.setcursor(0, 0);
//lcd.print(" ");
lcd.setcursor(0, 0);
lcd.print(" tank on ");
serial.println("the screen show on");
break;
}
}
}
// if there's no net connection, there 1 last time
// through loop, stop client:
if (!client.connected() && lastconnected) {
serial.println();
serial.println("disconnecting.");
serial.println("-------------------------------------------------------------------");
client.stop();
}
// if you're not connected, , ten seconds have passed since
// last connection, connect again , send data:
if(!client.connected() && (millis() - lastconnectiontime > postinginterval)) {
httprequest();
}
// store state of connection next time through
// loop:
lastconnected = client.connected();
}
// method makes http connection server:
void httprequest() {
// if there's successful connection:
if (client.connect(server, 80)) {
serial.println("connecting...");
// send http put request:
client.println("get http://aveshop.co.uk/mysql-scripts/report_tankstate.php http/1.0");
client.println();
// note time connection made:
lastconnectiontime = millis();
}
else {
// if couldn't make connection:
serial.println("connection failed");
serial.println("disconnecting.");
//enc28j60.init(mac);
client.stop();
}
}
thanks.
no.
you need provide more details.
first is: how display connected, , clear photo of should help.
did ever use screen before,and in same setup ?
is there visible on screen ?
load sketch nothing else put stuff on display in current hardware setup.
get screen work way first can find you're doing wrong @ moment.
you need provide more details.
first is: how display connected, , clear photo of should help.
did ever use screen before,and in same setup ?
is there visible on screen ?
load sketch nothing else put stuff on display in current hardware setup.
get screen work way first can find you're doing wrong @ moment.
Arduino Forum > Using Arduino > Displays > Nothing showing on screen
arduino
Comments
Post a Comment