B4R Question type as return ?

vali khandangoll

Active Member
Hi
I use a library with name TinyMPU6050 that attached below.
fow show the gyroscop x or y or z angle must use mpu6050.GetAngX command

this command format is mpu6050.GetAngX(ang X as:: return) as float.
please help me with an example about ang X as:: return.
or an simple B4R example for this library.

thanks.
 

vali khandangoll

Active Member
You cannot access a C struct directly. You will need to create a wrapper or access the fields with inline C.
So please help me and write a source code that used this tiny mpu library.
you can download that from this url.

or another code with any library you want


thanks
 
Upvote 0

vali khandangoll

Active Member
please look at this pic.
 

Attachments

  • Untitled.png
    Untitled.png
    3.2 KB · Views: 125
Upvote 0

candide

Active Member
Licensed User
i created a wrapper for TinyMPU6050, do you want to test it and to check if it can help you ?

testTinyMPU6050 is script used to test this library, and it is an example to use it

files deleted => please to use files below
 
Last edited:
Upvote 0

vali khandangoll

Active Member
hi
I download and tested your program and library.
It seems that the values it shows are not correct.

Have you tried it yourself?
I already said above that I desperately need this program.
I would be very grateful if you could solve this issue for me.

بسیار بسیار متشکرم
 
Upvote 0

candide

Active Member
Licensed User
no i didn't test this library with MPU6050 because i don't have one available , but i will do soon.

after, i think your wiring is not correct, because with this library, you have aleatory values when MPU6050 is not connected. (we have no error return in case of error)

Please to check your I2C wiring with B4R script below: it will detect MPU6050 at address 0x68 if it is correct

=> please to use files below
 
Last edited:
Upvote 0

candide

Active Member
Licensed User
after a test of MPU6050 , please to find a new version of I2C_scanner and a new version of rTinyMPU6050.

in my case, with I2C_scanner i can confurm MPU6050 availability at address 0x68 and after test with TinyMPU6050 library is OK
 

Attachments

  • I2C_scanner.zip
    1.4 KB · Views: 141
  • rTinyMPU6050.zip
    6.5 KB · Views: 129
  • B4R_testTinyMPU6050.zip
    1.3 KB · Views: 144
Upvote 0
Top