Only question; what the heck is that {;} supposed to do? Why isn't the serial read -inside- the braces for the if serial available?
But you say it works....
sketch 1:
void loop() {
if( Serial.available() ) // Hvis der er data at læse
{;}
val = Serial.read(); // Læs det, og gem det i variablen 'val'