Skip to content
Browse files

Updated the example

  • Loading branch information...
1 parent e5bb1db commit bef2b9472db541b6c763a1d47cc97a24ee913896 @brunnels committed
Showing with 56 additions and 10 deletions.
  1. +56 −10 examples/test/test.ino
View
66 examples/test/test.ino
@@ -1,16 +1,62 @@
-#include <Wire.h>
+#include <I2C.h>
#include <PCA9685.h>
-PCA9685 driver1(0x41);
+PCA9685 whiteDrv(0x43);
-void setup()
+void setup()
{
- driver1.begin();
+ whiteDrv.begin();
Serial.begin(9600);
+
+ whiteDrv.setPWMFrequency(200);
+ Serial.println(whiteDrv.getPWMFrequency());
+
+ //turn everything off
+ whiteDrv.PWM(0, 15, 0);
}
-void loop()
-{
- driver1.PWMSingle(0, 255); delay (3000);
- Serial.println(driver1.getPWM(0));
- Serial.println("full");
-}
+void loop()
+{
+ int i = 0;
+ int j = 0;
+ int k = 0;
+
+ while (i < 6) {
+ j = 0;
+ while (j <= 255) {
+ whiteDrv.PWM(i, j);
+ j++;
+ }
+ i++;
+ }
+
+ while (i >= 0) {
+ j = 255;
+ while (j >= 0) {
+ whiteDrv.PWM(i, j);
+ j--;
+ }
+ i--;
+ }
+
+ Serial.println(whiteDrv.getPWM(0));
+
+ delay(500);
+
+ while (k <= 255) {
+ whiteDrv.PWM(0, 5, k);
+ k++;
+ }
+
+ Serial.println(whiteDrv.getPWM(0));
+
+ delay(1000);
+
+ while (k >= 0) {
+ whiteDrv.PWM(0, 5, k);
+ k--;
+ }
+
+ Serial.println(whiteDrv.getPWM(0));
+
+ delay(500);
+}

0 comments on commit bef2b94

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