Thomas Cauwelier / Mbed 2 deprecated visible_light_communication

Dependencies:   SoftSerial SDFileSystem mbed wave_player

Revision:
27:6dbcad451cbc
Parent:
26:1c8a7d0bb4b7
Child:
29:c2d95d88ee0b
--- a/Client.cpp	Wed May 17 01:47:04 2017 +0200
+++ b/Client.cpp	Wed May 17 00:22:55 2017 +0000
@@ -58,15 +58,15 @@
 }
 
 void Client::send_file() {
+    printf("starting file write\r\n");
     // get file size
     int size = 0;
     for (int i = 0; i < 4; ++i) {
         while (!softSerial.readable());
         int b = softSerial.getc();
-        while (!softSerial.writeable());
-        softSerial.putc(b);
         size |= b << ((3 - i) << 3);
     }
+    printf("must write %i bytes\r\n", size);
 
 
     // send data
@@ -87,6 +87,7 @@
 
         // store max 64 bytes
         fwrite(buffer, sizeof(char), (size_t) k, wave_file);
+        //printf("wrote %i:%i bytes\r\n",k,j);
     }
 
     play_file();