//************************************************************************************************************ // The following code uses a modified version of Nathan Labott's code from his senior capstone of Spring 2019. // This includes functions, comments, and their respective implementation. // To see the original version of this implementation, use the following URL link: // http://compsci02.snc.edu/cs460/2019/labonw/uploads/1/2/4/1/124126046/maincsspring2019.zip //************************************************************************************************************ // auto.c #include "abdrive.h" #include "ping.h" #include "servo.h" #include "simpletools.h" #include "wifi.h" void auto(); char cmd, direction; int * cog; int event, id, handler, navId; char grid[ROWS][COLUMNS]; int main() { wifi_start(31, 30, 115200, WX_ALL_COM); // communication to bot is through WX Wi-Fi Module navId = wifi_listen(HTTP, "/path"); // bot will listen on the same path created by the webpage cog = cog_run(auto, 128); } void auto() { while (1) { wifi_poll(&event, &id, &handler); // grab data from path if (event == 'P') { // POST request if (id == navId) { print("Incoming POST request\r"); wifi_scan(POST, handler, "go%c", &cmd); print("go=%c\n", cmd); } } switch (cmd) { case 'F': drive_goto(61, 61); // move forward (currently set at ~20 cm -- change to fit the distance between the center of your cells of your grid) break; case 'L': drive_goto(-25, 26); // make a zero-radius turn to the left (no overall distance made) break; case 'R': drive_goto(26, -25); // make a zero-radius turn to the right (no overall distance made) break; default: break; } } }