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

Kevin Cozens kevin-4dS5u2o1hCn3fQ9qLvQP4Q at public.gmane.org
Fri Jan 17 18:20:55 UTC 2014


On 14-01-16 09:37 PM, Jamon Camisso wrote:
> On 16/01/14 08:54 PM, Kevin Cozens wrote:
>>    sscanf(&line[len-6], "%f", &raw_temp);
>
> Ah interesting, do I understand this correctly as: sscanf returns the
> indicated 6 bytes of the contents of the string 'line' into the memory
> address of the float raw_temp?

The first parameter is the address where it will start scanning for 
something. The second parameter is the format of what it expects to find (in 
this case, a floating point number). The third parameter is the address of a 
variable where it will store the floating point number it reads from the 
memory pointed to by the first parameter.

-- 
Cheers!

Kevin.

http://www.ve3syb.ca/           |"Nerds make the shiny things that distract
Owner of Elecraft K2 #2172      | the mouth-breathers, and that's why we're
                                 | powerful!"
#include <disclaimer/favourite> |             --Chris Hardwick
--
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