char data; // create a character variable type
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); // baud rate
pinMode(13, OUTPUT); // (pin number , input/output)
pinMode(10, INPUT);
Serial.print("Hello World"); // to print
Serial.println("Hello World"); // to print by leaving a line
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(13, HIGH); //(pin number , HIGH/LOW) used ot turn ON and OFF the LED
delay(1000); // delay in ms (milli seconds)
digitalWrite(13, LOW);
delay(1000);
Serial.print("Hello World"); // to print multiple times
// conditional statement
if(Serial.available()>0){
data =Serial.read();
// Serial.println(data);
if(data=='a'){
Serial.println("Hello!");
}
else if(data=='c'){
Serial.println("Bye");
}
}
}