Revpi compact unreg method

Topics about the Software of Revolution Pi
Post Reply
franck_cern
Posts: 1
Joined: 13 Jun 2024, 14:23

Revpi compact unreg method

Post by franck_cern »

Hello,
I've got a Revpi compact.
On my system, I've got to count some events on a digital input.
for that, I've used reg_event() method. After a count of 10, I want to unregister this event.

Here is the "reg_event" code:

def fan_event_start(self):
global fan_time
fan_time = time.time()
self.rpi.io.DInBit_1.reg_event(self.fan_event, edge=revpimodio2.RISING)
self.rpi.mainloop()
And the "unreg_event":

def fan_event_stop(self):
self.rpi.io.DInbit_1.unreg_event(self.fan_event)

But it raise me :
raise AttributeError("can not find io '{0}'".format(key))
AttributeError: can not find io 'DInbit_1'

I don't understand my error, could someone explain me ?
Thanks
Franck
User avatar
dirk
KUNBUS
Posts: 2047
Joined: 15 Dec 2016, 13:19

Re: Revpi compact unreg method

Post by dirk »

Hi Frank and welcome to the Revolution Pi community,
probably the variable you want to access, "DInbit_1" is simply not declared.
Can you find it in PiCtory?
Did you save the PiCtory configuration as "Default" and reset the driver?

Have a look at that tutorial:
Revolution Pi Python Introduction
I find the ipython3 shell particularly helpful.

You can interactively see which objects are available in the namespace - a real game changer during development.
Post Reply