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 4DGL-uLCD-SE mbed-rtos nRF24L01P
Diff: main.cpp
- Revision:
- 18:e2a8ea6f55d3
- Parent:
- 13:fbcc71fca474
- Child:
- 20:e068469ffb89
--- a/main.cpp Fri Apr 20 15:23:53 2018 +0000 +++ b/main.cpp Fri Apr 20 16:10:43 2018 +0000 @@ -3,6 +3,9 @@ #include "Microphone.h" #include "nRF24L01P.h" #define TRANSFER_SIZE 4 //added 5:54pm 4/18/18 +#include "CircularBuf.h" +#include "HUD.h" +#include "Speaker.h" Serial pc(USBTX, USBRX); // tx, rx nRF24L01P my_nrf24l01p(p5, p6, p7, p8, p9, p10); // mosi, miso, sck, csn, ce, irq @@ -10,7 +13,9 @@ DigitalOut myled2(LED2); DigitalOut myled3(LED3); Ticker t; //10:41 am 4/20 - +CircularBuf<uint_8> txbuf(30); +CircularBuf<uint_8> rxbuf(30); +Speakr spkr(p18); Microphone mymicrophone(p16); InterruptIn Button(p20); //changed DitialIn to InterruptIn at 5:54 4/18/18 AnalogOut speaker(p18); //added 6:34 pm at 4/18/18 @@ -90,14 +95,16 @@ void receive() //most of this function added by david at 6:02pm 4/18/18 { - float sample; - float average = 0.67/3.3;//initial DC bias level + // float sample; + // float average = 0.67/3.3;//initial DC bias level + uint8_t spkrarray[29]; while (Button == 0) { if (my_nrf24l01p.readable(0)) { - my_nrf24l01p.read(0, rxData, 1 );//replace thrid val w/ 1? - sample = uint8_t (rxData); - average = 0.9999*average + 0.0001*sample; //This is in the mPA demo but I'm not sure how it works -david - speaker = 0.5 +((sample - average)*33.0); + rxBuf.push(spkrarray, 30); + spkr.write(spkrarray[1]); + // sample = uint8_t (rxData); + // average = 0.9999*average + 0.0001*sample; //This is in the mPA demo but I'm not sure how it works -david + // speaker = 0.5 +((sample - average)*33.0); } }