a

Fork of ESE519_Lab6_part1_skeleton by Carter Sharer

Revision:
11:46c532b752d5
Parent:
10:dafae6093487
Child:
12:ea030e3181d3
--- a/main.cpp	Thu Nov 01 22:50:44 2018 +0000
+++ b/main.cpp	Fri Nov 01 18:48:35 2019 +0000
@@ -10,7 +10,6 @@
 #include "Joystick.h"
 #include "wifiGETWrapper.h"
 #define SEND        //Uncomment if you want to transmit data
-
 #define NONE 250
 
 //============================
@@ -58,136 +57,9 @@
 // Serial port for showing RX data.
 Serial pc(USBTX, USBRX);
 
-// Send / receive buffers.
-// IMPORTANT: The MRF24J40 is intended as zigbee tranceiver; it tends
-// to reject data that doesn't have the right header. So the first
-// 8 bytes in txBuffer look like a valid header. The remaining 120
-// bytes can be used for anything you like.
 char txBuffer[128];
 char rxBuffer[128];
 int rxLen;
-//***************** You can start coding here *****************//
-
-//Returns true if c is a letter (upper or lower case), false otherwise
-bool isLetter(char c) {
-    
-    /*
-    * YOUR IMPLIMENTATION HERE
-    *
-    *
-    *
-    */
-    
-    return false;
-}
-
-//Returns true if c is a number character (0-9), false otherwise
-bool isNumber(char c) {
-    
-    /*
-    * YOUR IMPLIMENTATION HERE
-    *
-    *
-    *
-    */
-    
-    return false;
-}
-
-//Pulls data out of rxBuffer and updates global variables accordingly 
-//Len is the length of the rxBuffer we are going to scan 
-void communication_protocal(int len)
-{
-    bool found_name = false;
-    bool found_num = false;
-    bool complete_name = false;
-    bool complete_num = false;
-    uint8_t name_start = NONE; uint8_t name_end = NONE;
-    uint8_t num_start = NONE; uint8_t num_end = NONE;
-    
-    //Loop through all charaters in rxBuffer
-    for(uint8_t i = 0; i <= rxLen; i++) {
-        char c = rxBuffer[i];
-        //pc.printf("Indexed char '%c'\r\n", c);
-
-        //Is it the start of a name? (Check if its a letter)
-        if(isLetter(c) & name_start==NONE) { //if a num
-            //If We havent found a name yet, this is start of a name
-            if(found_name == false) {
-                //pc.printf("found name start at: '%c'\r\n", c);
-                name_start = i;
-                found_name = true;
-            }
-        }
-        //Is is a 'end of name' charater? Check for ' ', ':', '-'
-        else if(((c == '|') | (c == ':') | (c == '-')) & found_name & !complete_name) {// found end name character
-            if(found_name) {
-                complete_name = true;
-                name_end = i;
-                //pc.printf("found end of name at: '%c'\r\n", txBuffer[name_end]);
-            }
-        }
-
-        //Is it a 'start of a number' charater? Check if its a number, or '-', or a '.'
-        else if( (isNumber(c) | (c=='-') | (c=='.')) & complete_name & num_start==NONE) {
-            if(found_num == false) {
-                //pc.printf("found num start at: '%c'\r\n",c);
-                num_start = i;
-                found_num = true;
-            }
-        }
-        //Is it a 'end of number' character? Check if its a ' ', ':', '-', or a letter
-        else if( (((c=='|')|(c==':')|(c=='-')) | isLetter(c)) & found_num & complete_name) {
-            if(found_num) {
-                complete_num = true;
-                num_end = i;
-                //pc.printf("found end of num at: '%c' \r\n", txBuffer[num_end]);
-            }
-        }
-        
-        //If we have a complete name AND number value (ie. start and end of each != NONE)
-        if(found_name & found_num & complete_name & complete_num) {
-            //pc.printf("Found MATCH\r\n");
-            //Reset flags
-            found_name = false;
-            found_num = false;
-            complete_name = false;
-            complete_num = false;
-            
-            //Set name
-            uint8_t nameLen = uint8_t((name_end-name_start) + 1);
-            char * name[nameLen];
-            *name = &rxBuffer[name_start];
-            rxBuffer[name_end] = '\0';
-            
-            //Set num
-            uint8_t numLen = uint8_t((num_end-num_start) + 1);
-            char * num[numLen];
-            *num = &rxBuffer[num_start];
-            rxBuffer[num_end] = '\0';
-            
-            //Now that we have isolated a name and its number value
-            //we want to set the corresponding value to this number.
-            //Ex: if name is 'Knob4' and num is '0.34', we want to the the 
-            // variable name knob4 to the value 0.34.  
-            //Do this for all variable names in COMMUNICATION_FORMAT
-            //HINT: look up strcmp, and atof
-            /*
-            * YOUR IMPLIMENTATION HERE
-            *
-            *
-            *
-            */
-            
-            
-            //Reset flags
-            name_start = NONE;
-            name_end = NONE;
-            num_start = NONE;
-            num_end = NONE;
-        }
-    }
-}
 
 int main (void)
 {
@@ -195,10 +67,13 @@
     //Set Baud rate (9600-115200 is ideal)
     pc.baud(115200);
     pc.printf("\r\n Start! \r\n");
+
     //This is an example wifi connection! Please fill this in with the SSID of your BBBL and the password too.
-    const char * SSID = "BeagleBone-365E";
-    const char * password = "BeagleBone";
+    const char * SSID = "BeagleBone-365E";//TODO: CHANGE THIS LINE
+    const char * password = "BeagleBone";//TODO: CHANGE THIS LINE
+
     initConnection(SSID,password);
+    
     //Start Timer
     timer.start();