This is an old revision of the document!


#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);

}

}

et/examples/sensor/demo.1289318852.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