mpu6050-gyro
A node driver for the MPU-6050 IMU. Tested and working on Raspberry pi.
Installation
npm install mpu6050-gyro
Usage
var gyro = ; var address = 0x68; //MPU6050 addressvar bus = 1; //i2c bus used var gyro = busaddress ; { var gyro_xyz = gyro; var accel_xyz = gyro; var gyro_data = gyro_xyz: gyro_xyz accel_xyz: accel_xyz rollpitch: gyro console; ;} if gyro ;
Hardware setup
This driver reads MPU-6050 datas over I2C.
Plug VCC to 3.3V ( pin #1 ),
GND to GROUND ( pin #6 ),
SDA to SDA ( pin #3 / GPIO 2 ),
SCL to SCL ( pin #5 / GPIO 3 ).
Available Methods
gyro.get_gyro_xyz()
Returns JSON object with raw x,y,z datas from gyroscope.
gyro.get_accel_xyz()
Returns JSON object with raw x,y,z datas from accelerometer.
gyro.get_roll_pitch( gyro_xyz, accel_xyz )
Returns JSON object with roll and pitch in degrees.
Contributions
Pull requests welcome.
License
MIT