This is an old revision of the document!


//
#include <stdio.h>
#include <homelab/adc.h>
#include <homelab/module/sensors.h>
#include <homelab/module/lcd_alpha.h>
 
//
// Põhiprogramm
//
int main(void)
{
	unsigned short value;
	signed short temperature;	
	char text[16];
 
	// LCD ekraani seadistamine
	lcd_alpha_init(LCD_ALPHA_DISP_ON);
 
	// LCD ekraani puhastamine
	lcd_alpha_clear();
 
	// Programmi nimi
	lcd_alpha_write_string("Termomeeter");
 
	// ADC muunduri seadistamine
	adc_init(ADC_REF_AVCC, ADC_PRESCALE_8);
 
	// Lõputu tsükkel
	while (true)
	{
		value = adc_get_average_value(2, 4);
		sprintf(text, "%d\337C   ", thermistor_calculate_celsius(value));
 
		// Teksti kuvamine LCD teise rea alguses
		lcd_alpha_goto_xy(0, 1);
		lcd_alpha_write_string(text);
 
	}
}
et/examples/sensor/demo.1289316172.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0