Led_driver

Dependencies:   TLC5940 mbed

Fork of TLC5940ServoTest by Andrew Duda

main.cpp

Committer:
sakr
Date:
2017-03-21
Revision:
5:022819ad9a5f
Parent:
4:8fc1281b08fa

File content as of revision 5:022819ad9a5f:

#include "mbed.h"
#include "TLC5940.h"

// Create the TLC5940 instance
TLC5940 tlc(p7, p5, p21, p9, p10, p11, p12, 2); //(SCLK, MOSI, GSCLK, BLANK, XLAT, DCPRG, VPRG, const int number)
Serial pc(USBTX, USBRX);             // (tx, rx)

int i =0;
int f =0;
int d =0;
unsigned short GSData[32] = { 0x0000 };
unsigned char DCData[10] = { 0x00 };


void run()
{
   


    while(i < 32) {
        wait(0.4);
        GSData[i] = 0xFFF;
        tlc.setNewGSData(GSData);
        ++i;
    }//while1

    pc.printf("32 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] = 0x000;
        tlc.setNewGSData(GSData);
    }//while2

    pc.printf("0 erreicht \n");
   
   
}

int main()
{
    while(1)
    {
        DCData[d] = 0xFF;
        tlc.setNewDCData(DCData);
        run();
        wait(0.2);
        printf("Status \n");
        run2();
        wait(0.2);
    }//while

}//main