CODE:-
String inval;
int relaypin=12;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(relaypin,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
while (Serial.available()>0) {
inval=Serial.readString();
}
Serial.println(inval);
if ( inval=="turn on"){
digitalWrite(relaypin,LOW);
}
if ( inval=="turn off"){
digitalWrite(relaypin,HIGH);
}
}
Video Link to know more details about this projects :- https://youtu.be/DOExdL37IbA
0 Comments