Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Timer Alarm settings

    Scheduled Pinned Locked Moved LoPy
    5 Posts 4 Posters 1.7k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      robotmad
      last edited by

      I don't understand the syntax for creating an alarm object: class Timer.Alarm(handler=None, s, *, ms, us, arg=None, periodic=False)

      usage example is given as:
      Timer.Alarm(self._seconds_handler, 1, periodic=True)

      This example works but that only gives a single integer numeric parameter (which seems to achieve 1 second), please can we have an example of something else, say 150mS periodic alarm?

      A 1 Reply Last reply Reply Quote 0
      • A Offline
        abilio @robotmad
        last edited by

        @robotmad, sure, it would be:

        Timer.Alarm(self._seconds_handler, ms=150, periodic=True)
        
        sorenS 1 Reply Last reply Reply Quote 1
        • R Offline
          robotmad
          last edited by

          Thanks - so much clearer now.

          1 Reply Last reply Reply Quote 0
          • sorenS Offline
            soren @abilio
            last edited by

            @abilio regarding the documentation for Alarm, is it supposed to be obvious to everyone what the "*" argument means? I had no clue, and had to search the forum and end up here before I realised how to set the time in milliseconds.

            L 1 Reply Last reply Reply Quote 0
            • L Offline
              livius @soren
              last edited by

              @soren
              https://stackoverflow.com/questions/14301967/python-bare-asterisk-in-function-argument

              to set something as named parameter specify its name and value

              ms=15
              

              think about people first, then computers

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • 1 / 1
              • First post
                Last post

              Pycom on Twitter

              Pycom