Hello world for the TLC5940Servo library.
Dependencies: TLC5940Servo mbed
Diff: main.cpp
- Revision:
- 0:0b054b47ac3d
- Child:
- 1:aeb0ed70cbd0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 21 02:36:27 2014 +0000 @@ -0,0 +1,51 @@ +#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; + + while (1) { + switch (sw) { + case 0: + tlc[5] = 0x0fff; + break; + case 1: + tlc[5] = 0x0f8f; + break; + case 2: + tlc[5] = 0x0f0f; + break; + } + 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