code not working

Let me start out by saying that this is a code I used following a youtube video Paul Whorter so unless I really messed this up it is considered a good program.What is happening is that teh code compiles perfectly, no issues there, it downloads perfectly also.

What is not happening is this program is supposed to run and ask what color led you want and then after you input the color the led should light.The led , no matter which is selected does not light,I think I have a hardware problem.

What I have tried:
I double checked that the wires are correct, using the right pin outs,and actually tested each led by removing the wire from Arduino 10,11,12 and putting them independently to +5vdc, leds lit.

I checked through the code several times and watched the video again and the code seams to be correct.

I wrote a small program using each of thoes pins to and they put out the voltage to the leds so that works.

I tried using a loopback test and it repeated what I put in the serial window.

So here I am lost ,I think ,possibly I have a problem with the Arduino UNO, just will not run that program .I do not have a second Arduino to test on so I can't prove that .I was hoping that someone would run this on their Arduino ,the program as written and see if it works.If so then I have a hardware issue.If that is the case maybe someone can tell me what to do , short of purchasing another Arduino Uno.

I am using Arduino 1.8.11
Windows 10 Pro

Here is the code as written, thanks

int redPin=10;
int yellowPin=11;
int bluePin=12;
String myColor;
String msg= "What Color led do you want on? ";
void setup() {
// put your setup code here, to run once:

void loop() {
// put your main code here, to run repeatedly:
while (Serial.available()==0){


if (myColor=="red"){

if (myColor=="yellow"){

if (myColor=="blue"){


What have you got the Line ending set to in the Serial monitor ?

Try No line ending

Explore the use of code tags please.

Please disregard this post, not sure how to delete it, my error in coding .I figured out what I had done wrong.Thanks to any and all that have read this, don't want to wast your time ,I was just confused.I have been studying this over and over , should have walked away and regrouped.

What is done is done and there are useful advices for other people tumbling in. It's okey!
During many years of coding I have seen this before. Tell somebody the trouble and You find the solution Yourself….. Wellcome to the club!

Better Look for AnalogWrite Function and Use Analog Pins When Dealing with Analog Devices.

Good example of programming…

#define LED_Red A2
#define LED_Green A3
#define LED_Blue A4

#define OFF 0
#define ON 255

Replace DigitalWrite with AnalogWrite and LOW’s and HIGH’s with ON and OFF

This should work fine…

opened for ziadkassab

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.