#include<EasyTransfer.h>
//#include<Wire.h>
int a1=2;
int a2=3;
int b1=4;
int b2=5;
int jack=6;
int m;
int n;
EasyTransfer lt;
typedef struct RECEIVE_DATA_STRUCTURE
{
int x;
int y;
int z;
};
RECEIVE_DATA_STRUCTURE aman;
//#define I2C_SLAVE_ADDRESS 9
void setup(){
//Wire.begin(I2C_SLAVE_ADDRESS);
lt.begin(details(aman),&Serial);
//Wire.onreceieve
Serial.begin(9600);
pinMode(a1,OUTPUT);
pinMode(a2,OUTPUT);
pinMode(b1, OUTPUT);
pinMode(b2,OUTPUT);
pinMode(jack,OUTPUT);
}
void loop()
{
if(lt.receiveData())
m=map(m,0,1023,-12,12);
n=map(n,0,1023,-14,14);
if(m==0 && n==0)
{
digitalWrite(a1,LOW);
digitalWrite(a2,LOW);
digitalWrite(b1,LOW);
digitalWrite(b2,LOW);
}
else if(m==0 && n==14)
{
digitalWrite(a1,HIGH);
digitalWrite(b1,LOW);
digitalWrite(a2,HIGH);
digitalWrite(b2,LOW);
}
else if(m==0 && n==-14)
{
digitalWrite(b1,HIGH);
digitalWrite(a1,LOW);
digitalWrite(b2,HIGH);
digitalWrite(a2,LOW);
}
else if(m==12 && n==0)
{
digitalWrite(a1,LOW);
digitalWrite(b1,LOW);
digitalWrite(a2,HIGH);
digitalWrite(b2,LOW);
}
else if(m==-12 && n==0)
{
digitalWrite(a1,HIGH);
digitalWrite(b1,LOW);
digitalWrite(a2,LOW);
digitalWrite(b2,LOW);
}
}
this code for receiver end , getting no errors but cant get output
this code is for transmitter side
#include<EasyTransfer.h>
int vx=A0;
int vy=A1;
int cam=8;
EasyTransfer lt;
struct SEND_DATA_STRUCTURE
{
int x;
int y;
int z;
};
SEND_DATA_STRUCTURE aman;
void setup()
{
pinMode(cam,INPUT);
Serial.begin(9600);
Serial.begin(9600);
lt.begin(details(aman),&Serial);
}
void loop()
{
aman.x=analogRead(vx);
aman.y=analogRead(vy);
aman.z=digitalRead(cam);
lt.sendData();
}