Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1246

Python • Re: Some trouble with pigpio callback

$
0
0
The callbacks are calling the class and not the instance of the class.

Wrong:

Code:

        self.pio.callback(rc,pigpio.EITHER_EDGE,inout.RightAct)        self.pio.callback(ro,pigpio.EITHER_EDGE,inout.RightAct)        self.pio.callback(lc,pigpio.EITHER_EDGE,inout.LeftAct)         self.pio.callback(lo,pigpio.EITHER_EDGE,inout.LeftAct)         self.pio.callback(lid,pigpio.EITHER_EDGE,inout.LidAct)
This should work:

Code:

        self.pio.callback(rc,pigpio.EITHER_EDGE,self.RightAct)        self.pio.callback(ro,pigpio.EITHER_EDGE,self.RightAct)        self.pio.callback(lc,pigpio.EITHER_EDGE,self.LeftAct)         self.pio.callback(lo,pigpio.EITHER_EDGE,self.LeftAct)         self.pio.callback(lid,pigpio.EITHER_EDGE,self.LidAct)
Then the count of arguments should be right.

Statistics: Posted by DeaD_EyE — Thu Feb 27, 2025 10:25 am



Viewing all articles
Browse latest Browse all 1246

Trending Articles