Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float ds18x20_temp_read( char *id, char family )
- {
- FILE *f;
- char path[MAX_PATH_LEN];
- float value;
- sprintf( path, "%s/%02X.%s/temperature", OWFS_PATH, family, id );
- f = fopen( path, "r" );
- if ( f == NULL )
- {
- printf( "Error opening file %s for read!\n", path );
- return -1;
- }
- fscanf( f, "%f", &value );
- fclose( f );
- printf( "t: %f\n", value );
- return value;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement