右側のほうのセンサLPC1114FN28 fumiya版

Dependencies:   IRM2121_2 Ping mbed HMC6352 Watchdog

Fork of CatPot_SensorRight by CatPot 2015-2016

Revision:
4:bac44e117fce
Parent:
2:099a6c81a02e
Child:
5:a41471351ae3
--- a/main.cpp	Fri Feb 13 10:12:38 2015 +0000
+++ b/main.cpp	Mon Feb 23 09:39:33 2015 +0000
@@ -173,52 +173,22 @@
             PingCk = 0;
         }
         */
-        IrData[0] = 5;
-        IrData[1] = 40;
-        IrData[2] = 20;
-        
+
         I2CState = Mbed.receive();
-        
         switch(I2CState){    
             case I2CSlave::ReadAddressed:
-            
-                 if(0/*AddressData*/){
-                    switch(AddressData){
-                        case 0x01://IR
-                                SendData[0] = (char)IrData[0];
-                                SendData[1] = (char)IrData[1];
-                                SendData[2] = (char)IrData[2];
-                                Mbed.write(SendData, 3);
-                                break;                   
-                            
-                        case 0x02://ping
-                                SendData[0] = (char)PingData[0];
-                                SendData[1] = (char)PingData[1];
-                                Mbed.write(SendData, 2);
-                                break;
-                        default:
-                                break;
-                    }
-                 }else{
-                     SendData[0] = 0xAA;//(char)IrData[0];
-                     SendData[1] = 0xBB;//(char)IrData[1];
-                     SendData[2] = 0xCC;//(char)IrData[2];
-                     Mbed.write(SendData, 3);
-                }
                  
-                 AddressData = 0;
+                
+                 Mbed.write(SendData, 9);
                  break;
             case I2CSlave::WriteGeneral:
-                 AddressData = Mbed.read();
+                 Mbed.read(SendData, 9);
                  break;
             case I2CSlave::WriteAddressed:
-                 AddressData = Mbed.read();
                  break;
         
         }
-        
-        //pc.printf("%d  %d %d %d %d %d\n",IrTemp[0],IrTemp[1],IrTemp[2],IrTemp[3],IrTemp[4],IrTemp[5]);
-        
+
         Led = 0;
     
         //wait(0.5);