abduallah Azizi
abduallah Azizi

Reputation: 1

How to turn on LED in pıc24FJ124 and UART by reading message using UART1_read()

I can read and write message with UART and access port and it works correctly. Now I want to turn on one of the LEDs on the circuit For example when I send "ON" it will turn on the LED (ex:RC3) I did it but just at first of running the code after that it stop .

this part of code :

if (UART1_IsRxReady()) {
         Temp Array [Index++] = UART1_Read();
    }
    if (( Temp Array[Index - 1] == '\n') || (TempArray[Index] == '\n') || (TempArray[Index] == '\r\n')) {
        if (TempArray[0] == 'O' && TempArray[1] == 'N') {
            IO_RC3_Toggle();
            for (int i = 0; i < Index; i++) {
                printf("%c", TempArray[i]);
            } UART1_Read();}
        else if (TempArray[0] == 'O' && TempArray[1] == 'F') {
            IO_RC4_Toggle();
            for (int i = 0; i < Index; i++) {
                printf("%c", TempArray[i]);
            }
            UART1_Read();
           
           
        }  Reset_Buff();
    }

Upvotes: 0

Views: 122

Answers (0)

Related Questions