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:
- 9:268d096562f1
- Parent:
- 2:dc046ff72566
--- a/main.cpp Wed Apr 18 14:45:12 2018 +0000 +++ b/main.cpp Wed Apr 18 15:23:23 2018 +0000 @@ -13,8 +13,8 @@ Microphone mymicrophone(p16); - -int main() { +Mutex mux; +void nrfpcstartup() { //should be called once // The nRF24L01+ supports transfers from 1 to 32 bytes, but Sparkfun's // "Nordic Serial Interface Board" (http://www.sparkfun.com/products/9019) @@ -40,19 +40,27 @@ my_nrf24l01p.setReceiveMode(); my_nrf24l01p.enable(); + while (1) { + + } +} -void michello() { + + +void michello(void const *args) { + mux.lock(); //read in, subtract 0.67 DC bias, take absolute value, and scale up .1Vpp to 15 for builtin LED display myleds = int(abs((mymicrophone - (0.67/3.3)))*500.0); //Use an 8kHz audio sample rate (phone quality audio); wait(1.0/8000.0); + mux.unlock(); } -void sendmic() { - whilte (1) +void nrfctransmit() { + my_nrf24l01p.write(0, (uint8_t)mymicrophone, txDataCnt); } -void pchello() { +void pchello(void const *args) { // If we've received anything over the host serial link... if ( pc.readable() ) { @@ -91,13 +99,11 @@ } Mutex mux; -Thread pcthread; -Thread micthread; - while (1) { - - -} -main (1) { +//Thread pcthread; +//Thread micthread; +int main() { + Thread t1(pchello); + Thread t2(michello); while (1) { }