Create this program

Dependencies:   mbed HCSR04 HMC6352 PID TextLCD

Revision:
5:e07e380ddb93
Parent:
3:901d18b901b4
--- a/communication.h	Fri Aug 07 06:51:51 2015 +0000
+++ b/communication.h	Sat Aug 08 12:39:18 2015 +0000
@@ -42,6 +42,7 @@
     delete i2cmaster;
 }
 
+// set frequency and address
 void CommuMaster::init(int correctFrequency, char addr) {
     i2cmaster->frequency(correctFrequency);
     this->addr = addr;
@@ -61,6 +62,7 @@
     delete i2cslave;
 }
 
+// set frequency and address
 void CommuSlave::init(int correctFrequency, char addr) {
     i2cslave->frequency(correctFrequency);
     i2cslave->address(addr);
@@ -77,6 +79,7 @@
  * example program(master)
 
 #include "mbed.h"
+#include "communication.h"
 
 #define DATA_NUM    8
 
@@ -90,7 +93,7 @@
     while (1) {
         master.receiveData(data);
         for (int i = 0; i < DATA_NUM; i++) {
-            pc.printf("%d ", data[i]);
+            pc.printf("%d ", data[i]);      // display "1 1 0 0 0 0 0 1 "
         }
         pc.putchar('\n');
     }
@@ -99,6 +102,7 @@
  * example program(slave)
 
 #include "mbed.h"
+#include "communication.h"
 
 int main(void) {
     CommuSlave slave(D5, D6);