Re: Raspberry Pi temperature sensors

new topic     » goto parent     » topic index » view thread      » older message » newer message
ryanj said...

so it just took some system_exec() and pipeio:exec() calls

I'm not too keen on saying "I did this with Euphoria" only to say "by using system(), etc." it just feels a bit dishonest. Anybody can run another app that does the heavy lifting.

I don't have a sensor handy to test this right now, but you should be able to copy the Bash script near verbatim:

#!/usr/bin/env eui 
 
include std/io.e 
include std/convert.e 
 
-- Read Temperature 
object tempread = read_file( "/sys/bus/w1/devices/10-000802b4ba0e/w1_slave" ) 
 
-- Format 
atom temp = to_number( tempread[match("t=",tempread)+2..$] ) / 1000 
 
-- Output 
printf( STDOUT, "The measured temperature is %0.2f°C\n", temp ) 

Of course, this could do with some better error and type checking, as could the example Bash script.

-Greg

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu