Simple data sending to test operability of the radio.

Dependencies:   RF24_fork mbed

Fork of Sensornode_temp by Daniel Mako

main.cpp

Committer:
Makodan
Date:
2018-05-14
Revision:
1:bd92b3ee97c1
Parent:
0:49273053c399

File content as of revision 1:bd92b3ee97c1:

#include "mbed.h"
#include "config.h"
#include "RF24.h"


DigitalOut myled(ledpin);

RF24 radio(spi_MOSI, spi_MISO, spi_SCK, nrf_CE, nrf_CSN );



void RadioSetup();

int main(){

    myled=1;
    RadioSetup();
    radio.stopListening();
    wait_ms(1000);
    myled=0;
    int dummy = 1234;
    
     while(1){
        
        myled=1;  
        radio.write(&dummy, 4);
        wait_ms(1000);
        myled=0;
        wait_ms(1000);
    }
}
    
    void RadioSetup(){
    radio.begin();
    radio.setPALevel(RF24_PA_MAX);
    radio.setChannel(RadioChannel);
    radio.setRetries(0,2);
    radio.setDataRate(RF24_2MBPS);
    radio.enableDynamicAck();
    radio.enableDynamicPayloads();
    radio.openWritingPipe(DataAddress);
    }