Takes data over the serial connection and transmits it over a radio link using the nRF24L01+.

Dependencies:   Radio mbed

Committer:
pclary
Date:
Mon Sep 02 02:20:09 2013 +0000
Revision:
0:114850b470f5
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pclary 0:114850b470f5 1 #include "mbed.h"
pclary 0:114850b470f5 2 #include "Radio.h"
pclary 0:114850b470f5 3
pclary 0:114850b470f5 4
pclary 0:114850b470f5 5
pclary 0:114850b470f5 6 RadioController radio(p5, p6, p7, p8, p9);
pclary 0:114850b470f5 7
pclary 0:114850b470f5 8
pclary 0:114850b470f5 9
pclary 0:114850b470f5 10 int main()
pclary 0:114850b470f5 11 {
pclary 0:114850b470f5 12 Serial pc(USBTX, USBRX);
pclary 0:114850b470f5 13 pc.baud(460800);
pclary 0:114850b470f5 14
pclary 0:114850b470f5 15 radio.reset();
pclary 0:114850b470f5 16
pclary 0:114850b470f5 17 uint32_t data;
pclary 0:114850b470f5 18
pclary 0:114850b470f5 19 while (true)
pclary 0:114850b470f5 20 {
pclary 0:114850b470f5 21 data = 0;
pclary 0:114850b470f5 22 data |= ((uint32_t)pc.getc()) << 0;
pclary 0:114850b470f5 23 data |= ((uint32_t)pc.getc()) << 8;
pclary 0:114850b470f5 24 data |= ((uint32_t)pc.getc()) << 16;
pclary 0:114850b470f5 25 data |= ((uint32_t)pc.getc()) << 24;
pclary 0:114850b470f5 26 radio.transmit(data);
pclary 0:114850b470f5 27 }
pclary 0:114850b470f5 28 }