Code won't work on one computer but will on another.

I’m new to this so please bare with me. I have an issue running a program I wrote. It won’t work on both my work and home computers. However the program ran just fine on my coworkers computer. The program takes an input through the serial monitor and turns on a specified LED. If I type “red” the red LED should come on. This is not what’s happening however on my computer. The input doesn’t turn the LED on. It recognizes I put in an input and loops back and asks me which color I want again in the serial monitor. My coworker added a little bit of code to read back if the pins are working or not(1=on 0=off). They all read (0) on my computer. I attached the code.

Based on a YouTube tutorial using this exact setup(which works for the guy in the video). The whole setup is controlled through the computer using the serial monitor in Arduino IDE. The circuit is simple. 3 LED’s that each have a connector from their own separate pins to resistors to a LED to a common ground. I’ll post a picture when I get home if it’s helpful. The Arduino is hooked up with a standard USB cable through the front of my computer. When I tested the circuit on my coworkers computer it was the same exact setup. Walked it over from my desk so no variance there. Also we are both using Arduino IDE.

Before I get asked them I’ll answer the obvious questions I’ll surely get. In case you didn’t read it, yes the circuits are correct. I tested them with a different program that just blinks all the lights at once(from my computer). Yes I checked that I’m using the right port when I send the code to the Arduino.

The link below is the video I was using the tutorial for this program.

RGB_Example.ino (1002 Bytes)

What about the line ending setting in the serial monitor? Is it set to "none"?

Have you checked that the serial monitor is set to the correct com port? It can be different from the com port used by the IDE.

The baud rate is set correctly?

Ken_F how do I set the correct COM port for the serial monitor?

Yes on the baud rate.- aarg

If you're doing any serial interfacing beyond the initial development, you should be using a terminal program like Putty or Tera Term, not the serial monitor.

Verify that it is the same as the IDE com port. It will be shown on the very top of the serial monitor window just above the transmit text window. Also, your com port could be different on each computer that you run the IDE on for each Arduino device you use on that computer.

On the Arduino side, are you using the same hardware as your coworker or just an identical setup?

Check the line ending settings of your Serial Monitor.

pylon- we are both using the same Arduino IDE right off this Arduino website. What should the line ending be? Also what effect does this have on why it might not work?(just curious so I understand why)

Ken_F- The COM port changes in the Serial Monitor in Arduino IDE as you change the port under the tools menu.

All my stuff is at home at the moment so I will try different line endings and look to see if the serial monitor isn't matching up even though it's still displaying the message it supposed to when asking me which color I'd like.

PS. I updated the post. I stated I'm using a tutorial(if I didn't before) off of YouTube. I'm using the exact same setup as the guy in the video software and components. I did post the link in the original post.

Maybe I missed it, but are you using the IDE installed on your PC, or the online version?


I have an Arduino UNO at work I forgot about. I remembered that I could light up the LED on it so I made a light patternwith different blinking configurations and did a very similar program. I changed the serial monitor end line to "no line ending" and it worked. I'll have to try it on the one at home to confirm.