Hi,
Welcome to the forum.
Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Thanks.. Tom.. 
See?? That's how to do it. Maybe it's a 1am thing.
If newbies posting code incorrectly is a constant problem, then how about moving item #7 up to item #1? Or even title the sticky "Before Posting Code, Read This" and then have the code section at item #1. Then people will see it. At the moment the section you want people to read is a post underneath a post. No wonder no-one bothers to drill down to find it.
My apologies for not formatting the code, I didn't realise that was required in addition to verifying. I do not, and never will, consider myself a coder.
Before embarking on this project I studied "Getting Started With Arduino" which I believe is the standard beginners tome. I don't think it mentions braces in its 130 pages. I didn't think a course in C++ would be necessary to put together a simple sketch like this. However, on your advice I've dipped into an online course to see what it says on the subject of braces and, to be honest, I'm no further illuminated on the subject than I was at the start. Further study required.
Anyway, thank you for replying to my post.
I'm only trying to achieve three functions with this sketch so that I can get a heat recovery unit working in a basic fashion for visitors next week. The manufacturer's board is controlling the fans OK, but not the compressor. The manufacturer's only remedy is for me to spend £11,000 on a new unit, which is why I'm trying to get some basic functionality out of my old unit. There's nothing wrong with the compressor, the problem is on the board.
1: The Compressor must come on if the Programmer closes Pin 1 to Ground.
2: If the Frost Stat opens Pin 2 to Ground (it's normally closed), the Defrost Valve must switch on, along with the Compressor which should already be on (slightly different to what I said above) until the excess ice is gone and the Frost Stat closes Pin 2 to Ground again, switching the Defrost Valve off, leaving just the compressor on.
3: If the High Pressure Stat opens Pin 3 to Ground (it's normally closed), both the Compressor and the Defrost Valve must switch off, (and remain that way until the Arduino is reset, if possible.)
I suspect the reason my sketch is not working correctly is to do with these braces. I thought my initial sketch was a pretty reasonable start.
And now, the latest version of the sketch....
#define RELAY_ON 0
#define RELAY_OFF 1
#define Relay_1 7 // Digital I/O pin number 7 - Relay 1 - Compressor
#define Relay_2 6 // Digital I/O pin number 6 - Relay 2 - Defrost Valve
#define Relay_3 5 // Digital I/O pin number 5 - Relay 3 - Supply Power to Relays 1 & 2
#define Relay_4 4 // Digital I/O pin number 4 - Relay 4 - Not Used
#define Programmable_Thermostat 1 // Digital I/O pin 1 - Toggle Switch - closed for heat demand
#define Frost_Stat 2 // Digital I/O pin 2- Toggle Switch - normally closed, open for defrost mode
#define High_Pressure_Stat 3 // Digital I/O pin 3 - Toggle Switch - normally closed, open to stop compressor
void setup() /****** SETUP: RUNS ONCE ******/
{
// Initialize Pins so relays are inactive at reset
digitalWrite(Relay_1, RELAY_ON); // Initialize Relay Pins so relays are inactive at reset
digitalWrite(Relay_2, RELAY_ON); // Initialize Relay Pins so relays are inactive at reset
digitalWrite(Relay_3, RELAY_ON); // Initialize Relay Pins so relays are inactive at reset
digitalWrite(Relay_4, RELAY_ON); // Initialize Relay Pins so relays are inactive at reset
// THEN set pins as outputs
pinMode(Relay_1, OUTPUT); // set Relay Pin as output
pinMode(Relay_2, OUTPUT); // set Relay Pin as output
pinMode(Relay_3, OUTPUT); // set Relay Pin as output
pinMode(Relay_4, OUTPUT); // set Relay Pin as output
pinMode(1, INPUT_PULLUP); // enable internal pullup resistor on Pin 1 - Programmable Thermostat
pinMode(2, INPUT_PULLUP); // enable internal pullup resistor on Pin 2 - Defrost Stat
pinMode(3, INPUT_PULLUP); // enable internal pullup resistor on Pin 3 - High Pressure Stat
} //--(end setup )---
void loop() /****** LOOP: RUNS CONSTANTLY ******/
{
if (digitalRead(1) == HIGH
)digitalWrite(Relay_1, RELAY_ON); // set Compressor ON
else {
digitalWrite(Relay_1, RELAY_OFF); // set Compressor OFF
if (digitalRead(2) == LOW
)digitalWrite(Relay_2, RELAY_ON); // set Defrost Valve ON
else {
digitalWrite(Relay_2, RELAY_OFF); // set Defrost Valve OFF
if (digitalRead(3) == LOW
)digitalWrite(Relay_3, RELAY_ON); // set available power for Compressor & Defrost Valve to ON
else {
digitalWrite(Relay_3, RELAY_OFF); // set available power for Compressor & Defrost Valve to OFF
}
}
}
}//--(end main loop )---
//*********( THE END )***********