Index: trunk/code/projects/colonet/robot/joystick/discrete_control/joystick.c
===================================================================
--- trunk/code/projects/colonet/robot/joystick/discrete_control/joystick.c	(revision 1348)
+++ trunk/code/projects/colonet/robot/joystick/discrete_control/joystick.c	(revision 1349)
@@ -32,10 +32,14 @@
 int joystick_status (void);
 int joystick_change (int old, int new);
 
+PacketGroupHandler cntlHandler = {4, NULL, NULL, NULL, NULL};
+
 int main (void) {
   dragonfly_init(SERIAL | USB | COMM | ORB | ANALOG);
 	ADCSRA = _BV(ADEN) | _BV(ADPS2) | _BV(ADPS1) | _BV(ADPS0);
-	xbee_init();
+  //xbee_init();
+  wl_init();
+  wl_register_packet_group(&cntlHandler);
 
   orb_set_color(BLUE);
   
@@ -48,41 +52,55 @@
     cur_status = joystick_status();
     change = joystick_change(last_status, cur_status);
     
-    char buf[100];
+/*    char buf[100];
     sprintf(buf, "status: %d\n", cur_status);
     usb_puts(buf);
-    
+*/ 
     if (change & MOVED_UP) {
       orb_set_color(GREEN);
-      xbee_putc('f');
+      //xbee_putc('f');
+      wl_send_global_packet(4, 'f', NULL, 0, 0);
+      usb_putc('f');
     }
     if (change & MOVED_Y_CENTER) {
       orb_set_color(RED);
-      xbee_putc('s');
+      //xbee_putc('s');
+      wl_send_global_packet(4, 's', NULL, 0, 0);
+      usb_putc('s');
     }
     if (change & MOVED_DOWN) {
       orb_set_color(BLUE);
-      xbee_putc('b');
+      //xbee_putc('b');
+      wl_send_global_packet(4, 'b', NULL, 0, 0);
+      usb_putc('b');
     }
     if (change & MOVED_LEFT) {
       orb_set_color(ORANGE);
-      xbee_putc('l');
+      //xbee_putc('l');
+      wl_send_global_packet(4, 'l', NULL, 0, 0);
+      usb_putc('l');
     }
     if (change & MOVED_X_CENTER) {
       orb_set_color(RED);
-      xbee_putc('s');
+      //xbee_putc('s');
+      wl_send_global_packet(4, 's', NULL, 0, 0);
+      usb_putc('s');
     }
     if (change & MOVED_RIGHT) {
       orb_set_color(YELLOW);
-      xbee_putc('r');
+      //xbee_putc('r');
+      wl_send_global_packet(4, 'r', NULL, 0, 0);
+      usb_putc('r');
     }
     if (change & TRIGGER_PRESSED) {
       orb_set_color(PURPLE);
-      xbee_putc('t');
+      //xbee_putc('t');
+      wl_send_global_packet(4, 't', NULL, 0, 0);
     }
     if (change & BUTTON_PRESSED) {
       orb_set_color(YELLOW);
-      xbee_putc('u');
+      //xbee_putc('u');
+      wl_send_global_packet(4, 's', NULL, 0, 0);
     }
     delay_ms(100);
   }
@@ -162,3 +180,4 @@
 
   return trigger_status | button_status | x_status | y_status;
 }
+
Index: trunk/code/projects/colonet/robot/joystick/simple_slave/slave.c
===================================================================
--- trunk/code/projects/colonet/robot/joystick/simple_slave/slave.c	(revision 1348)
+++ trunk/code/projects/colonet/robot/joystick/simple_slave/slave.c	(revision 1349)
@@ -2,23 +2,29 @@
 #include <wireless.h>
 #include "../../../common/colonet_defs.h"
 
+void packet_receive (char type, int source, unsigned char* packet, int length);
 
+PacketGroupHandler packetHandler = {4, NULL, NULL, &packet_receive, NULL};
 
 int main (void) {
   dragonfly_init(SERIAL | USB | COMM | ORB | ANALOG | MOTORS | BUZZER);
 	ADCSRA = _BV(ADEN) | _BV(ADPS2) | _BV(ADPS1) | _BV(ADPS0);
-	xbee_init();
+	//xbee_init();
+    wl_init();
+    wl_register_packet_group(&packetHandler);
 	orb_set_color(PURPLE);
   
-  char buf[100];
-  char c;
+  /*char buf[100];
+  char c;*/
   while (1) {
-    c = xbee_getc();
-    orb_set_color(GREEN);
-    sprintf(buf, "got char: %c\n", c);
-    usb_puts(buf);
+    //usb_puts("entering while loop\n");
+    wl_do();
+//    c = xbee_getc();
+//    orb_set_color(GREEN);
+//    sprintf(buf, "got char: %c\n", c);
+//    usb_puts(buf);
     
-    if (c == 'f') {
+    /*if (c == 'f') {
       orb_set_color(GREEN);
       motor1_set(1, 250);
       motor2_set(1, 250);
@@ -52,8 +58,51 @@
       buzzer_chirp(1000, A4);
     }
     
-    delay_ms(100);
+    delay_ms(100);*/
   }
   
 }
 
+void packet_receive (char type, int source, unsigned char* packet, int length) {
+    switch (type) {
+        case 'f':
+            orb_set_color(GREEN);
+            motor1_set(1, 250);
+            motor2_set(1, 250);
+            break;
+        case 's':
+            orb_set_color(RED);
+            motor1_set(0, 0);
+            motor2_set(0, 0);
+            break;
+        case 'b':
+            orb_set_color(BLUE);
+            motor1_set(0, 250);
+            motor2_set(0, 250);
+            break;
+        case 'l':
+            orb_set_color(ORANGE);
+            motor1_set(0, 250);
+            motor2_set(1, 250);
+            break;
+        case 'r':
+            orb_set_color(YELLOW);
+            motor1_set(1, 250);
+            motor2_set(0, 250);
+            break;
+        case 't':
+            orb_set_color(PURPLE);
+            buzzer_chirp(1000, C5);
+            break;
+        case 'u':
+            orb_set_color(YELLOW);
+            buzzer_chirp(1000, A4);
+            break;
+        default:
+            orb_set_color(RED);
+            motor1_set(0, 0);
+            motor2_set(0, 0);
+            break;
+    }
+}
+
