Servo Motor Control Using By Bluetooth HC-05


 Code :-

#include <SoftwareSerial.h>

#include <Servo.h> // servo library 

Servo myservo1, myservo2, myservo3, myservo4; 

int bluetoothTx = 0;

int bluetoothRx = 1;

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);


void setup()

{

  myservo1.attach(3);

  myservo2.attach(5);

  myservo3.attach(6);

  myservo4.attach(9);

  Serial.begin(9600);

  bluetooth.begin(9600);

}

void loop()

{

  if(bluetooth.available()>= 2 )

  {

    unsigned int servopos = bluetooth.read();

    unsigned int servopos1 = bluetooth.read();

    unsigned int realservo = (servopos1 *256) + servopos;

    Serial.println(realservo);


    if (realservo >= 1000 && realservo <1180) {

      int servo1 = realservo;

      servo1 = map(servo1, 1000, 1180, 0, 180);

      myservo1.write(servo1);

      Serial.println("Servo 1 Rotate");

      delay(10);

    }

    if (realservo >= 2000 && realservo <2180) {

      int servo2 = realservo;

      servo2 = map(servo2, 2000, 2180, 0, 180);

      myservo2.write(servo2);

      Serial.println("Servo 2 Rotate");

      delay(10);

    }

    if (realservo >= 3000 && realservo <3180) {

      int servo3 = realservo;

      servo3 = map(servo3, 3000, 3180, 0, 180);

      myservo3.write(servo3);

      Serial.println("Servo 3 Rotate");

      delay(10);

    }

    if (realservo >= 4000 && realservo <4180) {

      int servo4 = realservo;

      servo4 = map(servo4, 4000, 4180, 0, 180);

      myservo4.write(servo4);

      Serial.println("Servo 4 Rotate");

      delay(10);

    }

  }

}


Circuit Diagram:- 


Buy App :- https://tinyurl.com/26t4dqwc

Price 100/- Only
---------------------------------------------------------------------------------------------------
BLDC Motor Control Using By Bluetooth HC-05

Code Price :- 150/-
App Price :- 100/-

Free Circit Circuit Diagram








Comments

  1. Hello! I recently watched, How to Control servo motor using by Bluetooth module Hc-05 || Servo Motor Control || Arduino. And I could not access WhatsApp at that point I wanted to know if you can send me the application for controlling the servo. If you could that would be awesome, Thanks for your time.

    ReplyDelete

Post a Comment

Popular posts from this blog

Best IOT Project By Technical idEas