hey im hoping someone might be able to lend a hand. right now im learning about strings and how to combine strings and using them in serial ports. I was able to get hello Nicholas and its my program to print in the serial port but now im trying to combine both serials together onto one print line. ive checked my coding and can see anything wrong with it but now it wont print the hello Nicholas its my program. maybe you can help.
int redLedPin=9; //Declaring red led as an int, and set to 9:
int yellowLedPin=10; // Declaring yellow led as an int, and set to 10:
int redOnTime=250; //Red led is on 250:
int redOffTime=250; // Red led is off 250:
int yellowOnTime=250; // Yellow led is on 250:
int yellowOffTime=250; // Yellow led is off 250:
int numRedBlink=5;
int numYellowBlink=3;
String redMessage= "the red led is blinking"; // declaring a string variable
String yellowMessage= "the yellow led is blinking"; // declaring a string variable
void setup() {
Serial.begin(9600);
String wm1 ="hello nicholas"; // declare string variable
String wm2="its your program";
String wm3; // declare a sting variable
wm3=wm1+wm2; // assign wm1 plus wm2 or otherwise known as concatenation
Serial.print(wm3);
pinMode(redLedPin,OUTPUT);
pinMode(yellowLedPin,OUTPUT);
}
void loop() {
int c=c+1;
Serial.println(redMessage);
for (c=1; c<=numRedBlink; c=c+1){ // starting for loop
Serial.print("I am Awsome");
Serial.println(c);
digitalWrite(redLedPin,HIGH); // turn the red led on:
delay(redOffTime); // wait:
digitalWrite(redLedPin,LOW); // turn the red led off:
delay(redOffTime); //Wait:
}
Serial.println(" ");
Serial.println(yellowMessage);
for (int c=1; c<=numYellowBlink; c=c+1){
Serial.print("i am awsome");
Serial.println(c);
digitalWrite(yellowLedPin,HIGH); //turn the yellow led on:
delay(yellowOffTime); //Wait:
digitalWrite(yellowLedPin,LOW); //turn the yellow led off:
delay(yellowOffTime); //Wait:
Serial.println(" ");
}
}