Nucleo_PCF8574_led_iic

Dependencies:   PCF8574 mbed

Revision:
0:8cb68b6fa38d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 27 05:06:22 2016 +0000
@@ -0,0 +1,29 @@
+
+#include "mbed.h"
+#include "PCF8574.h"
+
+PCF8574 io(D14,D15,0x70);//iic 设置:D14 SDA,D15 SCL
+
+int main()
+{
+   while(1) 
+    {
+     io.write(0x0);
+        if ((io.read()) == 16) 
+        {
+         io.write(0x01);
+        }
+        else if((io.read()) == 32)
+        {
+         io.write(0x02);
+        }
+        else if((io.read()) == 64)
+        {
+         io.write(0x04);
+        }
+        else if((io.read()) == 128)
+        {
+         io.write(0x08);
+        }
+    }
+}
\ No newline at end of file