Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
et:examples:sensor:demo [2010/11/09 18:07] raivo.sellet:examples:sensor:demo [2020/07/20 12:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +<code c>
 +#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);
 + }
 +}
 +</code>
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