Controlling LEDs With PC Using Arduino

Wireless communication plays a very important role within the communication system. We may be able to send data from one point to another point simply through wireless communication. There is such a large option available for the wireless communication like Bluetooth, Wi-Fi etc. In this article, we concern only in Bluetooth. Bluetooth is a standard wireless technology which transfers the information over very short distances. It is assumed that you just ought to knowledge to How To Send Serial Data From Arduino To Laptop or PC and How To Receive and Send Serial Data Using Arduino Board

Controlling led via PC/Laptop

After Reading this article you will be able to control LED via your PC/Laptop. For controlling the led we use arduino board Introduction to Arduino Board

Circuit diagram:

Here we use three led blue, green and red that are connected to pin no. 10,9 and 8 of arduino board respectively. We also connect an LCD display module to arduino board. read this post for Interfacing LCD With Arduino UNO. All other connection for controlling led via PC is shown below image

circuit diagram for led control
Circuit Diagram
Program:

// ProjectsDunia
// http://projectsdunia.blogspot.in
// Our Facebook Page http://facebook.com/projectsdunia

//  control LED with your PC


#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int blue_led=10;
int green_led=9;
int red_led=8;
int store=0;
void setup()
 {
    // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // initialize the serial communications:
  Serial.begin(9600);
  pinMode(blue_led, OUTPUT);
  pinMode(green_led, OUTPUT);
  pinMode(red_led, OUTPUT);
  }
void loop()
{
  // when characters arrive over the serial port...
  if (Serial.available()) 
  {
    // save the data 
    store=Serial.read();
    switch(store)
    {
      case '1':
      lcd.clear();
      digitalWrite(blue_led,HIGH);
      lcd.write(" Blue_LED ON ");
      break;
      case '2':
      lcd.clear();
      digitalWrite(blue_led,LOW);
      lcd.write(" Blue_LED OFF ");
      break;
      case  '3':
      lcd.clear();
      digitalWrite(green_led,HIGH);
      lcd.write(" Green_LED ON ");
      break;
      case '4':
      lcd.clear();
      digitalWrite(green_led,LOW);
      lcd.write(" Green_LED OFF ");
      break;
      case '5':
      lcd.clear();
      digitalWrite(red_led,HIGH);
      lcd.write(" Red_LED ON ");
      break;
      case '6':
      lcd.clear();
      digitalWrite(red_led,LOW);
      lcd.write(" Red_LED OFF ");
      break;
      
    }
  }
}
  
Download:

LED control file

Video:



If you have any question, leave a comment below, Thanks for reading this article.If you like this article then support us by subscribing our youtube channel and like our facebook page.


Comments

Popular posts from this blog

How to Remove �Powered by Blogger� attribution From Blogspot Blog?

Fritzing: an Electronic Design Automation software