#include <built_in.h> unsigned int valor_sensor = 0; unsigned int luz = 0; void main() {    ANSELH = 0;   ANSELA = 0x02;                          // Configure RA1 pin as analog   ANSELC = 0;                             // Configure PORTC pins as digital   C1ON_bit = 0;                           // Disable comparators   C2ON_bit = 0;    TRISA = 0x02;                          // Set RA1 pin as input   TRISC = 0x00;                          // Set PORTC as output    UART1_Init(9600);                      // Initialize UART module at 9600 bps   Delay_ms(100);                         // Wait for UART module to stabilize    while (1) {                            // Endless loop         valor_sensor = ADC_Read(1);      // get ADC value from 1st channel  RA1         luz = (5.0 * valor_sensor * 100.0)/1024.0;         UART1_Write_Text(luz+" Luz/n");         Delay_ms(300);          if (luz <= 490)                 //Si la resistendia que produce el ldr es menor o igual que 490          {           LATC = 0x00;                   //Turn OFF on PORTC El led se apaga          }          else                            //Si es mayor que 490          {           LATD = 0xff;                   //Turn ON on PORTC El led se eniende          }     }   } }