void Proceso(void){ // Lectura del Voutput del sensor LM35 // Mostrando Voutput y su conversion a °C char val[15]; float volts; float grados; char centigrados[15]; adc_value = ADC1_Get_Sample(10); grados = adc_value/cuentas; FloatToStr(grados,centigrados); UART1_Write_Text(centigrados); UART1_Write(13); UART1_Write(10); Lcd_Out(1, 1, centigrados); Lcd_Out(1, 8, "\xDFc"); volts = adc_value; FloatToStr(volts,val); Lcd_Out(2, 15, "V"); Lcd_Out(2, 1, val); delay(0xFFFFF); Lcd_Cmd(_LCD_CLEAR); if (UART1_Data_Ready()) { // If data is received uart_rd = UART1_Read(); // read the received data if (uart_rd == '1'){ LAMPARA = ~LAMPARA; } else if (uart_rd == '2') { VENTILADOR = ~VENTILADOR; } } }
void ReadSensor() { adc_rd = ADC1_Get_Sample( 12 ); Delay_ms(10); }