Python Forum
Problems with Interrupts/ callback functions in Python for an Alarm Clock project
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems with Interrupts/ callback functions in Python for an Alarm Clock project
#2
The example uses time.sleep() to wait before cancelling it.
   pi = pigpio.pi()
   decoder = rotary_encoder.decoder(pi, 7, 8, callback)
   time.sleep(300)
   decoder.cancel()
   pi.stop()
It sounds like you don't actually want to call decoder.cancel(), though... it sounds like you want it to just run forever, while the callbacks get handled. So maybe...
decoder = rotary_encoder.decoder(#etc)
while True:
    # handle events

    # so the pi doesn't melt :)
    time.sleep(500)
Reply


Messages In This Thread
RE: Problems with Interrupts/ callback functions in Python for an Alarm Clock project - by nilamo - Dec-16-2016, 10:17 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  World Clock syntax error OscarBoots 1 243 May-03-2024, 05:20 AM
Last Post: snippsat
  Alarm system with state, class, enum. Frankduc 0 1,317 May-04-2022, 01:26 PM
Last Post: Frankduc
  simulation of alarm system Frankduc 6 1,750 Apr-21-2022, 03:45 PM
Last Post: Frankduc
Question Debian 11 Bullseye | Python 3.9.x | pip install mysql-connector-python-rf problems BrandonKastning 4 6,797 Feb-05-2022, 08:25 PM
Last Post: BrandonKastning
  Module 'time' has no attribute 'clock' Sophie 4 3,215 Jan-25-2022, 08:05 PM
Last Post: Sophie
  Clock\time calculation script Drone4four 3 1,519 Jan-21-2022, 03:44 PM
Last Post: ibreeden
  Handling interrupts in OOP Lou 2 1,791 Sep-02-2021, 02:17 PM
Last Post: Larz60+
  time.clock not functioning Oldman45 3 2,774 Apr-07-2021, 08:51 AM
Last Post: Oldman45
  How to update component props every time when a Dash callback returns? sguzunov 0 2,588 Jul-27-2020, 07:11 AM
Last Post: sguzunov
  update imhow in callback from pyaudio markB 0 2,396 May-28-2020, 06:01 PM
Last Post: markB

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020