git-svn-id: https://svn.salfter.gotdns.org/svn/a2bfc/trunk@87 1b90f75b-8b96-4784-87c0-14078182fce6
37 lines
659 B
C
37 lines
659 B
C
#include <stdio.h>
|
|
#include <conio.h>
|
|
#include "ow.h"
|
|
#include "ow-temp.h"
|
|
|
|
int main (void)
|
|
{
|
|
short i, devcount;
|
|
unsigned char devs[80];
|
|
unsigned char* tempsensor=NULL;
|
|
unsigned char* clock=NULL;
|
|
|
|
devcount=ow_enumeratedevices(devs, 10);
|
|
for (i=0; i<devcount; i++)
|
|
if (ow_temp_idcheck(&devs[i<<3]))
|
|
tempsensor=&devs[i<<3];
|
|
if (tempsensor==NULL)
|
|
{
|
|
printf("Error: no temperature sensor found.\n");
|
|
return -1;
|
|
}
|
|
|
|
do
|
|
{
|
|
do
|
|
{
|
|
for (i=0; i<250; i++)
|
|
ow_mswait();
|
|
printf("%i deg F\n", ow_temp_read(tempsensor, OW_TEMP_FAHRENHEIT));
|
|
}
|
|
while (!kbhit());
|
|
}
|
|
while (cgetc()!=3);
|
|
|
|
return 0;
|
|
}
|