Jeremy Blum's RGB nightlight: Listing 2-6

Using the code in this listing I am only able to activate RED, BLUE & TEAL. Green cannot be activated or the remaining composite colors.

The code looks OK- am I missing some need for further manipulation of the code in order to activate the remaining colors.

Thanks

Using the code in this listing

We can't see your code, which Arduino you have, or which version of the IDE you are using.

am I missing some need for further manipulation of the code in order to activate the remaining colors.

Probably.

IDE 1.6.4

Arduino Uno v3

code as per attachment

Thanks for your time.

Exploring Arduino.doc (32 KB)

code as per attachment

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.

*.txt, as requested

Blum RGB.txt (3.11 KB)

Why does your code have no Serial.print() statements?
How is your switch wired?

PaulS:
Why does your code have no Serial.print() statements?
How is your switch wired?

As a novice, don't know the answer to that.

This project is from Blum, Jeremy (2013-07-16). "Exploring Arduino: Tools and Techniques for Engineering"

8-4-2015 2-04-15 AM.pdf (184 KB)

As a novice, don't know the answer to that.

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?

Or, you don't know how your switch is wired?

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???.

Am I correct?

The pwm's appear to have been relocated in v3 to pins 12-17.

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?

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.

Looking at genuine UNO 3's on Ebay shows that pins 9, 10, 11 & additionally 3, 5 & 6, a total of 6, are pwm's.

Others here have downloaded my code & pdf. Be interested to know how they fare.

I'll try 3, 5 & 6 otherwise I will move on for now. Spent too much time on this!

Tried another Uno3 clone, with the same result. So the Uno isn't the problem.

Has anyone had success with this project?