You took a simple text file and bloated it by putting it in doc file. Why? Simply renaming the file with a .txt extension would have greatly increased the odds that I would download the file.
You don't know why you haven't added Serial.print() statements so you can debug your code?
In setup(), add
Serial.begin(115200);
In loop(), add
Serial.println("Switch now pressed");
after
if(lastButton == LOW && currentButton == HIGH)
{
Do you get the message, in the Serial Monitor (after setting the baud rate at the bottom to 115200) each time you press the switch, and only when you press the switch?
Thanks for taking the time to give me the additional code. Unfortunately they gave me errors & will try again again soon after I have resolved the following.
The pdf I posted above of the circuit diagram I was following appears to be an earlier model uno, not v3, since the pwm outputs seem to be in a different location to v3. I was following whatever version that was and so I was using pins 9, 10 &11. The pwm's appear to have been relocated in v3 to pins 2-7???.
PaulS:
The current Uno page still says PWM is on pins 3, 5, 6, 9, 10, and 11.
Do you have a real Arduino, or a clone?
Why then are pins 2-7 shown as DIGITAL pwm on my board?
A clone, I think. Has green not gold indicator component.
Incidentally, the forum at http://forum.freetronics.com/viewtopic.php?t=181 seems to indicate there may not be a lot of clarity with the operation of the pwm pins. The thread does not say which version is being referred to.