Answers for "hc-05 bluetooth arduino"

C
0

hc-05 bluetooth arduino

/*
HC05 - Bluetooth AT-Command mode
modified on 10 Feb 2019
by Saeed Hosseini
https://electropeak.com/learn/
*/
#include <SoftwareSerial.h>
SoftwareSerial MyBlue(2, 3); // RX | TX
int flag = 0;
int LED = 8;
void setup()
{
  Serial.begin(9600);
  MyBlue.begin(9600);
  pinMode(LED, OUTPUT);
  Serial.println("Ready to connect\nDefualt password is 1234 or 000");
}
void loop()
{
  if (MyBlue.available())
    flag = MyBlue.read();
  if (flag == 1)
  {
    digitalWrite(LED, HIGH);
    Serial.println("LED On");
  }
  else if (flag == 0)
  {
    digitalWrite(LED, HIGH);
    Serial.println("LED Off");
  }
}
Posted by: Guest on September-17-2021

Code answers related to "C"

Browse Popular Code Answers by Language