I am using Codesys ver 3,5 on Raspberry Pi and I want to use a Gyro MPU6050
I have installed Gyro MPU6050 from "I2C masters" (it is there as default)
But I do not have any reedings in RUN MODE
Must I install a library?
What am I missing?
I would be very glad if you have any advices on how to proceed?
Thank you everyone for your help!
Do you have 'always update variables' set to disabled?
If so, you need to use the variables in code before they will be updated.
Thanks for reply.......
Do you think I should make this setting in: codesys or in Raspberry?
In fact, I do not know what you mean when you write: use variables in code before update.
Do you know codesys?
Hope you can answer me again
Circle (10) in the image in this help file.
"Use variables in code" means that.. you have to write code in your CODESYS application, which uses the variables you want to see.
Yes, I know CODESYS.
I'm trying to understand what you're advising me to do and maybe I'm just not good enough.
When I stand on the MPU6050 and right click - Edit I / O I do not have the image you sent me .......
Can you help me further?
I am very grateful for your answers and I hope I solve the problem so I can move forward with my task.
Always update variables is available if you go to the device tree and look under PLC Settings under the device.
For what @icampbell is talking about the variables won't be refreshed unless they're used somewhere in your code. Like an input variables POU. For instance if I'm connected up to 1 of my PLC cards and I'm looking the variables like %IX4.4 won't change unless %IX4.4 or a variable I've mapped it to is being read in a POU. That POU also has to be configured in Task Configuration and running. Basically if a devices variables aren't being used in your code it won't be updated. Sorry icampbell I've mostly repeated what you said.
Here is the help file page on it.
Hello kalmeyer. I was telling you something wrong, the Gyro MPU6050 driver is built slightly different to other drivers.
Make sure the address is correct in Gyro_MPU6050 > I²C-Bus Parameters > I²C address
Access the variables in your code using: Gyro_MPU6050.lrAX, Gyro_MPU6050.lrGX etc.
Thank you very much for your answer.
The problem is solved when I had bought an MPU6050 that was faulty.
I activated the GYRO MPU6050 directly from CoDeSys and I got reedings immediately in RUN MODE.
Thank you very much for the help ....
I have some issues with my MPU6050 and RaspberryPi 4. I tested it on an arduino and it worked there but is was "slow" on inputs, Maybe just a bad example code i run.
I have added the Device and Lib. But i get no readings like you. Is there anything i miss here or might it be that mine is broken to?
Got me another MPU6050. But had the same issue. But i noticed a strange thing. If i run a .py script on the R-Pi, and then open Codesys i get readings, But they are not stable. If i Reboot the R-pi and dont run the .py script i dont get any readings again. Why do i have to run a .py script to get the readings in Codesys?
Log in to post a comment.