Skip to content

Jacajack/avr-ds18b20

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

avr-ds18b20

The MIT License Travis CI

avr-ds18b20 is an AVR library for controlling DS18B20 temperature sensors. It can be easily compiled for every micro-controller supported by avr-gcc.

Usage example

#include <avr/io.h>
#include <util/delay.h>
#include <stdio.h>

#include <ds18b20/ds18b20.h>

int main( )
{
	int temp;

	while ( 1 )
	{
		//Start conversion (without ROM matching)
		ds18b20convert( &PORTB, &DDRB, &PINB, ( 1 << 0 ), NULL );

		//Delay (sensor needs time to perform conversion)
		_delay_ms( 1000 );

		//Read temperature (without ROM matching)
		ds18b20read( &PORTB, &DDRB, &PINB, ( 1 << 0 ), NULL, &temp );

		//Somehow use data stored in `temp` variable
	}

	return 0;
}

For more information visit wiki.