CART
  • Cart is empty.

    ItemQuantityPrice

    Total: $0

Temperature Sensor


DS1621 I2C Temperature Sensor

Toolkit:AVR Development System

Location:/bipom/devtools/WinAVR/minimaxavrc/Examples/ds1621

Code Example


int main (void)
{
	ERRCODE ec = SUCCESS;

    BYTE temp = 0;
    
	// delay 500 milliseconds after power up

	_delay_ms(500);        

	// Initialize the serial port 1 to 19200 baud

	uart1Init(19200);

	// Initialize I2C Bus

    i2cInit();	
		
	// Loop forever

	for(;;)
	{
        ec = ds1621Temperature( &temp );
	
		if( ec == SUCCESS )
		{
			uart1Printf( "\n\rTemperature: %d Celsius", temp );
		}
		else
		{
		    uart1Printf( "\n\rError reading temperature, ec=%d", ec );
		}
	}    	
}