Controlling motors wirelessly using Piezoelectric sensors and cc2500

I’m Currently working on my project.I use three piezoelectric sensors to control six motors wirelessly using cc2500. My transmitter contains an arduino with 3 sensors and cc2500 transmitter.

Receiver module contains arduino and 6 12v DC motors connected in pairs with l293d motor driver.

When one sensor is touched, all the 6 motors move in forward direction.
when another sensor is touched, left side motors shd move fwd and right motors not to run.
when another sensor is touched, all right motors shd move fwd, and left motors not to run.

i’ve attached the prog what i wrote.
But the problem is when one sensor is touched, in serial monitor of transmitter part, i see all the sensors working . this makes receiver side a problem. where motors run as they like. Please help me in making the sensor send only one information to receiver side.

RX.ino (1.5 KB)

TX.ino (530 Bytes)

If you want only 1 sensor to send data, you need to use else statements when checking all the values. The way tx.ino is now, you check a and maybe send a value, then check b and maybe send a value, etc.

void setup() 
{
  pinMode(A0,INPUT);
  pinMode(A1,INPUT);
  pinMode(A2,INPUT);
  pinMode(A3,INPUT);
  Serial.begin(9600);
}

void loop() 
{
int a=analogRead(A0);

int b=analogRead(A1);

int c=analogRead(A2);

//Serial.println("PIEZO1=");
//delay(1000);
//Serial.println(a);
//Serial.print("PIEZ02=");
//Serial.println(b);
//Serial.print("PIEZO3=");
//Serial.println(c);
if(a>10)
{
  Serial.println('A');
  delay(1000);
}
else if(b>700)
{
  Serial.println("B");
  delay(1000);
}
else if(c>700)
{
  Serial.println("C");
  delay(1000);
}
}

blh64: If you want only 1 sensor to send data, you need to use else statements when checking all the values. The way tx.ino is now, you check a and maybe send a value, then check b and maybe send a value, etc.

void setup() 
{
  pinMode(A0,INPUT);
  pinMode(A1,INPUT);
  pinMode(A2,INPUT);
  pinMode(A3,INPUT);
  Serial.begin(9600);
}

void loop() { int a=analogRead(A0);

int b=analogRead(A1);

int c=analogRead(A2);

//Serial.println("PIEZO1="); //delay(1000); //Serial.println(a); //Serial.print("PIEZ02="); //Serial.println(b); //Serial.print("PIEZO3="); //Serial.println(c); if(a>10) {  Serial.println('A');  delay(1000); } else if(b>700) {  Serial.println("B");  delay(1000); } else if(c>700) {  Serial.println("C");  delay(1000); } }

ive used else if.But only 'A' gets printed eventhough i touch other sensors.

Is A always greater than 10?