Skip to content
Browse files

Added PCF8575 example

  • Loading branch information...
1 parent 455ad44 commit d684869935bdcc361537d7aabeb2be5d30aaf337 @lucadentella committed Mar 11, 2012
Showing with 32 additions and 0 deletions.
  1. +29 −0 PCF8575_Led_rolling/PCF8575_Led_rolling.ino
  2. +3 −0 PCF8575_Led_rolling/README
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

0 comments on commit d684869

Please sign in to comment.
Something went wrong with that request. Please try again.