Hi Again,
I just ran a quick test to get everything laid out properly and I hit a problem while integrating it into my main sketch.
This worked fine
#include <gLCD.h>
const char RST = 8;
const char CS = 9;
const char Clk = 13;
const char Data = 11;
gLCD graphic(RST,CS,Clk,Data,HIGH_SPEED); //High speed
char wt[] = "LOW";
void setup() {
graphic.begin(0,2,0,PHILLIPS_1);
graphic.setBackColour(1,1,1);
graphic.Box(0,0,6100,6100,4);
graphic.setFont(0);
}
void loop() {
//call
graphic.setForeColour(15,15,15); //Text is coloured Blue
graphic.setCoordinate(1,1);
graphic.print("Connected to server:"); //Normal sized text, no background. Hello and World will be printed on seperate lines
//resp
graphic.setCoordinate(1,10);
graphic.setForeColour(0,15,0); //Text is coloured Blue
graphic.print("TRUE"); //Normal
//call
graphic.setForeColour(15,15,15); //Text is coloured Blue
graphic.setCoordinate(1,20);
graphic.print("Standards:"); //Normal
//resp
graphic.setCoordinate(1,30);
graphic.setForeColour(15,0,0); //Text is coloured Blue
graphic.print(wt); //Normal
//call
graphic.setForeColour(15,15,15); //Text is coloured Blue
graphic.setCoordinate(1,40);
graphic.print("Burgervan tadpole?:"); //Normal
//resp
graphic.setCoordinate(1,50);
graphic.setForeColour(15,0,15); //Text is coloured Blue
graphic.print("Maybe"); //Normal
}
But the second I slot it into my code, it doesn't print the text. Just the stuff in the initial setup.
// Include description files for other libraries used (if any)
#include <Twitter.h>
#include <gLCD.h>
#include <Ethernet.h>
#include <SPI.h>
#include <EthernetUdp.h>
#include <PString.h>
// Define Constants
// Max string length may have to be adjusted depending on data to be extracted
#define MAX_STRING_LEN 80
const char RST = 8;
const char CS = 9;
const char Clk = 13;
const char Data = 11;
gLCD graphic(RST,CS,Clk,Data,HIGH_SPEED); //High speed
// Setup vars
char tagStr[MAX_STRING_LEN] = ""; //to contain the XML tags for comparison
char dataStr[MAX_STRING_LEN] = ""; //to store information between hashtags
char tmpStr[MAX_STRING_LEN] = ""; //temporary string for something.. I dunno
char prevStr[MAX_STRING_LEN] = ""; //to compare tweets to their previous, stops repeat functions
char buffer[MAX_STRING_LEN] = ""; // for PString... maybe Concatenate if it still jams up.
char endTag[3] = {'<', '/', '\0'}; //to recognise the ends of chars, XML tags and strings
char makeCoffee[] = "make me coffee"; // trigger text for incoming tweets
boolean firstTweetRead = false; //to stop make() on first tweet read
PString tweetString(buffer, sizeof(buffer)); //contains the tweet
long randNumber; //to make the tweets unique
int len; //No idea
int totalCount = 1; //to count connect attempts
int ledPin = 3; //to control the relay
// Flags to differentiate XML tags from document elements (ie. data)
boolean tagFlag = false;
boolean dataFlag = false;
// Ethernet vars
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x13, 0x1D }; //Arduino MAC
byte ip[] = {78,147,235,111 }; //My home IP
byte server[] = { 199,59,149,232 }; // Twitter IP
Twitter twitter("794475482-XuCh0IVm8nTRcTAxkV6Gpx6VkdElWsww1Ns11n8x");
// Start ethernet client
EthernetClient client;
void setup()
{
graphic.begin(0,2,0,PHILLIPS_1);
graphic.setBackColour(1,1,1);
graphic.Box(0,0,6100,6100,4);
graphic.setFont(0);
pinMode (ledPin, OUTPUT);
randomSeed(analogRead(5));
Serial.begin(9600);
//Ethernet Client
// attempt a DHCP connection:
Serial.println(F("setup"));
if (!Ethernet.begin(mac)) {
// if DHCP fails, start with a hard-coded address:
Serial.println(F("failed, trying manually"));
Ethernet.begin(mac, ip);
}
connectToServer();
}
void loop() {
screen();
while (client.connected()) {
while (client.available()) {
serialEvent();
screen();
}
}
if (!client.connected()) {
Serial.println();
Serial.println(F("=========Disconnected=========="));
Serial.println("");
client.stop();
client.flush();
screen();
// Time until next update
//Serial.println("Waiting");
for (int t = 1; t <= 30; t++) {
delay(1000); // 1/2 minute
}
screen();
connectToServer();
}
}
void screen(){
//call
graphic.setForeColour(15,15,15); //Text is coloured Blue
graphic.setCoordinate(1,1);
graphic.print("Connected to server:"); //Normal sized text, no background. Hello and World will be printed on seperate lines
//resp
graphic.setCoordinate(1,10);
graphic.setForeColour(0,15,0); //Text is coloured Blue
graphic.print("TRUE"); //Normal
//call
graphic.setForeColour(15,15,15); //Text is coloured Blue
graphic.setCoordinate(1,20);
graphic.print("Water Level:"); //Normal
//resp
graphic.setCoordinate(1,30);
graphic.setForeColour(15,0,0); //Text is coloured Blue
graphic.print("LOW"); //Normal
//call
graphic.setForeColour(15,15,15); //Text is coloured Blue
graphic.setCoordinate(1,40);
graphic.print("Making Coffee:"); //Normal
//resp
graphic.setCoordinate(1,50);
graphic.setForeColour(15,0,15); //Text is coloured Blue
graphic.print("FALSE"); //Normal
}
Why is this?