Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Oh, and by the way, don't blindly run after sleep returns. sleep may be interrupted, so your process may have slept for a much shorter time than expected.

Yes, indeed! I had forgotten about that. Sleep() returns the value of unslept seconds. So if its not zero, just sleep again for that return value. Sleep is often implemented with SIGALRM so that's another potential issue.

Good description of power/brightness for LED's. As another comment, you can get what are called "resistor LED's". In that case, the resistor is built into the LED. Probably the most common value will be 1K Ohms which is a good choice for 5V. For 3.3V perhaps, 470 or 560 Ohms would be fine. The brightness can also be adjusted by pulsing the LED. I forget exact waveforms that I've used in the past for "ON", but as a starting point, probably a square wave with 20-30ms/on-off is about as bright as 100%. Play with different duty cycles for "on" and see what happens... Current and duty cycle of that current vs perceived brightness is a non-linear function.

BTW, I like blinking as the "good state" -> that means that the processor is running and is able to turn the LED on/off. Also, different cadences of the LED can be used to indicate error conditions. Human brains are excellent at pattern recognition. My router has a particular flashing light sequence that I recognize as "normal" without really thinking about what each individual light means. If the LED is stuck either at ON or OFF, I would surmise that the processor is "dead". If you just have a single LED, perhaps Long blip, followed by short blip means Internet connection bad, etc.


In reply to Re^3: Continuous or timed? by Marshall
in thread Continuous or timed? by Bod

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2024-03-28 09:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found