exmaple of i2c io expander

Dependencies:   PCF8574

Files at this revision

API Documentation at this revision

Comitter:
dinos95
Date:
Tue Feb 23 13:19:09 2021 +0000
Commit message:
example of IO I2C expander

Changed in this revision

.gitignore Show annotated file Show diff for this revision Revisions of this file
PCF8574.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r f14e513bde7d .gitignore
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gitignore	Tue Feb 23 13:19:09 2021 +0000
@@ -0,0 +1,4 @@
+.build
+.mbed
+projectfiles
+*.py*
diff -r 000000000000 -r f14e513bde7d PCF8574.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PCF8574.lib	Tue Feb 23 13:19:09 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/Bas/code/PCF8574/#7913586369c2
diff -r 000000000000 -r f14e513bde7d main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Feb 23 13:19:09 2021 +0000
@@ -0,0 +1,21 @@
+
+#include "mbed.h"
+#include "pcf8574.h"
+
+I2C _i2c(D14, D15);// (sda,scl)
+PCF8574 pcf0(&_i2c,0x00,PCF8574_TYPE);
+
+int main()
+{
+    pcf0.WriteByte(0b00010100);
+    thread_sleep_for(5000);
+    pcf0.WriteByte(0b00000100);
+    thread_sleep_for(5000);
+    pcf0.WriteByte(0b00010000);
+    thread_sleep_for(5000);
+    pcf0.WriteByte(0b00010100);
+
+    while (true) {
+
+    }
+}
diff -r 000000000000 -r f14e513bde7d mbed-os.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Tue Feb 23 13:19:09 2021 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#cf4f12a123c05fcae83fc56d76442015cb8a39e9