I've been struggling trying to figure out why my code isn't activating the rgb LED.I have tested the it to make sure all the colors work but can't seem to activate anything in the serial Monitor Although the Prompt to turn on an led does come up and seem to work. Here's my CODE
int redPin=10;
int greenPin=9;
int bluePin=8;
String mycolor;
String msg="What color do you want?";
void setup() {
// put your setup code here, to run once:
pinMode(redPin,OUTPUT);
pinMode(greenPin,OUTPUT);
pinMode(bluePin,OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(msg);
while(Serial.available()==0){
}
mycolor=Serial.readString();
if (mycolor=="red"){
digitalWrite(redPin,HIGH);
digitalWrite(greenPin,LOW);
digitalWrite(bluePin,LOW);
}
if (mycolor=="green"){
digitalWrite(redPin,LOW);
digitalWrite(greenPin,HIGH);
digitalWrite(bluePin,LOW);
}
if (mycolor=="blue"){
digitalWrite(redPin,LOW);
digitalWrite(greenPin,LOW);
digitalWrite(bluePin,HIGH);
}
}
Gotcha this may have been from a tutorial that may be outdated was trying to follow it on youtube if you have any suggestions for Arduino tutorials for beginners it would be great to hear as I am still learning. Here's the link to that video if your interested Arduino Tutorial 20: Understanding RGB LED's - YouTube. Thanks
Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project.