#include <stdio.h>
#include <homelab/delay.h>
#include <homelab/adc.h>
#include <homelab/module/sensors.h>
#include <homelab/module/lcd_alpha.h>
#include <homelab/module/segment_display.h>
 
int main(void)
{
	char t[16];
 
	lcd_alpha_init(LCD_ALPHA_DISP_ON);
	lcd_alpha_clear();
	lcd_alpha_write_string("Andurite demo");
	adc_init(ADC_REF_AVCC, ADC_PRESCALE_8);
	segment_display_init();
 
	while (true)
	{
 
 
		sprintf(t, "%d\337C %dlx %dcm", thermistor_calculate_celsius(adc_get_average_value(2, 4)),adc_get_average_value(1, 4), ir_distance_calculate_cm(GP2Y0A21YK, adc_get_average_value(0, 4)));
		lcd_alpha_goto_xy(0, 1);
		lcd_alpha_write_string(t);
 
		segment_display_write(adc_get_average_value(3, 4) * 10 / 1024);
 		sw_delay_ms(500);
	}
}