Dan Tomlinson / Mbed 2 deprecated mbed_TESTTOWER

Dependencies:   ConfigFile N5110 PowerControl beep mbed

Files at this revision

API Documentation at this revision

Comitter:
el13drt
Date:
Fri May 08 07:42:49 2015 +0000
Parent:
68:e978b6bccff8
Child:
70:8f76ea42f084
Commit message:
debounce;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri May 08 07:30:43 2015 +0000
+++ b/main.cpp	Fri May 08 07:42:49 2015 +0000
@@ -16,7 +16,15 @@
 void write()
 {
     ///Sets a Key and Value.
-    if (!cfg.setValue("Open", player1initials)) {//key/value
+    if (!cfg.setValue("Open1", player1initials)) {//key/value
+        error("Failure to set a value.\n");
+    }
+        ///Sets a Key and Value.
+    if (!cfg.setValue("Open2", player2initials)) {//key/value
+        error("Failure to set a value.\n");
+    }
+        ///Sets a Key and Value.
+    if (!cfg.setValue("Open3", player3initials)) {//key/value
         error("Failure to set a value.\n");
     }
     ///If a file does not already exist, create one.
@@ -30,16 +38,26 @@
 void read(){
     
     //Checks if key matches.
-    char *key = "Open";
+    char *key1 = "Open1";
+    char *key2 = "Open2";
+    char *key3 = "Open3";
 
     ///Checks Key and Value - if read is unsuccessful it an prints error message.
     if (!cfg.read("/local/towerMemory.cfg")) {
         error("Failure to read a configuration file.\n");
     }
     ///check file size - if size acceptable, prints buffer to location.
-    if (cfg.getValue(key, &player1initials[0], sizeof(player1initials))) {
+    if (cfg.getValue(key1, &player1initials[0], sizeof(player1initials))) {
         serial.printf("%s\n",player1initials);
     }
+    //check file size - if size acceptable, prints buffer to location.
+    if (cfg.getValue(key2, &player2initials[0], sizeof(player2initials))) {
+        serial.printf("%s\n",player2initials);
+    }
+    //check file size - if size acceptable, prints buffer to location.
+    if (cfg.getValue(key3, &player3initials[0], sizeof(player3initials))) {
+        serial.printf("%s\n",player3initials);
+    }
 }
 
 ///Struct declaration for storing alphabet arrays.