How to read a 1-wire sensor with C on a Raspberry Pi

Mel Wilson mwilson-Ja3L+HSX0kI at public.gmane.org
Fri Jan 17 01:43:47 UTC 2014


On Thu, 2014-01-16 at 20:01 -0500, Jamon Camisso wrote:
> On 16/01/14 07:55 PM, Jamon Camisso wrote:
> > So I've managed to get a temperature sensor wired up and outputting data
> > from my Raspberry Pi. I can poll the /sys/bus/w1/devices file for the
> > sensor and see output like the following:
> > [ ... ]
> Ah and note: I know that the inline variable assignment is bad form, I'm
> just trying to save some space. I also know my rounding is off here:
> float temp_f = floorf((atof(temp_raw)/1000 + 0.05)*100)/100;
> 
> But that I can figure out on my own.

Could I ask which sensor you're using, and how you've hooked it up?  I'm
doing similar things here, using RHT02, RHT03 or DS1820B.  I've been
using them with Arduini, though.  I have some RasPi boards to play with.

	Mel.


--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list