Q.No.13 - WAP to On/Off relay by using bluetooth module On/Off.

Sol.- This solution is not done on Hardware please make sure you verify it on your own.

#include <SoftwareSerial.h>
int Rxpin=0;
int Txpin=1;
int relay=3;
SoftwareSerial BTSerial(Rxpin,Txpin);
void setup()
{
	pinMode(relay,OUTPUT);
	BTSerial.begin(9600);

}
void loop(){
	char read=BTSerial.read();
	if(read=="1"){
		digitalWrite(relay,1)
	}
	else{
		digitalWrite(relay,0)
	}
}

Note : That this code is not verified. Please make sure you verify it.

Explain:

OUTPUT: