ARDUINO SKETCH FOR BLUETOOTH CONTROLLING OF LED

#include <SoftwareSerial.h>

#define led 9

int state=0;
void setup() {
Serial.begin(9600);// put your setup code here, to run once:
pinMode(led,OUTPUT);
}
void loop()
{


  if(Serial.available()>0)
 {
  state=Serial.read();
 }

    if(state=='1')
    {
    digitalWrite(led,HIGH);
    }
else   if(state == '0')
  {
    digitalWrite(led,LOW);
    }
  else
  {
   Serial.println("ur have entered something else inputs pls enter either 0 or 1");
    }
  }

Comments

Popular posts from this blog

"Kernel Panic” error After upgrading Parrot OS

HACK HC-05(BLUETOOTH MODULE) FRIMWARE INTO HID FRIMWARE

HACK AND CLONE CAR KEY FOB, MY EPIC FAILURE...!!