Skip to content

Instantly share code, notes, and snippets.

@LaloHao
Created May 23, 2015 02:18
Show Gist options
  • Save LaloHao/a84376b035f07a472842 to your computer and use it in GitHub Desktop.
Save LaloHao/a84376b035f07a472842 to your computer and use it in GitHub Desktop.
Pic BT
char uart_rd;
void main()
{
UART1_Init(9600);
Delay_ms(100);
do
{
if (UART1_Data_Ready()) { // Si se recibe un dato en UART
uart_rd = UART1_Read();
UART1_Write(uart_rd);
if(uart_rd == '1') //Encender Luz
PORTE.RE1 = 1;
else if(uart_rd == '0') //Apagar Luz
PORTE.RE1 = 0;
else if(uart_rd == '2') //Encender ventilador
PORTA.RA5 = 1;
else if(uart_rd == '3') //Apagar ventilador
PORTA.RA5 = 0;
}
} while (1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment