C++ Library for the PsiSwarm Robot - Version 0.8

Dependents:   PsiSwarm_V8_Blank_CPP Autonomia_RndmWlk

Fork of PsiSwarmV7_CPP by Psi Swarm Robot

Revision:
9:dde9e21030eb
Parent:
8:6c92789d5f87
Child:
10:e58323951c08
--- a/serial.cpp	Sun Oct 16 12:54:33 2016 +0000
+++ b/serial.cpp	Sun Oct 16 14:12:49 2016 +0000
@@ -13,7 +13,7 @@
  * (C) Dept. Electronics & Computer Science, University of York
  * James Hilder, Alan Millard, Alexander Horsfield, Homero Elizondo, Jon Timmis
  *
- * PsiSwarm Library Version: 0.7
+ * PsiSwarm Library Version: 0.8
  *
  * October 2016
  *
@@ -353,7 +353,7 @@
             sprintf(subcommand,"G:%s R:%s",IF_char_to_binary_char(message[1]), IF_char_to_binary_char(message[2]));
             if(allow_commands) {
                 command_status = 1;
-                set_leds(message[1],message[2]);
+                led.set_leds(message[1],message[2]);
             } else command_status = 2;
             break;
         case 11:
@@ -361,7 +361,7 @@
             sprintf(subcommand,"%s",IF_char_to_binary_char(message[1]));
             if(allow_commands) {
                 command_status = 1;
-                set_red_leds(message[1]);
+                led.set_red_leds(message[1]);
             } else command_status = 2;
             break;
         case 12:
@@ -369,7 +369,7 @@
             sprintf(subcommand,"%s",IF_char_to_binary_char(message[1]));
             if(allow_commands) {
                 command_status = 1;
-                set_green_leds(message[1]);
+                led.set_green_leds(message[1]);
             } else command_status = 2;
             break;
         case 13:
@@ -392,7 +392,7 @@
                 sprintf(subcommand,"%d %s",message[1],colour_string);
                 if(allow_commands) {
                     command_status = 1;
-                    set_led(message[1],message[2]);
+                    led.set_led(message[1],message[2]);
                 } else command_status = 2;
             } else {
                 sprintf(subcommand,"[INVALID CODE]");
@@ -419,7 +419,7 @@
                 sprintf(subcommand,"%s",colour_string);
                 if(allow_commands) {
                     command_status = 1;
-                    set_center_led(message[1]);
+                    led.set_center_led(message[1]);
                 } else command_status = 2;
             } else {
                 sprintf(subcommand,"[INVALID CODE]");
@@ -432,7 +432,7 @@
             sprintf(subcommand,"%1.5f",dec);
             if(allow_commands) {
                 command_status = 1;
-                set_center_led_brightness(dec);
+                led.set_center_led_brightness(dec);
             } else command_status = 2;
             break;
         case 16:
@@ -452,7 +452,7 @@
             sprintf(subcommand,"FOR %1.5fS",dec);
             if(allow_commands) {
                 command_status = 1;
-                blink_leds(dec);
+                led.blink_leds(dec);
             } else command_status = 2;
             break;
         case 18:
@@ -465,7 +465,10 @@
                     strcpy(subcommand,"OFF");
                     break;
             }
-            //Function not yet implemented
+            if(allow_commands) {
+                command_status = 1;
+                led.set_base_led(message[1]);
+            } else command_status = 2;
             break;
         case 19:
             strcpy(command,"SET CENTER LED ");
@@ -487,7 +490,7 @@
             sprintf(subcommand,"%s @ %1.5f brightness",colour_string,dec);
             if(allow_commands) {
                 command_status = 1;
-                set_center_led(message[1],dec);
+                led.set_center_led(message[1],dec);
             } else command_status = 2;
             break;
 
@@ -738,7 +741,7 @@
             // LED REQUESTS
         case 50:
             strcpy(command,"GET LED STATES");
-            sprintf(ret_message,"%04x",get_led_states());
+            sprintf(ret_message,"%04x",led.get_led_states());
             send_message = 1;
             break;