// Прошивка для удаленного радиомодуля #include #include #include #include #include "nrf24l01/nrf24.h" typedef struct data_arr{ uint8_t buffer[32]; }data_array; uint8_t tx_mac[5] = {0xE7,0xE7,0xE7,0xE7,0xE7}; uint8_t rx_mac[5] = {0xD7,0xD7,0xD7,0xD7,0xD7}; int main(void){ /* initializes hardware pins */ nrf24_init(); /* RF channel: #2 , payload length: 4 */ nrf24_config(2,32); /* Set the module's own address */ nrf24_rx_address(rx_mac); /* Set the transmit address */ nrf24_tx_address(tx_mac); sei(); data_array buff; while(1){ if(nrf24_dataReady()){ nrf24_getData((uint8_t *) &buff); nrf24_send((uint8_t*) &buff); /* Wait for transmission to end */ while(nrf24_isSending()); /* Optionally, go back to RX mode ... */ nrf24_powerUpRx(); /* Wait a little ... */ _delay_ms(10); } } }