Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added PCF8575 example

  • Loading branch information...
commit d684869935bdcc361537d7aabeb2be5d30aaf337 1 parent 455ad44
@lucadentella authored
View
29 PCF8575_Led_rolling/PCF8575_Led_rolling.ino
@@ -0,0 +1,29 @@
+#include <Wire.h>
+
+#define PCF8575_ADDRESS 0x20
+unsigned int outputs;
+
+void setup() {
+
+ Wire.begin();
+
+ Serial.begin(57600);
+ Serial.println("PCF8575 LED rolling demo");
+
+ outputs = 0xFFFE;
+}
+
+void loop() {
+
+ byte low = outputs & 0x00FF;
+ byte high = outputs >> 8;
+ Wire.beginTransmission(PCF8575_ADDRESS);
+ Wire.write(low);
+ Wire.write(high);
+ Wire.endTransmission();
+
+ if(outputs == 0x7FFF) outputs = 0xFFFE;
+ else outputs = (outputs << 1) + 1;
+
+ delay(200);
+}
View
3  PCF8575_Led_rolling/README
@@ -0,0 +1,3 @@
+A simple demo to show how to drive PCF8575 via I2C
+
+http://www.youtube.com/watch?v=UXPuzbEV_ic
Please sign in to comment.
Something went wrong with that request. Please try again.