Created
May 23, 2015 02:18
-
-
Save LaloHao/a84376b035f07a472842 to your computer and use it in GitHub Desktop.
Pic BT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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