Am 13.01.2017 um 18:23 schrieb bdrmachine:
> Wouldsomeone Please help me with the input string needed forthe
> owcapiexample program. I am trying to read my 18b20 sensors that
> areattached to my Raspberry Pi 3 using the I2C interface. I can
> readthem with my browser @ “localhost:2121”. The problem is I cannot
> get the example code that was loaded
> at(/usr/share/doc/libowfs-dev/examples/owcapi/C) to work. I need
> helpfiguring out what parameters to pass to ./owcapiexample ??? ???? 
> Ihave spent countless hours at this. Please help. ThanksBrian
> 
Please understand this very simple test program first:

=== Makefile 
========================================================================
.PHONY: all clean
CFLAGS=-I /opt/owfs/include/
LDFLAGS=-L /opt/owfs/lib64/ -lowcapi

all: owcapitest

clean:
        -rm *.o owcapitest

owcapitest: owcapitest.o
        $(CC) $(LDFLAGS) -o $@ $^

=== owcapitest.c 
====================================================================
#include <stdio.h>
#include <stdlib.h>
#include <owcapi.h>

int main(int argc, char* argv[]) {
        size_t   rs;
        char    *buf;
        ssize_t  rss;

        if ((rss = OW_init("-s localhost:4304")) < 0) {
                        perror("OW_init failed");
                        exit(EXIT_FAILURE);
        }

        if ((rs = OW_get("/uncached/10.AE9C54020800/temperature", &buf, &rs)) < 
0) {
                        perror("OW_get failed");
                        exit(EXIT_FAILURE);
        }

        printf("%s\n",buf);
}
=====================================================================================


Kind regards

        Jan

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to