Hello world for the TLC5940Servo library.

Dependencies:   TLC5940Servo mbed

Files at this revision

API Documentation at this revision

Comitter:
dudanian
Date:
Tue Oct 21 06:05:45 2014 +0000
Parent:
0:0b054b47ac3d
Child:
2:faa25eaa18dd
Commit message:
Changed code to cycle through servo settings.

Changed in this revision

TLC5940Servo.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
--- a/TLC5940Servo.lib	Tue Oct 21 02:36:27 2014 +0000
+++ b/TLC5940Servo.lib	Tue Oct 21 06:05:45 2014 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/dudanian/code/TLC5940Servo/#ba4e0390f72e
+http://developer.mbed.org/users/dudanian/code/TLC5940Servo/#1d2251574d35
--- a/main.cpp	Tue Oct 21 02:36:27 2014 +0000
+++ b/main.cpp	Tue Oct 21 06:05:45 2014 +0000
@@ -1,51 +1,18 @@
 #include "mbed.h"
 #include "TLC5940Servo.h"
-#include "Servo.h"
 
 TLC5940Servo tlc(p5, p7, p8, p9, p21);
-Servo serv();
-
-
 
 int main()
 {   
-    // Enable the first LED
-    tlc[5] = 0xFFF;
-    int val = 0;
-    int sw = 0;
-    
+    // Calibrate the 5th motor
+    tlc.calibrate(5, 0.0006, 40.0);
     while (1) {
-        switch (sw) {
-        case 0:
-            tlc[5] = 0x0fff;
-            break;
-        case 1:
-            tlc[5] = 0x0f8f;
-            break;
-        case 2:
-            tlc[5] = 0x0f0f;
-            break;
+        for (float i = 0.0; i < 1.0; i += 0.05) {
+            tlc[5] = i; // assigning
+            printf("%f\n\r", tlc[5]); // reading
+            wait (0.1);
         }
-        sw = (sw + 1) % 3;
-        printf("%d\n\r", tlc[5]);
         wait(1.0);
     }
-    
-    /*while(1)
-    {
-        if (sw){
-            tlc[5] = val++;
-            if (val >= 0x0FFF)
-            sw = 0;
-        }
-        else {
-            tlc[5] = val--;
-            if (val <= 0)
-            sw = 1;
-        }
-        printf("%d\n\r", val);
-        wait(0.01);
-    }*/
-    
-    
-} // write 203 307 409 for -40, 0, +40 degrees
\ No newline at end of file
+}
\ No newline at end of file