Hi waisha.
It looks like a resource problem on the RevPi. Of course, when the CPU is busy and the system starts to be unoperable, revpimodio2 can of course no longer maintain the cycle time and these warnings are issued.
We now have to find out what is happening there.
- In the command line, for example, you could use `htop` to display CPU and RAM consumption. Then you can also find the responsible process.
If it is your Python program, I suspect that several times `revpimodio2. RevPiModIO(autorefresh=True)` is called. Only a single RevPiModIO instance may exist, old instances must be terminated cleanly by calling `.exit()`.
Bad example:
Code: Select all
import revpimodio2
from time import sleep
for i in range(5):
rpi = revpimodio2.RevPiModIO(autorefresh=True)
rpi.io.O_1.value = True
sleep(10)
rpi.io.O_1.value = False
sleep(10)
# Now the important part, which will free the resources
rpi.exit()
The example is supposed to make the output O_1 flash, but if you did not call `rpi.exit()` at the end, more and more instances would be created that remain active in memory and the CPU through the `autorefresh`.
That's how it should be done
Code: Select all
import revpimodio2
from time import sleep
# Do this just once in your program and use this object
rpi = revpimodio2.RevPiModIO(autorefresh=True)
for i in range(5):
rpi.io.O_1.value = True
sleep(10)
rpi.io.O_1.value = False
sleep(10)
# At the end of the program call exit to make sure all data is written to process image
rpi.exit()