ECE 4180 - Final Project Team / Mbed 2 deprecated WalkieTalkie

Dependencies:   mbed 4DGL-uLCD-SE mbed-rtos nRF24L01P

Revision:
13:fbcc71fca474
Parent:
12:efcfe4c0d9f2
Child:
18:e2a8ea6f55d3
--- a/main.cpp	Fri Apr 20 14:38:27 2018 +0000
+++ b/main.cpp	Fri Apr 20 14:59:25 2018 +0000
@@ -9,6 +9,7 @@
 DigitalOut myled1(LED1);
 DigitalOut myled2(LED2);
 DigitalOut myled3(LED3);
+Ticker t; //10:41 am 4/20
 
 Microphone mymicrophone(p16);
 InterruptIn Button(p20); //changed DitialIn to InterruptIn at 5:54 4/18/18
@@ -17,7 +18,8 @@
 char txData[TRANSFER_SIZE], rxData[TRANSFER_SIZE]; //making these usable by other voids.
 int txDataCnt = 0;//and this.
 int rxDataCnt = 0;//and this. //David Rechtmann 6.24 pm 4/18/18
-
+int micvalue[30];
+    int micvalcount = 0;
 void startup()
 {
 
@@ -99,7 +101,7 @@
         }
 
     }
-}
+}`  
 
 void transmit()
 {
@@ -109,15 +111,25 @@
     // txData[txDataCnt++] = ;
     speaker = 0;
     while (Button == 1) {
-        my_nrf24l01P.write(0, mymicrophone.getData(), 1);
+        my_nrf24l01P.write(0, micvalue, 30);
     }
 }
 
+void pollmic()
+{
+    micvalue[micvalcount] = mymicrophone.getData();
+    micvalcount = micvalcount + 1;
+    if (micvalcount > 30); {
+    micvalcount = 0;
+    }
+    
+    }
+
 int main()
 {
     Button.mode(PullUp);//added 6:23pm 4/18/18
-    Button.rise(&transmit);
-    Button.fall(&receive);
+    t.attach(&pollmic, 0.0001);
+    t.attach(&receive, 0.0001);
     while (1) {
 
     }