init

Dependencies:   mbed nRF24L01P

Committer:
ViriJay
Date:
Fri Jan 18 10:41:07 2019 +0000
Revision:
0:7c3fd90d5bd9
Child:
1:053b63d70298
init

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ViriJay 0:7c3fd90d5bd9 1 #include "mbed.h"
ViriJay 0:7c3fd90d5bd9 2 #include "nRF24L01P.h"
ViriJay 0:7c3fd90d5bd9 3
ViriJay 0:7c3fd90d5bd9 4 SPI spi(D11, D12, D13);
ViriJay 0:7c3fd90d5bd9 5 DigitalOut cs(D10, 1);
ViriJay 0:7c3fd90d5bd9 6 nRF24L01P my_nrf24l01p(D11, D12, D13, D8, D9, D7); // mosi, miso, sck, csn, ce, irq
ViriJay 0:7c3fd90d5bd9 7
ViriJay 0:7c3fd90d5bd9 8 #define TRANSFER_SIZE 2
ViriJay 0:7c3fd90d5bd9 9
ViriJay 0:7c3fd90d5bd9 10 void toggle_led() {
ViriJay 0:7c3fd90d5bd9 11 led1 = !led1;
ViriJay 0:7c3fd90d5bd9 12 }
ViriJay 0:7c3fd90d5bd9 13
ViriJay 0:7c3fd90d5bd9 14 int main() {
ViriJay 0:7c3fd90d5bd9 15 // Init the ticker with the address of the function (toggle_led) to be attached and the interval (100 ms)
ViriJay 0:7c3fd90d5bd9 16 toggle_led_ticker.attach(&toggle_led, 0.1);
ViriJay 0:7c3fd90d5bd9 17 while (true) {
ViriJay 0:7c3fd90d5bd9 18 // Do other things...
ViriJay 0:7c3fd90d5bd9 19 }
ViriJay 0:7c3fd90d5bd9 20 }