0% found this document useful (0 votes)
7 views2 pages

Home Automation AND CONTROLL

This document contains an Arduino sketch that sets up eight output pins and reads serial input. Depending on the character received ('A' to 'H' and their lowercase counterparts), it turns the corresponding output pin on or off. The setup initializes the serial communication and configures the pins, while the loop continuously checks for serial data and responds accordingly.

Uploaded by

kg6979495
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Home Automation AND CONTROLL

This document contains an Arduino sketch that sets up eight output pins and reads serial input. Depending on the character received ('A' to 'H' and their lowercase counterparts), it turns the corresponding output pin on or off. The setup initializes the serial communication and configures the pins, while the loop continuously checks for serial data and responds accordingly.

Uploaded by

kg6979495
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#define L1 3

#define L2 4
#define L3 5
#define L4 6
#define L5 7
#define L6 8
#define L7 9
#define L8 10
int data;

void setup()
{
Serial.begin(9600);
pinMode(L1, OUTPUT);
pinMode(L2, OUTPUT);
pinMode(L3, OUTPUT);
pinMode(L4, OUTPUT);
pinMode(L5, OUTPUT);
pinMode(L6, OUTPUT);
pinMode(L7, OUTPUT);
pinMode(L8, OUTPUT);
}

void loop()
{
while (Serial.available() > 0)
{
data = Serial.read();
Serial.println(data);
/////////////////////////////////////////////////
if (data == 'A')
{
digitalWrite(L1, HIGH);
}
else if (data == 'a')
{
digitalWrite(L1, LOW);
}
/////////////////////////////////////
else if (data == 'B')
{
digitalWrite(L2, HIGH);
}
else if (data == 'b')
{
digitalWrite(L2, LOW);
}
//////////////////////////////////////////

else if (data == 'C')


{
digitalWrite(L3, HIGH);
}
else if (data == 'c')
{
digitalWrite(L3, LOW);
}
/////////////////////////////////////
else if (data == 'D')
{
digitalWrite(L4, HIGH);
}
else if (data == 'd')
{
digitalWrite(L4, LOW);
}
//////////////////////////////////////////
/////////////////////////////////////////////////
else if (data == 'E')
{
digitalWrite(L5, HIGH);
}
else if (data == 'e')
{
digitalWrite(L5, LOW);
}
/////////////////////////////////////
else if (data == 'F')
{
digitalWrite(L6, HIGH);
}
else if (data == 'f')
{
digitalWrite(L6, LOW);
}
//////////////////////////////////////////

else if (data == 'G')


{
digitalWrite(L7, HIGH);
}
else if (data == 'g')
{
digitalWrite(L7, LOW);
}
/////////////////////////////////////
else if (data == 'H')
{
digitalWrite(L8, HIGH);
}
else if (data == 'h')
{
digitalWrite(L8, LOW);
}
//////////////////////////////////////////
}
}

You might also like