Il giorno gio, 26/01/2012 alle 07.48 +0100, Michael Haberler ha scritto: > Am 25.01.2012 um 23:46 schrieb Spiderdab: > > > On mer, 2012-01-25 at 20:39 +0100, Michael Haberler wrote: > >> Hi Davide, > >> > >> why dont you just do this for edge detection (adapted from > >> configs/gladevcp/complex/complex.py): > >> > >> def on_led_pin_changed(self,hal_led,data=None): > >> if hal_led.hal_pin.get(): > >> print "LED changed to true" > >> else: > >> print "LED changed to false" > >> > >> - Michael > >> > > That's a good work-around, but you need a LED linked to the pin you want > > to read. > > no you dont need a LED > > see the example for a standalone HAL pin, connecting the value-changed > signal, and looking at state in the signal handler: > > http://www.linuxcnc.org/docs/devel/html/gui/gladevcp.html#gladevcp:Adding_HAL_pins > > - Michael > Ops! i think i should have read that.. that way, to control the state i think you should write something like: on_bit_trigger -> if it's true: do this if it's false: do that
does it work like that? Thank you michael. > > with the class i added into hal_glib.py you can create a bit_pin, net > > this with what you want into your_file.hal and play your handler. > > i.e. in this way i set up a combo of two joystick buttons to start > > recording my movements into g-code (yes there is also a LED on it..) and > > another combo to wirite "M2" at the end of the file and increment by one > > the seq number of the file. > > i've found this way very useful. > > Davide. > > > > > > > >> Am 24.01.2012 um 00:39 schrieb Spiderdab: > >> > >>> It works! > >>> I don't know how much it could be useful for other, but here is the > >>> modified hal_glib.py code. I added 'value-is-true' and 'value-is-false' > >>> to evaluate a bit-pin state. > >>> added the GBitPin Class, so it is not mixed with GPin. > >>> > >>> I'm attaching this code, in case someone would like to evaluate. > >>> > >>> Ciao, Davide. > >>> > >>> On lun, 2012-01-23 at 22:37 +0100, Spiderdab wrote: > >>>> Hi, i was looking into hal_glib.py, because i wanted to add a boolean > >>>> possibility other than 'value-changed'. > >>>> This way one can monitor a bit-pin and set an handler if it's true. > >>>> > >>>> Am I assuming the right idea? > >>>> do you think it's a trivial thing to do?, or do i have to change also > >>>> other files? > >>>> > >>>> Thanks, Davide. > >>>> > >>>> > >>>> > >>>> ------------------------------------------------------------------------------ > >>>> Try before you buy = See our experts in action! > >>>> The most comprehensive online learning library for Microsoft developers > >>>> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > >>>> Metro Style Apps, more. Free future releases when you subscribe now! > >>>> http://p.sf.net/sfu/learndevnow-dev2 > >>>> _______________________________________________ > >>>> Emc-developers mailing list > >>>> Emc-developers@lists.sourceforge.net > >>>> https://lists.sourceforge.net/lists/listinfo/emc-developers > >>> > >>> <hal_glib_GBitPin-MOD.zip>------------------------------------------------------------------------------ > >>> Try before you buy = See our experts in action! > >>> The most comprehensive online learning library for Microsoft developers > >>> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > >>> Metro Style Apps, more. Free future releases when you subscribe now! > >>> http://p.sf.net/sfu/learndevnow-dev2_______________________________________________ > >>> Emc-developers mailing list > >>> Emc-developers@lists.sourceforge.net > >>> https://lists.sourceforge.net/lists/listinfo/emc-developers > >> > >> > >> ------------------------------------------------------------------------------ > >> Keep Your Developer Skills Current with LearnDevNow! > >> The most comprehensive online learning library for Microsoft developers > >> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > >> Metro Style Apps, more. Free future releases when you subscribe now! > >> http://p.sf.net/sfu/learndevnow-d2d > >> _______________________________________________ > >> Emc-developers mailing list > >> Emc-developers@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/emc-developers > > > > > > > > ------------------------------------------------------------------------------ > > Keep Your Developer Skills Current with LearnDevNow! > > The most comprehensive online learning library for Microsoft developers > > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > > Metro Style Apps, more. Free future releases when you subscribe now! > > http://p.sf.net/sfu/learndevnow-d2d > > _______________________________________________ > > Emc-developers mailing list > > Emc-developers@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/emc-developers > > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > Emc-developers mailing list > Emc-developers@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-developers ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers