Hardware Braille Simulator / Mbed 2 deprecated MI2C

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
rrbeauch
Date:
Wed Nov 19 22:47:17 2014 +0000
Parent:
0:942156b7d5e8
Commit message:
Trying out specific write. General write does not seem to work as indicated by LED1

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Nov 19 22:34:10 2014 +0000
+++ b/main.cpp	Wed Nov 19 22:47:17 2014 +0000
@@ -10,10 +10,11 @@
 //-------------------------------------------------------
 //Global Variables
 I2C mI2C(p28,p27);
-DigitalOut sendLED(LED1);
+DigitalOut sendGenLED(LED1);
 DigitalOut receiveLED(LED2);
+DigitalOut sendSpecLED(LED3);
 int dCardAddress = 0x02;
-//char msg[6] = {'(','T','E','S','T',')'};
+char sendMSG = 'Z';
 char msg[2];
 //-------------------------------------------------------
 
@@ -42,14 +43,16 @@
 
 int main() 
 {
-    sendLED = 0;
+    sendGenLED = 0;
     receiveLED = 0;
     //mI2C.frequency(100000);
     int data = 0x0001;
     while(1) 
     {
-        mI2C.write(data);
-            sendLED = 1;
+        if(mI2C.write(data))
+            sendGenLED = 1;
+        if(!mI2C.write(dCardAddress,&sendMSG,1,0))
+            sendSpecLED = 1;     
         mI2C.read((dCardAddress),msg,2,0);
         if(msg[0] || msg[1]) 
         {
@@ -57,10 +60,10 @@
             msg[0] = 0;
             msg[1] = 0;
         }
-        
         wait(0.5);
-        sendLED = 0;
-        receiveLED = 0;       
+        sendGenLED = 0;
+        receiveLED = 0;
+        sendSpecLED = 0;       
     }
     /*receiveLED = writeRow(dCardAddress, msg, 6);
     while(1)