This chip is a port expansor, thal "speak" to master through I2C communication.

Dependencies:   mbed

Fork of PCF8574 by Simon Ford

Files at this revision

API Documentation at this revision

Comitter:
waspSalander
Date:
Thu Jun 08 13:31:05 2017 +0000
Parent:
1:ec8da0c59403
Commit message:
Biblioteca do PCF8574; ; Expansor de portas que de comunica com o master por meio do Protocolo I2C.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jun 08 13:31:05 2017 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+DigitalOut debugPin(LED1);
+DigitalOut debugPin1(LED2);
+I2C i2c(p28, p29);        // sda, scl
+Serial pc(USBTX, USBRX); // tx, rx
+
+const int addr = 0x40; // define the I2C Address
+
+int main() {
+    char cmd[2];
+    
+    while(1) {
+        debugPin1 = 1;
+        cmd[0] = 0x40;            // pointer to command register
+        cmd[1] = 0x00;            // pointer to command register
+        //i2c.start();
+        i2c.write(addr, cmd, 2); // Send command string
+        //i2c.stop();
+        wait(1); 
+        debugPin1 = 0;
+        wait(1); 
+                     // Could also poll, 65ms is typical
+
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jun 08 13:31:05 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/856d2700e60b
\ No newline at end of file