A robotic hand that mimics a human hand in real-time using Bluetooth

Thread Starter

Young2

Joined Dec 7, 2020
94
When the bending sensor imitates the human hand in real-time via Bluetooth HC-05, the received data is different from the sent data, any god help to see how to deal with it? Sending data with Arduino UNO board
The code is as follows

Code:
int a,b,c,d,e;

void setup() {
  Serial.begin(38400);
}

// The function of this code is to read the bend sensor value.
void loop() {
  a=analogRead(A0); //Read the value of the sensor on port A0 and assign it to a.
  b=analogRead(A1); //All the following are the same as above.
  c=analogRead(A5);
  d=analogRead(A3);
  e=analogRead(A4);

// This code implements the function of sending the value from the sender to the receiver.

  Serial.println('<');
  Serial.println(a);
  Serial.println(b);
  Serial.println(c);
  Serial.println(d);
  Serial.println(e);
}
Receiving data with Arduino nano board
The code is as follows

Code:
#include<Servo.h>
Servo s1,s2,s3,s4,s5;                     //servo
unsigned int val;
int a,b,c,d,e;
int val1,val2,val3,val4,val5;
char ch;
void setup() {
Serial.begin(38400);
s1.attach(6);                           //Numerical function of servo angle
s2.attach(7);
s3.attach(8);
s4.attach(9);
s5.attach(10);
}


void loop() {
if(Serial.available()>0)
  {
    ch=Serial.read();
    if(ch=='<')
    {
       a=Serial.parseInt();
       b=Serial.parseInt();
       c=Serial.parseInt();
       d=Serial.parseInt();
       e=Serial.parseInt();

    }
  }
  Serial.println('<');
  Serial.println(a);
  Serial.println(b);
  Serial.println(c);
  Serial.println(d);
  Serial.println(e);   

   val1 = analogRead(a);           
   val1= map(val1,1024,0, 0, 130);     
   s1.write(val1);   

   val2 = analogRead(b);           
   val2= map(val2, 1024, 0, 0, 130);     
   s2.write(val2);   

   val3 = analogRead(c);           
   val3= map(val3, 1024, 0, 0, 130);     
   s3.write(val3); 

   val4 = analogRead(d);           
   val4= map(val4, 1024, 0, 0, 130);     
   s4.write(val4); 

   val5 = analogRead(e);           
   val5= map(val5, 0, 1024 , 0, 120);   
   s5.write(val5); 
   delay(10);                     

}
 

ericgibbs

Joined Jan 29, 2010
14,130
hi Y2,
My next step would be to send known numeric values from the TX to the RX

ie: a range of a ....thru.. e fixed known values, this would prove the BT link.

E
 
Top