Files
a2bfc/main.c
2007-09-24 03:27:51 +00:00

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;
}