B4R Question Problem in use GY-521 Gyroscope library

vali khandangoll

Active Member
hi all of you.
I have a library with name GY-521 for Gyroscope module .
but I don't know how to use it. especially getGyroX , getAccelX or another get...

thanks for ever
 

derez

Expert
Licensed User
Longtime User
Upvote 0

vali khandangoll

Active Member
Googling I found this :

You can use my example https://www.b4x.com/android/forum/t...nts-mpu-6050-and-magnetometer-hmc5883l.65917/ , no need for any library.
Hi.
my problem in not this.
I can not use getGyroX or getAccelZ functions.
B4R always this error.
GetGyroX(_gx as return) as float.
i dont know _gx as return.

my source code is in below

Sub Process_Globals
Public Serial1 As Serial
Public Gyroscope As GY521
Public GX As Float
Public x As RandomAccessFile
End Sub

Private Sub AppStart

Serial1.Initialize(115200)
Log("AppStart")

AddLooper("GetGyroscope")
End Sub

public Sub GetGyroscope
Gyroscope.readGyro
GX=Gyroscope.getGyroX
End Sub
 
Upvote 0

vali khandangoll

Active Member
Googling I found this :

You can use my example https://www.b4x.com/android/forum/t...nts-mpu-6050-and-magnetometer-hmc5883l.65917/ , no need for any library.

Googling I found this :

You can use my example https://www.b4x.com/android/forum/t...nts-mpu-6050-and-magnetometer-hmc5883l.65917/ , no need for any library.
Hi again
I used your first Example but do not work correctly.
all of values shown always 0 and tmp=36.5
I check pins but I can not success.
 
Upvote 0

derez

Expert
Licensed User
Longtime User
If you use Arduino- connect SCL to A5, SDA to A4, 3.3V and ground
If you use Wemos or Nodemcu - connect SCL To D2 And SDA To D1.
The MPU is using the rWire library so check where to connect for rWire in any other board.
 
Upvote 0

vali khandangoll

Active Member
Perhaps you can use the library
Hi
I used your library.
When I want to upload show this error.

Can you please look into the matter,

SoftwareI2C.cpp:31:10: fatal error: SoftI2CMaster.h: No such file or directory
#include <SoftI2CMaster.h>
^~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

I want to make a quadqupter and this library is very very necessary for me.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
Hi
I used your library.
When I want to upload show this error.

Can you please look into the matter,

SoftwareI2C.cpp:31:10: fatal error: SoftI2CMaster.h: No such file or directory
#include <SoftI2CMaster.h>
^~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

I want to make a quadqupter and this library is very very necessary for me.
You can download it from the url
 
Upvote 0
Top