Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-os nRF24L01P
main.cpp
- Committer:
- emerichartmann
- Date:
- 2022-01-14
- Revision:
- 11:dfaa218e7949
- Parent:
- 10:c24908236b2d
- Child:
- 12:155a1ce7c92b
File content as of revision 11:dfaa218e7949:
/*
RobotCup ENS Paris Saclay 2021-2022
Code by Eve Delegue
2021-12-17
Programme communication PC-Robot
Point de vue : pc
micro controleur : L432
envoi d'une chaine de caractère de taille TRANSFER_SIZE = 20
*/
#include "mbed.h"
#include "nRF24L01P.h"
/* 115200 bit/s */
BufferedSerial pc(USBTX, USBRX,115200); // tx, rx
//Définition des E/S de la liaison SPI vers le module nRF24L01+
nRF24L01P my_nrf24l01p(D11, D12, D13, A3, D9, A0); // mosi, miso, sck, csn, ce, irq
int main()
{
#define TRANSFER_SIZE 32
char c;
my_nrf24l01p.powerUp();
my_nrf24l01p.setRfFrequency(2418);
my_nrf24l01p.setAirDataRate(1000);
my_nrf24l01p.setRfOutputPower(-6);
my_nrf24l01p.setTransferSize( TRANSFER_SIZE );
my_nrf24l01p.setTransmitMode();
my_nrf24l01p.setCrcWidth(0);
my_nrf24l01p.setTxAddress();
my_nrf24l01p.enable();
while (1) {
if (pc.readable())
{
for (int i=0; i<32 ; i++){
pc.read(&c+i,1);
}
pc.write(&c,32);
my_nrf24l01p.write( NRF24L01P_PIPE_P0, &c ,32);
}
}
}