Soft Serial is working, barely and grossly.

Dependencies:   SoftSerial mbed-rtos mbed

Revision:
0:e584a98289a4
Child:
1:05a16e044d09
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jun 21 21:44:50 2017 +0000
@@ -0,0 +1,87 @@
+#include "mbed.h"
+#include "SoftSerial.h"
+#include "rtos.h"
+#include <sstream>
+
+/* --------- I/O INFORMATION ---------
+ USB Debugging Pins: tx = D1(PA2), rx = D0(PA3)
+ XBEE Board Pins: 
+    DOUT (rx) <- D3 (PB3)
+    DIN (tx)  <- D2 (PA10)   
+    GND <- GND
+    5V <- 5V
+    
+*/ 
+
+Serial pc(D1, D0); // PA2, PA3
+
+const int nodeID = 0;
+void initialize_node(SoftSerial &xbee);
+//Thread thread;
+
+int uptime = 0;
+
+int main()
+{
+    SoftSerial xbee(D3, D2); // tx, rx
+    initialize_node(xbee);
+    pc.printf("ECHOOOOOO");
+    
+    char data;
+    
+    while(true) {
+        
+        // Continuous transmit
+        /*
+        std::stringstream s;
+        s << 'H' << 'E' << 'L' << 'L' << 'O';
+        xbee.printf(s.str().c_str());
+        */
+        
+        //xbee.printf("%d", nodeID);
+        xbee.printf("Times Through Loop: %d", uptime);
+        xbee.printf("\n");
+        //pc.printf("%d", nodeID);
+        uptime++;
+        wait(0.1);
+        
+        //Requested transmit
+        if(xbee.readable()) {
+            data = xbee.getc();
+            if(data == 'p'){
+                xbee.printf("%d", nodeID);
+            } else if (data == 'u') {
+                xbee.printf("uptime = %d\n", uptime);
+            }
+        }
+        
+    }
+}
+
+void initialize_node(SoftSerial &xbee){
+    // Eventually put stuff here. 
+}
+
+/*
+int main(){
+    pc.printf("Echoes back to the screen anything you type\n");
+    while(1){
+        if(pc.readable()){
+            pc.putc(pc.getc()+1);
+            pc.printf("\n");
+        }
+        
+        wait(0.1);
+        pc.printf("E");
+    }
+} 
+*/
+
+
+
+
+
+
+
+
+