mmotor
/
TLC5940LEDtreiber
Led_driver
Fork of TLC5940ServoTest by
Diff: main.cpp
- Revision:
- 4:8fc1281b08fa
- Parent:
- 3:ad4dfe34cfcd
- Child:
- 5:022819ad9a5f
--- a/main.cpp Tue Oct 21 15:06:20 2014 +0000 +++ b/main.cpp Mon Mar 06 13:47:17 2017 +0000 @@ -1,20 +1,59 @@ -#include "mbed.h" -#include "TLC5940Servo.h" - -TLC5940Servo tlc(p5, p7, p8, p9, p21); - -int main() -{ - // Calibrate the 5th motor - tlc[5].calibrate(0.0006, 40.0); - while (1) { - for (float i = 0.0; i <= 1.01; i += 0.05) { - tlc[5] = i; // assigning - printf("%f\n\r", (float)tlc[5]); // reading - wait (0.1); - } - wait(0.5); - tlc[5] = 0.0; - wait(0.5); - } -} \ No newline at end of file +#include "mbed.h" +#include "TLC5940.h" + +// Create the TLC5940 instance +TLC5940 tlc(p7, p5, p21, p9, p10, p11, p12, 1); +Serial pc(USBTX, USBRX); // (tx, rx) + +int i =0; +int f =0; +unsigned short GSData[16] = { 0x0000 }; + + +void run() +{ + + + + while(i < 16) { + wait(0.1); + GSData[i] = 0xFFF; + tlc.setNewGSData(GSData); + ++i; + }//while1 + + pc.printf("16 erreicht \n"); + pc.printf("%d\n", i); + + +} + +void run2() +{ + pc.printf("i= %d\n", i); + while(i > 0) { + pc.printf("while_2= %d\n", i); + --i; + wait(0.1); + GSData[i] = 0x1F4; + tlc.setNewGSData(GSData); + }//while2 + + pc.printf("0 erreicht \n"); + + +} + +int main() +{ + while(1) + { + + run(); + wait(1); + printf("Status \n"); + run2(); + wait(1); + }//while + +}//main