Hi everyone
I want to sperate array data. For example phone send sifre[4] = {0x00, 0x01, 0x02, 0x03} and seperate my board
how can i do it?
Hi everyone
I want to sperate array data. For example phone send sifre[4] = {0x00, 0x01, 0x02, 0x03} and seperate my board
static const uint16_t sifre[4] = {0x00, 0x01, 0x02, 0x03}; if(led_state == sifre[4]) bsp_board_led_on(LED_2)
how can i do it?
This doesn't make much sense.
Do you actually want to check led_state against your sifre array? Where does the data array come from? What kind of data type is led_state? If by data[4] you mean sifre[4], then sifre[4] is outside your data array's boundaries. You need to check sifre[3] to get the fourth byte in the array.
This doesn't make much sense.
Do you actually want to check led_state against your sifre array? Where does the data array come from? What kind of data type is led_state? If by data[4] you mean sifre[4], then sifre[4] is outside your data array's boundaries. You need to check sifre[3] to get the fourth byte in the array.
If you simply want to compare two arrays you can do it like suggested here for example: C program to compare two arrays.
bool compareArray(uint8_t a[], uint8_t b[], uint8_t size) { for(uint8_t i = 0; i < size; i++) { if(a[i]!=b[i]) { return false; } } return true; }