Posts

Showing posts from December, 2023

Servo Motor Control Using By Bluetooth HC-05

Image
  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");   ...