Here is the code. But to just to clarify the problem by explaining it from the other way around. The screens works perfectly until I start the ethernet. So if I don't call Ethernet.begin(mac); then the screen works.
#include <genieArduino.h>
#include <SPI.h>
#include <Ethernet.h>
const int analogInPin = 5;
int sensorValue = 0;
int digits[5] = {0};
// Network
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0x17, 0xD1 };
IPAddress ipLocal(10, 1, 1, 150); // Only used if we fix the IP. Can also use DHCP
int portLocal = 4333;
IPAddress ipRemote(10, 1, 1, 119);
int portRemote = 13000;
EthernetUDP Udp;
void setup()
{
genieBegin (GENIE_SERIAL, 9600);
pinMode(4, OUTPUT);
digitalWrite(4, 1);
delay(100);
digitalWrite(4, 0);
// Start the ethernet using DHCP
configureEthernet(true);
delay (3500); //let the display start up
}
void loop() {
sensorValue = analogRead(analogInPin) * 10;
int splitSource = sensorValue;
// First split the incoming long into five separate digits
digits[0] = int ( splitSource / 10000 );
splitSource = splitSource % 10000;
digits[1] = int ( splitSource / 1000 );
splitSource = splitSource % 1000;
digits[2] = int ( splitSource / 100 );
splitSource = splitSource % 100;
digits[3] = int ( splitSource / 10 );
splitSource = splitSource % 10;
digits[4] = splitSource % 10;
genieWriteObject(GENIE_OBJ_VIDEO, 0x00, digits[4]);
genieWriteObject(GENIE_OBJ_VIDEO, 0x01, sensorValue >= 10 ? digits[3] : 10);
genieWriteObject(GENIE_OBJ_VIDEO, 0x02, sensorValue >= 100 ? digits[2] : 10);
genieWriteObject(GENIE_OBJ_VIDEO, 0x03, sensorValue >= 1000 ? digits[1] : 10);
genieWriteObject(GENIE_OBJ_VIDEO, 0x04, sensorValue >= 10000 ? digits[0] : 10);
delay(10);
// This is just here to check if ethernet works with ethernet shield and LCD shield
Udp.beginPacket(ipRemote, portRemote);
Udp.write(sensorValue);
Udp.endPacket();
}
void configureEthernet(boolean useDHCP)
{
if (useDHCP)
{
Ethernet.begin(mac);
}
else
{
Ethernet.begin(mac, ipLocal);
}
Udp.begin(portLocal);
}