Hello friend
I'm using xbee series 2 to send MPU6050 data and flex sensor data
i succeed to send data using this code :
// I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files
// for both classes must be in the include path of your project
#include "I2Cdev.h"
#include "MPU6050.h"
// class default I2C address is 0x68
// specific I2C addresses may be passed as a parameter here
// AD0 low = 0x68 (default for InvenSense evaluation board)
// AD0 high = 0x69
MPU6050 accelgyro;
int16_t ax, ay, az;
int16_t gx, gy, gz;
#define LED_PIN 13
bool blinkState = false;
int f2 = A1; //analog pin 0
int f1=A0;
void setup(){
// join I2C bus (I2Cdev library doesn't do this automatically)
Wire.begin();
// initialize serial communication
// (38400 chosen because it works as well at 8MHz as it does at 16MHz, but
// it's really up to you depending on your project)
Serial.begin(9600);
// initialize device
Serial.println("Initializing I2C devices...");
accelgyro.initialize();
// verify connection
Serial.println("Testing device connections...");
Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
// configure Arduino LED for
}
void loop(){
int flex1 = analogRead(f1);
int flex2 = analogRead(f2);
// read raw accel/gyro measurements from device
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
Serial.print("\t");Serial.print("\t");Serial.print("\t"); Serial.print("Gripper="); Serial.print(flex1); Serial.print("\t");Serial.print("\n");
Serial.print("Base="); Serial.print(ax); Serial.print("\t");Serial.print("\n");
}
any thing going smoothly but
1- my data keep receiving without any receiver code
2- i have 3 reading data how can i put each one to control 3 servo motor
please help me im about to graduate
thanks