<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
One thing to keep in mind with this and nearly everything else on a
Raspberry Pi is that your program can be preempted at any time.
Literally in the middle of one of the Python statements control may
be yanked away and given to another process, then passed back to
finish that statement an indeterminate time later. Between device
interrupts and processor scheduling ("time slicing") with background
daemons, there is a blizzard of program interruption going on more
or less randomly. Depending on the system load (or just plain
chance) you may see this never or a lot or anything in between. So
don't be surprised if the simple code from the Adafruit tutorial
below puts out some very funky numbers occasionally (i.e. they're
completely crazy with respect to what you know the sensor should be
reporting). There are ways to make the code immune to these kinds of
errors, but it adds complexity. A relatively accurate time reckoning
scheme for Python on Linux is in "answer 54" <a
href="http://stackoverflow.com/questions/231767/what-does-the-yield-keyword-do-in-python?rq=1">on
this page</a>. I just confirmed this works fine on my regular
Linux system and think it ought to work just as well on an RPI. One
way to reject bogosity is to toss a number that represents an
impossible change in sensor readings. That is, if you know the
sensor can't be reporting a room temperature of 70 degrees one
moment and 90 degrees the next, you can toss the 90 degree reading.
But this adds complexity and it won't be long before you want to use
an ADC chip. :-)<br>
<br>
And concidentally, tonight at Splatspace Geoff Tattersfield
facilitated a session about using an MCP3008 ADC chip with a
Raspberry Pi using the SPI bus. Folks went through <a
href="https://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi">this
Adafruit tutorial</a>.<br>
<br>
-Pete<br>
<br>
<div class="moz-cite-prefix">On 08/27/2015 09:32 PM, dan via
TriEmbed wrote:<br>
</div>
<blockquote
cite="mid:CACLXGbS6KZapuDQfiOD12OZef+HLBhmsdzJQJbDQeYtQnswmDw@mail.gmail.com"
type="cite">
<div dir="ltr">I love it! And a very nice write-up too :) I'm
definitely a fan of using the lights to show different kinds of
information (weather, time, scores, etc.) I really like your
weather display. Maybe you could have chasing blue lights when
it's going to rain, hehe.
<div><br>
</div>
<div>As a hardware nerd, I especially like the photoresistor RC
timing trick. I'd have never thought of that, but it makes
perfect sense. I'll have to keep that in mind for other
projects :)
<div><br>
</div>
<div>For those curious, the adafruit article Chip linked to
explains how you can read restive sensors (like a photocell)
using a Raspberry Pi's GPIO pins without needing an external
Analog-to-Digital converter module. For simple sensors, this
would be a great way to interface them to the Pi on the
cheap.</div>
</div>
<div><br>
</div>
<div><a moz-do-not-send="true"
href="https://learn.adafruit.com/basic-resistor-sensor-reading-on-raspberry-pi/how-it-works">https://learn.adafruit.com/basic-resistor-sensor-reading-on-raspberry-pi/how-it-works</a><br>
</div>
<div><br>
</div>
<div>Thanks very much for sharing! Please keep us up to date
if/when you make any changes/additions!</div>
<div><br>
</div>
<div>-Dan</div>
<div><br>
</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Aug 27, 2015 at 7:24 PM,
Charles McClelland via TriEmbed <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:triembed@triembed.org"
target="_blank">triembed@triembed.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div>All,</div>
<div><br>
</div>
From the last meeting, <a moz-do-not-send="true"
href="https://www.hackster.io/chipmc/awesome-led-entertainment-center"
target="_blank">here</a> is the documentation for my
Entertainment Center LED Geek makeover. Comments and
suggestions are welcome but please be kind as this is my
first time programming in Python.
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>Chip</div>
<div><br>
</div>
</div>
<br>
_______________________________________________<br>
Triangle, NC Embedded Computing mailing list<br>
<a moz-do-not-send="true"
href="mailto:TriEmbed@triembed.org">TriEmbed@triembed.org</a><br>
<a moz-do-not-send="true"
href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org"
rel="noreferrer" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>
TriEmbed web site: <a moz-do-not-send="true"
href="http://TriEmbed.org" rel="noreferrer"
target="_blank">http://TriEmbed.org</a><br>
<br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Triangle, NC Embedded Computing mailing list
<a class="moz-txt-link-abbreviated" href="mailto:TriEmbed@triembed.org">TriEmbed@triembed.org</a>
<a class="moz-txt-link-freetext" href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a>
TriEmbed web site: <a class="moz-txt-link-freetext" href="http://TriEmbed.org">http://TriEmbed.org</a>
</pre>
</blockquote>
<br>
</body>
</html>