Steven Rhodes / Mbed 2 deprecated CNCAirbrushCode
Revision:
0:22803b0c80a9
Child:
1:648d1f317624
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Apr 17 09:52:07 2012 +0000
@@ -0,0 +1,34 @@
+#include "mbed.h"
+#include "Wifly.h"
+LocalFileSystem local("local");
+Serial pc(USBTX, USBRX);
+DigitalOut led(LED1);
+Wifly wifi(p9, p10, p8);
+Command * cmd;
+
+int main() {
+    pc.baud(460800);
+    printf("Test Airbrush!\r\n");
+    wifi.createAdhocNetwork();
+    while (1) {
+        while(pc.readable()) {
+            wifi.putc(pc.getc());
+        }
+        while(wifi.readable()){
+            pc.putc(wifi.getc());
+        }
+        if(wifi.hasCmd()){
+            cmd = wifi.getCmd();
+            switch(cmd->cmd) {
+              case 0x00:
+                pc.printf("Move to x: %d, y:%d, z:%d\n\r", cmd->l[0], cmd->l[1], cmd->l[2]);
+                wait(3);
+                wifi.send("Done"); // Make sure to always send confirmation
+                break;
+              default:
+                pc.printf("You should probably do something with case %x\n\r", cmd->cmd);
+                wifi.send("No code");
+            }
+        }
+    }
+}