You are on page 1of 7

Results and discussions

Whenever a switch on the transmitter side (which acts as a remote control) is pressed a
signal is transmitted to the receiver. The programming is done in such a way that on pressing
a particular button on sending end arduino a particular bulb glows in the appliance circuit,at
the receiving end, till the button is released. Suppose if the switches two and four are pressed
then according to the program number 3 is transmitted to the receiver side. On releasing the
button the bulb which had been glowing is tuned off the distance between the two the
Arduinos is about 5meters.

SENDING END PROGRAM :

void setup()
{
int LED1=8;
int LED2=10;
int S1=2;
int S2=3;
int S3=4;
int S4=5;
pinMode(LED1,OUTPUT);
pinMode(LED2,OUTPUT);
pinMode(S1,INPUT_PULLUP);
pinMode(S2,INPUT_PULLUP);
pinMode(S3,INPUT_PULLUP);

pinMode(S4,INPUT_PULLUP);

Serial.begin(9600);

}
void loop()
{
int LED1=8;
int LED2=10;
int S1=2;
int S2=3;
int S3=4;
int S4=5;
int a;
int b;
int c;

int d;

int z;
a=digitalRead(S1);
b=digitalRead(S2);
c=digitalRead(S3);
d=digitalRead(S4);
if(a==LOW && b==LOW&&c==LOW&&d==LOW)
{
z=1;
Serial.println(z);
}
else if(a==HIGH && b==LOW&&c==LOW&&d==LOW)
{
z=2;
Serial.println(z);
}
else if(a==HIGH && b==LOW&&c==HIGH&&d==LOW)
{
z=3;
Serial.println(z);
}
else if(a==LOW && b==LOW&&c==HIGH&&d==LOW)
{
z=4;
Serial.println(z);
}
delay(1);
}
RECEIVING ENG PROGRAM:

The programming on the receiving side is done in such a way that they receive the signals from
the transmitter through Xbee. The program written below is the receiving end program.

void setup()
{
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
Serial.begin(9600);
}

void loop()
{
int b;
while(Serial.available()==0);
b=Serial.read();
if (b==49)
digitalWrite(13,LOW);
digitalWrite(12,LOW);
Serial.println(b);
}
else
{
digitalWrite(12,LOW);
digitalWrite(13,LOW);

if(b==50)
{
digitalWrite(12,LOW);
digitalWrite(13,HIGH);
Serial.println(b);
}
else
{
digitalWrite(12,LOW);
digitalWrite(13,LOW);
}
if(b==51)
{
digitalWrite(12,HIGH);
digitalWrite(13,HIGH);

Serial.println(b);
}
else
{
digitalWrite(12,LOW);
digitalWrite(13,LOW);
}
if(b==52)
{
digitalWrite(12,HIGH);
digitalWrite(13,LOW);
Serial.println(b);
}
else
{
digitalWrite(12,LOW);
digitalWrite(13,LOW);
}
delay(0.5);
}
The receiver Arduino accepts the ASCII value of 3 that is 51 and it is printed on the serial
monitor of the receiving side. The respective relays are connected to the twelfth and thirteen
pin of receiving arduino and whenever it accepts the signal from transmitter, according to the
program the respective loads will be operated depending on the switch pressed.

You might also like