subroutine troubles

hi all,

im new to programing for a start so it may be an easy fix. what im trying to achieve is if the switch is pressed the lcd displays the message. the message is coming up but it is not affected by the switch. ive checked the switch and operation work. seems to be skipping the main program and going to sub routine void pg1().

any help would be appreciated

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

byte p20[8] =
{
B00010,
B00100,
B01000,
B11111,
B01000,
B00100,
B00010,

};
int switchPin = 9;
int ledPin =13;

void setup() {
// set up the LCD’s number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print(" ");

//Make progress characters
lcd.createChar(0, p20);

pinMode(switchPin, INPUT);
pinMode(ledPin, OUTPUT);

}

void loop ()
{
lcd.setCursor(0,1);
lcd.print(" ");

if (digitalRead(switchPin)==LOW);
{
pg1();
}
delay(10000);
if (digitalRead(switchPin)==HIGH);
{
digitalWrite(ledPin, HIGH);
}
}

void pg1() {
lcd.setCursor(2,0);
lcd.print("help please ");

lcd.setCursor(0, 1);
lcd.write(8);
lcd.setCursor(2,1);
lcd.print(“Start”);
delay (2000);
return;

} :astonished:

Do not put a colon after the brackets in an if. It makes them not work.

Thanks Mike,

I was thinking it must be something simple but i over looked that. I just tried it it and it works fine. First little task done :D