compilation failed report (solved)

Hi
The editor software suggested I report the failure of compilation on this forum so that's what I am doing. Previous versions compiled ok so I am at a loss to explain why this one went wrong. Any ideas? I was messing around with my if stuff for PWM2.

program code follows=========
/*
digital input, analog output, serial output

Reads a digital input pin, uses the result to increment a value that is then
used to set the pulse width modulation (PWM) of an output pin.
Also prints the results to the Serial Monitor.

The circuit:

  • input "generator stopped" signal on pin 3
  • LED connected from digital pin 9 to ground
    */

int PWM = 0; // value output to the PWM (analog out)
int PWM2 = 0; // value output to second stage diversion

void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
pinMode(3, INPUT);
pinMode(13, OUTPUT);
}

void loop() {
// check if dumping enabled and not inhibited
if (digitalRead(3)) {PWM++ ; digitalWrite(13, HIGH);}
else {PWM-- ; digitalWrite(13, LOW);}
if (PWM>255) {PWM=255;PWM2++;}
else PWM2--;
if (PWM<0) PWM=0;
if (PWM2<0) PWM2=0;
// change the analog out value:
analogWrite(9, PWM);
analogWrite(10, PWM2);

// print the results to the Serial Monitor:

Serial.print("PWM = ");
Serial.print(PWM);
Serial.print("\t PWM2 = ");
Serial.println(PWM2);

// wait a second before the next loop for the venus device
// to catch up after the last change of load:
delay(1000);
}

======

thanks
Hugh

Hi, do you get any specific error? Can you share the sketch link?

Hi

Thanks for helping. I do not get any other information but the compilation error notice in red. Here is the link to the sketch. It is working well enough on my arduino but when I try to edit and compile it this notice appears saying I should report the failure to compile. I just need to make some adjustments but I cannot compile it for some reason!

cheers
Hugh

perhaps I ought to mention that this is taken from a sketch "AnalogInOutserial" that is the first in the list of examples under 03.Analog, but I have made some big changes to it. I am using a digital input from some relay contacts and then using a PWM output to drive an SSR to operate a diversion load on my off-grid power system.

OK I have some news. I have apparently solved the problem. It may have been a power supply issue. I took the power plug out of the arduino, and just used the USB lead alone and I found that I can edit, compile and upload the program to the arduino now.